MCPcopy Create free account
hub / github.com/BitVM/BitVM / test_double

Function test_double

bitvm/src/bn254/fq.rs:897–916  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

895
896 #[test]
897 fn test_double() {
898 println!("Fq.double: {} bytes", Fq::double(0).len());
899 let m = BigUint::from_str_radix(Fq::MODULUS, 16).unwrap();
900
901 for _ in 0..100 {
902 let a: BigUint = m.clone().sub(BigUint::new(vec![1]));
903
904 let a = a.rem(&m);
905 let c: BigUint = a.clone().add(a.clone()).rem(&m);
906
907 let script = script! {
908 { Fq::push_u32_le(&a.to_u32_digits()) }
909 { Fq::double(0) }
910 { Fq::push_u32_le(&c.to_u32_digits()) }
911 { Fq::equalverify(1, 0) }
912 OP_TRUE
913 };
914 run(script);
915 }
916 }
917
918 #[test]
919 fn test_neg() {

Callers

nothing calls this directly

Calls 4

runFunction · 0.85
cloneMethod · 0.80
subMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected