bigint::monty: use infallible conversions in tests

This commit is contained in:
Josh Stone 2017-10-22 15:49:51 -07:00
parent bb0c9324b2
commit 35b7187e83
1 changed files with 4 additions and 4 deletions

View File

@ -1092,10 +1092,10 @@ fn test_is_even() {
#[test]
fn test_modpow() {
fn check(b: usize, e: usize, m: usize, r: usize) {
let big_b: BigUint = FromPrimitive::from_usize(b).unwrap();
let big_e: BigUint = FromPrimitive::from_usize(e).unwrap();
let big_m: BigUint = FromPrimitive::from_usize(m).unwrap();
let big_r: BigUint = FromPrimitive::from_usize(r).unwrap();
let big_b = BigUint::from(b);
let big_e = BigUint::from(e);
let big_m = BigUint::from(m);
let big_r = BigUint::from(r);
assert_eq!(big_b.modpow(&big_e, &big_m), big_r);
}