MCPcopy Create free account
hub / github.com/docknetwork/crypto / check_powers

Function check_powers

utils/src/ff.rs:160–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

158
159 #[test]
160 fn check_powers() {
161 let mut rng = StdRng::seed_from_u64(0u64);
162
163 let exp = Fr::rand(&mut rng);
164 let num = 10;
165 let mut p1 = powers(&exp, num);
166 assert!(p1[0].is_one());
167 for i in 1..num as usize {
168 assert_eq!(p1[i], p1[i - 1] * exp);
169 }
170
171 let p2 = powers_starting_from(exp.clone(), &exp, num - 1);
172 assert_eq!(p2[0], exp);
173 p1.remove(0);
174 assert_eq!(p1, p2);
175 }
176}

Callers

nothing calls this directly

Calls 5

randFunction · 0.85
powersFunction · 0.85
powers_starting_fromFunction · 0.85
cloneMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected