diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-03-30 15:26:58 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-03-30 15:26:58 +0300 |
commit | edf26c6ac2fa34280f1c5a9fe12e741ba1dc9e49 (patch) | |
tree | 26136af4bfc867336a3dcae5a971c745462ea1f7 /test | |
parent | f021dfc21ac0a96270afbdcf9498b14e95619e6f (diff) | |
download | egawk-edf26c6ac2fa34280f1c5a9fe12e741ba1dc9e49.tar.gz egawk-edf26c6ac2fa34280f1c5a9fe12e741ba1dc9e49.tar.bz2 egawk-edf26c6ac2fa34280f1c5a9fe12e741ba1dc9e49.zip |
Add asort with booleans test.
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 5 | ||||
-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 |
6 files changed, 46 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 2604c270..0212e1ff 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2021-03-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): asortbool, new test. + * asortbool.awk, asortbool.ok: New files. + 2021-03-08 Arnold D. Robbins <arnold@skeeve.com> * dumpvars.ok, functab5.ok, id.ok, intest.awk, symtab11.ok, diff --git a/test/Makefile.am b/test/Makefile.am index bdb8831f..0c56b7e4 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 92ef9d06..fa823d0a 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..7f5a94fb --- /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] = bool(1) + a[6] = bool(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..de08a770 --- /dev/null +++ b/test/asortbool.ok @@ -0,0 +1,6 @@ +1, bool: FALSE +2, bool: TRUE +3, number: -45 +4, number: 45 +5, string: foo +6, array: 47 |