1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 05:27:45 +00:00

factor::miller_rabin: Add negative test over all small composites

This commit is contained in:
nicoo 2020-07-04 20:38:58 +02:00
parent 600268c6e4
commit 1e4d824829

View file

@ -143,6 +143,18 @@ mod tests {
}
}
#[test]
fn first_composites() {
assert!(!is_prime(0));
assert!(!is_prime(1));
for (p, q) in primes().zip(primes().skip(1)) {
for i in p + 1..q {
assert!(!is_prime(i), "{} reported prime", i);
}
}
}
#[test]
fn issue_1556() {
// 10 425 511 = 2441 × 4271