Skip to content

Commit

Permalink
Check complement point
Browse files Browse the repository at this point in the history
  • Loading branch information
davxy committed May 31, 2024
1 parent 06bd003 commit 89a7d03
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ where
assert!(result.is_ok());
}

#[cfg(feature = "ring")]
pub fn check_complement_point<S: ring::RingSuite>()
where
BaseField<S>: ark_ff::PrimeField,
CurveConfig<S>: ark_ec::short_weierstrass::SWCurveConfig + Clone,
AffinePoint<S>: ring::IntoSW<CurveConfig<S>>,
{
use ring::IntoSW;
let pt = S::COMPLEMENT_POINT.into_sw();
assert!(pt.is_on_curve());
assert!(!pt.is_in_correct_subgroup_assuming_on_curve());
}

#[macro_export]
macro_rules! suite_tests {
($suite:ident, $build_ring:ident) => {
Expand Down Expand Up @@ -127,6 +140,12 @@ macro_rules! ring_suite_tests {
fn ring_prove_verify() {
$crate::testing::ring_prove_verify::<$suite>()
}

#[cfg(feature = "ring")]
#[test]
fn check_complement_point() {
$crate::testing::check_complement_point::<$suite>()
}
};
($suite:ident, false) => {};
}

0 comments on commit 89a7d03

Please sign in to comment.