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

Function test_div3

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

Source from the content-addressed store, hash-verified

958
959 #[test]
960 fn test_div3() {
961 println!("Fq.div3: {} bytes", Fq::div3().len());
962 let mut prng = ChaCha20Rng::seed_from_u64(0);
963
964 for _ in 0..10 {
965 let a = ark_bn254::Fq::rand(&mut prng);
966 let b = a.clone().double();
967 let c = a.add(b);
968
969 let script = script! {
970 { Fq::push_u32_le(&BigUint::from(c).to_u32_digits()) }
971 { Fq::div3() }
972 { Fq::push_u32_le(&BigUint::from(a).to_u32_digits()) }
973 { Fq::equalverify(1, 0) }
974 OP_TRUE
975 };
976 run(script);
977 }
978 }
979
980 #[test]
981 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