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

fixup! factor: Add test exhibiting a bug in ρ

This commit is contained in:
nicoo 2020-06-19 15:28:01 +02:00
parent 9fe3de72f2
commit 45a1408fb0

View file

@ -159,8 +159,13 @@ mod tests {
#[test]
fn factor_recombines_strong_pseudoprime() {
// This is a strong pseudoprime (wrt. miller_rabin::BASIS)
// and triggered a bug in rho::factor's codepath handling
// miller_rabbin::Result::Composite
let pseudoprime = 17179869183;
for _ in 0..20 {
// Repeat the test 20 times, as it only fails some fraction
// of the time.
assert!(factor(pseudoprime).product() == pseudoprime);
}
}