Add a `MerkleHashOrchard::random` function under the `test-dependencies` feature.

This commit is contained in:
Kris Nuttycombe 2024-03-11 18:06:05 -06:00
parent 1db974141b
commit 7ef1feaf16
1 changed files with 16 additions and 0 deletions

View File

@ -260,6 +260,22 @@ impl<'de> Deserialize<'de> for MerkleHashOrchard {
}
}
/// Test utilities available under the `test-dependencies` feature flag.
#[cfg(feature = "test-dependencies")]
pub mod testing {
use ff::Field;
use rand::RngCore;
use super::MerkleHashOrchard;
impl MerkleHashOrchard {
/// Return a random fake `MerkleHashOrchard`.
pub fn random(rng: &mut impl RngCore) -> Self {
Self(pasta_curves::Fp::random(rng))
}
}
}
#[cfg(test)]
mod tests {
use {