diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/Gentests | 5 | ||||
-rw-r--r-- | test/Makefile.am | 23 | ||||
-rw-r--r-- | test/Makefile.in | 36 | ||||
-rw-r--r-- | test/Maketests | 13 | ||||
-rw-r--r-- | test/mpfrbigint.awk | 11 | ||||
-rw-r--r-- | test/mpfrbigint.ok | 5 | ||||
-rw-r--r-- | test/mpfrsort.awk | 8 | ||||
-rw-r--r-- | test/mpfrsort.ok | 11 | ||||
-rw-r--r-- | test/rand-mpfr1.ok | 1 |
9 files changed, 94 insertions, 19 deletions
diff --git a/test/Gentests b/test/Gentests index 640c3a0c..ae56b8cc 100755 --- a/test/Gentests +++ b/test/Gentests @@ -100,9 +100,12 @@ function generate(x, s) printf "\t@echo $@\n" printf "\t@AWKPATH=$(srcdir) $(AWK) -f $@.awk %s >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@\n", s + if (x in mpfr) { delete mpfr[x] - printf "\t@-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@\n\n" + printf "\t@-if test -z \"$$AWKFLAGS\" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \\\n" + printf "\t$(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \\\n" + printf "\tfi\n\n" } else { printf "\t@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@\n\n" } diff --git a/test/Makefile.am b/test/Makefile.am index bc174fb8..da3faeaa 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -846,7 +846,7 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat -MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange +MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange mpfrsort mpfrbigint LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ @@ -1112,7 +1112,9 @@ fmtspcl.ok: fmtspcl.tok Makefile fmtspcl: fmtspcl.ok @echo $@ @$(AWK) -f $(srcdir)/fmtspcl.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ + fi reint:: @echo $@ @@ -1455,6 +1457,13 @@ rri1:: AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rand: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + ($(CMP) $(srcdir)/$@-mpfr.ok _$@ || $(CMP) $(srcdir)/$@-mpfr1.ok _$@) && rm -f _$@ ; \ + fi + mpfrieee: @echo $@ @$(AWK) -M -vPREC=double -f $(srcdir)/$@.awk > _$@ 2>&1 @@ -1475,6 +1484,16 @@ mpfrnr: @$(AWK) -M -vPREC=113 -f $(srcdir)/$@.awk $(srcdir)/$@.in > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +mpfrsort: + @echo $@ + @$(AWK) -M -vPREC=53 -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrbigint: + @echo $@ + @$(AWK) -M -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 7a88e836..4eb95900 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1029,7 +1029,7 @@ GAWK_EXT_TESTS = \ EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat -MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange +MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange mpfrsort mpfrbigint LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc @@ -1463,7 +1463,9 @@ fmtspcl.ok: fmtspcl.tok Makefile fmtspcl: fmtspcl.ok @echo $@ @$(AWK) -f $(srcdir)/fmtspcl.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ + fi reint:: @echo $@ @@ -1806,6 +1808,13 @@ rri1:: AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rand: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + ($(CMP) $(srcdir)/$@-mpfr.ok _$@ || $(CMP) $(srcdir)/$@-mpfr1.ok _$@) && rm -f _$@ ; \ + fi + mpfrieee: @echo $@ @$(AWK) -M -vPREC=double -f $(srcdir)/$@.awk > _$@ 2>&1 @@ -1825,6 +1834,16 @@ mpfrnr: @echo $@ @$(AWK) -M -vPREC=113 -f $(srcdir)/$@.awk $(srcdir)/$@.in > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrsort: + @echo $@ + @$(AWK) -M -vPREC=53 -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrbigint: + @echo $@ + @$(AWK) -M -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -2467,11 +2486,6 @@ prtoeval: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -rand: - @echo $@ - @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ - range1: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2995,12 +3009,16 @@ fmttest: fnarydel: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ + fi fnparydl: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ + fi rebt8b2: @echo $@ diff --git a/test/Maketests b/test/Maketests index e7577dea..4bc06e50 100644 --- a/test/Maketests +++ b/test/Maketests @@ -640,11 +640,6 @@ prtoeval: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -rand: - @echo $@ - @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ - range1: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1168,12 +1163,16 @@ fmttest: fnarydel: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ + fi fnparydl: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-($(CMP) $(srcdir)/$@.ok _$@ || $(CMP) $(srcdir)/$@-mpfr.ok _$@) && rm -f _$@ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ + fi rebt8b2: @echo $@ diff --git a/test/mpfrbigint.awk b/test/mpfrbigint.awk new file mode 100644 index 00000000..bfdd871a --- /dev/null +++ b/test/mpfrbigint.awk @@ -0,0 +1,11 @@ +BEGIN { + x = 5^4^3^2 + print "# of digits =", length(x) + print substr(x, 1, 20), "...", substr(x, length(x) - 19, 20) + + PREC = 1 + 3.321928095 * length(x); # 1 + digits * log2(10) + print "floating-point computation with precision =", PREC + y = 5.0^4.0^3.0^2.0 + print "# of digits =", length(y) + print substr(y, 1, 20), "...", substr(y, length(y) - 19, 20) +} diff --git a/test/mpfrbigint.ok b/test/mpfrbigint.ok new file mode 100644 index 00000000..670d4e07 --- /dev/null +++ b/test/mpfrbigint.ok @@ -0,0 +1,5 @@ +# of digits = 183231 +62060698786608744707 ... 92256259918212890625 +floating-point computation with precision = 608681 +# of digits = 183231 +62060698786608744707 ... 92256259918212890625 diff --git a/test/mpfrsort.awk b/test/mpfrsort.awk new file mode 100644 index 00000000..6f7fa65c --- /dev/null +++ b/test/mpfrsort.awk @@ -0,0 +1,8 @@ +BEGIN { +# s = "1.0 +nan 0.0 -1 +inf -0.0 1 nan 1.0 -nan -inf 2.0" + s = "1.0 +nan 0.0 -1 +inf -0.0 1 1.0 -nan -inf 2.0" + split(s, a) + PROCINFO["sorted_in"] = "@val_num_asc" + for (i in a) + print a[i] +} diff --git a/test/mpfrsort.ok b/test/mpfrsort.ok new file mode 100644 index 00000000..77a51ecf --- /dev/null +++ b/test/mpfrsort.ok @@ -0,0 +1,11 @@ +-inf +-1 +-0.0 +0.0 +1 +1.0 +1.0 +2.0 ++inf ++nan +-nan diff --git a/test/rand-mpfr1.ok b/test/rand-mpfr1.ok new file mode 100644 index 00000000..448f4032 --- /dev/null +++ b/test/rand-mpfr1.ok @@ -0,0 +1 @@ + 25 42 47 49 80 5 4 92 59 96 8 63 92 28 41 37 80 51 48 |