aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-10-02 17:20:39 +0100
committerPádraig Brady <P@draigBrady.com>2025-10-02 17:22:28 +0100
commit1b12425f6742a8a911fab647d161ffad2ed41c7b (patch)
treef5337bacedca44eba88135278c89836c26d17c73 /tests
parentunexpand: fix heap buffer overflow with --tabs=[+/]NUM (diff)
downloadcoreutils-1b12425f6742a8a911fab647d161ffad2ed41c7b.tar.gz
coreutils-1b12425f6742a8a911fab647d161ffad2ed41c7b.zip
tests: factor: add suggested large prime tests
* tests/factor/create-test.sh: Add 2 new large primes from: https://github.com/coreutils/coreutils/issues/65 * tests/local.mk: Reference the 2 new generated tests.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/factor/create-test.sh11
-rw-r--r--tests/local.mk3
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/factor/create-test.sh b/tests/factor/create-test.sh
index 7fad40cdc..dce41e35b 100755
--- a/tests/factor/create-test.sh
+++ b/tests/factor/create-test.sh
@@ -28,9 +28,14 @@ t2=170141183460469229545748130981302223887
bug73474=22222222222222222202111121111
# 2^400 - 593
-bigprime=25822498780869085896559191720030118743297057928292235128306593565406\
+bigprime1=25822498780869085896559191720030118743297057928292235128306593565406\
47622016841194629645353280137831435903171972747492783
+# https://github.com/coreutils/coreutils/issues/65
+bigprime2=94441166490049640643114101303190314499640643114101
+bigprime3=043460469944309303043460469400946644499055903044644824545863023322934\
+65458630233229
+
# 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.
@@ -74,7 +79,9 @@ 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 ;;
+ t38) set $bigprime1 $bigprime1 02f3c51a2896ff4524fd76de5f5854029879a179 ;;
+ t39) set $bigprime2 $bigprime2 86751e6f21342b4a1b73ccb1a5d43f236121263f ;;
+ t40) set $bigprime3 $bigprime3 b568a680f97be86bbd8f297f530ffe2872422d9f ;;
*)
echo "$0: error: unknown test: '$test_name' -> '$t'" >&2
exit 1
diff --git a/tests/local.mk b/tests/local.mk
index 3c57e8ed2..19bc194fb 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -780,7 +780,8 @@ 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)/t38.sh
+ $(tf)/t35.sh $(tf)/t36.sh $(tf)/t37.sh $(tf)/t38.sh $(tf)/t39.sh \
+ $(tf)/t40.sh
$(factor_tests): $(tf)/run.sh $(tf)/create-test.sh
$(AM_V_GEN)$(MKDIR_P) $(tf)