mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 14:07:46 +00:00
factor::miller_rabin: Add tests reproducing #1556
This commit is contained in:
parent
ddd38403e6
commit
c5c86b00e9
1 changed files with 19 additions and 0 deletions
|
@ -108,4 +108,23 @@ mod tests {
|
||||||
}
|
}
|
||||||
assert!(is_prime(NEXT_PRIME));
|
assert!(is_prime(NEXT_PRIME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn issue_1556() {
|
||||||
|
// 10 425 511 = 2441 × 4271
|
||||||
|
assert!(!is_prime(10_425_511));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn small_composites() {
|
||||||
|
use crate::table::P_INVS_U64;
|
||||||
|
|
||||||
|
for i in 0..P_INVS_U64.len() {
|
||||||
|
let (p, _, _) = P_INVS_U64[i];
|
||||||
|
for (q, _, _) in &P_INVS_U64[0..i] {
|
||||||
|
let n = p * q;
|
||||||
|
assert!(!is_prime(n), "{} = {} × {} reported prime", n, p, q);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue