aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog11
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/asortbool.awk19
-rw-r--r--test/asortbool.ok6
-rw-r--r--test/dumpvars.ok2
-rw-r--r--test/functab5.ok1
-rw-r--r--test/id.ok1
-rw-r--r--test/intest.awk4
-rw-r--r--test/rwarray.awk11
-rw-r--r--test/symtab11.ok1
-rw-r--r--test/symtab8.ok2
13 files changed, 70 insertions, 6 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 641a9849..b3574856 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -4,6 +4,17 @@
<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 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
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..ef110989 100644
--- a/test/functab5.ok
+++ b/test/functab5.ok
@@ -3,6 +3,7 @@ asort'
asorti'
atan2'
bindtextdomain'
+bool'
chdir'
close'
compl'
diff --git a/test/id.ok b/test/id.ok
index ab4df74a..f990546f 100644
--- a/test/id.ok
+++ b/test/id.ok
@@ -34,6 +34,7 @@ asort -> builtin
asorti -> builtin
atan2 -> builtin
bindtextdomain -> builtin
+bool -> builtin
close -> builtin
compl -> builtin
cos -> 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..831f17c3 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] = bool(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]) != "bool")
+ printf("dict[\"%s\"] should be bool, is %s\n",
+ bool_sub, typeof(dict[bool_sub]));
+
+ if ((dict[bool_sub] "") != "TRUE")
+ printf("dict[\"%s\"] should be TRUE, is %s\n",
+ bool_sub, dict[bool_sub]);
}
diff --git a/test/symtab11.ok b/test/symtab11.ok
index 7d4be46c..da2cfcba 100644
--- a/test/symtab11.ok
+++ b/test/symtab11.ok
@@ -37,6 +37,7 @@ BEGIN -- Functab is next
[asorti] = asorti
[atan2] = atan2
[bindtextdomain] = bindtextdomain
+[bool] = bool
[close] = close
[compl] = compl
[cos] = cos
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