Merge pull request #422 from nuttycom/test_only_random_merklehashorchard

Add a `MerkleHashOrchard::random` function under the `test-dependencies` feature.
This commit is contained in:
Kris Nuttycombe 2024-03-11 18:26:44 -06:00 committed by GitHub
commit a6b3407e2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 {