Skip to content

Commit

Permalink
chore: move new test to test_suite
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnevadoc committed May 2, 2024
1 parent cd10b80 commit 7270af0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
10 changes: 1 addition & 9 deletions src/bn256/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,7 @@ mod test {
use super::*;
use group::UncompressedEncoding;

#[test]
fn test_cofactor_clearing() {
for _ in 0..100 {
let point = G2::random(OsRng);
assert!(bool::from(point.is_on_curve()));
use group::cofactor::CofactorGroup;
assert!(bool::from(point.is_torsion_free()));
}
}
crate::curve_testing_suite!(G2, "clear_cofactor");
crate::curve_testing_suite!(G1, G2);
crate::curve_testing_suite!(G1, "hash_to_curve");
crate::curve_testing_suite!(G1, "endo_consistency");
Expand Down
10 changes: 1 addition & 9 deletions src/pluto_eris/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,7 @@ mod test {
use super::*;
use group::UncompressedEncoding;

#[test]
fn test_cofactor_clearing() {
for _ in 0..50 {
let point = G2::random(OsRng);
assert!(bool::from(point.is_on_curve()));
use group::cofactor::CofactorGroup;
assert!(bool::from(point.is_torsion_free()));
}
}
crate::curve_testing_suite!(G2, "clear_cofactor");
crate::curve_testing_suite!(G1, Eris, G2);
crate::curve_testing_suite!(G1, Eris, "hash_to_curve");
crate::curve_testing_suite!(G1, Eris, "endo_consistency");
Expand Down
16 changes: 16 additions & 0 deletions src/tests/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,22 @@ macro_rules! curve_testing_suite {
}
};

($($curve: ident),*, "clear_cofactor") => {
#[test]
fn test_cofactor_clearing() {
use rand_core::OsRng;
$(
for _ in 0..50 {
let point = $curve::random(OsRng);
assert!(bool::from(point.is_on_curve()));
use group::cofactor::CofactorGroup;
assert!(bool::from(point.is_torsion_free()));
}

)*
}
};

($($curve: ident),*, "endo_consistency") => {
#[test]
fn test_endo_consistency() {
Expand Down

0 comments on commit 7270af0

Please sign in to comment.