aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2025-06-21 11:41:11 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2025-07-09 17:12:40 -0700
commit5037ce930c243e6fc06f5b879daece31d4628da4 (patch)
tree5281d50be7b7ee350161767ba1b9e610b718f3b2 /tests
parentfactor: add comments to factor.c (diff)
downloadcoreutils-5037ce930c243e6fc06f5b879daece31d4628da4.tar.gz
coreutils-5037ce930c243e6fc06f5b879daece31d4628da4.zip
factor: don’t prove primality
Suggested for consideration by Torbjörn Granlund in: https://lists.gnu.org/r/coreutils/2025-01/msg00000.html * src/factor.c (PROVE_PRIMALITY): Now defaults to false. (mp_prime_p): Help the compiler by telling it mpz_prob_prime_p returns nonnegative. * tests/factor/create-test.sh (bigprime): Test 2^400 - 593, since that’s now practical. * tests/local.mk (factor_tests): Add new test.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/factor/create-test.sh5
-rw-r--r--tests/local.mk2
2 files changed, 6 insertions, 1 deletions
diff --git a/tests/factor/create-test.sh b/tests/factor/create-test.sh
index fc84b1484..7fad40cdc 100755
--- a/tests/factor/create-test.sh
+++ b/tests/factor/create-test.sh
@@ -27,6 +27,10 @@ t2=170141183460469229545748130981302223887
# https://bugs.gnu.org/73474
bug73474=22222222222222222202111121111
+# 2^400 - 593
+bigprime=25822498780869085896559191720030118743297057928292235128306593565406\
+47622016841194629645353280137831435903171972747492783
+
# Each test is a triple: lo, hi, sha1 of result.
# The test script, run.sh, runs seq lo hi|factor|sha1sum
# and verifies that the actual and expected checksums are the same.
@@ -70,6 +74,7 @@ case $t in
t35) set ${q}958336 ${q}960335 2374919a89196e1fce93adfe779cb4664556d4b6 ;;
t36) set ${q}960336 ${q}962335 569e4363e8d9e8830a187d9ab27365eef08abde1 ;;
t37) set $bug73474 $bug73474 61d04aaf757acc5a37eb1d5581a98eea78ef50e8 ;;
+ t38) set $bigprime $bigprime 02f3c51a2896ff4524fd76de5f5854029879a179 ;;
*)
echo "$0: error: unknown test: '$test_name' -> '$t'" >&2
exit 1
diff --git a/tests/local.mk b/tests/local.mk
index 03114f759..dd07032da 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -765,7 +765,7 @@ factor_tests = \
$(tf)/t20.sh $(tf)/t21.sh $(tf)/t22.sh $(tf)/t23.sh $(tf)/t24.sh \
$(tf)/t25.sh $(tf)/t26.sh $(tf)/t27.sh $(tf)/t28.sh $(tf)/t29.sh \
$(tf)/t30.sh $(tf)/t31.sh $(tf)/t32.sh $(tf)/t33.sh $(tf)/t34.sh \
- $(tf)/t35.sh $(tf)/t36.sh $(tf)/t37.sh
+ $(tf)/t35.sh $(tf)/t36.sh $(tf)/t37.sh $(tf)/t38.sh
$(factor_tests): $(tf)/run.sh $(tf)/create-test.sh
$(AM_V_GEN)$(MKDIR_P) $(tf)