summaryrefslogtreecommitdiff
path: root/tests/t-gmpmax.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2001-06-15 02:59:07 +0200
committerKevin Ryde <user42@zip.com.au>2001-06-15 02:59:07 +0200
commit6e405893321292793bf318fbe5c6d22816b68882 (patch)
tree637ce160aaf2c9c4725393ab666b73dce39181dc /tests/t-gmpmax.c
parent739d244429e790580033c28e2e720c6d5f616c91 (diff)
downloadgmp-6e405893321292793bf318fbe5c6d22816b68882.tar.gz
* tests/t-gmpmax.c: New file.
Diffstat (limited to 'tests/t-gmpmax.c')
-rw-r--r--tests/t-gmpmax.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/t-gmpmax.c b/tests/t-gmpmax.c
new file mode 100644
index 000000000..d98e11540
--- /dev/null
+++ b/tests/t-gmpmax.c
@@ -0,0 +1,70 @@
+/* Check the values of __GMP_UINT_MAX etc.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include <stdio.h>
+#include <limits.h>
+#include "gmp.h"
+
+
+/* __GMP_UINT_MAX etc are generated with expressions in gmp.h since we don't
+ want to demand <limits.h> or forcibly include it. Check the expressions
+ come out the same as <limits.h>. */
+
+int
+main (int argc, char *argv[])
+{
+ int error = 0;
+
+#ifdef UINT_MAX
+ if (__GMP_UINT_MAX != UINT_MAX)
+ {
+ printf ("__GMP_UINT_MAX incorrect\n");
+ printf (" __GMP_UINT_MAX %u 0x%X\n", __GMP_UINT_MAX, __GMP_UINT_MAX);
+ printf (" UINT_MAX %u 0x%X\n", UINT_MAX, UINT_MAX);
+ error = 1;
+ }
+#endif
+
+#ifdef ULONG_MAX
+ if (__GMP_ULONG_MAX != ULONG_MAX)
+ {
+ printf ("__GMP_ULONG_MAX incorrect\n");
+ printf (" __GMP_ULONG_MAX %lu 0x%lX\n", __GMP_ULONG_MAX, __GMP_ULONG_MAX);
+ printf (" ULONG_MAX %lu 0x%lX\n", ULONG_MAX, ULONG_MAX);
+ error = 1;
+ }
+#endif
+
+#ifdef USHRT_MAX
+ if (__GMP_USHRT_MAX != USHRT_MAX)
+ {
+ printf ("__GMP_USHRT_MAX incorrect\n");
+ printf (" __GMP_USHRT_MAX %hu 0x%hX\n", __GMP_USHRT_MAX, __GMP_USHRT_MAX);
+ printf (" USHRT_MAX %hu 0x%hX\n", USHRT_MAX, USHRT_MAX);
+ error = 1;
+ }
+#endif
+
+ if (error)
+ abort ();
+
+ exit (0);
+}