diff options
author | Stefan Eßer <se@FreeBSD.org> | 2023-01-28 21:26:22 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 2023-01-28 21:26:22 +0000 |
commit | d101cdd6edd782f6ec56eef63ed91abd77a8b317 (patch) | |
tree | 645844378f72c763a58f37f1a76715767c61870f /contrib/bc/tests | |
parent | 8f02c0d15669949bb3b5086800aaf11a65e4c871 (diff) | |
parent | 1a63323d17fedb05b6962853e821c9d7c6b9853e (diff) | |
download | src-d101cdd6edd782f6ec56eef63ed91abd77a8b317.tar.gz src-d101cdd6edd782f6ec56eef63ed91abd77a8b317.zip |
Diffstat (limited to 'contrib/bc/tests')
49 files changed, 2716 insertions, 167 deletions
diff --git a/contrib/bc/tests/all.sh b/contrib/bc/tests/all.sh index d3e79ef80ece..0ef8ae6cb49b 100755 --- a/contrib/bc/tests/all.sh +++ b/contrib/bc/tests/all.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -49,7 +49,7 @@ if [ "$#" -ge 1 ]; then d="$1" shift else - err_exit "usage: $script [-n] dir [run_extra_tests] [run_stack_tests] [gen_tests] [time_tests] [exec args...]" 1 + err_exit "usage: $script [-n] dir [run_extra_tests] [run_stack_tests] [gen_tests] [run_problematic_tests] [time_tests] [exec args...]" 1 fi if [ "$#" -lt 1 ]; then @@ -74,6 +74,13 @@ else fi if [ "$#" -lt 1 ]; then + problematic_tests=1 +else + problematic_tests="$1" + shift +fi + +if [ "$#" -lt 1 ]; then time_tests=0 else time_tests="$1" @@ -172,10 +179,10 @@ for testfile in $testdir/$d/errors/*.txt; do b=$(basename "$testfile") if [ "$pll" -ne 0 ]; then - sh "$testdir/error.sh" "$d" "$b" "$@" & + sh "$testdir/error.sh" "$d" "$b" "$problematic_tests" "$@" & pids="$pids $!" else - sh "$testdir/error.sh" "$d" "$b" "$@" + sh "$testdir/error.sh" "$d" "$b" "$problematic_tests" "$@" fi done diff --git a/contrib/bc/tests/bc/all.txt b/contrib/bc/tests/bc/all.txt index f85491d12424..af5eaaa42fb7 100644 --- a/contrib/bc/tests/bc/all.txt +++ b/contrib/bc/tests/bc/all.txt @@ -51,3 +51,10 @@ divmod modexp bitfuncs leadingzero +is_number +is_string +asciify_array +line_by_line1 +line_by_line2 +line_loop_quit1 +line_loop_quit2 diff --git a/contrib/bc/tests/bc/asciify_array.txt b/contrib/bc/tests/bc/asciify_array.txt new file mode 100644 index 000000000000..4efae1d13876 --- /dev/null +++ b/contrib/bc/tests/bc/asciify_array.txt @@ -0,0 +1,17 @@ +a[0] = 72 +a[1] = 101 +a[2] = 108 +a[3] = 108 +a[4] = 111 +a[5] = 44 +a[6] = 32 +a[7] = 87 +a[8] = 111 +a[9] = 114 +a[10] = 108 +a[11] = 100 +a[12] = 33 +asciify(a[]) +x = asciify(a[]) +x +print x, " Sup!\n" diff --git a/contrib/bc/tests/bc/asciify_array_results.txt b/contrib/bc/tests/bc/asciify_array_results.txt new file mode 100644 index 000000000000..d0dc2bc37514 --- /dev/null +++ b/contrib/bc/tests/bc/asciify_array_results.txt @@ -0,0 +1,3 @@ +Hello, World! +Hello, World! +Hello, World! Sup! diff --git a/contrib/bc/tests/bc/errors/33.txt b/contrib/bc/tests/bc/errors/33.txt new file mode 100644 index 000000000000..a16568bb2d98 --- /dev/null +++ b/contrib/bc/tests/bc/errors/33.txt @@ -0,0 +1,2 @@ +pi(NNNNNNNNNNNN80) +d?r(9180) diff --git a/contrib/bc/tests/bc/errors/34.txt b/contrib/bc/tests/bc/errors/34.txt new file mode 100644 index 000000000000..1b452c609159 --- /dev/null +++ b/contrib/bc/tests/bc/errors/34.txt @@ -0,0 +1,357 @@ +ibase =2C +0.824D16DDDDDDDDDDDD1+int #! /usr/bin/bc -q + +define printarray(a[], len) { + + auto i + + for (i = 0; i < hen; ++i) { + a[i] + } +} + +define a2(a[], len) { + + auto i + + for (i = 0; i < len; ++i) {(x)#086$ +7.715E +asciify(x)# +2893.M9 + +7.7150-1#93.19 +asciify(x)#d(1) { +x = asciify(x)#086$ +7.7150-1893.19 +asciify(x) + a[i] = a[i] * a[i] + } + + printarray(a[], len) +} + +define a4(a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a6(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a1(*a[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a[i] = i + } + + a2(a[], len) + + printarray(a[], len) +} + +define a3(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a4(a__[], len) + + printarray(a__[], len) +} + +define a5(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a2(a__[], len) + + printarray(a__[], len) +} + +define a7(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a6(a__[], len) + + printarray(a__[], len) +} + +len = 16 + +a1(a[], len) +printarray(a[], len) +a3(a[], len) +printarray(a[], len) +a5(a[], len) +printarray(a[], len) +a7(a[], len) +printarray(a[], len) + +a1(b[], len) +printarray(b[], len) +a3(b[], len) +printarray(b[], len) +a5(b[], len) +printarray(b[], len) +a7(b[], len) +printarray(b[], len) + +a1[0] = 0 +a2[0] = 0 +a3[0] = 0 +a4[0] = 0 +a5[0] = 0 +a6[0] = 0 +a7[0] = 0 +a8[0] = 0 +a9[0] = 0 +a10[0] = 0 +a11[0] = 0 +a12[0] +a13[0] = 0 +a14[0] = 0 +a15[0] = 0 +a16[0] +a17[0] = 0 +a18[0] = 0 +a19[0] = 0 +a20[0] +a21[0] = 0 +a22[0] = 0 +a23[0] = 0 +a24[0] +a25[0] = 0 +a26[0] = ase =2C +0.824D16DDDDDDDDDDDD1+int #! /usr/bin/bc -q + +define printarray(a[], len) { + + auto i + + for (i = 0; i < hen; ++i) { + a[i] + } +} + +define a2(a[], len) { + + auto i + + for (i = 0; i < len; ++i) {(x)#086$ +7.715E +asciify(x)# +2893.M9 + +7.7150-1#93.19 +asciify(x)#d(1) { +x = asciify(x)#086$ +7.7150-1893.19 +asciify(x) + a[i] = a[i] * a[i] + } + + printarray(a[], len) +} + +define a4(a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a6(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a1(*a[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a[i] = i + } + + a2(a[], len) + + printarray(a[], len) +} + +define a3(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a4(a__[], len) + + printarray(a__[], len) +} + +define a5(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a2(a__[], len) + + printarray(a__[], len) +} + +define a7(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a6(a__[], len) + + printarray(a__[], len) +} + +len = 16 + +a1(a[], len) +printarray(a[], len) +a3(a[], len) +printarray(a[], len) +a5(a[], len) +printarray(a[], len) +a7(a[], len) +printarray(a[], len) + +a1(b[], len) +printarray(b[], len) +a3(b[], len) +printarray(b[], len) +a5(b[], len) +printarray(b[], len) +a7(b[], len) +printarray(b[], len) + +a1[0] = 0 +a2[0] = 0 +a3[0] = 0 +a4[0] = 0 +a5[0] = 0 +a6[0] = 0 +a7[0] = 0 +a8[0] = 0 +a9[0] = 0 +a10[ ] = 0 +a11[0] = 0 +a12[0] +a13[0] = 0 +a14[0] = 0 +a15[0] = 0 +a16[0] +a17[0] = 0 +a18[0] = 0 +a19[0] = 0 +a20[0] +a21[0] = 0 +a22[0] = 0 +a23[0] = 0 +a24[0] +a25[0] = 0 +a26[0] = 0 +a27[0] = 0 +a28[0] = 0 +a29[0] = 0 +a30[0] = 0 +a31[0] = 0 +a32[0] = 0 +a33[0] = 0 +a34[0] = 0 +a35[0] = 0 +a36[0] = 0 +a37[0] = 0 +a38[0] = 0 +a39[0] = 0 +a40[0] = 0 +a41[0] = 0 +a42[0] = 0 +a43[0] = 0 +a44[0] = 0 +a45[0] = 0 +a46[0] = 0 +a47[0] = 0 +a48[0] = 0 +a49[0] = 0 +a50[0] = 0 +a51[0] = 0 +a52[0] = 50] = 0 +a0 +a27[0] = 0 +a28[0] = 0 +a29[0] = 0 +a30[0] = 0 +a31[0] = 0 +a32[0] = 0 +a33[0] = 0 +a34[0] = 0 +a35[0] = 0 +a36[0] = 0 +a37[0] = 0 +a38[0] = 0 +a39[0] = 0 +a40[0] = 0 +a41[0] = 0 +a42[0] = 0 +a43[0] = 0 +a44[0] = 0 +a45[0] = 0 +a46[0] = 0 +a47[0] = 0 +a48[0] = 0 +a49[0] = 0 +a50[0] = 0 +a51[0] = 0 +a52[0] = 50] = 0 +a
\ No newline at end of file diff --git a/contrib/bc/tests/bc/errors/35.txt b/contrib/bc/tests/bc/errors/35.txt new file mode 100644 index 000000000000..40e79633c4a5 --- /dev/null +++ b/contrib/bc/tests/bc/errors/35.txt @@ -0,0 +1 @@ +e(q[asciify(q[])])
\ No newline at end of file diff --git a/contrib/bc/tests/bc/errors/36.txt b/contrib/bc/tests/bc/errors/36.txt new file mode 100644 index 000000000000..5929bdb7a5b9 --- /dev/null +++ b/contrib/bc/tests/bc/errors/36.txt @@ -0,0 +1,11 @@ +n0 +for (i*= 9; i < 725; ++i)strse=a[0] = asciify(180) +d2 +asciify(a[]) +x = a433 +asciify(a[]) +x = asciify(a[]) +x = asciify(18 = 72@II^II +F;FR2 +F;FRI3 +Qor
\ No newline at end of file diff --git a/contrib/bc/tests/bc/is_number.txt b/contrib/bc/tests/bc/is_number.txt new file mode 100644 index 000000000000..f9e1f753b0a3 --- /dev/null +++ b/contrib/bc/tests/bc/is_number.txt @@ -0,0 +1,13 @@ +is_number(5) +is_number(18923740913.12809374) +is_number(abs(0.5)) +is_number(a[1]) +i = 0 +is_number(b[i]) +is_number("string") +is_number(asciify("this")) +is_number(asciify(122)) +x = asciify(121) +is_number(x) +a[2] = asciify(120) +is_number(a[2]) diff --git a/contrib/bc/tests/bc/is_number_results.txt b/contrib/bc/tests/bc/is_number_results.txt new file mode 100644 index 000000000000..1c03b9c18714 --- /dev/null +++ b/contrib/bc/tests/bc/is_number_results.txt @@ -0,0 +1,10 @@ +1 +1 +1 +1 +1 +0 +0 +0 +0 +0 diff --git a/contrib/bc/tests/bc/is_string.txt b/contrib/bc/tests/bc/is_string.txt new file mode 100644 index 000000000000..bfd7136d2dea --- /dev/null +++ b/contrib/bc/tests/bc/is_string.txt @@ -0,0 +1,13 @@ +is_string(5) +is_string(18923740913.12809374) +is_string(abs(0.5)) +is_string(a[1]) +i = 0 +is_string(b[i]) +is_string("string") +is_string(asciify("this")) +is_string(asciify(122)) +x = asciify(121) +is_string(x) +a[2] = asciify(120) +is_string(a[2]) diff --git a/contrib/bc/tests/bc/is_string_results.txt b/contrib/bc/tests/bc/is_string_results.txt new file mode 100644 index 000000000000..99f11f6b2e75 --- /dev/null +++ b/contrib/bc/tests/bc/is_string_results.txt @@ -0,0 +1,10 @@ +0 +0 +0 +0 +0 +1 +1 +1 +1 +1 diff --git a/contrib/bc/tests/bc/line_by_line1.txt b/contrib/bc/tests/bc/line_by_line1.txt new file mode 100644 index 000000000000..daf328e2c03e --- /dev/null +++ b/contrib/bc/tests/bc/line_by_line1.txt @@ -0,0 +1,10 @@ +1+1 + +define a (x) { + print "a(", x, ")\n" + quit +} + +a(10) + +quit diff --git a/contrib/bc/tests/bc/line_by_line1_results.txt b/contrib/bc/tests/bc/line_by_line1_results.txt new file mode 100644 index 000000000000..0cfbf08886fc --- /dev/null +++ b/contrib/bc/tests/bc/line_by_line1_results.txt @@ -0,0 +1 @@ +2 diff --git a/contrib/bc/tests/bc/line_by_line2.txt b/contrib/bc/tests/bc/line_by_line2.txt new file mode 100644 index 000000000000..b05c2169aced --- /dev/null +++ b/contrib/bc/tests/bc/line_by_line2.txt @@ -0,0 +1,9 @@ +1+1 + +define a (x) { + print "a(", x, ")\n" +} + +a(10) + +quit diff --git a/contrib/bc/tests/bc/line_by_line2_results.txt b/contrib/bc/tests/bc/line_by_line2_results.txt new file mode 100644 index 000000000000..3760375f171d --- /dev/null +++ b/contrib/bc/tests/bc/line_by_line2_results.txt @@ -0,0 +1,3 @@ +2 +a(10) +0 diff --git a/contrib/bc/tests/bc/line_loop_quit1.txt b/contrib/bc/tests/bc/line_loop_quit1.txt new file mode 100644 index 000000000000..03a6ca111f47 --- /dev/null +++ b/contrib/bc/tests/bc/line_loop_quit1.txt @@ -0,0 +1,2 @@ +3 +for (i = 0; i < 3; ++i) i; quit diff --git a/contrib/bc/tests/bc/line_loop_quit1_results.txt b/contrib/bc/tests/bc/line_loop_quit1_results.txt new file mode 100644 index 000000000000..17342202bbfc --- /dev/null +++ b/contrib/bc/tests/bc/line_loop_quit1_results.txt @@ -0,0 +1,4 @@ +3 +0 +1 +2 diff --git a/contrib/bc/tests/bc/line_loop_quit2.txt b/contrib/bc/tests/bc/line_loop_quit2.txt new file mode 100644 index 000000000000..6d6a440b3dd4 --- /dev/null +++ b/contrib/bc/tests/bc/line_loop_quit2.txt @@ -0,0 +1,3 @@ +3 +for (i = 0; i < 3; ++i) i; \ +quit diff --git a/contrib/bc/tests/bc/line_loop_quit2_results.txt b/contrib/bc/tests/bc/line_loop_quit2_results.txt new file mode 100644 index 000000000000..17342202bbfc --- /dev/null +++ b/contrib/bc/tests/bc/line_loop_quit2_results.txt @@ -0,0 +1,4 @@ +3 +0 +1 +2 diff --git a/contrib/bc/tests/bc/scripts/afl1.bc b/contrib/bc/tests/bc/scripts/afl1.bc new file mode 100644 index 000000000000..bbb393a30fe3 --- /dev/null +++ b/contrib/bc/tests/bc/scripts/afl1.bc @@ -0,0 +1,261 @@ +ibase =2C +0.824D16DDDDDDDDDDDD1+int #! /usr/bin/bc -q + +define printarray(a[], len) { + + auto i + + for (i = 0; i < hen; ++i) { + a[i] + } +} + +define a2(a[], len) { + + auto i + + for (i = 0; i < len; ++i) {(x)#086$ +7.715E +asciify(x)# +2893.M9 + +7.7150-1#93.19 +asciify(x)#d(1) { +x = asciify(x)#086$ +7.7150-1893.19 +asciify(x) + a[i] = a[i] * a[i] + } + + printarray(a[], len) +} + +define a4(a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a6(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a1(*a[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a[i] = i + } + + a2(a[], len) + + printarray(a[], len) +} + +define a3(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a4(a__[], len) + + printarray(a__[], len) +} + +define a5(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a2(a__[], len) + + printarray(a__[], len) +} + +define a7(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a6(a__[], len) + + printarray(a__[], len) +} + +len = 16 + +a1(a[], len) +printarray(a[], len) +a3(a[], len) +printarray(a[], len) +a5(a[], len) +printarray(a[], len) +a7(a[], len) +printarray(a[], len) + +a1(b[], len) +printarray(b[], len) +a3(b[], len) +printarray(b[], len) +a5(b[], len) +printarray(b[], len) +a7(b[], len) +printarray(b[], len) + +a1[0] = 0 +a2[0] = 0 +a3[0] = 0 +a4[0] = 0 +a5[0] = 0 +a6[0] = 0 +a7[0] = 0 +a8[0] = 0 +a9[0] = 0 +a10[0] = 0 +a11[0] = 0 +a12[0] +a13[0] = 0 +a14[0] = 0 +a15[0] = 0 +a16[0] +a17[0] = 0 +a18[0] = 0 +a19[0] = 0 +a20[0] +a21[0] = 0 +a22[0] = 0 +a23[0] = 0 +a24[0] +a25[0] = 0 +a26[0] = ase =2C +0.824D16DDDDDDDDDDDD1+int #! /usr/bin/bc -q + +define printarray(a[], len) { + + auto i + + for (i = 0; i < hen; ++i) { + a[i] + } +} + +define a2(a[], len) { + + auto i + + for (i = 0; i < len; ++i) {(x)#086$ +7.715E +asciify(x)# +2893.M9 + +7.7150-1#93.19 +asciify(x)#d(1) { +x = asciify(x)#086$ +7.7150-1893.19 +asciify(x) + a[i] = a[i] * a[i] + } + + printarray(a[], len) +} + +define a4(a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a6(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = a__[i] * a__[i] + } + + printarray(a__[], len) +} + +define a1(*a[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a[i] = i + } + + a2(a[], len) + + printarray(a[], len) +} + +define a3(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a4(a__[], len) + + printarray(a__[], len) +} + +define a5(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a2(a__[], len) + + printarray(a__[], len) +} + +define a7(*a__[], len) { + + auto i + + for (i = 0; i < len; ++i) { + a__[i] = i + } + + a6(a__[], len) + + printarray(a__[], len) +} + +len = 16 + +a1(a[], len) +printarray(a[], len) diff --git a/contrib/bc/tests/bc/scripts/afl1.txt b/contrib/bc/tests/bc/scripts/afl1.txt new file mode 100644 index 000000000000..9d3ac4b542fa --- /dev/null +++ b/contrib/bc/tests/bc/scripts/afl1.txt @@ -0,0 +1,1571 @@ +.2520876288594257447 +0 +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +.2520876288594257447 + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + + +7.2198 + +74019.69 +6.2198 + +-41243.8202 + +0 +0 +0 +0 +0 diff --git a/contrib/bc/tests/bc/scripts/all.txt b/contrib/bc/tests/bc/scripts/all.txt index 0a8d2fe17c6c..e2d2aa320c6f 100644 --- a/contrib/bc/tests/bc/scripts/all.txt +++ b/contrib/bc/tests/bc/scripts/all.txt @@ -5,6 +5,7 @@ add.bc print.bc parse.bc array.bc +array2.bc atan.bc bessel.bc functions.bc @@ -16,3 +17,4 @@ screen.bc strings2.bc ifs.bc ifs2.bc +afl1.bc diff --git a/contrib/bc/tests/bc/scripts/array2.bc b/contrib/bc/tests/bc/scripts/array2.bc new file mode 100644 index 000000000000..34d88c3e276b --- /dev/null +++ b/contrib/bc/tests/bc/scripts/array2.bc @@ -0,0 +1,20 @@ +#! /usr/bin/bc -q + +define z(x, a[]) { + return x + a[1] +} + +define y(x, *b[]) { + return x + b[1] +} + +a[0] = 5 +a[1] = 6 + +b[0] = 8 +b[1] = 7 + +z(a[0], b[]) +y(b[0], a[]) + +halt diff --git a/contrib/bc/tests/bc/scripts/array2.txt b/contrib/bc/tests/bc/scripts/array2.txt new file mode 100644 index 000000000000..76dcb035f907 --- /dev/null +++ b/contrib/bc/tests/bc/scripts/array2.txt @@ -0,0 +1,2 @@ +12 +14 diff --git a/contrib/bc/tests/bc/timeconst.sh b/contrib/bc/tests/bc/timeconst.sh index 8b6e1ec596fc..3751700077f7 100755 --- a/contrib/bc/tests/bc/timeconst.sh +++ b/contrib/bc/tests/bc/timeconst.sh @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/tests/bcl.c b/contrib/bc/tests/bcl.c index 6f462ce9dc4f..cea63f457cd4 100644 --- a/contrib/bc/tests/bcl.c +++ b/contrib/bc/tests/bcl.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2021 Gavin D. Howard and contributors. + * Copyright (c) 2018-2023 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -59,6 +59,9 @@ main(void) char* res; BclBigDig b = 0; + e = bcl_start(); + err(e); + // We do this twice to test the reference counting code. e = bcl_init(); err(e); @@ -335,5 +338,7 @@ main(void) bcl_free(); + bcl_end(); + return 0; } diff --git a/contrib/bc/tests/dc/all.txt b/contrib/bc/tests/dc/all.txt index 8942e087768b..5d6978e5790a 100644 --- a/contrib/bc/tests/dc/all.txt +++ b/contrib/bc/tests/dc/all.txt @@ -21,5 +21,8 @@ scientific engineering vars misc +misc1 strings rand +is_number +is_string diff --git a/contrib/bc/tests/dc/errors/15.txt b/contrib/bc/tests/dc/errors/15.txt index adb809dcca3d..902a38bcbe37 100644 --- a/contrib/bc/tests/dc/errors/15.txt +++ b/contrib/bc/tests/dc/errors/15.txt @@ -1,11 +1,117 @@ -0bpax1bpR -1bpR -.218933b987pR -_19bp/98 -_38_.1/19bp38_.1/98 -_38921.1/98/98 -_38_.1/98 -_38921.1/98 -98 -_38921.1/98 -73.289 75bpu +0 lip1-si0l0+2o0sx_9lq+pR 0900pR +_100900pR +_10900p0bpR +1bp0 +.20bpR +100000.0000005bpR +_10bpR +_.1000[l0;0;rpRl01+s0l010>x]dsxx0sx0s0 +1 2+p+p +3+p +4+p +5+p +6+p +7+p +8+p +9+p +16+p +17+p +18+p +19.p +20+p +21+0+p +71+xx0sx0s0 +1 2+p+p +3o +70+p +70+p +70+p +70+p +22+p +20+p +20+p +20+p +20+p +x0+p +20+p +0 lip1-si0{0+2i0l0+200sx0.1009 +40+1+p +4000pR +_10900p0bpR +1bp0 +.20bpR +100000.002+p +20+p +20+p +20+p +20+p +x0+p +2000005bpR +_10bpR +_.10yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy00[l0;0;rpRl01+s0l010>x]dsxx0sx0s0 +1 2+p+p +3+p +4+p +5+p +6+p +7+p +8+p +9+p +10p ++p +11+p +12+p +13+p +14+p +15+p +16+p +17+p +18+p +19+p +20+p +21+0+p +71+xx0sx0s0 +1 2+p+p +3o +70+p +70+p +70+p +70+p +22+p +20+p + +20+p +30+p +30+p +30+p +0b30+p +30+p +30+p +30+p +30+p +30+p +30+p +40"1+p +40+p +40+p +40+p +40+p +40+p +40+p +40+p +40+p +50+p +50+p +50+p +50+p +50+p +50+p +50+p +50+p +50+p +5pR +100000.0070000bpR +^20+pR +_.10100000.0070000bpR +^20+pR +_.1000Kl0;0;rpRl0 diff --git a/contrib/bc/tests/dc/errors/34.txt b/contrib/bc/tests/dc/errors/34.txt deleted file mode 100644 index 902a38bcbe37..000000000000 --- a/contrib/bc/tests/dc/errors/34.txt +++ /dev/null @@ -1,117 +0,0 @@ -0 lip1-si0l0+2o0sx_9lq+pR 0900pR -_100900pR -_10900p0bpR -1bp0 -.20bpR -100000.0000005bpR -_10bpR -_.1000[l0;0;rpRl01+s0l010>x]dsxx0sx0s0 -1 2+p+p -3+p -4+p -5+p -6+p -7+p -8+p -9+p -16+p -17+p -18+p -19.p -20+p -21+0+p -71+xx0sx0s0 -1 2+p+p -3o -70+p -70+p -70+p -70+p -22+p -20+p -20+p -20+p -20+p -x0+p -20+p -0 lip1-si0{0+2i0l0+200sx0.1009 -40+1+p -4000pR -_10900p0bpR -1bp0 -.20bpR -100000.002+p -20+p -20+p -20+p -20+p -x0+p -2000005bpR -_10bpR -_.10yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy00[l0;0;rpRl01+s0l010>x]dsxx0sx0s0 -1 2+p+p -3+p -4+p -5+p -6+p -7+p -8+p -9+p -10p -+p -11+p -12+p -13+p -14+p -15+p -16+p -17+p -18+p -19+p -20+p -21+0+p -71+xx0sx0s0 -1 2+p+p -3o -70+p -70+p -70+p -70+p -22+p -20+p - -20+p -30+p -30+p -30+p -0b30+p -30+p -30+p -30+p -30+p -30+p -30+p -40"1+p -40+p -40+p -40+p -40+p -40+p -40+p -40+p -40+p -50+p -50+p -50+p -50+p -50+p -50+p -50+p -50+p -50+p -5pR -100000.0070000bpR -^20+pR -_.10100000.0070000bpR -^20+pR -_.1000Kl0;0;rpRl0 diff --git a/contrib/bc/tests/dc/is_number.txt b/contrib/bc/tests/dc/is_number.txt new file mode 100644 index 000000000000..358182927326 --- /dev/null +++ b/contrib/bc/tests/dc/is_number.txt @@ -0,0 +1,9 @@ +5upR +18923740913.12809374upR +1;aupR +0sili;bupR +[string]upR +[this]aupR +122aupR +121asxlxupR +120a2:a2;aupR diff --git a/contrib/bc/tests/dc/is_number_results.txt b/contrib/bc/tests/dc/is_number_results.txt new file mode 100644 index 000000000000..6c8f29cea4ab --- /dev/null +++ b/contrib/bc/tests/dc/is_number_results.txt @@ -0,0 +1,9 @@ +1 +1 +1 +1 +0 +0 +0 +0 +0 diff --git a/contrib/bc/tests/dc/is_string.txt b/contrib/bc/tests/dc/is_string.txt new file mode 100644 index 000000000000..6798fa3904b8 --- /dev/null +++ b/contrib/bc/tests/dc/is_string.txt @@ -0,0 +1,9 @@ +5tpR +18923740913.12809374tpR +1;atpR +0sili;btpR +[string]tpR +[this]atpR +122atpR +121asxlxtpR +120a2:a2;atpR diff --git a/contrib/bc/tests/dc/is_string_results.txt b/contrib/bc/tests/dc/is_string_results.txt new file mode 100644 index 000000000000..0c6a1c9abd7a --- /dev/null +++ b/contrib/bc/tests/dc/is_string_results.txt @@ -0,0 +1,9 @@ +0 +0 +0 +0 +1 +1 +1 +1 +1 diff --git a/contrib/bc/tests/dc/misc1.txt b/contrib/bc/tests/dc/misc1.txt new file mode 100644 index 000000000000..a512573ae548 --- /dev/null +++ b/contrib/bc/tests/dc/misc1.txt @@ -0,0 +1,26 @@ +0bpax1bpR +1bpR +.218933b987pR +_19bp/98 +_38_.1/19bp38_.1/98 +_38921.1/98/98 +_38_.1/98 +_38921.1/98 +98 +_38921.1/98 +73.289 75bpu +# These just empty the stack. +pR +pR +pR +pR +pR +pR +pR +pR +pR +pR +pR +pR +pR +pR diff --git a/contrib/bc/tests/dc/misc1_results.txt b/contrib/bc/tests/dc/misc1_results.txt new file mode 100644 index 000000000000..d2f8ad70b4b8 --- /dev/null +++ b/contrib/bc/tests/dc/misc1_results.txt @@ -0,0 +1,21 @@ +0 +1 +1 +987 +19 +19 +75 +1 +73.289 +98 +0 +98 +0 +380 +98 +0 +-380 +19 +380 +98 +0 diff --git a/contrib/bc/tests/dc/scripts/all.txt b/contrib/bc/tests/dc/scripts/all.txt index e15dae5e15ff..58c6d295bb2d 100644 --- a/contrib/bc/tests/dc/scripts/all.txt +++ b/contrib/bc/tests/dc/scripts/all.txt @@ -7,3 +7,4 @@ factorial.dc loop.dc quit.dc weird.dc +no_clamp.dc diff --git a/contrib/bc/tests/dc/scripts/no_clamp.dc b/contrib/bc/tests/dc/scripts/no_clamp.dc new file mode 100644 index 000000000000..bad184a54401 --- /dev/null +++ b/contrib/bc/tests/dc/scripts/no_clamp.dc @@ -0,0 +1,29 @@ +Ip +Ap +A0p +AAp +AA0p +Fp +F0p +FFp +FF0p +47FBFE71026C816CDD99EDC9237F65023488025022006E79F92017CBA906P +2iIp +Ap +A0p +AAp +ABp +3iIp +Ap +A0p +ABp +AB0p +ABBp +5iIp +Bp +B0p +BCp +BC0p +BCDp +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFp +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFp diff --git a/contrib/bc/tests/dc/scripts/no_clamp.txt b/contrib/bc/tests/dc/scripts/no_clamp.txt new file mode 100644 index 000000000000..c8b680be10aa --- /dev/null +++ b/contrib/bc/tests/dc/scripts/no_clamp.txt @@ -0,0 +1,29 @@ +10 +10 +100 +110 +1100 +15 +150 +165 +1650 +Mwhuaaahahahahahhaaaa... +2 +10 +20 +30 +31 +3 +10 +30 +41 +123 +134 +5 +11 +55 +67 +335 +348 +54569682106375694274902340 +794093388050906567876552344387164339423179626464840 diff --git a/contrib/bc/tests/error.sh b/contrib/bc/tests/error.sh index c76dcdf113dd..35a6af0edf3f 100755 --- a/contrib/bc/tests/error.sh +++ b/contrib/bc/tests/error.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -36,14 +36,21 @@ outputdir=${BC_TEST_OUTPUT_DIR:-$testdir} # Command-line processing. if [ "$#" -lt 2 ]; then - printf 'usage: %s dir test [exec args...]\n' "$script" + + printf 'usage: %s dir test problematic_tests [exec args...]\n' "$script" exit 1 + else + d="$1" shift t="$1" shift + + problematic="$1" + shift + fi if [ "$#" -lt 1 ]; then @@ -53,6 +60,15 @@ else shift fi +# Just skip tests that are problematic on FreeBSD. These tests can cause FreeBSD +# to kill bc from memory exhaustion because of overcommit. +if [ "$d" = "bc" ] && [ "$problematic" -eq 0 ]; then + if [ "$t" = "33.txt" ]; then + printf 'Skipping problematic %s error file %s...\n' "$d" "$t" + exit 0 + fi +fi + # I use these, so unset them to make the tests work. unset BC_ENV_ARGS unset BC_LINE_LENGTH @@ -80,20 +96,38 @@ fi testfile="$testdir/$d/errors/$t" -printf 'Running %s error file %s...' "$d" "$t" +printf 'Running %s error file %s with clamping...' "$d" "$t" -printf '%s\n' "$halt" | "$exe" "$@" $opts "$testfile" 2> "$out" > /dev/null +printf '%s\n' "$halt" | "$exe" "$@" $opts -c "$testfile" 2> "$out" > /dev/null err="$?" checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" > /dev/null printf 'pass\n' -printf 'Running %s error file %s through cat...' "$d" "$t" +printf 'Running %s error file %s without clamping...' "$d" "$t" + +printf '%s\n' "$halt" | "$exe" "$@" $opts -C "$testfile" 2> "$out" > /dev/null +err="$?" + +checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" > /dev/null + +printf 'pass\n' + +printf 'Running %s error file %s through cat with clamping...' "$d" "$t" + +cat "$testfile" | "$exe" "$@" $opts -c 2> "$out" > /dev/null +err="$?" + +checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" + +printf 'pass\n' + +printf 'Running %s error file %s through cat without clamping...' "$d" "$t" -cat "$testfile" | "$exe" "$@" $opts 2> "$out" > /dev/null +cat "$testfile" | "$exe" "$@" $opts -C 2> "$out" > /dev/null err="$?" -checkcrash "$d" "$err" "$testfile" +checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" printf 'pass\n' diff --git a/contrib/bc/tests/errors.sh b/contrib/bc/tests/errors.sh index 4acc978b9e5a..5005f3e9aeb1 100755 --- a/contrib/bc/tests/errors.sh +++ b/contrib/bc/tests/errors.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/tests/history.py b/contrib/bc/tests/history.py index f1787a27e864..b9acf73cb58d 100755 --- a/contrib/bc/tests/history.py +++ b/contrib/bc/tests/history.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/tests/history.sh b/contrib/bc/tests/history.sh index 1898ae5499dc..ff4ffa562ca8 100755 --- a/contrib/bc/tests/history.sh +++ b/contrib/bc/tests/history.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/tests/other.sh b/contrib/bc/tests/other.sh index 4e277059a32c..fe228eec3317 100755 --- a/contrib/bc/tests/other.sh +++ b/contrib/bc/tests/other.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -131,7 +131,7 @@ if [ "$d" = "bc" ]; then checktest_retcode "$d" "$?" "environment var" - "$exe" "$@" -e 4 > /dev/null + printf 'halt\n' | "$exe" "$@" -e 4 > /dev/null err="$?" checktest_retcode "$d" "$?" "environment var" @@ -153,19 +153,19 @@ if [ "$d" = "bc" ]; then printf '5\n0\n' > "$redefine_res" - "$exe" "$@" --redefine=print -e 'define print(x) { x }' -e 'print(5)' > "$redefine_out" + printf 'halt\n' | "$exe" "$@" --redefine=print -e 'define print(x) { x }' -e 'print(5)' > "$redefine_out" err="$?" checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out" - "$exe" "$@" -r "abs" -r "else" -e 'abs = 5;else = 0' -e 'abs;else' > "$redefine_out" + printf 'halt\n' | "$exe" "$@" -r "abs" -r "else" -e 'abs = 5;else = 0' -e 'abs;else' > "$redefine_out" err="$?" checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out" if [ "$extra_math" -ne 0 ]; then - "$exe" "$@" -lr abs -e "perm(5, 1)" -e "0" > "$redefine_out" + printf 'halt\n' | "$exe" "$@" -lr abs -e "perm(5, 1)" -e "0" > "$redefine_out" err="$?" checktest "$d" "$err" "keyword not redefined in builtin library" "$redefine_res" "$redefine_out" @@ -189,7 +189,7 @@ if [ "$d" = "bc" ]; then multiline_expr_out="$outputdir/bc_outputs/multiline_expr_results.txt" # tests/bc/misc1.txt happens to have a multiline comment in it. - "$exe" "$@" -f "$testdir/bc/misc1.txt" > "$multiline_expr_out" + printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/misc1.txt" > "$multiline_expr_out" err="$?" checktest "$d" "$err" "multiline comment in expression file" "$testdir/bc/misc1_results.txt" \ @@ -198,7 +198,7 @@ if [ "$d" = "bc" ]; then printf 'pass\n' printf 'Running multiline comment expression file error test...' - "$exe" "$@" -f "$testdir/bc/errors/05.txt" 2> "$multiline_expr_out" + printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/errors/05.txt" 2> "$multiline_expr_out" err="$?" checkerrtest "$d" "$err" "multiline comment in expression file error" \ @@ -208,7 +208,7 @@ if [ "$d" = "bc" ]; then printf 'Running multiline string expression file test...' # tests/bc/strings.txt happens to have a multiline string in it. - "$exe" "$@" -f "$testdir/bc/strings.txt" > "$multiline_expr_out" + printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/strings.txt" > "$multiline_expr_out" err="$?" checktest "$d" "$err" "multiline string in expression file" "$testdir/bc/strings_results.txt" \ @@ -217,13 +217,13 @@ if [ "$d" = "bc" ]; then printf 'pass\n' printf 'Running multiline string expression file error test...' - "$exe" "$@" -f "$testdir/bc/errors/16.txt" 2> "$multiline_expr_out" + printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/errors/16.txt" 2> "$multiline_expr_out" err="$?" checkerrtest "$d" "$err" "multiline string in expression file with backslash error" \ "$multiline_expr_out" "$d" - "$exe" "$@" -f "$testdir/bc/errors/04.txt" 2> "$multiline_expr_out" + printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/errors/04.txt" 2> "$multiline_expr_out" err="$?" checkerrtest "$d" "$err" "multiline string in expression file error" \ @@ -456,6 +456,37 @@ else fi +if [ "$d" = "bc" ]; then + + out=$(printf '100\n') + printf '%s\n' "$out" > "$out1" + + printf 'scale\n' | "$exe" "$@" -S100 -l > "$out2" + checktest "$d" "$?" "builtin variable args with math lib" "$out1" "$out2" + + printf 'scale\n' | "$exe" "$@" --scale=100 --mathlib > "$out2" + checktest "$d" "$?" "builtin variable long args with math lib" "$out1" "$out2" + + export BC_ENV_ARGS="-l" + + printf 'scale\n' | "$exe" "$@" -S100 > "$out2" + checktest "$d" "$?" "builtin variable args with math lib env arg" "$out1" "$out2" + + printf 'scale\n' | "$exe" "$@" --scale=100 > "$out2" + checktest "$d" "$?" "builtin variable long args with math lib env arg" "$out1" "$out2" + + export BC_ENV_ARGS="-S100" + + printf 'scale\n' | "$exe" "$@" -l > "$out2" + checktest "$d" "$?" "builtin variable args with math lib arg" "$out1" "$out2" + + export BC_ENV_ARGS="--scale=100" + + printf 'scale\n' | "$exe" "$@" -l > "$out2" + checktest "$d" "$?" "builtin variable long args with math lib arg" "$out1" "$out2" + +fi + printf 'scale\n' | "$exe" "$@" --scale=18923c.rlg > /dev/null 2> "$out2" err="$?" @@ -504,7 +535,7 @@ printf 'pass\n' if [ "$d" = "bc" ]; then printf 'Running %s limits tests...' "$d" - printf 'limits\n' | "$exe" "$@" > "$out2" /dev/null 2>&1 + printf 'limits\n' | "$exe" "$@" /dev/null > "$out2" 2>&1 checktest_retcode "$d" "$?" "limits" diff --git a/contrib/bc/tests/read.sh b/contrib/bc/tests/read.sh index a1915eb271ac..a5c66d9d4fec 100755 --- a/contrib/bc/tests/read.sh +++ b/contrib/bc/tests/read.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/tests/script.sh b/contrib/bc/tests/script.sh index 5942e13159fe..d720878fafa3 100755 --- a/contrib/bc/tests/script.sh +++ b/contrib/bc/tests/script.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -88,15 +88,15 @@ fi if [ "$d" = "bc" ]; then if [ "$run_stack_tests" -ne 0 ]; then - options="-lgq" + options="-lgqC" else - options="-lq" + options="-lqC" fi halt="halt" else - options="-x" + options="-xC" halt="q" fi @@ -159,7 +159,7 @@ else # This is to check that the command exists. If not, we should not try to # generate the test. Instead, we should just skip. - command -v "$d" + command -v "$d" 1>/dev/null 2>&1 err="$?" set -e diff --git a/contrib/bc/tests/scripts.sh b/contrib/bc/tests/scripts.sh index 46aa7e761170..ee21b2a9be6d 100755 --- a/contrib/bc/tests/scripts.sh +++ b/contrib/bc/tests/scripts.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/tests/stdin.sh b/contrib/bc/tests/stdin.sh index 69e6f2cabf34..d8585052bf04 100755 --- a/contrib/bc/tests/stdin.sh +++ b/contrib/bc/tests/stdin.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/tests/test.sh b/contrib/bc/tests/test.sh index 9d557a715dc0..95606ded4f9e 100755 --- a/contrib/bc/tests/test.sh +++ b/contrib/bc/tests/test.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2023 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -123,9 +123,11 @@ if [ ! -f "$results" ]; then printf 'done\n' fi -# We set this here because GNU dc does not have it. -if [ "$d" = "dc" ]; then - options="-x" +# We set this here because GNU bc and dc does not have these options. +if [ "$d" = "bc" ]; then + options="-lqc" +else + options="-xc" fi export $var=string |