]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: factor: add suggested large prime tests
authorPádraig Brady <P@draigBrady.com>
Thu, 2 Oct 2025 16:20:39 +0000 (17:20 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 2 Oct 2025 16:22:28 +0000 (17:22 +0100)
* 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.

tests/factor/create-test.sh
tests/local.mk

index 7fad40cdcc56cd0af8de232ffad4cc1eeddb9af1..dce41e35b5d164722303bc327def18e0ecd315ab 100755 (executable)
@@ -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
index 3c57e8ed28df2f9ea35f961db6e225e575cd6928..19bc194fb5c52c859c98a966fe886f82bd4d0f15 100644 (file)
@@ -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)