| 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() { |