aboutsummaryrefslogtreecommitdiff
path: root/vendor/gmp-6.3.0/tests/mpq
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gmp-6.3.0/tests/mpq')
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/Makefile.am35
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/Makefile.in1241
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/io.c136
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/reuse.c245
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-aors.c182
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp.c101
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c117
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c116
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c146
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-equal.c146
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-get_d.c294
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-get_str.c142
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-inp_str.c171
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-inv.c60
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c244
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-set_f.c169
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-set_str.c102
17 files changed, 3647 insertions, 0 deletions
diff --git a/vendor/gmp-6.3.0/tests/mpq/Makefile.am b/vendor/gmp-6.3.0/tests/mpq/Makefile.am
new file mode 100644
index 0000000..e12e60c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/Makefile.am
@@ -0,0 +1,35 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 1996, 1999-2002, 2012, 2015 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+check_PROGRAMS = t-aors t-cmp t-cmp_ui t-cmp_si t-equal t-get_d t-get_str \
+ t-inp_str t-inv t-md_2exp t-set_f t-set_str io reuse t-cmp_z
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/vendor/gmp-6.3.0/tests/mpq/Makefile.in b/vendor/gmp-6.3.0/tests/mpq/Makefile.in
new file mode 100644
index 0000000..d6279ab
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/Makefile.in
@@ -0,0 +1,1241 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 1996, 1999-2002, 2012, 2015 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = t-aors$(EXEEXT) t-cmp$(EXEEXT) t-cmp_ui$(EXEEXT) \
+ t-cmp_si$(EXEEXT) t-equal$(EXEEXT) t-get_d$(EXEEXT) \
+ t-get_str$(EXEEXT) t-inp_str$(EXEEXT) t-inv$(EXEEXT) \
+ t-md_2exp$(EXEEXT) t-set_f$(EXEEXT) t-set_str$(EXEEXT) \
+ io$(EXEEXT) reuse$(EXEEXT) t-cmp_z$(EXEEXT)
+subdir = tests/mpq
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+io_SOURCES = io.c
+io_OBJECTS = io.$(OBJEXT)
+io_LDADD = $(LDADD)
+io_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+reuse_SOURCES = reuse.c
+reuse_OBJECTS = reuse.$(OBJEXT)
+reuse_LDADD = $(LDADD)
+reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_aors_SOURCES = t-aors.c
+t_aors_OBJECTS = t-aors.$(OBJEXT)
+t_aors_LDADD = $(LDADD)
+t_aors_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_SOURCES = t-cmp.c
+t_cmp_OBJECTS = t-cmp.$(OBJEXT)
+t_cmp_LDADD = $(LDADD)
+t_cmp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_si_SOURCES = t-cmp_si.c
+t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT)
+t_cmp_si_LDADD = $(LDADD)
+t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_ui_SOURCES = t-cmp_ui.c
+t_cmp_ui_OBJECTS = t-cmp_ui.$(OBJEXT)
+t_cmp_ui_LDADD = $(LDADD)
+t_cmp_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_z_SOURCES = t-cmp_z.c
+t_cmp_z_OBJECTS = t-cmp_z.$(OBJEXT)
+t_cmp_z_LDADD = $(LDADD)
+t_cmp_z_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_equal_SOURCES = t-equal.c
+t_equal_OBJECTS = t-equal.$(OBJEXT)
+t_equal_LDADD = $(LDADD)
+t_equal_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_d_SOURCES = t-get_d.c
+t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_LDADD = $(LDADD)
+t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_str_SOURCES = t-get_str.c
+t_get_str_OBJECTS = t-get_str.$(OBJEXT)
+t_get_str_LDADD = $(LDADD)
+t_get_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_inp_str_SOURCES = t-inp_str.c
+t_inp_str_OBJECTS = t-inp_str.$(OBJEXT)
+t_inp_str_LDADD = $(LDADD)
+t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_inv_SOURCES = t-inv.c
+t_inv_OBJECTS = t-inv.$(OBJEXT)
+t_inv_LDADD = $(LDADD)
+t_inv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_md_2exp_SOURCES = t-md_2exp.c
+t_md_2exp_OBJECTS = t-md_2exp.$(OBJEXT)
+t_md_2exp_LDADD = $(LDADD)
+t_md_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_f_SOURCES = t-set_f.c
+t_set_f_OBJECTS = t-set_f.$(OBJEXT)
+t_set_f_LDADD = $(LDADD)
+t_set_f_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_str_SOURCES = t-set_str.c
+t_set_str_OBJECTS = t-set_str.$(OBJEXT)
+t_set_str_LDADD = $(LDADD)
+t_set_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = io.c reuse.c t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c \
+ t-cmp_z.c t-equal.c t-get_d.c t-get_str.c t-inp_str.c t-inv.c \
+ t-md_2exp.c t-set_f.c t-set_str.c
+DIST_SOURCES = io.c reuse.c t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c \
+ t-cmp_z.c t-equal.c t-get_d.c t-get_str.c t-inp_str.c t-inv.c \
+ t-md_2exp.c t-set_f.c t-set_str.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES) $(EXTRA_io_DEPENDENCIES)
+ @rm -f io$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(io_OBJECTS) $(io_LDADD) $(LIBS)
+
+reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
+ @rm -f reuse$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
+
+t-aors$(EXEEXT): $(t_aors_OBJECTS) $(t_aors_DEPENDENCIES) $(EXTRA_t_aors_DEPENDENCIES)
+ @rm -f t-aors$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_aors_OBJECTS) $(t_aors_LDADD) $(LIBS)
+
+t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES) $(EXTRA_t_cmp_DEPENDENCIES)
+ @rm -f t-cmp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS)
+
+t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES)
+ @rm -f t-cmp_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
+
+t-cmp_ui$(EXEEXT): $(t_cmp_ui_OBJECTS) $(t_cmp_ui_DEPENDENCIES) $(EXTRA_t_cmp_ui_DEPENDENCIES)
+ @rm -f t-cmp_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_ui_OBJECTS) $(t_cmp_ui_LDADD) $(LIBS)
+
+t-cmp_z$(EXEEXT): $(t_cmp_z_OBJECTS) $(t_cmp_z_DEPENDENCIES) $(EXTRA_t_cmp_z_DEPENDENCIES)
+ @rm -f t-cmp_z$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_z_OBJECTS) $(t_cmp_z_LDADD) $(LIBS)
+
+t-equal$(EXEEXT): $(t_equal_OBJECTS) $(t_equal_DEPENDENCIES) $(EXTRA_t_equal_DEPENDENCIES)
+ @rm -f t-equal$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_equal_OBJECTS) $(t_equal_LDADD) $(LIBS)
+
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ @rm -f t-get_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+
+t-get_str$(EXEEXT): $(t_get_str_OBJECTS) $(t_get_str_DEPENDENCIES) $(EXTRA_t_get_str_DEPENDENCIES)
+ @rm -f t-get_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_str_OBJECTS) $(t_get_str_LDADD) $(LIBS)
+
+t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES)
+ @rm -f t-inp_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
+
+t-inv$(EXEEXT): $(t_inv_OBJECTS) $(t_inv_DEPENDENCIES) $(EXTRA_t_inv_DEPENDENCIES)
+ @rm -f t-inv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_inv_OBJECTS) $(t_inv_LDADD) $(LIBS)
+
+t-md_2exp$(EXEEXT): $(t_md_2exp_OBJECTS) $(t_md_2exp_DEPENDENCIES) $(EXTRA_t_md_2exp_DEPENDENCIES)
+ @rm -f t-md_2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_md_2exp_OBJECTS) $(t_md_2exp_LDADD) $(LIBS)
+
+t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES) $(EXTRA_t_set_f_DEPENDENCIES)
+ @rm -f t-set_f$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS)
+
+t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES) $(EXTRA_t_set_str_DEPENDENCIES)
+ @rm -f t-set_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-aors.log: t-aors$(EXEEXT)
+ @p='t-aors$(EXEEXT)'; \
+ b='t-aors'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp.log: t-cmp$(EXEEXT)
+ @p='t-cmp$(EXEEXT)'; \
+ b='t-cmp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_ui.log: t-cmp_ui$(EXEEXT)
+ @p='t-cmp_ui$(EXEEXT)'; \
+ b='t-cmp_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_si.log: t-cmp_si$(EXEEXT)
+ @p='t-cmp_si$(EXEEXT)'; \
+ b='t-cmp_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-equal.log: t-equal$(EXEEXT)
+ @p='t-equal$(EXEEXT)'; \
+ b='t-equal'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_d.log: t-get_d$(EXEEXT)
+ @p='t-get_d$(EXEEXT)'; \
+ b='t-get_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_str.log: t-get_str$(EXEEXT)
+ @p='t-get_str$(EXEEXT)'; \
+ b='t-get_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-inp_str.log: t-inp_str$(EXEEXT)
+ @p='t-inp_str$(EXEEXT)'; \
+ b='t-inp_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-inv.log: t-inv$(EXEEXT)
+ @p='t-inv$(EXEEXT)'; \
+ b='t-inv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-md_2exp.log: t-md_2exp$(EXEEXT)
+ @p='t-md_2exp$(EXEEXT)'; \
+ b='t-md_2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_f.log: t-set_f$(EXEEXT)
+ @p='t-set_f$(EXEEXT)'; \
+ b='t-set_f'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_str.log: t-set_str$(EXEEXT)
+ @p='t-set_str$(EXEEXT)'; \
+ b='t-set_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+io.log: io$(EXEEXT)
+ @p='io$(EXEEXT)'; \
+ b='io'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+reuse.log: reuse$(EXEEXT)
+ @p='reuse$(EXEEXT)'; \
+ b='reuse'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_z.log: t-cmp_z$(EXEEXT)
+ @p='t-cmp_z$(EXEEXT)'; \
+ b='t-cmp_z'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/mpq/io.c b/vendor/gmp-6.3.0/tests/mpq/io.c
new file mode 100644
index 0000000..3336c6a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/io.c
@@ -0,0 +1,136 @@
+/* Test conversion and I/O using mpq_out_str and mpq_inp_str.
+
+Copyright 1993, 1994, 1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define FILENAME "io.tmp"
+
+void
+debug_mp (mpq_t x, int base)
+{
+ mpq_out_str (stdout, base, x); fputc ('\n', stdout);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpq_t op1, op2;
+ mp_size_t size;
+ int i;
+ int reps = 10000;
+ FILE *fp;
+ int base;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ size_t nread;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (op1);
+ mpq_init (op2);
+
+ fp = fopen (FILENAME, "w+");
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs) + 2;
+ mpz_errandomb (mpq_numref(op1), rands, size);
+ mpz_errandomb_nonzero (mpq_denref(op1), rands, size);
+ mpq_canonicalize (op1);
+
+ mpz_urandomb (bs, rands, 1);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpq_neg (op1, op1);
+
+ mpz_urandomb (bs, rands, 16);
+ bsi = mpz_get_ui (bs);
+ base = bsi % 36 + 1;
+ if (base == 1)
+ base = 0;
+
+ rewind (fp);
+ if (mpq_out_str (fp, base, op1) == 0
+ || putc (' ', fp) == EOF
+ || fflush (fp) != 0)
+ {
+ printf ("mpq_out_str write error\n");
+ abort ();
+ }
+
+ rewind (fp);
+ nread = mpq_inp_str (op2, fp, base);
+ if (nread == 0)
+ {
+ if (ferror (fp))
+ printf ("mpq_inp_str stream read error\n");
+ else
+ printf ("mpq_inp_str data conversion error\n");
+ abort ();
+ }
+
+ if (nread != ftell(fp))
+ {
+ printf ("mpq_inp_str nread doesn't match ftell\n");
+ printf (" nread %lu\n", (unsigned long) nread);
+ printf (" ftell %ld\n", ftell(fp));
+ abort ();
+ }
+
+ if (mpq_cmp (op1, op2))
+ {
+ printf ("ERROR\n");
+ printf ("op1 = "); debug_mp (op1, -16);
+ printf ("op2 = "); debug_mp (op2, -16);
+ printf ("base = %d\n", base);
+ abort ();
+ }
+ }
+
+ fclose (fp);
+
+ unlink (FILENAME);
+
+ mpz_clear (bs);
+ mpq_clear (op1);
+ mpq_clear (op2);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/reuse.c b/vendor/gmp-6.3.0/tests/mpq/reuse.c
new file mode 100644
index 0000000..b724ffc
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/reuse.c
@@ -0,0 +1,245 @@
+/* Test that routines allow reusing a source variable as destination.
+
+Copyright 1996, 2000-2002, 2012, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if __GMP_LIBGMP_DLL
+
+/* FIXME: When linking to a DLL libgmp, mpq_add etc can't be used as
+ initializers for global variables because they're effectively global
+ variables (function pointers) themselves. Perhaps calling a test
+ function successively with mpq_add etc would be better. */
+
+int
+main (void)
+{
+ printf ("Test suppressed for windows DLL\n");
+ exit (0);
+}
+
+
+#else /* ! DLL_EXPORT */
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+void dump_abort (const char *, mpq_t, mpq_t);
+
+typedef void (*dss_func) (mpq_ptr, mpq_srcptr, mpq_srcptr);
+
+dss_func dss_funcs[] =
+{
+ mpq_div, mpq_add, mpq_mul, mpq_sub,
+};
+
+const char *dss_func_names[] =
+{
+ "mpq_div", "mpq_add", "mpq_mul", "mpq_sub",
+};
+
+typedef void (*ds_func) (mpq_ptr, mpq_srcptr);
+
+ds_func ds_funcs[] =
+{
+ mpq_abs, mpq_neg,
+};
+
+const char *ds_func_names[] =
+{
+ "mpq_abs", "mpq_neg",
+};
+
+typedef void (*dsi_func) (mpq_ptr, mpq_srcptr, unsigned long int);
+
+dsi_func dsi_funcs[] =
+{
+ mpq_mul_2exp, mpq_div_2exp
+};
+
+const char *dsi_func_names[] =
+{
+ "mpq_mul_2exp", "mpq_div_2exp"
+};
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ int pass, reps = 100;
+ mpq_t in1, in2, out1;
+ unsigned long int randbits, in2i;
+ mpq_t res1, res2;
+ gmp_randstate_ptr rands;
+
+ tests_start ();
+
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpq_init (in1);
+ mpq_init (in2);
+ mpq_init (out1);
+ mpq_init (res1);
+ mpq_init (res2);
+
+ for (pass = 1; pass <= reps; pass++)
+ {
+ randbits = urandom ();
+
+ if (randbits & 1)
+ {
+ mpq_clear (in1);
+ mpq_init (in1);
+ }
+ randbits >>= 1;
+ mpz_errandomb (mpq_numref(in1), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(in1), rands, 512L);
+ if (randbits & 1)
+ mpz_neg (mpq_numref(in1),mpq_numref(in1));
+ randbits >>= 1;
+ mpq_canonicalize (in1);
+
+ if (randbits & 1)
+ {
+ mpq_clear (in2);
+ mpq_init (in2);
+ }
+ randbits >>= 1;
+ mpz_errandomb (mpq_numref(in2), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(in2), rands, 512L);
+ if (randbits & 1)
+ mpz_neg (mpq_numref(in2),mpq_numref(in2));
+ randbits >>= 1;
+ mpq_canonicalize (in2);
+
+ for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++)
+ {
+ /* Don't divide by 0. */
+ if (i == 0 && mpq_cmp_ui (in2, 0, 1) == 0)
+ continue;
+
+ if (randbits & 1)
+ {
+ mpq_clear (res1);
+ mpq_init (res1);
+ }
+ randbits >>= 1;
+
+ (dss_funcs[i]) (res1, in1, in2);
+ MPQ_CHECK_FORMAT(res1);
+
+ mpq_set (out1, in1);
+ (dss_funcs[i]) (out1, out1, in2);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dss_func_names[i], res1, out1);
+
+ mpq_set (out1, in2);
+ (dss_funcs[i]) (out1, in1, out1);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dss_func_names[i], res1, out1);
+
+ mpq_set (out1, in2);
+ (dss_funcs[i]) (res1, out1, in2);
+ MPQ_CHECK_FORMAT(res1);
+
+ (dss_funcs[i]) (res2, in2, in2);
+ MPQ_CHECK_FORMAT(res2);
+
+ (dss_funcs[i]) (out1, out1, out1);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, res2) != 0)
+ dump_abort (dss_func_names[i], res1, res2);
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dss_func_names[i], res1, out1);
+ }
+
+ for (i = 0; i < sizeof (ds_funcs) / sizeof (ds_func); i++)
+ {
+ if (randbits & 1)
+ {
+ mpq_clear (res1);
+ mpq_init (res1);
+ }
+ randbits >>= 1;
+ (ds_funcs[i]) (res1, in1);
+ MPQ_CHECK_FORMAT(res1);
+
+ mpq_set (out1, in1);
+ (ds_funcs[i]) (out1, out1);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (ds_func_names[i], res1, out1);
+ }
+
+ in2i = urandom () % 65536;
+ for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++)
+ {
+ if (randbits & 1)
+ {
+ mpq_clear (res1);
+ mpq_init (res1);
+ }
+ randbits >>= 1;
+
+ (dsi_funcs[i]) (res1, in1, in2i);
+ MPQ_CHECK_FORMAT(res1);
+
+ mpq_set (out1, in1);
+ (dsi_funcs[i]) (out1, out1, in2i);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dsi_func_names[i], res1, out1);
+ }
+
+ }
+
+ mpq_clear (in1);
+ mpq_clear (in2);
+ mpq_clear (out1);
+ mpq_clear (res1);
+ mpq_clear (res2);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (const char *name, mpq_t res1, mpq_t res2)
+{
+ printf ("failure in %s:\n", name);
+ mpq_trace (" res1 ", res1);
+ mpq_trace (" res2 ", res2);
+ abort ();
+}
+
+#endif /* ! DLL_EXPORT */
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-aors.c b/vendor/gmp-6.3.0/tests/mpq/t-aors.c
new file mode 100644
index 0000000..8ee9f93
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-aors.c
@@ -0,0 +1,182 @@
+/* Test mpq_add and mpq_sub.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_all (mpq_ptr x, mpq_ptr y, mpq_ptr want_add, mpq_ptr want_sub)
+{
+ mpq_t got;
+ int neg_x, neg_y, swap;
+
+ mpq_init (got);
+
+ MPQ_CHECK_FORMAT (want_add);
+ MPQ_CHECK_FORMAT (want_sub);
+ MPQ_CHECK_FORMAT (x);
+ MPQ_CHECK_FORMAT (y);
+
+ for (swap = 0; swap <= 1; swap++)
+ {
+ for (neg_x = 0; neg_x <= 1; neg_x++)
+ {
+ for (neg_y = 0; neg_y <= 1; neg_y++)
+ {
+ mpq_add (got, x, y);
+ MPQ_CHECK_FORMAT (got);
+ if (! mpq_equal (got, want_add))
+ {
+ printf ("mpq_add wrong\n");
+ mpq_trace (" x ", x);
+ mpq_trace (" y ", y);
+ mpq_trace (" got ", got);
+ mpq_trace (" want", want_add);
+ abort ();
+ }
+
+ mpq_sub (got, x, y);
+ MPQ_CHECK_FORMAT (got);
+ if (! mpq_equal (got, want_sub))
+ {
+ printf ("mpq_sub wrong\n");
+ mpq_trace (" x ", x);
+ mpq_trace (" y ", y);
+ mpq_trace (" got ", got);
+ mpq_trace (" want", want_sub);
+ abort ();
+ }
+
+
+ mpq_neg (y, y);
+ mpq_swap (want_add, want_sub);
+ }
+
+ mpq_neg (x, x);
+ mpq_swap (want_add, want_sub);
+ mpq_neg (want_add, want_add);
+ mpq_neg (want_sub, want_sub);
+ }
+
+ mpq_swap (x, y);
+ mpq_neg (want_sub, want_sub);
+ }
+
+ mpq_clear (got);
+}
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *x;
+ const char *y;
+ const char *want_add;
+ const char *want_sub;
+
+ } data[] = {
+
+ { "0", "0", "0", "0" },
+ { "1", "0", "1", "1" },
+ { "1", "1", "2", "0" },
+
+ { "1/2", "1/2", "1", "0" },
+ { "5/6", "14/15", "53/30", "-1/10" },
+ };
+
+ mpq_t x, y, want_add, want_sub;
+ int i;
+
+ mpq_init (x);
+ mpq_init (y);
+ mpq_init (want_add);
+ mpq_init (want_sub);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpq_set_str_or_abort (x, data[i].x, 0);
+ mpq_set_str_or_abort (y, data[i].y, 0);
+ mpq_set_str_or_abort (want_add, data[i].want_add, 0);
+ mpq_set_str_or_abort (want_sub, data[i].want_sub, 0);
+
+ check_all (x, y, want_add, want_sub);
+ }
+
+ mpq_clear (x);
+ mpq_clear (y);
+ mpq_clear (want_add);
+ mpq_clear (want_sub);
+}
+
+
+void
+check_rand (void)
+{
+ mpq_t x, y, want_add, want_sub;
+ int i;
+ gmp_randstate_ptr rands = RANDS;
+
+ mpq_init (x);
+ mpq_init (y);
+ mpq_init (want_add);
+ mpq_init (want_sub);
+
+ for (i = 0; i < 500; i++)
+ {
+ mpz_errandomb (mpq_numref(x), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(x), rands, 512L);
+ mpq_canonicalize (x);
+
+ mpz_errandomb (mpq_numref(y), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(y), rands, 512L);
+ mpq_canonicalize (y);
+
+ refmpq_add (want_add, x, y);
+ refmpq_sub (want_sub, x, y);
+
+ check_all (x, y, want_add, want_sub);
+ }
+
+ mpq_clear (x);
+ mpq_clear (y);
+ mpq_clear (want_add);
+ mpq_clear (want_sub);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+ check_rand ();
+
+ tests_end ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp.c
new file mode 100644
index 0000000..187db7f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp.c
@@ -0,0 +1,101 @@
+/* Test mpq_cmp.
+
+Copyright 1996, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
+
+int
+ref_mpq_cmp (mpq_t a, mpq_t b)
+{
+ mpz_t ai, bi;
+ int cc;
+
+ mpz_init (ai);
+ mpz_init (bi);
+
+ mpz_mul (ai, NUM (a), DEN (b));
+ mpz_mul (bi, NUM (b), DEN (a));
+ cc = mpz_cmp (ai, bi);
+ mpz_clear (ai);
+ mpz_clear (bi);
+ return cc;
+}
+
+#ifndef SIZE
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a, b;
+ mp_size_t size;
+ int reps = 10000;
+ int i;
+ int cc, ccref;
+
+ tests_start ();
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (a);
+ mpq_init (b);
+
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (a), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (DEN (a), size);
+ }
+ while (mpz_cmp_ui (DEN (a), 0) == 0);
+
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (b), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (DEN (b), size);
+ }
+ while (mpz_cmp_ui (DEN (b), 0) == 0);
+
+ mpq_canonicalize (a);
+ mpq_canonicalize (b);
+
+ ccref = ref_mpq_cmp (a, b);
+ cc = mpq_cmp (a, b);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+ }
+
+ mpq_clear (a);
+ mpq_clear (b);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c
new file mode 100644
index 0000000..5ffa247
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c
@@ -0,0 +1,117 @@
+/* Test mpq_cmp_si.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define SGN(x) ((x)<0 ? -1 : (x) != 0)
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *q;
+ long n;
+ unsigned long d;
+ int want;
+ } data[] = {
+ { "0", 0, 1, 0 },
+ { "0", 0, 123, 0 },
+ { "0", 0, ULONG_MAX, 0 },
+ { "1", 0, 1, 1 },
+ { "1", 0, 123, 1 },
+ { "1", 0, ULONG_MAX, 1 },
+ { "-1", 0, 1, -1 },
+ { "-1", 0, 123, -1 },
+ { "-1", 0, ULONG_MAX, -1 },
+
+ { "123", 123, 1, 0 },
+ { "124", 123, 1, 1 },
+ { "122", 123, 1, -1 },
+
+ { "-123", 123, 1, -1 },
+ { "-124", 123, 1, -1 },
+ { "-122", 123, 1, -1 },
+
+ { "123", -123, 1, 1 },
+ { "124", -123, 1, 1 },
+ { "122", -123, 1, 1 },
+
+ { "-123", -123, 1, 0 },
+ { "-124", -123, 1, -1 },
+ { "-122", -123, 1, 1 },
+
+ { "5/7", 3,4, -1 },
+ { "5/7", -3,4, 1 },
+ { "-5/7", 3,4, -1 },
+ { "-5/7", -3,4, 1 },
+ };
+
+ mpq_t q;
+ int i, got;
+
+ mpq_init (q);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpq_set_str_or_abort (q, data[i].q, 0);
+ MPQ_CHECK_FORMAT (q);
+
+ got = mpq_cmp_si (q, data[i].n, data[i].d);
+ if (SGN(got) != data[i].want)
+ {
+ printf ("mpq_cmp_si wrong\n");
+ error:
+ mpq_trace (" q", q);
+ printf (" n=%ld\n", data[i].n);
+ printf (" d=%lu\n", data[i].d);
+ printf (" got=%d\n", got);
+ printf (" want=%d\n", data[i].want);
+ abort ();
+ }
+
+ if (data[i].n == 0)
+ {
+ got = mpq_cmp_si (q, 0L, data[i].d);
+ if (SGN(got) != data[i].want)
+ {
+ printf ("mpq_cmp_si wrong\n");
+ goto error;
+ }
+ }
+ }
+
+ mpq_clear (q);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c
new file mode 100644
index 0000000..51bb2cb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c
@@ -0,0 +1,116 @@
+/* Test mpq_cmp_ui.
+
+Copyright 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
+
+int
+ref_mpq_cmp_ui (mpq_t a, unsigned long int bn, unsigned long int bd)
+{
+ mpz_t ai, bi;
+ int cc;
+
+ mpz_init (ai);
+ mpz_init (bi);
+
+ mpz_mul_ui (ai, NUM (a), bd);
+ mpz_mul_ui (bi, DEN (a), bn);
+ cc = mpz_cmp (ai, bi);
+ mpz_clear (ai);
+ mpz_clear (bi);
+ return cc;
+}
+
+#ifndef SIZE
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a, b;
+ mp_size_t size;
+ int reps = 10000;
+ int i;
+ int cc, ccref;
+ unsigned long int bn, bd;
+
+ tests_start ();
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (a);
+ mpq_init (b);
+
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (a), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (DEN (a), size);
+ }
+ while (mpz_cmp_ui (DEN (a), 0) == 0);
+
+ mpz_random2 (NUM (b), (mp_size_t) 1);
+ mpz_mod_ui (NUM (b), NUM (b), ~(unsigned long int) 0);
+ mpz_add_ui (NUM (b), NUM (b), 1);
+
+ mpz_random2 (DEN (b), (mp_size_t) 1);
+ mpz_mod_ui (DEN (b), DEN (b), ~(unsigned long int) 0);
+ mpz_add_ui (DEN (b), DEN (b), 1);
+
+ mpq_canonicalize (a);
+ mpq_canonicalize (b);
+
+ ccref = ref_mpq_cmp_ui (a, 1, 1);
+ cc = mpq_cmp_ui (a, 1, 1);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+
+ ccref = ref_mpq_cmp_ui (a, 0, 1);
+ cc = mpq_cmp_ui (a, 0, 1);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+
+ bn = mpz_get_ui (NUM (b));
+ bd = mpz_get_ui (DEN (b));
+
+ ccref = ref_mpq_cmp_ui (a, bn, bd);
+ cc = mpq_cmp_ui (a, bn, bd);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+ }
+
+ mpq_clear (a);
+ mpq_clear (b);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c
new file mode 100644
index 0000000..3e66a3c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c
@@ -0,0 +1,146 @@
+/* Test mpq_cmp_z.
+
+Copyright 1996, 2001, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
+
+int
+ref_mpq_cmp_z (mpq_t a, mpz_t b)
+{
+ mpz_t bi;
+ int cc;
+
+ mpz_init (bi);
+
+ mpz_mul (bi, b, DEN (a));
+ cc = mpz_cmp (NUM (a), bi);
+ mpz_clear (bi);
+ return cc;
+}
+
+#ifndef SIZE
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
+#endif
+
+#ifndef MAXN
+#define MAXN 5 /* increasing this impatcs on total timing */
+#endif
+
+void
+sizes_test (int m)
+{
+ mpq_t a;
+ mpz_t b;
+ int i, j, k, s;
+ int cc, ccref;
+
+ mpq_init (a);
+ mpz_init (b);
+
+ for (i = 0; i <= MAXN ; ++i)
+ {
+ mpz_setbit (DEN (a), i*m); /* \sum_0^i 2^(i*m) */
+ for (j = 0; j <= MAXN; ++j)
+ {
+ mpz_set_ui (NUM (a), 0);
+ mpz_setbit (NUM (a), j*m); /* 2^(j*m) */
+ for (k = 0; k <= MAXN; ++k)
+ {
+ mpz_set_ui (b, 0);
+ mpz_setbit (b, k*m); /* 2^(k*m) */
+ if (i == 0) /* Denominator is 1, compare the two exponents */
+ ccref = (j>k)-(j<k);
+ else
+ ccref = j-i > k ? 1 : -1;
+ for (s = 1; s >= -1; s -= 2)
+ {
+ cc = mpq_cmp_z (a, b);
+
+ if (ccref != SGN (cc))
+ {
+ fprintf (stderr, "i=%i, j=%i, k=%i, m=%i, s=%i\n; ccref= %i, cc= %i\n", i, j, k, m, s, ccref, cc);
+ abort ();
+ }
+
+ mpq_neg (a, a);
+ mpz_neg (b, b);
+ ccref = - ccref;
+ }
+ }
+ }
+ }
+
+ mpq_clear (a);
+ mpz_clear (b);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a;
+ mpz_t b;
+ mp_size_t size;
+ int reps = 10000;
+ int i;
+ int cc, ccref;
+
+ tests_start ();
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (a);
+ mpz_init (b);
+
+ for (i = 0; i < reps; i++)
+ {
+ if (i % 8192 == 0)
+ sizes_test (urandom () % (i + 1) + 1);
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (a), size);
+ do
+ {
+ size = urandom () % (SIZE/2);
+ mpz_random2 (DEN (a), size);
+ }
+ while (mpz_cmp_ui (DEN (a), 0) == 0);
+
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (b, size);
+
+ mpq_canonicalize (a);
+
+ ccref = ref_mpq_cmp_z (a, b);
+ cc = mpq_cmp_z (a, b);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+ }
+
+ mpq_clear (a);
+ mpz_clear (b);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-equal.c b/vendor/gmp-6.3.0/tests/mpq/t-equal.c
new file mode 100644
index 0000000..671c530
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-equal.c
@@ -0,0 +1,146 @@
+/* Test mpq_equal.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpq_srcptr x, mpq_srcptr y, int want)
+{
+ int got;
+
+ MPQ_CHECK_FORMAT (x);
+ MPQ_CHECK_FORMAT (y);
+
+ got = mpq_equal (x, y);
+ if ((got != 0) != (want != 0))
+ {
+ printf ("mpq_equal got %d want %d\n", got, want);
+ mpq_trace ("x", x);
+ mpq_trace ("y", y);
+ abort ();
+ }
+}
+
+
+void
+check_all (mpq_ptr x, mpq_ptr y, int want)
+{
+ check_one (x, y, want);
+ check_one (y, x, want);
+
+ mpq_neg (x, x);
+ mpq_neg (y, y);
+
+ check_one (x, y, want);
+ check_one (y, x, want);
+}
+
+
+#define SET4Z(z, size,l3,l2,l1,l0) \
+ SIZ(z) = size; PTR(z)[3] = l3; PTR(z)[2] = l2; PTR(z)[1] = l1; PTR(z)[0] = l0
+
+#define SET4(q, nsize,n3,n2,n1,n0, dsize,d3,d2,d1,d0) \
+ SET4Z (mpq_numref(q), nsize,n3,n2,n1,n0); \
+ SET4Z (mpq_denref(q), dsize,d3,d2,d1,d0)
+
+
+/* Exercise various combinations of same and slightly different values. */
+
+void
+check_various (void)
+{
+ mpq_t x, y;
+
+ mpq_init (x);
+ mpq_init (y);
+
+ mpz_realloc (mpq_numref(x), (mp_size_t) 20);
+ mpz_realloc (mpq_denref(x), (mp_size_t) 20);
+ mpz_realloc (mpq_numref(y), (mp_size_t) 20);
+ mpz_realloc (mpq_denref(y), (mp_size_t) 20);
+
+ /* 0 == 0 */
+ SET4 (x, 0,13,12,11,10, 1,23,22,21,1);
+ SET4 (y, 0,33,32,31,30, 1,43,42,41,1);
+ check_all (x, y, 1);
+
+ /* 83/99 == 83/99 */
+ SET4 (x, 1,13,12,11,83, 1,23,22,21,99);
+ SET4 (y, 1,33,32,31,83, 1,43,42,41,99);
+ check_all (x, y, 1);
+
+ /* 1:2:3:4/5:6:7 == 1:2:3:4/5:6:7 */
+ SET4 (x, 4,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 1);
+
+ /* various individual changes making != */
+ SET4 (x, 4,1,2,3,667, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,666,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,666,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+#if GMP_NUMB_BITS != 62
+ SET4 (x, 4,667,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+#endif
+ SET4 (x, 4,1,2,3,4, 3,88,5,6,667);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,3,4, 3,88,5,667,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,3,4, 3,88,666,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, -4,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 1,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 2,99,5,6,7);
+ check_all (x, y, 0);
+
+ mpq_clear (x);
+ mpq_clear (y);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_various ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-get_d.c b/vendor/gmp-6.3.0/tests/mpq/t-get_d.c
new file mode 100644
index 0000000..98d6a5f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-get_d.c
@@ -0,0 +1,294 @@
+/* Test mpq_get_d and mpq_set_d
+
+Copyright 1991, 1993, 1994, 1996, 2000-2003, 2012, 2013 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 8
+#endif
+
+/* VAX D floats only have an 8 bit signed exponent, so anything 2^128 or
+ bigger will overflow, that being 4 limbs. */
+#if defined (__vax) || defined (__vax__) && SIZE > 4
+#undef SIZE
+#define SIZE 4
+#define EPSIZE 3
+#else
+#define EPSIZE SIZE
+#endif
+
+void dump (mpq_t);
+
+void
+check_monotonic (int argc, char **argv)
+{
+ mpq_t a;
+ mp_size_t size;
+ int reps = 100;
+ int i, j;
+ double last_d, new_d;
+ mpq_t qlast_d, qnew_d;
+ mpq_t eps;
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ /* The idea here is to test the monotonousness of mpq_get_d by adding
+ numbers to the numerator and denominator. */
+
+ mpq_init (a);
+ mpq_init (eps);
+ mpq_init (qlast_d);
+ mpq_init (qnew_d);
+
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (mpq_numref (a), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (mpq_denref (a), size);
+ }
+ while (mpz_cmp_ui (mpq_denref (a), 0) == 0);
+
+ mpq_canonicalize (a);
+
+ last_d = mpq_get_d (a);
+ mpq_set_d (qlast_d, last_d);
+ for (j = 0; j < 10; j++)
+ {
+ size = urandom () % EPSIZE + 1;
+ mpz_random2 (mpq_numref (eps), size);
+ size = urandom () % EPSIZE + 1;
+ mpz_random2 (mpq_denref (eps), size);
+ mpq_canonicalize (eps);
+
+ mpq_add (a, a, eps);
+ mpq_canonicalize (a);
+ new_d = mpq_get_d (a);
+ if (last_d > new_d)
+ {
+ printf ("\nERROR (test %d/%d): bad mpq_get_d results\n", i, j);
+ printf ("last: %.16g\n", last_d);
+ printf (" new: %.16g\n", new_d); dump (a);
+ abort ();
+ }
+ mpq_set_d (qnew_d, new_d);
+ MPQ_CHECK_FORMAT (qnew_d);
+ if (mpq_cmp (qlast_d, qnew_d) > 0)
+ {
+ printf ("ERROR (test %d/%d): bad mpq_set_d results\n", i, j);
+ printf ("last: %.16g\n", last_d); dump (qlast_d);
+ printf (" new: %.16g\n", new_d); dump (qnew_d);
+ abort ();
+ }
+ last_d = new_d;
+ mpq_set (qlast_d, qnew_d);
+ }
+ }
+
+ mpq_clear (a);
+ mpq_clear (eps);
+ mpq_clear (qlast_d);
+ mpq_clear (qnew_d);
+}
+
+double
+my_ldexp (double d, int e)
+{
+ for (;;)
+ {
+ if (e > 0)
+ {
+ if (e >= 16)
+ {
+ d *= 65536.0;
+ e -= 16;
+ }
+ else
+ {
+ d *= 2.0;
+ e -= 1;
+ }
+ }
+ else if (e < 0)
+ {
+
+ if (e <= -16)
+ {
+ d /= 65536.0;
+ e += 16;
+ }
+ else
+ {
+ d /= 2.0;
+ e += 1;
+ }
+ }
+ else
+ return d;
+ }
+}
+
+#define MAXEXP 500
+
+#if defined (__vax) || defined (__vax__)
+#undef MAXEXP
+#define MAXEXP 30
+#endif
+
+void
+check_random (int argc, char **argv)
+{
+ gmp_randstate_ptr rands = RANDS;
+
+ double d;
+ mpq_t q;
+ mpz_t a, t;
+ int exp;
+
+ int test, reps = 100000;
+
+ if (argc == 2)
+ reps = 100 * atoi (argv[1]);
+
+ mpq_init (q);
+ mpz_init (a);
+ mpz_init (t);
+
+ for (test = 0; test < reps; test++)
+ {
+ mpz_rrandomb (a, rands, 53);
+ mpz_urandomb (t, rands, 32);
+ exp = mpz_get_ui (t) % (2*MAXEXP) - MAXEXP;
+
+ d = my_ldexp (mpz_get_d (a), exp);
+ mpq_set_d (q, d);
+ /* Check that n/d = a * 2^exp, or
+ d*a 2^{exp} = n */
+ mpz_mul (t, a, mpq_denref (q));
+ if (exp > 0)
+ mpz_mul_2exp (t, t, exp);
+ else
+ {
+ if (!mpz_divisible_2exp_p (t, -exp))
+ goto fail;
+ mpz_div_2exp (t, t, -exp);
+ }
+ if (mpz_cmp (t, mpq_numref (q)) != 0)
+ {
+ fail:
+ printf ("ERROR (check_random test %d): bad mpq_set_d results\n", test);
+ printf ("%.16g\n", d);
+ gmp_printf ("%Qd\n", q);
+ abort ();
+ }
+ }
+ mpq_clear (q);
+ mpz_clear (t);
+ mpz_clear (a);
+}
+
+void
+dump (mpq_t x)
+{
+ mpz_out_str (stdout, 10, mpq_numref (x));
+ printf ("/");
+ mpz_out_str (stdout, 10, mpq_denref (x));
+ printf ("\n");
+}
+
+/* Check various values 2^n and 1/2^n. */
+void
+check_onebit (void)
+{
+ static const long data[] = {
+ -3*GMP_NUMB_BITS-1, -3*GMP_NUMB_BITS, -3*GMP_NUMB_BITS+1,
+ -2*GMP_NUMB_BITS-1, -2*GMP_NUMB_BITS, -2*GMP_NUMB_BITS+1,
+ -GMP_NUMB_BITS-1, -GMP_NUMB_BITS, -GMP_NUMB_BITS+1,
+ -5, -2, -1, 0, 1, 2, 5,
+ GMP_NUMB_BITS-1, GMP_NUMB_BITS, GMP_NUMB_BITS+1,
+ 2*GMP_NUMB_BITS-1, 2*GMP_NUMB_BITS, 2*GMP_NUMB_BITS+1,
+ 3*GMP_NUMB_BITS-1, 3*GMP_NUMB_BITS, 3*GMP_NUMB_BITS+1,
+ };
+
+ int i, neg;
+ long exp, l;
+ mpq_t q;
+ double got, want;
+
+ mpq_init (q);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ exp = data[i];
+
+ mpq_set_ui (q, 1L, 1L);
+ if (exp >= 0)
+ mpq_mul_2exp (q, q, exp);
+ else
+ mpq_div_2exp (q, q, -exp);
+
+ want = 1.0;
+ for (l = 0; l < exp; l++)
+ want *= 2.0;
+ for (l = 0; l > exp; l--)
+ want /= 2.0;
+
+ for (neg = 0; neg <= 1; neg++)
+ {
+ if (neg)
+ {
+ mpq_neg (q, q);
+ want = -want;
+ }
+
+ got = mpq_get_d (q);
+
+ if (got != want)
+ {
+ printf ("mpq_get_d wrong on %s2**%ld\n", neg ? "-" : "", exp);
+ mpq_trace (" q ", q);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ abort();
+ }
+ }
+ }
+ mpq_clear (q);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ check_onebit ();
+ check_monotonic (argc, argv);
+ check_random (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-get_str.c b/vendor/gmp-6.3.0/tests/mpq/t-get_str.c
new file mode 100644
index 0000000..e586521
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-get_str.c
@@ -0,0 +1,142 @@
+/* Test mpq_get_str.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpq_srcptr q, int base, const char *want)
+{
+ char *str, *ret;
+ size_t str_alloc;
+
+ MPQ_CHECK_FORMAT (q);
+ mp_trace_base = base;
+
+ str_alloc =
+ mpz_sizeinbase (mpq_numref(q), ABS(base)) +
+ mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3;
+
+ str = mpq_get_str (NULL, base, q);
+ if (strlen(str)+1 > str_alloc)
+ {
+ printf ("mpq_get_str size bigger than should be (passing NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got size %lu \"%s\"\n", (unsigned long) strlen(str)+1, str);
+ printf (" want size %lu\n", (unsigned long) str_alloc);
+ abort ();
+ }
+ if (strcmp (str, want) != 0)
+ {
+ printf ("mpq_get_str wrong (passing NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got \"%s\"\n", str);
+ printf (" want \"%s\"\n", want);
+ mpq_trace (" q", q);
+ abort ();
+ }
+ (*__gmp_free_func) (str, strlen (str) + 1);
+
+ str = (char *) (*__gmp_allocate_func) (str_alloc);
+
+ ret = mpq_get_str (str, base, q);
+ if (str != ret)
+ {
+ printf ("mpq_get_str wrong return value (passing non-NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got %p\n", (void *) ret);
+ printf (" want %p\n", (void *) str);
+ abort ();
+ }
+ if (strcmp (str, want) != 0)
+ {
+ printf ("mpq_get_str wrong (passing non-NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got \"%s\"\n", str);
+ printf (" want \"%s\"\n", want);
+ abort ();
+ }
+ (*__gmp_free_func) (str, str_alloc);
+}
+
+
+void
+check_all (mpq_srcptr q, int base, const char *want)
+{
+ char *s;
+
+ check_one (q, base, want);
+
+ s = __gmp_allocate_strdup (want);
+ strtoupper (s);
+ check_one (q, -base, s);
+ (*__gmp_free_func) (s, strlen(s)+1);
+}
+
+void
+check_data (void)
+{
+ static const struct {
+ int base;
+ const char *num;
+ const char *den;
+ const char *want;
+ } data[] = {
+ { 10, "0", "1", "0" },
+ { 10, "1", "1", "1" },
+
+ { 16, "ffffffff", "1", "ffffffff" },
+ { 16, "ffffffffffffffff", "1", "ffffffffffffffff" },
+
+ { 16, "1", "ffffffff", "1/ffffffff" },
+ { 16, "1", "ffffffffffffffff", "1/ffffffffffffffff" },
+ { 16, "1", "10000000000000003", "1/10000000000000003" },
+
+ { 10, "12345678901234567890", "9876543210987654323",
+ "12345678901234567890/9876543210987654323" },
+ };
+
+ mpq_t q;
+ int i;
+
+ mpq_init (q);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (mpq_numref(q), data[i].num, data[i].base);
+ mpz_set_str_or_abort (mpq_denref(q), data[i].den, data[i].base);
+ check_all (q, data[i].base, data[i].want);
+ }
+ mpq_clear (q);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-inp_str.c b/vendor/gmp-6.3.0/tests/mpq/t-inp_str.c
new file mode 100644
index 0000000..b44abd8
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-inp_str.c
@@ -0,0 +1,171 @@
+/* Test mpq_inp_str.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define FILENAME "t-inp_str.tmp"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *inp;
+ int base;
+ const char *want;
+ int want_nread;
+
+ } data[] = {
+
+ { "0", 10, "0", 1 },
+ { "0/1", 10, "0", 3 },
+
+ { "0/", 10, "0", 0 },
+ { "/123", 10, "0", 0 },
+ { "blah", 10, "0", 0 },
+ { "123/blah", 10, "0", 0 },
+ { "5 /8", 10, "5", 1 },
+ { "5/ 8", 10, "0", 0 },
+
+ { "ff", 16, "255", 2 },
+ { "-ff", 16, "-255", 3 },
+ { "FF", 16, "255", 2 },
+ { "-FF", 16, "-255", 3 },
+
+ { "z", 36, "35", 1 },
+ { "Z", 36, "35", 1 },
+
+ { "0x0", 0, "0", 3 },
+ { "0x10", 0, "16", 4 },
+ { "-0x0", 0, "0", 4 },
+ { "-0x10", 0, "-16", 5 },
+ { "-0x10/5", 0, "-16/5", 7 },
+
+ { "00", 0, "0", 2 },
+ { "010", 0, "8", 3 },
+ { "-00", 0, "0", 3 },
+ { "-010", 0, "-8", 4 },
+ };
+
+ mpq_t got, want;
+ long ftell_nread;
+ int i, post, j, got_nread;
+ FILE *fp;
+
+ mpq_init (got);
+ mpq_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (post = 0; post <= 2; post++)
+ {
+ mpq_set_str_or_abort (want, data[i].want, 0);
+ MPQ_CHECK_FORMAT (want);
+
+ fp = fopen (FILENAME, "w+");
+ ASSERT_ALWAYS (fp != NULL);
+ fputs (data[i].inp, fp);
+ for (j = 0; j < post; j++)
+ putc (' ', fp);
+ fflush (fp);
+ ASSERT_ALWAYS (! ferror(fp));
+
+ rewind (fp);
+ got_nread = mpq_inp_str (got, fp, data[i].base);
+
+ if (got_nread != 0)
+ {
+ ftell_nread = ftell (fp);
+ if (got_nread != ftell_nread)
+ {
+ printf ("mpq_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" got_nread %d\n", got_nread);
+ printf (" ftell_nread %ld\n", ftell_nread);
+ abort ();
+ }
+ }
+
+ if (post == 0 && data[i].want_nread == strlen(data[i].inp))
+ {
+ int c = getc(fp);
+ if (c != EOF)
+ {
+ printf ("mpq_inp_str didn't read to EOF\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" c '%c' %#x\n", c, c);
+ abort ();
+ }
+ }
+
+ if (got_nread != data[i].want_nread)
+ {
+ printf ("mpq_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" got_nread %d\n", got_nread);
+ printf (" want_nread %d\n", data[i].want_nread);
+ abort ();
+ }
+
+ MPQ_CHECK_FORMAT (got);
+
+ if (! mpq_equal (got, want))
+ {
+ printf ("mpq_inp_str wrong result\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ mpq_trace (" got ", got);
+ mpq_trace (" want", want);
+ abort ();
+ }
+
+ ASSERT_ALWAYS (fclose (fp) == 0);
+ }
+ }
+
+ mpq_clear (got);
+ mpq_clear (want);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ unlink (FILENAME);
+ tests_end ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-inv.c b/vendor/gmp-6.3.0/tests/mpq/t-inv.c
new file mode 100644
index 0000000..87ba8d4
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-inv.c
@@ -0,0 +1,60 @@
+/* Test mpq_inv (and set/get_num/den).
+
+Copyright 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a, b;
+ mpz_t m, n;
+ const char* s = "-420000000000000000000000";
+
+ tests_start ();
+
+ mpq_inits (a, b, (mpq_ptr)0);
+ mpz_inits (m, n, (mpz_ptr)0);
+
+ mpz_set_ui (m, 13);
+ mpq_set_den (a, m);
+ mpz_set_str (m, s, 0);
+ mpq_set_num (a, m);
+ MPQ_CHECK_FORMAT (a);
+ mpq_inv (b, a);
+ MPQ_CHECK_FORMAT (b);
+ mpq_get_num (n, b);
+ ASSERT_ALWAYS (mpz_cmp_si (n, -13) == 0);
+ mpq_neg (b, b);
+ mpq_inv (a, b);
+ MPQ_CHECK_FORMAT (a);
+ mpq_inv (b, b);
+ MPQ_CHECK_FORMAT (b);
+ mpq_get_den (n, b);
+ ASSERT_ALWAYS (mpz_cmp_ui (n, 13) == 0);
+ mpq_get_num (n, a);
+ mpz_add (n, n, m);
+ ASSERT_ALWAYS (mpz_sgn (n) == 0);
+
+ mpq_clears (a, b, (mpq_ptr)0);
+ mpz_clears (m, n, (mpz_ptr)0);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c b/vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c
new file mode 100644
index 0000000..2bffce9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c
@@ -0,0 +1,244 @@
+/* Test mpq_mul_2exp and mpq_div_2exp.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+struct pair_t {
+ const char *num;
+ const char *den;
+};
+
+void
+check_random ()
+{
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long arg_size, size_range;
+ mpq_t q, r;
+ int i;
+ mp_bitcnt_t shift;
+ int reps = 10000;
+
+ rands = RANDS;
+
+ mpz_init (bs);
+ mpq_init (q);
+ mpq_init (r);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 11 + 2; /* 0..4096 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ arg_size = mpz_get_ui (bs);
+ mpz_rrandomb (mpq_numref (q), rands, arg_size);
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ arg_size = mpz_get_ui (bs);
+ mpz_rrandomb (mpq_denref (q), rands, arg_size);
+ }
+ while (mpz_sgn (mpq_denref (q)) == 0);
+
+ /* We now have a random rational in q, albeit an unnormalised one. The
+ lack of normalisation should not matter here, so let's save the time a
+ gcd would require. */
+
+ mpz_urandomb (bs, rands, 32);
+ shift = mpz_get_ui (bs) % 4096;
+
+ mpq_mul_2exp (r, q, shift);
+
+ if (mpq_cmp (r, q) < 0)
+ {
+ printf ("mpq_mul_2exp wrong on random\n");
+ abort ();
+ }
+
+ mpq_div_2exp (r, r, shift);
+
+ if (mpq_cmp (r, q) != 0)
+ {
+ printf ("mpq_mul_2exp or mpq_div_2exp wrong on random\n");
+ abort ();
+ }
+ }
+ mpq_clear (q);
+ mpq_clear (r);
+ mpz_clear (bs);
+}
+
+int
+main (int argc, char **argv)
+{
+ static const struct {
+ struct pair_t left;
+ unsigned long n;
+ struct pair_t right;
+
+ } data[] = {
+ { {"0","1"}, 0, {"0","1"} },
+ { {"0","1"}, 1, {"0","1"} },
+ { {"0","1"}, 2, {"0","1"} },
+
+ { {"1","1"}, 0, {"1","1"} },
+ { {"1","1"}, 1, {"2","1"} },
+ { {"1","1"}, 2, {"4","1"} },
+ { {"1","1"}, 3, {"8","1"} },
+
+ { {"1","1"}, 31, {"0x80000000","1"} },
+ { {"1","1"}, 32, {"0x100000000","1"} },
+ { {"1","1"}, 33, {"0x200000000","1"} },
+ { {"1","1"}, 63, {"0x8000000000000000","1"} },
+ { {"1","1"}, 64, {"0x10000000000000000","1"} },
+ { {"1","1"}, 65, {"0x20000000000000000","1"} },
+ { {"1","1"}, 95, {"0x800000000000000000000000","1"} },
+ { {"1","1"}, 96, {"0x1000000000000000000000000","1"} },
+ { {"1","1"}, 97, {"0x2000000000000000000000000","1"} },
+ { {"1","1"}, 127, {"0x80000000000000000000000000000000","1"} },
+ { {"1","1"}, 128, {"0x100000000000000000000000000000000","1"} },
+ { {"1","1"}, 129, {"0x200000000000000000000000000000000","1"} },
+
+ { {"1","2"}, 31, {"0x40000000","1"} },
+ { {"1","2"}, 32, {"0x80000000","1"} },
+ { {"1","2"}, 33, {"0x100000000","1"} },
+ { {"1","2"}, 63, {"0x4000000000000000","1"} },
+ { {"1","2"}, 64, {"0x8000000000000000","1"} },
+ { {"1","2"}, 65, {"0x10000000000000000","1"} },
+ { {"1","2"}, 95, {"0x400000000000000000000000","1"} },
+ { {"1","2"}, 96, {"0x800000000000000000000000","1"} },
+ { {"1","2"}, 97, {"0x1000000000000000000000000","1"} },
+ { {"1","2"}, 127, {"0x40000000000000000000000000000000","1"} },
+ { {"1","2"}, 128, {"0x80000000000000000000000000000000","1"} },
+ { {"1","2"}, 129, {"0x100000000000000000000000000000000","1"} },
+
+ { {"1","0x80000000"}, 30, {"1","2"} },
+ { {"1","0x80000000"}, 31, {"1","1"} },
+ { {"1","0x80000000"}, 32, {"2","1"} },
+ { {"1","0x80000000"}, 33, {"4","1"} },
+ { {"1","0x80000000"}, 62, {"0x80000000","1"} },
+ { {"1","0x80000000"}, 63, {"0x100000000","1"} },
+ { {"1","0x80000000"}, 64, {"0x200000000","1"} },
+ { {"1","0x80000000"}, 94, {"0x8000000000000000","1"} },
+ { {"1","0x80000000"}, 95, {"0x10000000000000000","1"} },
+ { {"1","0x80000000"}, 96, {"0x20000000000000000","1"} },
+ { {"1","0x80000000"}, 126, {"0x800000000000000000000000","1"} },
+ { {"1","0x80000000"}, 127, {"0x1000000000000000000000000","1"} },
+ { {"1","0x80000000"}, 128, {"0x2000000000000000000000000","1"} },
+
+ { {"1","0x100000000"}, 1, {"1","0x80000000"} },
+ { {"1","0x100000000"}, 2, {"1","0x40000000"} },
+ { {"1","0x100000000"}, 3, {"1","0x20000000"} },
+
+ { {"1","0x10000000000000000"}, 1, {"1","0x8000000000000000"} },
+ { {"1","0x10000000000000000"}, 2, {"1","0x4000000000000000"} },
+ { {"1","0x10000000000000000"}, 3, {"1","0x2000000000000000"} },
+ };
+
+ void (*fun) (mpq_ptr, mpq_srcptr, unsigned long);
+ const struct pair_t *p_start, *p_want;
+ const char *name;
+ mpq_t sep, got, want;
+ mpq_ptr q;
+ int i, muldiv, sign, overlap;
+
+ tests_start ();
+
+ mpq_init (sep);
+ mpq_init (got);
+ mpq_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (muldiv = 0; muldiv < 2; muldiv++)
+ {
+ if (muldiv == 0)
+ {
+ fun = mpq_mul_2exp;
+ name = "mpq_mul_2exp";
+ p_start = &data[i].left;
+ p_want = &data[i].right;
+ }
+ else
+ {
+ fun = mpq_div_2exp;
+ name = "mpq_div_2exp";
+ p_start = &data[i].right;
+ p_want = &data[i].left;
+ }
+
+ for (sign = 0; sign <= 1; sign++)
+ {
+ mpz_set_str_or_abort (mpq_numref(want), p_want->num, 0);
+ mpz_set_str_or_abort (mpq_denref(want), p_want->den, 0);
+ if (sign)
+ mpq_neg (want, want);
+
+ for (overlap = 0; overlap <= 1; overlap++)
+ {
+ q = overlap ? got : sep;
+
+ /* initial garbage in "got" */
+ mpq_set_ui (got, 123L, 456L);
+
+ mpz_set_str_or_abort (mpq_numref(q), p_start->num, 0);
+ mpz_set_str_or_abort (mpq_denref(q), p_start->den, 0);
+ if (sign)
+ mpq_neg (q, q);
+
+ (*fun) (got, q, data[i].n);
+ MPQ_CHECK_FORMAT (got);
+
+ if (! mpq_equal (got, want))
+ {
+ printf ("%s wrong at data[%d], sign %d, overlap %d\n",
+ name, i, sign, overlap);
+ printf (" num \"%s\"\n", p_start->num);
+ printf (" den \"%s\"\n", p_start->den);
+ printf (" n %lu\n", data[i].n);
+
+ printf (" got ");
+ mpq_out_str (stdout, 16, got);
+ printf (" (hex)\n");
+
+ printf (" want ");
+ mpq_out_str (stdout, 16, want);
+ printf (" (hex)\n");
+
+ abort ();
+ }
+ }
+ }
+ }
+ }
+
+ check_random ();
+
+ mpq_clear (sep);
+ mpq_clear (got);
+ mpq_clear (want);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-set_f.c b/vendor/gmp-6.3.0/tests/mpq/t-set_f.c
new file mode 100644
index 0000000..e92e3aa
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-set_f.c
@@ -0,0 +1,169 @@
+/* Test mpq_set_f.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+int
+main (int argc, char **argv)
+{
+#if GMP_NAIL_BITS == 0
+ static const struct {
+ int f_base;
+ const char *f;
+ int z_base;
+ const char *want_num;
+ const char *want_den;
+
+ } data[] = {
+
+ { -2, "0", 16, "0", "1" },
+ { -2, "1", 16, "1", "1" },
+ { -2, "1@1", 16, "2", "1" },
+ { -2, "1@2", 16, "4", "1" },
+ { -2, "1@3", 16, "8", "1" },
+
+ { -2, "1@30", 16, "40000000", "1" },
+ { -2, "1@31", 16, "80000000", "1" },
+ { -2, "1@32", 16, "100000000", "1" },
+ { -2, "1@33", 16, "200000000", "1" },
+ { -2, "1@34", 16, "400000000", "1" },
+
+ { -2, "1@62", 16, "4000000000000000", "1" },
+ { -2, "1@63", 16, "8000000000000000", "1" },
+ { -2, "1@64", 16, "10000000000000000", "1" },
+ { -2, "1@65", 16, "20000000000000000", "1" },
+ { -2, "1@66", 16, "40000000000000000", "1" },
+
+ { -2, "1@126", 16, "40000000000000000000000000000000", "1" },
+ { -2, "1@127", 16, "80000000000000000000000000000000", "1" },
+ { -2, "1@128", 16, "100000000000000000000000000000000", "1" },
+ { -2, "1@129", 16, "200000000000000000000000000000000", "1" },
+ { -2, "1@130", 16, "400000000000000000000000000000000", "1" },
+
+ { -2, "1@-1", 16, "1", "2" },
+ { -2, "1@-2", 16, "1", "4" },
+ { -2, "1@-3", 16, "1", "8" },
+
+ { -2, "1@-30", 16, "1", "40000000" },
+ { -2, "1@-31", 16, "1", "80000000" },
+ { -2, "1@-32", 16, "1", "100000000" },
+ { -2, "1@-33", 16, "1", "200000000" },
+ { -2, "1@-34", 16, "1", "400000000" },
+
+ { -2, "1@-62", 16, "1", "4000000000000000" },
+ { -2, "1@-63", 16, "1", "8000000000000000" },
+ { -2, "1@-64", 16, "1", "10000000000000000" },
+ { -2, "1@-65", 16, "1", "20000000000000000" },
+ { -2, "1@-66", 16, "1", "40000000000000000" },
+
+ { -2, "1@-126", 16, "1", "40000000000000000000000000000000" },
+ { -2, "1@-127", 16, "1", "80000000000000000000000000000000" },
+ { -2, "1@-128", 16, "1", "100000000000000000000000000000000" },
+ { -2, "1@-129", 16, "1", "200000000000000000000000000000000" },
+ { -2, "1@-130", 16, "1", "400000000000000000000000000000000" },
+
+ { -2, "1@-30", 16, "1", "40000000" },
+ { -2, "1@-31", 16, "1", "80000000" },
+ { -2, "1@-32", 16, "1", "100000000" },
+ { -2, "1@-33", 16, "1", "200000000" },
+ { -2, "1@-34", 16, "1", "400000000" },
+
+ { -2, "11@-62", 16, "3", "4000000000000000" },
+ { -2, "11@-63", 16, "3", "8000000000000000" },
+ { -2, "11@-64", 16, "3", "10000000000000000" },
+ { -2, "11@-65", 16, "3", "20000000000000000" },
+ { -2, "11@-66", 16, "3", "40000000000000000" },
+
+ { 16, "80000000.00000001", 16, "8000000000000001", "100000000" },
+ { 16, "80000000.00000008", 16, "1000000000000001", "20000000" },
+ { 16, "80000000.8", 16, "100000001", "2" },
+
+ };
+
+ mpf_t f;
+ mpq_t got;
+ mpz_t want_num, want_den;
+ int i, neg;
+
+ tests_start ();
+
+ mpf_init2 (f, 1024L);
+ mpq_init (got);
+ mpz_init (want_num);
+ mpz_init (want_den);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (neg = 0; neg <= 1; neg++)
+ {
+ mpf_set_str_or_abort (f, data[i].f, data[i].f_base);
+ mpz_set_str_or_abort (want_num, data[i].want_num, data[i].z_base);
+ mpz_set_str_or_abort (want_den, data[i].want_den, data[i].z_base);
+
+ if (neg)
+ {
+ mpf_neg (f, f);
+ mpz_neg (want_num, want_num);
+ }
+
+ mpq_set_f (got, f);
+ MPQ_CHECK_FORMAT (got);
+
+ if (mpz_cmp (mpq_numref(got), want_num) != 0
+ || mpz_cmp (mpq_denref(got), want_den) != 0)
+ {
+ printf ("wrong at data[%d]\n", i);
+ printf (" f_base %d, z_base %d\n",
+ data[i].f_base, data[i].z_base);
+
+ printf (" f \"%s\" hex ", data[i].f);
+ mpf_out_str (stdout, 16, 0, f);
+ printf ("\n");
+
+ printf (" want num 0x");
+ mpz_out_str (stdout, 16, want_num);
+ printf ("\n");
+ printf (" want den 0x");
+ mpz_out_str (stdout, 16, want_den);
+ printf ("\n");
+
+ printf (" got num 0x");
+ mpz_out_str (stdout, 16, mpq_numref(got));
+ printf ("\n");
+ printf (" got den 0x");
+ mpz_out_str (stdout, 16, mpq_denref(got));
+ printf ("\n");
+
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (f);
+ mpq_clear (got);
+ mpz_clear (want_num);
+ mpz_clear (want_den);
+
+ tests_end ();
+#endif
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-set_str.c b/vendor/gmp-6.3.0/tests/mpq/t-set_str.c
new file mode 100644
index 0000000..1f5ca8b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-set_str.c
@@ -0,0 +1,102 @@
+/* Test mpq_set_str.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpq_srcptr want, int base, const char *str)
+{
+ mpq_t got;
+
+ MPQ_CHECK_FORMAT (want);
+ mp_trace_base = base;
+
+ mpq_init (got);
+
+ if (mpq_set_str (got, str, base) != 0)
+ {
+ printf ("mpq_set_str unexpectedly failed\n");
+ printf (" base %d\n", base);
+ printf (" str \"%s\"\n", str);
+ abort ();
+ }
+ MPQ_CHECK_FORMAT (got);
+
+ if (! mpq_equal (got, want))
+ {
+ printf ("mpq_set_str wrong\n");
+ printf (" base %d\n", base);
+ printf (" str \"%s\"\n", str);
+ mpq_trace ("got ", got);
+ mpq_trace ("want", want);
+ abort ();
+ }
+
+ mpq_clear (got);
+}
+
+void
+check_samples (void)
+{
+ mpq_t q;
+
+ mpq_init (q);
+
+ mpq_set_ui (q, 0L, 1L);
+ check_one (q, 10, "0");
+ check_one (q, 10, "0/1");
+ check_one (q, 10, "0 / 1");
+ check_one (q, 0, "0x0/ 1");
+ check_one (q, 0, "0x0/ 0x1");
+ check_one (q, 0, "0 / 0x1");
+
+ check_one (q, 10, "-0");
+ check_one (q, 10, "-0/1");
+ check_one (q, 10, "-0 / 1");
+ check_one (q, 0, "-0x0/ 1");
+ check_one (q, 0, "-0x0/ 0x1");
+ check_one (q, 0, "-0 / 0x1");
+
+ mpq_set_ui (q, 255L, 256L);
+ check_one (q, 10, "255/256");
+ check_one (q, 0, "0xFF/0x100");
+ check_one (q, 16, "FF/100");
+
+ mpq_neg (q, q);
+ check_one (q, 10, "-255/256");
+ check_one (q, 0, "-0xFF/0x100");
+ check_one (q, 16, "-FF/100");
+
+ mpq_clear (q);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_samples ();
+
+ tests_end ();
+ exit (0);
+}