aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog20
-rw-r--r--test/Makefile.am14
-rw-r--r--test/Makefile.in29
-rw-r--r--test/Maketests15
-rw-r--r--test/apiterm.awk8
-rw-r--r--test/apiterm.in1
-rw-r--r--test/apiterm.ok3
-rw-r--r--test/arrayind3.awk19
-rw-r--r--test/arrayind3.ok2
-rw-r--r--test/fldterm.awk10
-rw-r--r--test/fldterm.in1
-rw-r--r--test/fldterm.ok2
-rw-r--r--test/forcenum.awk6
-rw-r--r--test/forcenum.ok6
-rw-r--r--test/rebuild.in2
-rw-r--r--test/rebuild.ok2
16 files changed, 125 insertions, 15 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index eb75ed06..4808bb34 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -106,6 +106,26 @@
the report.
* clos1way6.ok2: New file.
+2016-07-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (apiterm, fldterm): New tests to make sure that we
+ are handling unterminated field string values properly.
+ * apiterm.awk, apiterm.in, apiterm.ok: New files.
+ * fldterm.awk, fldterm.in, fldterm.ok: New files.
+
+2016-07-06 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * forcenum.awk: We no longer need to force the strnum conversion,
+ since typeof now does this automatically.
+ * forcenum.ok: Change "number" to "strnum" for the numeric strings.
+ * rebuild.in: Change input to include a strnum.
+ * rebuild.ok: Update results.
+
+2016-07-04 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (arrayind3): New test.
+ * arrayind3.awk, arrayind3.ok: New files.
+
2016-07-03 Andrew J. Schorr <aschorr@telemetry-investments.com>
* Makefile.am (rebuild): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index bef3be77..b580e5eb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -50,6 +50,9 @@ EXTRA_DIST = \
anchor.awk \
anchor.in \
anchor.ok \
+ apiterm.awk \
+ apiterm.in \
+ apiterm.ok \
argarray.awk \
argarray.in \
argarray.ok \
@@ -60,6 +63,8 @@ EXTRA_DIST = \
arrayind1.ok \
arrayind2.awk \
arrayind2.ok \
+ arrayind3.awk \
+ arrayind3.ok \
arrayparm.awk \
arrayparm.ok \
arrayprm2.awk \
@@ -276,6 +281,9 @@ EXTRA_DIST = \
fldchgnf.awk \
fldchgnf.in \
fldchgnf.ok \
+ fldterm.awk \
+ fldterm.in \
+ fldterm.ok \
fmtspcl-mpfr.ok \
fmtspcl.awk \
fmtspcl.tok \
@@ -1150,7 +1158,7 @@ CLEANFILES = core core.* fmtspcl.ok
# try to keep these sorted. each letter starts a new line
BASIC_TESTS = \
- addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayparm arrayprm2 arrayprm3 \
+ addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayind3 arrayparm arrayprm2 arrayprm3 \
arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \
arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
aryprm8 aryprm9 arysubnm asgext awkpath \
@@ -1159,7 +1167,7 @@ BASIC_TESTS = \
concat3 concat4 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
eofsplit exit2 exitval1 exitval2 exitval3 \
- fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \
+ fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \
fstabplus funsemnl funsmnam funstack \
getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \
@@ -1241,7 +1249,7 @@ LOCALE_CHARSET_TESTS = \
mbprintf1 mbprintf2 mbprintf3 mbprintf4 rebt8b2 rtlenmb sort1 sprintfc
SHLIB_TESTS = \
- fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \
+ apiterm fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \
ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray testext time
# List of the tests which should be run with --lint option:
diff --git a/test/Makefile.in b/test/Makefile.in
index e3cdb583..5d31a464 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -307,6 +307,9 @@ EXTRA_DIST = \
anchor.awk \
anchor.in \
anchor.ok \
+ apiterm.awk \
+ apiterm.in \
+ apiterm.ok \
argarray.awk \
argarray.in \
argarray.ok \
@@ -317,6 +320,8 @@ EXTRA_DIST = \
arrayind1.ok \
arrayind2.awk \
arrayind2.ok \
+ arrayind3.awk \
+ arrayind3.ok \
arrayparm.awk \
arrayparm.ok \
arrayprm2.awk \
@@ -533,6 +538,9 @@ EXTRA_DIST = \
fldchgnf.awk \
fldchgnf.in \
fldchgnf.ok \
+ fldterm.awk \
+ fldterm.in \
+ fldterm.ok \
fmtspcl-mpfr.ok \
fmtspcl.awk \
fmtspcl.tok \
@@ -1406,7 +1414,7 @@ CLEANFILES = core core.* fmtspcl.ok
# try to keep these sorted. each letter starts a new line
BASIC_TESTS = \
- addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayparm arrayprm2 arrayprm3 \
+ addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayind3 arrayparm arrayprm2 arrayprm3 \
arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \
arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
aryprm8 aryprm9 arysubnm asgext awkpath \
@@ -1415,7 +1423,7 @@ BASIC_TESTS = \
concat3 concat4 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
eofsplit exit2 exitval1 exitval2 exitval3 \
- fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \
+ fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \
fstabplus funsemnl funsmnam funstack \
getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \
@@ -1493,7 +1501,7 @@ LOCALE_CHARSET_TESTS = \
mbprintf1 mbprintf2 mbprintf3 mbprintf4 rebt8b2 rtlenmb sort1 sprintfc
SHLIB_TESTS = \
- fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \
+ apiterm fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \
ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray testext time
@@ -2814,6 +2822,11 @@ arrayind2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+arrayind3:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
arrayparm:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -3064,6 +3077,11 @@ fldchgnf:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+fldterm:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fnamedat:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -4360,6 +4378,11 @@ sprintfc:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+apiterm:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fnmatch:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 081d96ef..7a5acf50 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -25,6 +25,11 @@ arrayind2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+arrayind3:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
arrayparm:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -275,6 +280,11 @@ fldchgnf:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+fldterm:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fnamedat:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -1571,6 +1581,11 @@ sprintfc:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+apiterm:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fnmatch:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/apiterm.awk b/test/apiterm.awk
new file mode 100644
index 00000000..95e4b120
--- /dev/null
+++ b/test/apiterm.awk
@@ -0,0 +1,8 @@
+@load "filefuncs"
+
+{
+ print $1
+ # check whether API terminates field strings properly
+ print chdir($1)
+ print ERRNO
+}
diff --git a/test/apiterm.in b/test/apiterm.in
new file mode 100644
index 00000000..c4732514
--- /dev/null
+++ b/test/apiterm.in
@@ -0,0 +1 @@
+. fubar
diff --git a/test/apiterm.ok b/test/apiterm.ok
new file mode 100644
index 00000000..ef4043be
--- /dev/null
+++ b/test/apiterm.ok
@@ -0,0 +1,3 @@
+.
+0
+
diff --git a/test/arrayind3.awk b/test/arrayind3.awk
new file mode 100644
index 00000000..ca4c58b5
--- /dev/null
+++ b/test/arrayind3.awk
@@ -0,0 +1,19 @@
+BEGIN {
+ # initialize cint arrays
+ pos[0] = 0
+ posout[0] = 0
+ split("00000779770060", f) # f[1] is a strnum
+ pos[f[1]] = 1 # subscripts must be strings!
+ for (x in pos) {
+ # if x is a strnum, then the
+ # x != 0 test may convert it to an integral NUMBER,
+ # and we might lose the unusual string representation
+ # if the cint code is not careful to recognize that this is
+ # actually a string
+ if (x != 0)
+ posout[x] = pos[x]
+ }
+ # which array element is populated?
+ print posout[779770060]
+ print posout["00000779770060"]
+}
diff --git a/test/arrayind3.ok b/test/arrayind3.ok
new file mode 100644
index 00000000..a464d9da
--- /dev/null
+++ b/test/arrayind3.ok
@@ -0,0 +1,2 @@
+
+1
diff --git a/test/fldterm.awk b/test/fldterm.awk
new file mode 100644
index 00000000..26fe01fb
--- /dev/null
+++ b/test/fldterm.awk
@@ -0,0 +1,10 @@
+BEGIN {
+ # choose a field separator that is numeric, so we can test whether
+ # force_number properly handles unterminated numeric field strings
+ FS = "3"
+}
+
+{
+ print $1+0
+ print $1
+}
diff --git a/test/fldterm.in b/test/fldterm.in
new file mode 100644
index 00000000..14a41cae
--- /dev/null
+++ b/test/fldterm.in
@@ -0,0 +1 @@
+5.53apple
diff --git a/test/fldterm.ok b/test/fldterm.ok
new file mode 100644
index 00000000..ecd7600e
--- /dev/null
+++ b/test/fldterm.ok
@@ -0,0 +1,2 @@
+5.5
+5.5
diff --git a/test/forcenum.awk b/test/forcenum.awk
index 54c536c9..1a7ddce7 100644
--- a/test/forcenum.awk
+++ b/test/forcenum.awk
@@ -1,8 +1,6 @@
BEGIN {
- # first, make some strnums
+ # make some strnums
nf = split("|5apple|+NaN| 6|0x1az|011Q|027", f, "|")
- for (i = 1; i <= nf; i++) {
- x = f[i]+0 # trigger strnum conversion to number or string
+ for (i = 1; i <= nf; i++)
printf "[%s] -> %g (type %s)\n", f[i], f[i], typeof(f[i])
- }
}
diff --git a/test/forcenum.ok b/test/forcenum.ok
index c74eefc7..a379db62 100644
--- a/test/forcenum.ok
+++ b/test/forcenum.ok
@@ -1,7 +1,7 @@
[] -> 0 (type string)
[5apple] -> 5 (type string)
-[+NaN] -> nan (type number)
-[ 6] -> 6 (type number)
+[+NaN] -> nan (type strnum)
+[ 6] -> 6 (type strnum)
[0x1az] -> 26 (type string)
[011Q] -> 9 (type string)
-[027] -> 23 (type number)
+[027] -> 23 (type strnum)
diff --git a/test/rebuild.in b/test/rebuild.in
index b2901ea9..2f16a825 100644
--- a/test/rebuild.in
+++ b/test/rebuild.in
@@ -1 +1 @@
-a b
+a 6.3
diff --git a/test/rebuild.ok b/test/rebuild.ok
index 29635279..0fe72e23 100644
--- a/test/rebuild.ok
+++ b/test/rebuild.ok
@@ -1,2 +1,2 @@
-test b
+test 6.3
strnum