diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 17 | ||||
-rw-r--r-- | test/Makefile.am | 22 | ||||
-rw-r--r-- | test/Makefile.in | 22 | ||||
-rw-r--r-- | test/readall.ok | 7 | ||||
-rw-r--r-- | test/readall1.awk | 10 | ||||
-rw-r--r-- | test/readall2.awk | 15 | ||||
-rw-r--r-- | test/testext-mpfr.ok | 2 | ||||
-rw-r--r-- | test/testext.ok | 2 |
8 files changed, 91 insertions, 6 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 66882c59..47289312 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -3,6 +3,23 @@ * Makefile.am (EXTRA_DIST): nsidentifier, new test. * nsidentifier.awk, nsidentifier.ok: New files. +2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (EXTRA_DIST): Add readall1.awk, readall2.awk, and + readall.ok. + (SHLIB_TESTS): Add readall. + (GENTESTS_UNUSED): Add readall1.awk and readall2.awk. + (readall): Add new test of the writeall and readall functions. + * readall1.awk, readall2.awk, readall.ok: New files. + +2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (testext): Change awk pattern to include functions in + testext.awk. + (diffout): If running MPFR tests and there's an mpfr.ok file, compare + to that instead of to the regular ok file. + * testext.ok, testext-mpfr.ok: Update for new test_array_create test. + 2021-12-07 Andrew J. Schorr <aschorr@telemetry-investments.com> * iolint.awk, iolint.ok: Reorder "cat" pipe/output file test to reduce diff --git a/test/Makefile.am b/test/Makefile.am index 27f12dbb..16606b09 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1033,6 +1033,9 @@ EXTRA_DIST = \ range1.ok \ range2.awk \ range2.ok \ + readall1.awk \ + readall2.awk \ + readall.ok \ readbuf.awk \ readbuf.ok \ readdir.awk \ @@ -1492,6 +1495,7 @@ SHLIB_TESTS = \ getfile \ inplace1 inplace2 inplace2bcomp inplace3 inplace3bcomp \ ordchr ordchr2 \ + readall \ readdir readdir_test readdir_retest readfile readfile2 revout \ revtwoway rwarray \ testext time @@ -1599,7 +1603,8 @@ ZOS_FAIL = @ZOS_FAIL@ GENTESTS_UNUSED = Makefile.in checknegtime.awk dtdgport.awk fix-fmtspcl.awk \ fmtspcl-mpfr.ok fmtspcl.awk fmtspcl.tok gtlnbufv.awk hello.awk \ inchello.awk inclib.awk inplace.1.in inplace.2.in inplace.in \ - printfloat.awk readdir0.awk valgrind.awk xref.awk + printfloat.awk readdir0.awk valgrind.awk xref.awk \ + readall1.awk readall2.awk # List of tests on MinGW or DJGPP that need a different cmp program NEED_TESTOUTCMP = \ @@ -2283,7 +2288,7 @@ inplace3bcomp:: testext:: @echo $@ - @-$(AWK) ' /^(@load|BEGIN)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk + @-$(AWK) ' /^(@load|BEGIN|function)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk @-$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null; \ then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ testext.awk testexttmp.txt ; \ @@ -2319,6 +2324,13 @@ readdir_retest: @-$(AWK) -lreaddir_test -F/ -f "$(srcdir)"/$@.awk "$(top_srcdir)" > _$@ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ +readall: + @echo $@ + @-$(AWK) -lrwarray -f "$(srcdir)"/$@1.awk -v "ofile=readall.state" > _$@ + @-$(AWK) -lrwarray -f "$(srcdir)"/$@2.awk -v "ifile=readall.state" >> _$@ + @-$(CMP) $@.ok _$@ && rm -f _$@ + @-$(RM) -f readall.state + fts: @echo $@ @-case `uname` in \ @@ -2520,7 +2532,11 @@ diffout: if [ "$$i" != "_*" ]; then \ echo ============== $$i ============= ; \ base=`echo $$i | sed 's/^_//'` ; \ - if [ -r $${base}.ok ]; then \ + if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r $${base}-mpfr.ok ]; then \ + diff -u $${base}-mpfr.ok $$i ; \ + elif echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r "$(srcdir)"/$${base}-mpfr.ok ]; then \ + diff -u "$(srcdir)"/$${base}-mpfr.ok $$i ; \ + elif [ -r $${base}.ok ]; then \ diff -u $${base}.ok $$i ; \ else \ diff -u "$(srcdir)"/$${base}.ok $$i ; \ diff --git a/test/Makefile.in b/test/Makefile.in index a755b633..cb4551e2 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1299,6 +1299,9 @@ EXTRA_DIST = \ range1.ok \ range2.awk \ range2.ok \ + readall1.awk \ + readall2.awk \ + readall.ok \ readbuf.awk \ readbuf.ok \ readdir.awk \ @@ -1754,6 +1757,7 @@ SHLIB_TESTS = \ getfile \ inplace1 inplace2 inplace2bcomp inplace3 inplace3bcomp \ ordchr ordchr2 \ + readall \ readdir readdir_test readdir_retest readfile readfile2 revout \ revtwoway rwarray \ testext time @@ -1866,7 +1870,8 @@ EXPECTED_FAIL_ZOS = \ GENTESTS_UNUSED = Makefile.in checknegtime.awk dtdgport.awk fix-fmtspcl.awk \ fmtspcl-mpfr.ok fmtspcl.awk fmtspcl.tok gtlnbufv.awk hello.awk \ inchello.awk inclib.awk inplace.1.in inplace.2.in inplace.in \ - printfloat.awk readdir0.awk valgrind.awk xref.awk + printfloat.awk readdir0.awk valgrind.awk xref.awk \ + readall1.awk readall2.awk # List of tests on MinGW or DJGPP that need a different cmp program @@ -2737,7 +2742,7 @@ inplace3bcomp:: testext:: @echo $@ - @-$(AWK) ' /^(@load|BEGIN)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk + @-$(AWK) ' /^(@load|BEGIN|function)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk @-$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null; \ then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ testext.awk testexttmp.txt ; \ @@ -2773,6 +2778,13 @@ readdir_retest: @-$(AWK) -lreaddir_test -F/ -f "$(srcdir)"/$@.awk "$(top_srcdir)" > _$@ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ +readall: + @echo $@ + @-$(AWK) -lrwarray -f "$(srcdir)"/$@1.awk -v "ofile=readall.state" > _$@ + @-$(AWK) -lrwarray -f "$(srcdir)"/$@2.awk -v "ifile=readall.state" >> _$@ + @-$(CMP) $@.ok _$@ && rm -f _$@ + @-$(RM) -f readall.state + fts: @echo $@ @-case `uname` in \ @@ -5352,7 +5364,11 @@ diffout: if [ "$$i" != "_*" ]; then \ echo ============== $$i ============= ; \ base=`echo $$i | sed 's/^_//'` ; \ - if [ -r $${base}.ok ]; then \ + if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r $${base}-mpfr.ok ]; then \ + diff -u $${base}-mpfr.ok $$i ; \ + elif echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r "$(srcdir)"/$${base}-mpfr.ok ]; then \ + diff -u "$(srcdir)"/$${base}-mpfr.ok $$i ; \ + elif [ -r $${base}.ok ]; then \ diff -u $${base}.ok $$i ; \ else \ diff -u "$(srcdir)"/$${base}.ok $$i ; \ diff --git a/test/readall.ok b/test/readall.ok new file mode 100644 index 00000000..b343af59 --- /dev/null +++ b/test/readall.ok @@ -0,0 +1,7 @@ +1 +1 +5.9 3 -2.327 +zebra[archie] = banana +zebra[0] = apple +zebra[3][foo] = bar +zebra[3][bar] = foo diff --git a/test/readall1.awk b/test/readall1.awk new file mode 100644 index 00000000..2888d157 --- /dev/null +++ b/test/readall1.awk @@ -0,0 +1,10 @@ +BEGIN { + x = 5.9 + y = 3 + z = -2.327 + zebra[0] = "apple" + zebra["archie"] = "banana" + zebra[3]["foo"] = "bar" + zebra[3]["bar"] = "foo" + print writeall(ofile) +} diff --git a/test/readall2.awk b/test/readall2.awk new file mode 100644 index 00000000..8b79849a --- /dev/null +++ b/test/readall2.awk @@ -0,0 +1,15 @@ +function printarray(n, x, i) { + for (i in x) { + if (isarray(x[i])) + printarray((n "[" i "]"), x[i]) + else + printf "%s[%s] = %s\n", n, i, x[i] + } +} + +BEGIN { + print readall(ifile) + print x, y, z + #print zebra[0], zebra[3]["foo"], zebra[3]["bar"] + printarray("zebra", zebra) +} diff --git a/test/testext-mpfr.ok b/test/testext-mpfr.ok index 2c616c67..ec584216 100644 --- a/test/testext-mpfr.ok +++ b/test/testext-mpfr.ok @@ -48,6 +48,8 @@ test_array_param: argument is not undefined (1) test_array_param() returned 0 isarray(a_scalar) = 0 +test_array_create returned 1 +good: we have an array Initial value of LINT is 0 print_do_lint: lint = 0 print_do_lint() returned 1 diff --git a/test/testext.ok b/test/testext.ok index fbc3c263..1d058302 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -48,6 +48,8 @@ test_array_param: argument is not undefined (1) test_array_param() returned 0 isarray(a_scalar) = 0 +test_array_create returned 1 +good: we have an array Initial value of LINT is 0 print_do_lint: lint = 0 print_do_lint() returned 1 |