diff --git a/tests/arithmetic_tests.rs b/tests/arithmetic_tests.rs index 83d72828..33dc1977 100644 --- a/tests/arithmetic_tests.rs +++ b/tests/arithmetic_tests.rs @@ -118,6 +118,29 @@ fn multiplication_test( ); } +fn doubling_test( + cs: ConstraintSystemRef, + rng: &mut R, +) { + let mut a_native = TargetF::rand(rng); + let mut a = + EmulatedFpVar::::new_witness(ark_relations::ns!(cs, "alloc a"), || { + Ok(a_native) + }) + .unwrap(); + + a.double_in_place().unwrap(); + a_native.double_in_place(); + let a_actual = a.value().unwrap(); + + assert!( + a_actual.eq(&a_native), + "a_actual = {:?}, a_native = {:?}", + a_actual.into_bigint().as_ref(), + a_native.into_bigint().as_ref() + ); +} + fn equality_test( cs: ConstraintSystemRef, rng: &mut R, @@ -592,6 +615,12 @@ macro_rules! nonnative_test { $test_target_field, $test_base_field ); + nonnative_test_individual!( + doubling_test, + $test_name, + $test_target_field, + $test_base_field + ); nonnative_test_individual!( equality_test, $test_name,