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

Function test_div3

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

Source from the content-addressed store, hash-verified

176
177 #[test]
178 fn test_div3() {
179 println!("Fr.div3: {} bytes", Fr::div3().len());
180 let mut prng = ChaCha20Rng::seed_from_u64(0);
181
182 for _ in 0..10 {
183 let a = ark_bn254::Fr::rand(&mut prng);
184 let b = a.clone().double();
185 let c = a.add(b);
186
187 let script = script! {
188 { Fr::push_u32_le(&BigUint::from(c).to_u32_digits()) }
189 { Fr::div3() }
190 { Fr::push_u32_le(&BigUint::from(a).to_u32_digits()) }
191 { Fr::equalverify(1, 0) }
192 OP_TRUE
193 };
194 run(script);
195 }
196 }
197
198 #[test]
199 fn test_is_one() {

Callers

nothing calls this directly

Calls 4

runFunction · 0.85
cloneMethod · 0.80
doubleMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected