1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 20:47:46 +00:00

factor: Add test exhibiting a bug in ρ

The test is repeated 20 times to make it overwhelmingly-likely to fail
(the bug itself is only triggered rarely)
This commit is contained in:
nicoo 2020-06-19 13:48:00 +02:00
parent 3a90e31307
commit 9eb944b6b9

View file

@ -156,4 +156,12 @@ mod tests {
.map(|i| 2 * i + 2u64.pow(32) + 1)
.all(|i| factor(i).product() == i));
}
#[test]
fn factor_recombines_strong_pseudoprime() {
let pseudoprime = 17179869183;
for _ in 0..20 {
assert!(factor(pseudoprime).product() == pseudoprime);
}
}
}