diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 9 | ||||
-rw-r--r-- | test/Makefile.am | 14 | ||||
-rw-r--r-- | test/Makefile.in | 14 | ||||
-rw-r--r-- | test/readall.ok | 7 | ||||
-rw-r--r-- | test/readall1.awk | 10 | ||||
-rw-r--r-- | test/readall2.awk | 15 |
6 files changed, 67 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 67637641..c6c0c657 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,5 +1,14 @@ 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 diff --git a/test/Makefile.am b/test/Makefile.am index f9cdfd40..1fa8ad3f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1031,6 +1031,9 @@ EXTRA_DIST = \ range1.ok \ range2.awk \ range2.ok \ + readall1.awk \ + readall2.awk \ + readall.ok \ readbuf.awk \ readbuf.ok \ readdir.awk \ @@ -1490,6 +1493,7 @@ SHLIB_TESTS = \ getfile \ inplace1 inplace2 inplace2bcomp inplace3 inplace3bcomp \ ordchr ordchr2 \ + readall \ readdir readdir_test readdir_retest readfile readfile2 revout \ revtwoway rwarray \ testext time @@ -1597,7 +1601,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 = \ @@ -2317,6 +2322,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 \ diff --git a/test/Makefile.in b/test/Makefile.in index a4d27586..c6c131fc 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1297,6 +1297,9 @@ EXTRA_DIST = \ range1.ok \ range2.awk \ range2.ok \ + readall1.awk \ + readall2.awk \ + readall.ok \ readbuf.awk \ readbuf.ok \ readdir.awk \ @@ -1752,6 +1755,7 @@ SHLIB_TESTS = \ getfile \ inplace1 inplace2 inplace2bcomp inplace3 inplace3bcomp \ ordchr ordchr2 \ + readall \ readdir readdir_test readdir_retest readfile readfile2 revout \ revtwoway rwarray \ testext time @@ -1864,7 +1868,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 @@ -2771,6 +2776,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 \ 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) +} |