diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 21 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 9 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/asortbool.awk | 19 | ||||
-rw-r--r-- | test/asortbool.ok | 6 | ||||
-rw-r--r-- | test/dumpvars.ok | 2 | ||||
-rw-r--r-- | test/functab5.ok | 1 | ||||
-rw-r--r-- | test/id.ok | 1 | ||||
-rw-r--r-- | test/intest.awk | 4 | ||||
-rw-r--r-- | test/rwarray.awk | 11 | ||||
-rw-r--r-- | test/symtab11.ok | 1 | ||||
-rw-r--r-- | test/symtab8.ok | 2 |
13 files changed, 80 insertions, 6 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index f139b895..7966fcf0 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -8,12 +8,33 @@ (testext): Ditto * iolint.ok: Updated. +2021-05-02 Arnold D. Robbins <arnold@skeeve.com> + + * asortbool.awk, functab5.ok, id.ok, rwarrray.awk, + symtab11.ok: Revise after code changes. + +2021-04-28 Arnold D. Robbins <arnold@skeeve.com> + + * asortbool.ok: Revise after code changes. + * rwarray.awk: Ditto. + 2021-04-14 Arnold D. Robbins <arnold@skeeve.com> * noeffect.awk: Add more test cases. Thanks to Wolfgang Laun <wolfgang.laun@gmail.com>. * lintwarn.ok, noeffect.ok: Updated after code and test changes. +2021-03-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): asortbool, new test. + * asortbool.awk, asortbool.ok: New files. + * rwarray.awk: Add test of saving/restoring bool values. + +2021-03-08 Arnold D. Robbins <arnold@skeeve.com> + + * dumpvars.ok, functab5.ok, id.ok, intest.awk, symtab11.ok, + symtab8.ok: Updated after code changes. + 2021-02-13 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (EXTRA_DIST): argcasfile, new test. diff --git a/test/Makefile.am b/test/Makefile.am index c0e37642..b8fe1cb7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -133,6 +133,8 @@ EXTRA_DIST = \ assignnumfield.ok \ assignnumfield2.awk \ assignnumfield2.ok \ + asortbool.awk \ + asortbool.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -1430,7 +1432,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \ - arraytype \ + arraytype asortbool \ backw badargs beginfile1 beginfile2 binmode1 \ charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \ clos1way6 crlf \ diff --git a/test/Makefile.in b/test/Makefile.in index 967fbab8..ada72c07 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -396,6 +396,8 @@ EXTRA_DIST = \ assignnumfield.ok \ assignnumfield2.awk \ assignnumfield2.ok \ + asortbool.awk \ + asortbool.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -1693,7 +1695,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \ - arraytype \ + arraytype asortbool \ backw badargs beginfile1 beginfile2 binmode1 \ charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \ clos1way6 crlf \ @@ -4265,6 +4267,11 @@ arraytype: then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \ else $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ; fi +asortbool: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + backw: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 20ed4a7f..d3c4a231 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1330,6 +1330,11 @@ arraytype: then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \ else $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ; fi +asortbool: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + backw: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/asortbool.awk b/test/asortbool.awk new file mode 100644 index 00000000..3ee02cb2 --- /dev/null +++ b/test/asortbool.awk @@ -0,0 +1,19 @@ +BEGIN { + a[1] = "foo" + a[2] = -45 + a[3] = 45 + a[4][1] = 47 + a[5] = mkbool(1) + a[6] = mkbool(0) + + asort(a, b, "@val_type_asc") + + j = length(b) + for (i = 1; i <= j; i++) { + printf("%d, %s: ", i, typeof(b[i])) + if (isarray(b[i])) + print b[i][1] + else + print b[i] + } +} diff --git a/test/asortbool.ok b/test/asortbool.ok new file mode 100644 index 00000000..623e417a --- /dev/null +++ b/test/asortbool.ok @@ -0,0 +1,6 @@ +1, number: -45 +2, number|bool: 0 +3, number|bool: 1 +4, number: 45 +5, string: foo +6, array: 47 diff --git a/test/dumpvars.ok b/test/dumpvars.ok index 85d1c859..7caecd35 100644 --- a/test/dumpvars.ok +++ b/test/dumpvars.ok @@ -9,7 +9,7 @@ FILENAME: "-" FNR: 3 FPAT: "[^[:space:]]+" FS: " " -FUNCTAB: array, 41 elements +FUNCTAB: array, 42 elements IGNORECASE: 0 LINT: 0 NF: 1 diff --git a/test/functab5.ok b/test/functab5.ok index 9ac4295d..d27f1393 100644 --- a/test/functab5.ok +++ b/test/functab5.ok @@ -21,6 +21,7 @@ length' log' lshift' match' +mkbool' mktime' or' patsplit' @@ -52,6 +52,7 @@ length -> builtin log -> builtin lshift -> builtin match -> builtin +mkbool -> builtin mktime -> builtin or -> builtin patsplit -> builtin diff --git a/test/intest.awk b/test/intest.awk index f030d07a..18e0cc4d 100644 --- a/test/intest.awk +++ b/test/intest.awk @@ -1,4 +1,4 @@ BEGIN { - bool = ((b = 1) in c); - print bool, b # gawk-3.0.1 prints "0 "; should print "0 1" + bool_result = ((b = 1) in c); + print bool_result, b # gawk-3.0.1 prints "0 "; should print "0 1" } diff --git a/test/rwarray.awk b/test/rwarray.awk index 86a4b589..eae22304 100644 --- a/test/rwarray.awk +++ b/test/rwarray.awk @@ -11,6 +11,9 @@ BEGIN { split("-2.4", f) dict[strnum_sub] = f[1] + bool_sub = "bool-sub" + dict[bool_sub] = mkbool(1) + n = asorti(dict, dictindices) for (i = 1; i <= n; i++) printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "orig.out" @@ -51,4 +54,12 @@ BEGIN { if (typeof(dict[strnum_sub]) != "strnum") printf("dict[\"%s\"] should be strnum, is %s\n", strnum_sub, typeof(dict[strnum_sub])); + + if (typeof(dict[bool_sub]) != "number|bool") + printf("dict[\"%s\"] should be number|bool, is %s\n", + bool_sub, typeof(dict[bool_sub])); + + if ((dict[bool_sub] "") != "1") + printf("dict[\"%s\"] should be 1, is %s\n", + bool_sub, dict[bool_sub]); } diff --git a/test/symtab11.ok b/test/symtab11.ok index 7d4be46c..c46d3aed 100644 --- a/test/symtab11.ok +++ b/test/symtab11.ok @@ -53,6 +53,7 @@ BEGIN -- Functab is next [log] = log [lshift] = lshift [match] = match +[mkbool] = mkbool [mktime] = mktime [or] = or [patsplit] = patsplit diff --git a/test/symtab8.ok b/test/symtab8.ok index da29b585..0cf40fe9 100644 --- a/test/symtab8.ok +++ b/test/symtab8.ok @@ -9,7 +9,7 @@ FIELDWIDTHS: "" FNR: 1 FPAT: "[^[:space:]]+" FS: " " -FUNCTAB: array, 41 elements +FUNCTAB: array, 42 elements IGNORECASE: 0 LINT: 0 NF: 1 |