diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | mpfr.c | 5 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/Makefile.in | 10 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/mpfrcase2.awk | 19 | ||||
-rw-r--r-- | test/mpfrcase2.in | 1 | ||||
-rw-r--r-- | test/mpfrcase2.ok | 1 |
9 files changed, 54 insertions, 3 deletions
@@ -3,6 +3,12 @@ * awk.h: Turn all the flag defines into enums. GDB can then show the bit maps directly. + Unrelated: Fix another MFPF bug, reported by Hyunho Cho + <mug896@naver.com>. + + * mpfr.c (force_mpnum): Restore the character at the end of + the string if only saw + or -. + 2020-07-07 Andrew J. Schorr <aschorr@telemetry-investments.com> * node.c (r_dupnode): Sanitize the code, particularly for MPFR. @@ -298,8 +298,11 @@ force_mpnum(NODE *n, int do_nondec, int use_locale) * won't check for that and set errno, so we have * to check manuall. */ - if (*cp1 == '\0') + if (*cp1 == '\0') { + *cpend = save; + mpg_zero(n); return false; + } if (do_nondec) base = get_numbase(cp1, cpend - cp1, use_locale); diff --git a/test/ChangeLog b/test/ChangeLog index 9a9922f2..b741651e 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2020-07-07 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): New test, mpfrcase2. + * mpfrcase2.awk, mpfrcase2.in, mpfrcase2.ok: New files. + 2020-07-06 Andrew J. Schorr <aschorr@telemetry-investments.com> * Makefile.am (AWK): Append $(GAWK_TEST_ARGS) to enable running diff --git a/test/Makefile.am b/test/Makefile.am index b7e3240f..76634925 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -703,6 +703,9 @@ EXTRA_DIST = \ mpfrcase.awk \ mpfrcase.in \ mpfrcase.ok \ + mpfrcase2.awk \ + mpfrcase2.in \ + mpfrcase2.ok \ mpfrexprange.awk \ mpfrexprange.ok \ mpfrfield.awk \ @@ -1467,7 +1470,7 @@ NEED_LINT = \ NEED_LINT_OLD = lintold # List of tests that must be run with -M -NEED_MPFR = mpfrbigint mpfrbigint2 mpfrcase mpfrexprange mpfrfield mpfrieee mpfrmemok1 \ +NEED_MPFR = mpfrbigint mpfrbigint2 mpfrcase mpfrcase2 mpfrexprange mpfrfield mpfrieee mpfrmemok1 \ mpfrnegzero mpfrnonum mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ mpfrstrtonum mpgforcenum mpfruplus mpfranswer42 diff --git a/test/Makefile.in b/test/Makefile.in index afa233fb..4af1a7ba 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -966,6 +966,9 @@ EXTRA_DIST = \ mpfrcase.awk \ mpfrcase.in \ mpfrcase.ok \ + mpfrcase2.awk \ + mpfrcase2.in \ + mpfrcase2.ok \ mpfrexprange.awk \ mpfrexprange.ok \ mpfrfield.awk \ @@ -1728,7 +1731,7 @@ NEED_LINT = \ NEED_LINT_OLD = lintold # List of tests that must be run with -M -NEED_MPFR = mpfrbigint mpfrbigint2 mpfrcase mpfrexprange mpfrfield mpfrieee mpfrmemok1 \ +NEED_MPFR = mpfrbigint mpfrbigint2 mpfrcase mpfrcase2 mpfrexprange mpfrfield mpfrieee mpfrmemok1 \ mpfrnegzero mpfrnonum mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ mpfrstrtonum mpgforcenum mpfruplus mpfranswer42 @@ -5124,6 +5127,11 @@ mpfrcase: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfrcase2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + mpfrfield: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 7fb3b3af..0b98f784 100644 --- a/test/Maketests +++ b/test/Maketests @@ -2241,6 +2241,11 @@ mpfrcase: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfrcase2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + mpfrfield: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/mpfrcase2.awk b/test/mpfrcase2.awk new file mode 100644 index 00000000..52924486 --- /dev/null +++ b/test/mpfrcase2.awk @@ -0,0 +1,19 @@ +{ + for (i = 1; i <= NF; i++) { + switch ($i) { + case "+" : case "-" : + case "*" : case "/" : + case "%" : case "^" : + printf $i; break + case /[a-z]/ : + printf $i; break + case /[0-9]/ : + printf $i; break + case /[ \t]/ : + printf $i; break + default : + print " wrong character " i " th: " $i + } + } + print "" +} diff --git a/test/mpfrcase2.in b/test/mpfrcase2.in new file mode 100644 index 00000000..6ad0de24 --- /dev/null +++ b/test/mpfrcase2.in @@ -0,0 +1 @@ +12+45 diff --git a/test/mpfrcase2.ok b/test/mpfrcase2.ok new file mode 100644 index 00000000..6ad0de24 --- /dev/null +++ b/test/mpfrcase2.ok @@ -0,0 +1 @@ +12+45 |