From 45a1408fb066533c30646764eee5efd68fc07382 Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 19 Jun 2020 15:28:01 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20factor:=20Add=20test=20exhibiting=20a?= =?UTF-8?q?=20bug=20in=20=CF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/uu/factor/src/factor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index f10198ca2..3ba471d73 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -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); } }