aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog8
-rw-r--r--test/Makefile.am5
-rw-r--r--test/Makefile.in5
-rw-r--r--test/fix-fmtspcl.awk23
-rw-r--r--test/fmtspcl.awk13
-rw-r--r--test/fmtspcl.tok32
-rw-r--r--test/numrange.ok2
7 files changed, 79 insertions, 9 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index b8816a5f..2d85c9a9 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,11 @@
+2018-07-13 Arnold D. Robbins <arnold@skeeve.com>
+
+ * fmtspcl.awk, fmtspcl.tok, numrange.ok: Revised after code changes
+ in gawk.
+ * fix-fmtscl.awk: New file.
+ * Makefile.am (fmtspcl.tok): Use fix-fmtscpl.awk instead of
+ inline program.
+
2018-07-12 Arnold D. Robbins <arnold@skeeve.com>
* fmtspcl.awk: Improve the formatting, add testing of uppercase
diff --git a/test/Makefile.am b/test/Makefile.am
index e4cca53d..4ab96409 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -278,6 +278,7 @@ EXTRA_DIST = \
fieldwdth.ok \
filefuncs.awk \
filefuncs.ok \
+ fix-fmtspcl.awk \
fldchg.awk \
fldchg.in \
fldchg.ok \
@@ -1687,8 +1688,8 @@ nors::
@echo A B C D E | tr -d '\12\15' | $(AWK) '{ print $$NF }' - "$(srcdir)"/nors.in > _$@ || echo EXIT CODE: $$? >> _$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-fmtspcl.ok: fmtspcl.tok Makefile
- @$(AWK) -v "sd=$(srcdir)" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < "$(srcdir)"/fmtspcl.tok > $@ 2>/dev/null
+fmtspcl.ok: fmtspcl.tok Makefile fix-fmtspcl.awk
+ @$(AWK) -v "sd=$(srcdir)" -f "$(srcdir)/fix-fmtspcl.awk" < "$(srcdir)"/fmtspcl.tok > $@ 2>/dev/null
fmtspcl: fmtspcl.ok
@echo $@
diff --git a/test/Makefile.in b/test/Makefile.in
index b987b1c2..5b34a5ad 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -536,6 +536,7 @@ EXTRA_DIST = \
fieldwdth.ok \
filefuncs.awk \
filefuncs.ok \
+ fix-fmtspcl.awk \
fldchg.awk \
fldchg.in \
fldchg.ok \
@@ -2132,8 +2133,8 @@ nors::
@echo A B C D E | tr -d '\12\15' | $(AWK) '{ print $$NF }' - "$(srcdir)"/nors.in > _$@ || echo EXIT CODE: $$? >> _$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-fmtspcl.ok: fmtspcl.tok Makefile
- @$(AWK) -v "sd=$(srcdir)" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < "$(srcdir)"/fmtspcl.tok > $@ 2>/dev/null
+fmtspcl.ok: fmtspcl.tok Makefile fix-fmtspcl.awk
+ @$(AWK) -v "sd=$(srcdir)" -f "$(srcdir)/fix-fmtspcl.awk" < "$(srcdir)"/fmtspcl.tok > $@ 2>/dev/null
fmtspcl: fmtspcl.ok
@echo $@
diff --git a/test/fix-fmtspcl.awk b/test/fix-fmtspcl.awk
new file mode 100644
index 00000000..018f519d
--- /dev/null
+++ b/test/fix-fmtspcl.awk
@@ -0,0 +1,23 @@
+BEGIN {
+ pnan = sprintf("%g",sqrt(-1))
+ nnan = sprintf("%g",-sqrt(-1))
+ pinf = sprintf("%g",-log(0))
+ ninf = sprintf("%g",log(0))
+
+ pnanu = toupper(pnan)
+ nnanu = toupper(nnan)
+ pinfu = toupper(pinf)
+ ninfu = toupper(ninf)
+}
+{
+ sub(/positive_nan/, pnan)
+ sub(/negative_nan/, nnan)
+ sub(/positive_infinity/, pinf)
+ sub(/negative_infinity/, ninf)
+ sub(/POSITIVE_NAN/, pnanu)
+ sub(/NEGATIVE_NAN/, nnanu)
+ sub(/POSITIVE_INFINITY/, pinfu)
+ sub(/NEGATIVE_INFINITY/, ninfu)
+ sub(/fmtspcl/,(sd "/fmtspcl"))
+ print
+}
diff --git a/test/fmtspcl.awk b/test/fmtspcl.awk
index eb99df65..b3313f77 100644
--- a/test/fmtspcl.awk
+++ b/test/fmtspcl.awk
@@ -8,14 +8,19 @@ function display(x, str, i, res) {
BEGIN {
nan = sqrt(-1)
- nan_str = sprintf("%f", nan)
- nnan_str = sprintf("%f", -nan)
+ nan_str = sprintf("%Pf", nan)
+ nnan_str = sprintf("%Pf", -nan)
+ if (nan_str == "nan")
+ nan_str = "+" nan_str
+ if (nnan_str == "nan")
+ nnan_str = "+" nnan_str
inf = -log(0)
- inf_str = sprintf("%f", inf)
- ninf_str = sprintf("%f", -inf)
+ inf_str = "+" sprintf("%Pf", inf)
+ ninf_str = sprintf("%Pf", -inf)
n = 0
formats[n++] = "%a"
+ formats[n++] = "%e"
formats[n++] = "%f"
formats[n++] = "%g"
formats[n++] = "%x"
diff --git a/test/fmtspcl.tok b/test/fmtspcl.tok
index 6fa0d1da..e85e170c 100644
--- a/test/fmtspcl.tok
+++ b/test/fmtspcl.tok
@@ -1,10 +1,42 @@
gawk: fmtspcl.awk:10: warning: sqrt: called with negative argument -1
gawk: fmtspcl.awk:3: warning: %a format is POSIX standard but not portable to other awks
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_nan is out of range for `%a' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_nan is out of range for `%e' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_nan is out of range for `%f' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_nan is out of range for `%g' format
gawk: fmtspcl.awk:3: warning: [s]printf: value positive_nan is out of range for `%x' format
gawk: fmtspcl.awk:3: warning: [s]printf: value positive_nan is out of range for `%d' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_nan is out of range for `%a' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_nan is out of range for `%e' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_nan is out of range for `%f' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_nan is out of range for `%g' format
gawk: fmtspcl.awk:3: warning: [s]printf: value negative_nan is out of range for `%x' format
gawk: fmtspcl.awk:3: warning: [s]printf: value negative_nan is out of range for `%d' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_infinity is out of range for `%a' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_infinity is out of range for `%e' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_infinity is out of range for `%f' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value positive_infinity is out of range for `%g' format
gawk: fmtspcl.awk:3: warning: [s]printf: value positive_infinity is out of range for `%x' format
gawk: fmtspcl.awk:3: warning: [s]printf: value positive_infinity is out of range for `%d' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_infinity is out of range for `%a' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_infinity is out of range for `%e' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_infinity is out of range for `%f' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value negative_infinity is out of range for `%g' format
gawk: fmtspcl.awk:3: warning: [s]printf: value negative_infinity is out of range for `%x' format
gawk: fmtspcl.awk:3: warning: [s]printf: value negative_infinity is out of range for `%d' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_NAN is out of range for `%A' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_NAN is out of range for `%E' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_NAN is out of range for `%F' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_NAN is out of range for `%G' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_NAN is out of range for `%A' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_NAN is out of range for `%E' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_NAN is out of range for `%F' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_NAN is out of range for `%G' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_INFINITY is out of range for `%A' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_INFINITY is out of range for `%E' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_INFINITY is out of range for `%F' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value POSITIVE_INFINITY is out of range for `%G' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_INFINITY is out of range for `%A' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_INFINITY is out of range for `%E' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_INFINITY is out of range for `%F' format
+gawk: fmtspcl.awk:3: warning: [s]printf: value NEGATIVE_INFINITY is out of range for `%G' format
diff --git a/test/numrange.ok b/test/numrange.ok
index 006da13a..73210bd3 100644
--- a/test/numrange.ok
+++ b/test/numrange.ok
@@ -1,2 +1,2 @@
-1.2e+931 -inf
-1.2e+931 inf
+1.2e+931 +inf