diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 13 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 9 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/arrayind3.awk | 19 | ||||
-rw-r--r-- | test/arrayind3.ok | 2 | ||||
-rw-r--r-- | test/forcenum.awk | 6 | ||||
-rw-r--r-- | test/forcenum.ok | 6 | ||||
-rw-r--r-- | test/rebuild.in | 2 | ||||
-rw-r--r-- | test/rebuild.ok | 2 |
10 files changed, 57 insertions, 11 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 8b4d70e8..6821488c 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,16 @@ +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 3a51b3ff..a13a01c9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -57,6 +57,8 @@ EXTRA_DIST = \ arrayind1.ok \ arrayind2.awk \ arrayind2.ok \ + arrayind3.awk \ + arrayind3.ok \ arrayparm.awk \ arrayparm.ok \ arrayprm2.awk \ @@ -1137,7 +1139,7 @@ CLEANFILES = core core.* fmtspcl.ok # try to keep these sorted. each letter starts a new line BASIC_TESTS = \ - addcomma anchgsub argarray arrayind1 arrayind2 arrayparm arrayprm2 arrayprm3 \ + addcomma anchgsub 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 \ diff --git a/test/Makefile.in b/test/Makefile.in index 29064326..6db4c34c 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -314,6 +314,8 @@ EXTRA_DIST = \ arrayind1.ok \ arrayind2.awk \ arrayind2.ok \ + arrayind3.awk \ + arrayind3.ok \ arrayparm.awk \ arrayparm.ok \ arrayprm2.awk \ @@ -1393,7 +1395,7 @@ CLEANFILES = core core.* fmtspcl.ok # try to keep these sorted. each letter starts a new line BASIC_TESTS = \ - addcomma anchgsub argarray arrayind1 arrayind2 arrayparm arrayprm2 arrayprm3 \ + addcomma anchgsub 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 \ @@ -2775,6 +2777,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: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 525a44d1..2aafd2bb 100644 --- a/test/Maketests +++ b/test/Maketests @@ -20,6 +20,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: $$? >>_$@ 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/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 |