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

Function test_double

bitvm/src/bn254/fr.rs:115–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113
114 #[test]
115 fn test_double() {
116 println!("Fr.double: {} bytes", Fr::double(0).len());
117 let m = BigUint::from_str_radix(Fr::MODULUS, 16).unwrap();
118
119 for _ in 0..100 {
120 let a: BigUint = m.clone().sub(BigUint::new(vec![1]));
121
122 let a = a.rem(&m);
123 let c: BigUint = a.clone().add(a.clone()).rem(&m);
124
125 let script = script! {
126 { Fr::push_u32_le(&a.to_u32_digits()) }
127 { Fr::double(0) }
128 { Fr::push_u32_le(&c.to_u32_digits()) }
129 { Fr::equalverify(1, 0) }
130 OP_TRUE
131 };
132 run(script);
133 }
134 }
135
136 #[test]
137 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