summaryrefslogtreecommitdiff
path: root/gl/tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-08-05 14:36:59 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-08-05 14:36:59 +0200
commit55bccd48156066ec6ec91e91cd0efe7ea11f897b (patch)
treeb36a525fc41e093ed0b004af78c591b3aac992dc /gl/tests
parentc76e86123bf115fc63b164ce93250afed0169b11 (diff)
downloadgnutls-55bccd48156066ec6ec91e91cd0efe7ea11f897b.tar.gz
gnulib only contains lgplv2 modules
Diffstat (limited to 'gl/tests')
-rw-r--r--gl/tests/Makefile.am274
-rw-r--r--gl/tests/dosname.h53
-rw-r--r--gl/tests/fpucw.h108
-rw-r--r--gl/tests/infinity.h60
-rw-r--r--gl/tests/intprops.h319
-rw-r--r--gl/tests/malloca.c149
-rw-r--r--gl/tests/malloca.h133
-rw-r--r--gl/tests/malloca.valgrind7
-rw-r--r--gl/tests/minus-zero.h74
-rw-r--r--gl/tests/nan.h70
-rw-r--r--gl/tests/putenv.c194
-rw-r--r--gl/tests/randomd.c1028
-rw-r--r--gl/tests/randoml.c1028
-rw-r--r--gl/tests/setenv.c390
-rw-r--r--gl/tests/strerror-override.c302
-rw-r--r--gl/tests/strerror-override.h56
-rw-r--r--gl/tests/strerror.c70
-rwxr-xr-xgl/tests/test-argp-2.sh113
-rw-r--r--gl/tests/test-argp.c491
-rw-r--r--gl/tests/test-dirent.c32
-rw-r--r--gl/tests/test-environ.c44
-rw-r--r--gl/tests/test-fprintf-posix.h153
-rw-r--r--gl/tests/test-frexp.c67
-rw-r--r--gl/tests/test-frexp.h179
-rw-r--r--gl/tests/test-frexpl.c78
-rw-r--r--gl/tests/test-fseterr.c44
-rw-r--r--gl/tests/test-getopt.c99
-rw-r--r--gl/tests/test-getopt.h1391
-rw-r--r--gl/tests/test-getopt_long.h2144
-rw-r--r--gl/tests/test-isnand-nolibm.c21
-rw-r--r--gl/tests/test-isnand.h63
-rw-r--r--gl/tests/test-isnanf-nolibm.c21
-rw-r--r--gl/tests/test-isnanf.h65
-rw-r--r--gl/tests/test-isnanl-nolibm.c23
-rw-r--r--gl/tests/test-isnanl.h127
-rw-r--r--gl/tests/test-malloc-gnu.c29
-rw-r--r--gl/tests/test-malloca.c62
-rw-r--r--gl/tests/test-math.c104
-rw-r--r--gl/tests/test-printf-frexp.c119
-rw-r--r--gl/tests/test-printf-frexpl.c134
-rw-r--r--gl/tests/test-printf-posix.h155
-rw-r--r--gl/tests/test-printf-posix.output40
-rw-r--r--gl/tests/test-rawmemchr.c92
-rw-r--r--gl/tests/test-setenv.c56
-rw-r--r--gl/tests/test-signbit.c177
-rw-r--r--gl/tests/test-sleep.c58
-rw-r--r--gl/tests/test-strchrnul.c86
-rw-r--r--gl/tests/test-sysexits.c52
-rw-r--r--gl/tests/test-unsetenv.c61
-rw-r--r--gl/tests/test-version-etc.c33
-rwxr-xr-xgl/tests/test-version-etc.sh43
-rw-r--r--gl/tests/test-vfprintf-posix.c52
-rwxr-xr-xgl/tests/test-vfprintf-posix.sh16
-rw-r--r--gl/tests/test-vprintf-posix.c52
-rwxr-xr-xgl/tests/test-vprintf-posix.sh16
-rw-r--r--gl/tests/unsetenv.c127
56 files changed, 941 insertions, 10093 deletions
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index 387dac9135..f4c8b3df2a 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -76,15 +76,6 @@ EXTRA_DIST += test-alloca-opt.c
## end gnulib module alloca-opt-tests
-## begin gnulib module argp-tests
-
-TESTS += test-argp test-argp-2.sh
-check_PROGRAMS += test-argp
-test_argp_LDADD = $(LDADD) @LIBINTL@
-EXTRA_DIST += test-argp.c test-argp-2.sh
-
-## end gnulib module argp-tests
-
## begin gnulib module arpa_inet-tests
TESTS += test-arpa_inet
@@ -159,13 +150,12 @@ EXTRA_DIST += test-connect.c signature.h macros.h
## end gnulib module connect-tests
-## begin gnulib module dirent-tests
+## begin gnulib module dosname
+
-TESTS += test-dirent
-check_PROGRAMS += test-dirent
-EXTRA_DIST += test-dirent.c
+EXTRA_DIST += dosname.h
-## end gnulib module dirent-tests
+## end gnulib module dosname
## begin gnulib module dup2-tests
@@ -175,15 +165,6 @@ EXTRA_DIST += test-dup2.c signature.h macros.h
## end gnulib module dup2-tests
-## begin gnulib module environ-tests
-
-TESTS += test-environ
-check_PROGRAMS += test-environ
-
-EXTRA_DIST += test-environ.c
-
-## end gnulib module environ-tests
-
## begin gnulib module errno-tests
TESTS += test-errno
@@ -269,6 +250,13 @@ EXTRA_DIST += test-float.c macros.h
## end gnulib module float-tests
+## begin gnulib module fpucw
+
+
+EXTRA_DIST += fpucw.h
+
+## end gnulib module fpucw
+
## begin gnulib module fputc-tests
TESTS += test-fputc
@@ -285,24 +273,6 @@ EXTRA_DIST += test-fread.c signature.h macros.h
## end gnulib module fread-tests
-## begin gnulib module frexp-nolibm-tests
-
-TESTS += test-frexp-nolibm
-check_PROGRAMS += test-frexp-nolibm
-test_frexp_nolibm_SOURCES = test-frexp.c randomd.c
-EXTRA_DIST += test-frexp.c test-frexp.h minus-zero.h infinity.h nan.h signature.h macros.h randomd.c
-
-## end gnulib module frexp-nolibm-tests
-
-## begin gnulib module frexpl-nolibm-tests
-
-TESTS += test-frexpl-nolibm
-check_PROGRAMS += test-frexpl-nolibm
-test_frexpl_nolibm_SOURCES = test-frexpl.c randoml.c
-EXTRA_DIST += test-frexpl.c test-frexp.h minus-zero.h infinity.h nan.h signature.h macros.h randoml.c
-
-## end gnulib module frexpl-nolibm-tests
-
## begin gnulib module fseek-tests
TESTS += test-fseek.sh test-fseek2.sh
@@ -319,15 +289,6 @@ EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh test-fseeko3.c test-f
## end gnulib module fseeko-tests
-## begin gnulib module fseterr-tests
-
-TESTS += test-fseterr
-check_PROGRAMS += test-fseterr
-
-EXTRA_DIST += test-fseterr.c
-
-## end gnulib module fseterr-tests
-
## begin gnulib module fstat-tests
TESTS += test-fstat
@@ -449,15 +410,6 @@ EXTRA_DIST += test-getline.c signature.h macros.h
## end gnulib module getline-tests
-## begin gnulib module getopt-posix-tests
-
-TESTS += test-getopt
-check_PROGRAMS += test-getopt
-test_getopt_LDADD = $(LDADD) $(LIBINTL)
-EXTRA_DIST += macros.h signature.h test-getopt.c test-getopt.h test-getopt_long.h
-
-## end gnulib module getopt-posix-tests
-
## begin gnulib module getpagesize
@@ -528,6 +480,13 @@ EXTRA_DIST += test-inet_pton.c signature.h macros.h
## end gnulib module inet_pton-tests
+## begin gnulib module intprops
+
+
+EXTRA_DIST += intprops.h
+
+## end gnulib module intprops
+
## begin gnulib module intprops-tests
TESTS += test-intprops
@@ -605,33 +564,6 @@ EXTRA_DIST += test-ioctl.c signature.h macros.h
## end gnulib module ioctl-tests
-## begin gnulib module isnand-nolibm-tests
-
-TESTS += test-isnand-nolibm
-check_PROGRAMS += test-isnand-nolibm
-
-EXTRA_DIST += test-isnand-nolibm.c test-isnand.h minus-zero.h infinity.h nan.h macros.h
-
-## end gnulib module isnand-nolibm-tests
-
-## begin gnulib module isnanf-nolibm-tests
-
-TESTS += test-isnanf-nolibm
-check_PROGRAMS += test-isnanf-nolibm
-
-EXTRA_DIST += test-isnanf-nolibm.c test-isnanf.h minus-zero.h infinity.h nan.h macros.h
-
-## end gnulib module isnanf-nolibm-tests
-
-## begin gnulib module isnanl-nolibm-tests
-
-TESTS += test-isnanl-nolibm
-check_PROGRAMS += test-isnanl-nolibm
-
-EXTRA_DIST += test-isnanl-nolibm.c test-isnanl.h minus-zero.h infinity.h nan.h macros.h
-
-## end gnulib module isnanl-nolibm-tests
-
## begin gnulib module listen-tests
TESTS += test-listen
@@ -664,39 +596,6 @@ EXTRA_DIST += test-lstat.h test-lstat.c signature.h macros.h
## end gnulib module lstat-tests
-## begin gnulib module malloc-gnu-tests
-
-TESTS += test-malloc-gnu
-check_PROGRAMS += test-malloc-gnu
-EXTRA_DIST += test-malloc-gnu.c
-
-## end gnulib module malloc-gnu-tests
-
-## begin gnulib module malloca
-
-libtests_a_SOURCES += malloca.c
-
-EXTRA_DIST += malloca.h malloca.valgrind
-
-## end gnulib module malloca
-
-## begin gnulib module malloca-tests
-
-TESTS += test-malloca
-check_PROGRAMS += test-malloca
-
-EXTRA_DIST += test-malloca.c
-
-## end gnulib module malloca-tests
-
-## begin gnulib module math-tests
-
-TESTS += test-math
-check_PROGRAMS += test-math
-EXTRA_DIST += test-math.c macros.h
-
-## end gnulib module math-tests
-
## begin gnulib module memchr-tests
TESTS += test-memchr
@@ -787,39 +686,6 @@ EXTRA_DIST += test-pipe.c signature.h macros.h
## end gnulib module pipe-posix-tests
-## begin gnulib module printf-frexp-tests
-
-TESTS += test-printf-frexp
-check_PROGRAMS += test-printf-frexp
-EXTRA_DIST += test-printf-frexp.c macros.h
-
-## end gnulib module printf-frexp-tests
-
-## begin gnulib module printf-frexpl-tests
-
-TESTS += test-printf-frexpl
-check_PROGRAMS += test-printf-frexpl
-EXTRA_DIST += test-printf-frexpl.c macros.h
-
-## end gnulib module printf-frexpl-tests
-
-## begin gnulib module putenv
-
-
-EXTRA_DIST += putenv.c
-
-EXTRA_libtests_a_SOURCES += putenv.c
-
-## end gnulib module putenv
-
-## begin gnulib module rawmemchr-tests
-
-TESTS += test-rawmemchr
-check_PROGRAMS += test-rawmemchr
-EXTRA_DIST += test-rawmemchr.c zerosize-ptr.h signature.h macros.h
-
-## end gnulib module rawmemchr-tests
-
## begin gnulib module read-file-tests
TESTS += test-read-file
@@ -883,23 +749,6 @@ EXTRA_DIST += test-sendto.c signature.h macros.h
## end gnulib module sendto-tests
-## begin gnulib module setenv
-
-
-EXTRA_DIST += setenv.c
-
-EXTRA_libtests_a_SOURCES += setenv.c
-
-## end gnulib module setenv
-
-## begin gnulib module setenv-tests
-
-TESTS += test-setenv
-check_PROGRAMS += test-setenv
-EXTRA_DIST += test-setenv.c signature.h macros.h
-
-## end gnulib module setenv-tests
-
## begin gnulib module setsockopt-tests
TESTS += test-setsockopt
@@ -926,23 +775,6 @@ EXTRA_DIST += test-signal-h.c
## end gnulib module signal-h-tests
-## begin gnulib module signbit-tests
-
-TESTS += test-signbit
-check_PROGRAMS += test-signbit
-
-EXTRA_DIST += test-signbit.c minus-zero.h infinity.h macros.h
-
-## end gnulib module signbit-tests
-
-## begin gnulib module sleep-tests
-
-TESTS += test-sleep
-check_PROGRAMS += test-sleep
-EXTRA_DIST += test-sleep.c signature.h macros.h
-
-## end gnulib module sleep-tests
-
## begin gnulib module snippet/_Noreturn
# Because this Makefile snippet defines a variable used by other
@@ -1108,13 +940,23 @@ EXTRA_DIST += test-stdlib.c test-sys_wait.h
## end gnulib module stdlib-tests
-## begin gnulib module strchrnul-tests
+## begin gnulib module strerror
-TESTS += test-strchrnul
-check_PROGRAMS += test-strchrnul
-EXTRA_DIST += test-strchrnul.c signature.h macros.h
-## end gnulib module strchrnul-tests
+EXTRA_DIST += strerror.c
+
+EXTRA_libtests_a_SOURCES += strerror.c
+
+## end gnulib module strerror
+
+## begin gnulib module strerror-override
+
+
+EXTRA_DIST += strerror-override.c strerror-override.h
+
+EXTRA_libtests_a_SOURCES += strerror-override.c
+
+## end gnulib module strerror-override
## begin gnulib module strerror-tests
@@ -1278,14 +1120,6 @@ EXTRA_DIST += test-sys_uio.c
## end gnulib module sys_uio-tests
-## begin gnulib module sysexits-tests
-
-TESTS += test-sysexits
-check_PROGRAMS += test-sysexits
-EXTRA_DIST += test-sysexits.c
-
-## end gnulib module sysexits-tests
-
## begin gnulib module test-framework-sh-tests
TESTS += test-init.sh
@@ -1326,23 +1160,6 @@ EXTRA_DIST += test-unistd.c
## end gnulib module unistd-tests
-## begin gnulib module unsetenv
-
-
-EXTRA_DIST += unsetenv.c
-
-EXTRA_libtests_a_SOURCES += unsetenv.c
-
-## end gnulib module unsetenv
-
-## begin gnulib module unsetenv-tests
-
-TESTS += test-unsetenv
-check_PROGRAMS += test-unsetenv
-EXTRA_DIST += test-unsetenv.c signature.h macros.h
-
-## end gnulib module unsetenv-tests
-
## begin gnulib module vasnprintf-tests
TESTS += test-vasnprintf
@@ -1379,31 +1196,6 @@ EXTRA_DIST += test-verify.c test-verify.sh
## end gnulib module verify-tests
-## begin gnulib module version-etc-tests
-
-TESTS += test-version-etc.sh
-check_PROGRAMS += test-version-etc
-test_version_etc_LDADD = $(LDADD) @LIBINTL@
-EXTRA_DIST += test-version-etc.c test-version-etc.sh
-
-## end gnulib module version-etc-tests
-
-## begin gnulib module vfprintf-posix-tests
-
-TESTS += test-vfprintf-posix.sh
-check_PROGRAMS += test-vfprintf-posix
-EXTRA_DIST += test-vfprintf-posix.sh test-vfprintf-posix.c test-fprintf-posix.h test-printf-posix.output infinity.h signature.h macros.h
-
-## end gnulib module vfprintf-posix-tests
-
-## begin gnulib module vprintf-posix-tests
-
-TESTS += test-vprintf-posix.sh
-check_PROGRAMS += test-vprintf-posix
-EXTRA_DIST += test-vprintf-posix.sh test-vprintf-posix.c test-printf-posix.h test-printf-posix.output infinity.h signature.h macros.h
-
-## end gnulib module vprintf-posix-tests
-
## begin gnulib module vsnprintf-tests
TESTS += test-vsnprintf
diff --git a/gl/tests/dosname.h b/gl/tests/dosname.h
new file mode 100644
index 0000000000..ba63ce4bd3
--- /dev/null
+++ b/gl/tests/dosname.h
@@ -0,0 +1,53 @@
+/* File names on MS-DOS/Windows systems.
+
+ Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+ From Paul Eggert and Jim Meyering. */
+
+#ifndef _DOSNAME_H
+#define _DOSNAME_H
+
+#if (defined _WIN32 || defined __WIN32__ || \
+ defined __MSDOS__ || defined __CYGWIN__ || \
+ defined __EMX__ || defined __DJGPP__)
+ /* This internal macro assumes ASCII, but all hosts that support drive
+ letters use ASCII. */
+# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \
+ <= 'z' - 'a')
+# define FILE_SYSTEM_PREFIX_LEN(Filename) \
+ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
+# ifndef __CYGWIN__
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
+# endif
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#else
+# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
+# define ISSLASH(C) ((C) == '/')
+#endif
+
+#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
+#endif
+
+#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
+# else
+# define IS_ABSOLUTE_FILE_NAME(F) \
+ (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
+#endif
+#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
+
+#endif /* DOSNAME_H_ */
diff --git a/gl/tests/fpucw.h b/gl/tests/fpucw.h
new file mode 100644
index 0000000000..0b7f5284a1
--- /dev/null
+++ b/gl/tests/fpucw.h
@@ -0,0 +1,108 @@
+/* Manipulating the FPU control word.
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2007.
+
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _FPUCW_H
+#define _FPUCW_H
+
+/* The i386 floating point hardware (the 387 compatible FPU, not the modern
+ SSE/SSE2 hardware) has a controllable rounding precision. It is specified
+ through the 'PC' bits in the FPU control word ('fctrl' register). (See
+ the GNU libc i386 <fpu_control.h> header for details.)
+
+ On some platforms, such as Linux or Solaris, the default precision setting
+ is set to "extended precision". This means that 'long double' instructions
+ operate correctly, but 'double' computations often produce slightly
+ different results as on strictly IEEE 754 conforming systems.
+
+ On some platforms, such as NetBSD, the default precision is set to
+ "double precision". This means that 'long double' instructions will operate
+ only as 'double', i.e. lead to wrong results. Similarly on FreeBSD 6.4, at
+ least for the division of 'long double' numbers.
+
+ The FPU control word is under control of the application, i.e. it is
+ not required to be set either way by the ABI. (In fact, the i386 ABI
+ http://refspecs.freestandards.org/elf/abi386-4.pdf page 3-12 = page 38
+ is not clear about it. But in any case, gcc treats the control word
+ like a "preserved" register: it emits code that assumes that the control
+ word is preserved across calls, and it restores the control word at the
+ end of functions that modify it.)
+
+ See Vincent Lefèvre's page http://www.vinc17.org/research/extended.en.html
+ for a good explanation.
+ See http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html for
+ some argumentation which setting should be the default. */
+
+/* This header file provides the following facilities:
+ fpucw_t integral type holding the value of 'fctrl'
+ FPU_PC_MASK bit mask denoting the precision control
+ FPU_PC_DOUBLE precision control for 53 bits mantissa
+ FPU_PC_EXTENDED precision control for 64 bits mantissa
+ GET_FPUCW () yields the current FPU control word
+ SET_FPUCW (word) sets the FPU control word
+ DECL_LONG_DOUBLE_ROUNDING variable declaration for
+ BEGIN/END_LONG_DOUBLE_ROUNDING
+ BEGIN_LONG_DOUBLE_ROUNDING () starts a sequence of instructions with
+ 'long double' safe operation precision
+ END_LONG_DOUBLE_ROUNDING () ends a sequence of instructions with
+ 'long double' safe operation precision
+ */
+
+/* Inline assembler like this works only with GNU C. */
+#if (defined __i386__ || defined __x86_64__) && defined __GNUC__
+
+typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */
+
+# define FPU_PC_MASK 0x0300
+# define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */
+# define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */
+
+# define GET_FPUCW() \
+ ({ fpucw_t _cw; \
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \
+ _cw; \
+ })
+# define SET_FPUCW(word) \
+ (void)({ fpucw_t _ncw = (word); \
+ __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \
+ })
+
+# define DECL_LONG_DOUBLE_ROUNDING \
+ fpucw_t oldcw;
+# define BEGIN_LONG_DOUBLE_ROUNDING() \
+ (void)(oldcw = GET_FPUCW (), \
+ SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED))
+# define END_LONG_DOUBLE_ROUNDING() \
+ SET_FPUCW (oldcw)
+
+#else
+
+typedef unsigned int fpucw_t;
+
+# define FPU_PC_MASK 0
+# define FPU_PC_DOUBLE 0
+# define FPU_PC_EXTENDED 0
+
+# define GET_FPUCW() 0
+# define SET_FPUCW(word) (void)(word)
+
+# define DECL_LONG_DOUBLE_ROUNDING
+# define BEGIN_LONG_DOUBLE_ROUNDING()
+# define END_LONG_DOUBLE_ROUNDING()
+
+#endif
+
+#endif /* _FPUCW_H */
diff --git a/gl/tests/infinity.h b/gl/tests/infinity.h
deleted file mode 100644
index 9111289985..0000000000
--- a/gl/tests/infinity.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Macros for infinity.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-/* Infinityf () returns a 'float' +Infinity. */
-
-/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f. */
-#if defined _MSC_VER
-static float
-Infinityf ()
-{
- static float zero = 0.0f;
- return 1.0f / zero;
-}
-#else
-# define Infinityf() (1.0f / 0.0f)
-#endif
-
-
-/* Infinityd () returns a 'double' +Infinity. */
-
-/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. */
-#if defined _MSC_VER
-static double
-Infinityd ()
-{
- static double zero = 0.0;
- return 1.0 / zero;
-}
-#else
-# define Infinityd() (1.0 / 0.0)
-#endif
-
-
-/* Infinityl () returns a 'long double' +Infinity. */
-
-/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. */
-#if defined _MSC_VER
-static double
-Infinityl ()
-{
- static long double zero = 0.0L;
- return 1.0L / zero;
-}
-#else
-# define Infinityl() (1.0L / 0.0L)
-#endif
diff --git a/gl/tests/intprops.h b/gl/tests/intprops.h
new file mode 100644
index 0000000000..f57f9b4dda
--- /dev/null
+++ b/gl/tests/intprops.h
@@ -0,0 +1,319 @@
+/* intprops.h -- properties of integer types
+
+ Copyright (C) 2001-2005, 2009-2013 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#ifndef _GL_INTPROPS_H
+#define _GL_INTPROPS_H
+
+#include <limits.h>
+
+/* Return an integer value, converted to the same type as the integer
+ expression E after integer type promotion. V is the unconverted value. */
+#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
+
+/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
+ <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */
+#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v))
+
+/* The extra casts in the following macros work around compiler bugs,
+ e.g., in Cray C 5.0.3.0. */
+
+/* True if the arithmetic type T is an integer type. bool counts as
+ an integer. */
+#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+
+/* True if negative values of the signed integer type T use two's
+ complement, ones' complement, or signed magnitude representation,
+ respectively. Much GNU code assumes two's complement, but some
+ people like to be portable to all possible C hosts. */
+#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
+#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
+#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+
+/* True if the signed integer expression E uses two's complement. */
+#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1)
+
+/* True if the arithmetic type T is signed. */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
+/* Return 1 if the integer expression E, after integer promotion, has
+ a signed type. */
+#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
+
+
+/* Minimum and maximum values for integer types and expressions. These
+ macros have undefined behavior if T is signed and has padding bits.
+ If this is a problem for you, please let us know how to fix it for
+ your host. */
+
+/* The maximum and minimum values for the integer type T. */
+#define TYPE_MINIMUM(t) \
+ ((t) (! TYPE_SIGNED (t) \
+ ? (t) 0 \
+ : TYPE_SIGNED_MAGNITUDE (t) \
+ ? ~ (t) 0 \
+ : ~ TYPE_MAXIMUM (t)))
+#define TYPE_MAXIMUM(t) \
+ ((t) (! TYPE_SIGNED (t) \
+ ? (t) -1 \
+ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
+
+/* The maximum and minimum values for the type of the expression E,
+ after integer promotion. E should not have side effects. */
+#define _GL_INT_MINIMUM(e) \
+ (_GL_INT_SIGNED (e) \
+ ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \
+ : _GL_INT_CONVERT (e, 0))
+#define _GL_INT_MAXIMUM(e) \
+ (_GL_INT_SIGNED (e) \
+ ? _GL_SIGNED_INT_MAXIMUM (e) \
+ : _GL_INT_NEGATE_CONVERT (e, 1))
+#define _GL_SIGNED_INT_MAXIMUM(e) \
+ (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
+
+
+/* Return 1 if the __typeof__ keyword works. This could be done by
+ 'configure', but for now it's easier to do it by hand. */
+#if 2 <= __GNUC__ || defined __IBM__TYPEOF__ || 0x5110 <= __SUNPRO_C
+# define _GL_HAVE___TYPEOF__ 1
+#else
+# define _GL_HAVE___TYPEOF__ 0
+#endif
+
+/* Return 1 if the integer type or expression T might be signed. Return 0
+ if it is definitely unsigned. This macro does not evaluate its argument,
+ and expands to an integer constant expression. */
+#if _GL_HAVE___TYPEOF__
+# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t))
+#else
+# define _GL_SIGNED_TYPE_OR_EXPR(t) 1
+#endif
+
+/* Bound on length of the string representing an unsigned integer
+ value representable in B bits. log10 (2.0) < 146/485. The
+ smallest value of B where this bound is not tight is 2621. */
+#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
+
+/* Bound on length of the string representing an integer type or expression T.
+ Subtract 1 for the sign bit if T is signed, and then add 1 more for
+ a minus sign if needed.
+
+ Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is
+ signed, this macro may overestimate the true bound by one byte when
+ applied to unsigned types of size 2, 4, 16, ... bytes. */
+#define INT_STRLEN_BOUND(t) \
+ (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \
+ - _GL_SIGNED_TYPE_OR_EXPR (t)) \
+ + _GL_SIGNED_TYPE_OR_EXPR (t))
+
+/* Bound on buffer size needed to represent an integer type or expression T,
+ including the terminating null. */
+#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+
+/* Range overflow checks.
+
+ The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C
+ operators might not yield numerically correct answers due to
+ arithmetic overflow. They do not rely on undefined or
+ implementation-defined behavior. Their implementations are simple
+ and straightforward, but they are a bit harder to use than the
+ INT_<op>_OVERFLOW macros described below.
+
+ Example usage:
+
+ long int i = ...;
+ long int j = ...;
+ if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX))
+ printf ("multiply would overflow");
+ else
+ printf ("product is %ld", i * j);
+
+ Restrictions on *_RANGE_OVERFLOW macros:
+
+ These macros do not check for all possible numerical problems or
+ undefined or unspecified behavior: they do not check for division
+ by zero, for bad shift counts, or for shifting negative numbers.
+
+ These macros may evaluate their arguments zero or multiple times,
+ so the arguments should not have side effects. The arithmetic
+ arguments (including the MIN and MAX arguments) must be of the same
+ integer type after the usual arithmetic conversions, and the type
+ must have minimum value MIN and maximum MAX. Unsigned types should
+ use a zero MIN of the proper type.
+
+ These macros are tuned for constant MIN and MAX. For commutative
+ operations such as A + B, they are also tuned for constant B. */
+
+/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic.
+ See above for restrictions. */
+#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \
+ ((b) < 0 \
+ ? (a) < (min) - (b) \
+ : (max) - (b) < (a))
+
+/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic.
+ See above for restrictions. */
+#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \
+ ((b) < 0 \
+ ? (max) + (b) < (a) \
+ : (a) < (min) + (b))
+
+/* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
+ See above for restrictions. */
+#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \
+ ((min) < 0 \
+ ? (a) < - (max) \
+ : 0 < (a))
+
+/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
+ See above for restrictions. Avoid && and || as they tickle
+ bugs in Sun C 5.11 2010/08/13 and other compilers; see
+ <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */
+#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \
+ ((b) < 0 \
+ ? ((a) < 0 \
+ ? (a) < (max) / (b) \
+ : (b) == -1 \
+ ? 0 \
+ : (min) / (b) < (a)) \
+ : (b) == 0 \
+ ? 0 \
+ : ((a) < 0 \
+ ? (a) < (min) / (b) \
+ : (max) / (b) < (a)))
+
+/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic.
+ See above for restrictions. Do not check for division by zero. */
+#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \
+ ((min) < 0 && (b) == -1 && (a) < - (max))
+
+/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic.
+ See above for restrictions. Do not check for division by zero.
+ Mathematically, % should never overflow, but on x86-like hosts
+ INT_MIN % -1 traps, and the C standard permits this, so treat this
+ as an overflow too. */
+#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \
+ INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max)
+
+/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic.
+ See above for restrictions. Here, MIN and MAX are for A only, and B need
+ not be of the same type as the other arguments. The C standard says that
+ behavior is undefined for shifts unless 0 <= B < wordwidth, and that when
+ A is negative then A << B has undefined behavior and A >> B has
+ implementation-defined behavior, but do not check these other
+ restrictions. */
+#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \
+ ((a) < 0 \
+ ? (a) < (min) >> (b) \
+ : (max) >> (b) < (a))
+
+
+/* The _GL*_OVERFLOW macros have the same restrictions as the
+ *_RANGE_OVERFLOW macros, except that they do not assume that operands
+ (e.g., A and B) have the same type as MIN and MAX. Instead, they assume
+ that the result (e.g., A + B) has that type. */
+#define _GL_ADD_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
+ : (a) < 0 ? (b) <= (a) + (b) \
+ : (b) < 0 ? (a) <= (a) + (b) \
+ : (a) + (b) < (b))
+#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
+ : (a) < 0 ? 1 \
+ : (b) < 0 ? (a) - (b) <= (a) \
+ : (a) < (b))
+#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
+ (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
+ || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
+#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
+ : (a) < 0 ? (b) <= (a) + (b) - 1 \
+ : (b) < 0 && (a) + (b) <= (a))
+#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
+ : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \
+ : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
+
+/* Return a nonzero value if A is a mathematical multiple of B, where
+ A is unsigned, B is negative, and MAX is the maximum value of A's
+ type. A's type must be the same as (A % B)'s type. Normally (A %
+ -B == 0) suffices, but things get tricky if -B would overflow. */
+#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \
+ (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \
+ ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \
+ ? (a) \
+ : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \
+ : (a) % - (b)) \
+ == 0)
+
+
+/* Integer overflow checks.
+
+ The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
+ might not yield numerically correct answers due to arithmetic overflow.
+ They work correctly on all known practical hosts, and do not rely
+ on undefined behavior due to signed arithmetic overflow.
+
+ Example usage:
+
+ long int i = ...;
+ long int j = ...;
+ if (INT_MULTIPLY_OVERFLOW (i, j))
+ printf ("multiply would overflow");
+ else
+ printf ("product is %ld", i * j);
+
+ These macros do not check for all possible numerical problems or
+ undefined or unspecified behavior: they do not check for division
+ by zero, for bad shift counts, or for shifting negative numbers.
+
+ These macros may evaluate their arguments zero or multiple times, so the
+ arguments should not have side effects.
+
+ These macros are tuned for their last argument being a constant.
+
+ Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
+ A % B, and A << B would overflow, respectively. */
+
+#define INT_ADD_OVERFLOW(a, b) \
+ _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
+#define INT_SUBTRACT_OVERFLOW(a, b) \
+ _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
+#define INT_NEGATE_OVERFLOW(a) \
+ INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+#define INT_MULTIPLY_OVERFLOW(a, b) \
+ _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
+#define INT_DIVIDE_OVERFLOW(a, b) \
+ _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
+#define INT_REMAINDER_OVERFLOW(a, b) \
+ _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW)
+#define INT_LEFT_SHIFT_OVERFLOW(a, b) \
+ INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \
+ _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+
+/* Return 1 if the expression A <op> B would overflow,
+ where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
+ assuming MIN and MAX are the minimum and maximum for the result type.
+ Arguments should be free of side effects. */
+#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \
+ op_result_overflow (a, b, \
+ _GL_INT_MINIMUM (0 * (b) + (a)), \
+ _GL_INT_MAXIMUM (0 * (b) + (a)))
+
+#endif /* _GL_INTPROPS_H */
diff --git a/gl/tests/malloca.c b/gl/tests/malloca.c
deleted file mode 100644
index 311be569bc..0000000000
--- a/gl/tests/malloca.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Safe automatic memory allocation.
- Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program 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, or (at your option)
- any later version.
-
- This program 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 this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#define _GL_USE_STDLIB_ALLOC 1
-#include <config.h>
-
-/* Specification. */
-#include "malloca.h"
-
-#include <stdint.h>
-
-#include "verify.h"
-
-/* The speed critical point in this file is freea() applied to an alloca()
- result: it must be fast, to match the speed of alloca(). The speed of
- mmalloca() and freea() in the other case are not critical, because they
- are only invoked for big memory sizes. */
-
-#if HAVE_ALLOCA
-
-/* Store the mmalloca() results in a hash table. This is needed to reliably
- distinguish a mmalloca() result and an alloca() result.
-
- Although it is possible that the same pointer is returned by alloca() and
- by mmalloca() at different times in the same application, it does not lead
- to a bug in freea(), because:
- - Before a pointer returned by alloca() can point into malloc()ed memory,
- the function must return, and once this has happened the programmer must
- not call freea() on it anyway.
- - Before a pointer returned by mmalloca() can point into the stack, it
- must be freed. The only function that can free it is freea(), and
- when freea() frees it, it also removes it from the hash table. */
-
-#define MAGIC_NUMBER 0x1415fb4a
-#define MAGIC_SIZE sizeof (int)
-/* This is how the header info would look like without any alignment
- considerations. */
-struct preliminary_header { void *next; int magic; };
-/* But the header's size must be a multiple of sa_alignment_max. */
-#define HEADER_SIZE \
- (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
-union header {
- void *next;
- struct {
- char room[HEADER_SIZE - MAGIC_SIZE];
- int word;
- } magic;
-};
-verify (HEADER_SIZE == sizeof (union header));
-/* We make the hash table quite big, so that during lookups the probability
- of empty hash buckets is quite high. There is no need to make the hash
- table resizable, because when the hash table gets filled so much that the
- lookup becomes slow, it means that the application has memory leaks. */
-#define HASH_TABLE_SIZE 257
-static void * mmalloca_results[HASH_TABLE_SIZE];
-
-#endif
-
-void *
-mmalloca (size_t n)
-{
-#if HAVE_ALLOCA
- /* Allocate one more word, that serves as an indicator for malloc()ed
- memory, so that freea() of an alloca() result is fast. */
- size_t nplus = n + HEADER_SIZE;
-
- if (nplus >= n)
- {
- void *p = malloc (nplus);
-
- if (p != NULL)
- {
- size_t slot;
- union header *h = p;
-
- p = h + 1;
-
- /* Put a magic number into the indicator word. */
- h->magic.word = MAGIC_NUMBER;
-
- /* Enter p into the hash table. */
- slot = (uintptr_t) p % HASH_TABLE_SIZE;
- h->next = mmalloca_results[slot];
- mmalloca_results[slot] = p;
-
- return p;
- }
- }
- /* Out of memory. */
- return NULL;
-#else
-# if !MALLOC_0_IS_NONNULL
- if (n == 0)
- n = 1;
-# endif
- return malloc (n);
-#endif
-}
-
-#if HAVE_ALLOCA
-void
-freea (void *p)
-{
- /* mmalloca() may have returned NULL. */
- if (p != NULL)
- {
- /* Attempt to quickly distinguish the mmalloca() result - which has
- a magic indicator word - and the alloca() result - which has an
- uninitialized indicator word. It is for this test that sa_increment
- additional bytes are allocated in the alloca() case. */
- if (((int *) p)[-1] == MAGIC_NUMBER)
- {
- /* Looks like a mmalloca() result. To see whether it really is one,
- perform a lookup in the hash table. */
- size_t slot = (uintptr_t) p % HASH_TABLE_SIZE;
- void **chain = &mmalloca_results[slot];
- for (; *chain != NULL;)
- {
- union header *h = p;
- if (*chain == p)
- {
- /* Found it. Remove it from the hash table and free it. */
- union header *p_begin = h - 1;
- *chain = p_begin->next;
- free (p_begin);
- return;
- }
- h = *chain;
- chain = &h[-1].next;
- }
- }
- /* At this point, we know it was not a mmalloca() result. */
- }
-}
-#endif
diff --git a/gl/tests/malloca.h b/gl/tests/malloca.h
deleted file mode 100644
index 6fbe45eab6..0000000000
--- a/gl/tests/malloca.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program 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, or (at your option)
- any later version.
-
- This program 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 this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _MALLOCA_H
-#define _MALLOCA_H
-
-#include <alloca.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
- alloca(N); otherwise it returns NULL. It either returns N bytes of
- memory allocated on the stack, that lasts until the function returns,
- or NULL.
- Use of safe_alloca should be avoided:
- - inside arguments of function calls - undefined behaviour,
- - in inline functions - the allocation may actually last until the
- calling function returns.
-*/
-#if HAVE_ALLOCA
-/* The OS usually guarantees only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- allocate anything larger than 4096 bytes. Also care for the possibility
- of a few compiler-allocated temporary stack slots.
- This must be a macro, not a function. */
-# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
-#else
-# define safe_alloca(N) ((void) (N), NULL)
-#endif
-
-/* malloca(N) is a safe variant of alloca(N). It allocates N bytes of
- memory allocated on the stack, that must be freed using freea() before
- the function returns. Upon failure, it returns NULL. */
-#if HAVE_ALLOCA
-# define malloca(N) \
- ((N) < 4032 - sa_increment \
- ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
- : mmalloca (N))
-#else
-# define malloca(N) \
- mmalloca (N)
-#endif
-extern void * mmalloca (size_t n);
-
-/* Free a block of memory allocated through malloca(). */
-#if HAVE_ALLOCA
-extern void freea (void *p);
-#else
-# define freea free
-#endif
-
-/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S).
- It allocates an array of N objects, each with S bytes of memory,
- on the stack. S must be positive and N must be nonnegative.
- The array must be freed using freea() before the function returns. */
-#if 1
-/* Cf. the definition of xalloc_oversized. */
-# define nmalloca(n, s) \
- ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \
- ? NULL \
- : malloca ((n) * (s)))
-#else
-extern void * nmalloca (size_t n, size_t s);
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/* ------------------- Auxiliary, non-public definitions ------------------- */
-
-/* Determine the alignment of a type at compile time. */
-#if defined __GNUC__ || defined __IBM__ALIGNOF__
-# define sa_alignof __alignof__
-#elif defined __cplusplus
- template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
-# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
-#elif defined __hpux
- /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
- values. */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#elif defined _AIX
- /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
- values. */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#else
-# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
-#endif
-
-enum
-{
-/* The desired alignment of memory allocations is the maximum alignment
- among all elementary types. */
- sa_alignment_long = sa_alignof (long),
- sa_alignment_double = sa_alignof (double),
-#if HAVE_LONG_LONG_INT
- sa_alignment_longlong = sa_alignof (long long),
-#endif
- sa_alignment_longdouble = sa_alignof (long double),
- sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
-#if HAVE_LONG_LONG_INT
- | (sa_alignment_longlong - 1)
-#endif
- | (sa_alignment_longdouble - 1)
- ) + 1,
-/* The increment that guarantees room for a magic word must be >= sizeof (int)
- and a multiple of sa_alignment_max. */
- sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max
-};
-
-#endif /* _MALLOCA_H */
diff --git a/gl/tests/malloca.valgrind b/gl/tests/malloca.valgrind
deleted file mode 100644
index 52f0a50f57..0000000000
--- a/gl/tests/malloca.valgrind
+++ /dev/null
@@ -1,7 +0,0 @@
-# Suppress a valgrind message about use of uninitialized memory in freea().
-# This use is OK because it provides only a speedup.
-{
- freea
- Memcheck:Cond
- fun:freea
-}
diff --git a/gl/tests/minus-zero.h b/gl/tests/minus-zero.h
deleted file mode 100644
index 5882cbf757..0000000000
--- a/gl/tests/minus-zero.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Macros for floating-point negative zero.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Keep in sync with m4/minus-zero.m4! */
-
-#include <float.h>
-
-
-/* minus_zerof represents the value -0.0f. */
-
-/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f.
- ICC 10.0 has a bug when optimizing the expression -zero.
- The expression -FLT_MIN * FLT_MIN does not work when cross-compiling
- to PowerPC on Mac OS X 10.5. */
-#if defined __hpux || defined __sgi || defined __ICC
-static float
-compute_minus_zerof (void)
-{
- return -FLT_MIN * FLT_MIN;
-}
-# define minus_zerof compute_minus_zerof ()
-#else
-float minus_zerof = -0.0f;
-#endif
-
-
-/* minus_zerod represents the value -0.0. */
-
-/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
- ICC 10.0 has a bug when optimizing the expression -zero.
- The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
- to PowerPC on Mac OS X 10.5. */
-#if defined __hpux || defined __sgi || defined __ICC
-static double
-compute_minus_zerod (void)
-{
- return -DBL_MIN * DBL_MIN;
-}
-# define minus_zerod compute_minus_zerod ()
-#else
-double minus_zerod = -0.0;
-#endif
-
-
-/* minus_zerol represents the value -0.0L. */
-
-/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0L.
- IRIX cc can't put -0.0L into .data, but can compute at runtime.
- ICC 10.0 has a bug when optimizing the expression -zero.
- The expression -LDBL_MIN * LDBL_MIN does not work when cross-compiling
- to PowerPC on Mac OS X 10.5. */
-#if defined __hpux || defined __sgi || defined __ICC
-static long double
-compute_minus_zerol (void)
-{
- return -LDBL_MIN * LDBL_MIN;
-}
-# define minus_zerol compute_minus_zerol ()
-#else
-long double minus_zerol = -0.0L;
-#endif
diff --git a/gl/tests/nan.h b/gl/tests/nan.h
deleted file mode 100644
index e95ceb96db..0000000000
--- a/gl/tests/nan.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Macros for not-a-number.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
-/* NaNf () returns a 'float' not-a-number. */
-
-/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
- on the expression 0.0 / 0.0. */
-#if defined __DECC || defined _MSC_VER
-static float
-NaNf ()
-{
- static float zero = 0.0f;
- return zero / zero;
-}
-#else
-# define NaNf() (0.0f / 0.0f)
-#endif
-
-
-/* NaNd () returns a 'double' not-a-number. */
-
-/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
- on the expression 0.0 / 0.0. */
-#if defined __DECC || defined _MSC_VER
-static double
-NaNd ()
-{
- static double zero = 0.0;
- return zero / zero;
-}
-#else
-# define NaNd() (0.0 / 0.0)
-#endif
-
-
-/* NaNl () returns a 'long double' not-a-number. */
-
-/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
- runtime type conversion.
- The Microsoft MSVC 9 compiler chokes on the expression 0.0L / 0.0L. */
-#ifdef __sgi
-static long double NaNl ()
-{
- double zero = 0.0;
- return zero / zero;
-}
-#elif defined _MSC_VER
-static long double
-NaNl ()
-{
- static long double zero = 0.0L;
- return zero / zero;
-}
-#else
-# define NaNl() (0.0L / 0.0L)
-#endif
diff --git a/gl/tests/putenv.c b/gl/tests/putenv.c
deleted file mode 100644
index 5461273084..0000000000
--- a/gl/tests/putenv.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2013 Free Software
- Foundation, Inc.
-
- NOTE: The canonical source of this file is maintained with the GNU C
- Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
- This program 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 any
- later version.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdlib.h>
-
-#include <stddef.h>
-
-/* Include errno.h *after* sys/types.h to work around header problems
- on AIX 3.2.5. */
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <string.h>
-#include <unistd.h>
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-
-#if _LIBC
-# if HAVE_GNU_LD
-# define environ __environ
-# else
-extern char **environ;
-# endif
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of 'environ'. */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-static int
-_unsetenv (const char *name)
-{
- size_t len;
-#if !HAVE_DECL__PUTENV
- char **ep;
-#endif
-
- if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- len = strlen (name);
-
-#if HAVE_DECL__PUTENV
- {
- int putenv_result, putenv_errno;
- char *name_ = malloc (len + 2);
- memcpy (name_, name, len);
- name_[len] = '=';
- name_[len + 1] = 0;
- putenv_result = _putenv (name_);
- putenv_errno = errno;
- free (name_);
- __set_errno (putenv_errno);
- return putenv_result;
- }
-#else
-
- LOCK;
-
- ep = environ;
- while (*ep != NULL)
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
- {
- /* Found it. Remove this pointer by moving later ones back. */
- char **dp = ep;
-
- do
- dp[0] = dp[1];
- while (*dp++);
- /* Continue the loop in case NAME appears again. */
- }
- else
- ++ep;
-
- UNLOCK;
-
- return 0;
-#endif
-}
-
-
-/* Put STRING, which is of the form "NAME=VALUE", in the environment.
- If STRING contains no '=', then remove STRING from the environment. */
-int
-putenv (char *string)
-{
- const char *name_end = strchr (string, '=');
- char **ep;
-
- if (name_end == NULL)
- {
- /* Remove the variable from the environment. */
- return _unsetenv (string);
- }
-
-#if HAVE_DECL__PUTENV
- /* Rely on _putenv to allocate the new environment. If other
- parts of the application use _putenv, the !HAVE_DECL__PUTENV code
- would fight over who owns the environ vector, causing a crash. */
- if (name_end[1])
- return _putenv (string);
- else
- {
- /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
- to allocate the environ vector and then replace the new
- entry with "NAME=". */
- int putenv_result, putenv_errno;
- char *name_x = malloc (name_end - string + sizeof "= ");
- if (!name_x)
- return -1;
- memcpy (name_x, string, name_end - string + 1);
- name_x[name_end - string + 1] = ' ';
- name_x[name_end - string + 2] = 0;
- putenv_result = _putenv (name_x);
- putenv_errno = errno;
- for (ep = environ; *ep; ep++)
- if (strcmp (*ep, name_x) == 0)
- {
- *ep = string;
- break;
- }
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- if (putenv_result == 0)
- {
- /* _putenv propagated "NAME= " into the subprocess environment;
- fix that by calling SetEnvironmentVariable directly. */
- name_x[name_end - string] = 0;
- putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
- putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
- }
-# endif
- free (name_x);
- __set_errno (putenv_errno);
- return putenv_result;
- }
-#else
- for (ep = environ; *ep; ep++)
- if (strncmp (*ep, string, name_end - string) == 0
- && (*ep)[name_end - string] == '=')
- break;
-
- if (*ep)
- *ep = string;
- else
- {
- static char **last_environ = NULL;
- size_t size = ep - environ;
- char **new_environ = malloc ((size + 2) * sizeof *new_environ);
- if (! new_environ)
- return -1;
- new_environ[0] = string;
- memcpy (new_environ + 1, environ, (size + 1) * sizeof *new_environ);
- free (last_environ);
- last_environ = new_environ;
- environ = new_environ;
- }
-
- return 0;
-#endif
-}
diff --git a/gl/tests/randomd.c b/gl/tests/randomd.c
deleted file mode 100644
index a3097efb4d..0000000000
--- a/gl/tests/randomd.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/* Some random 'double' numbers used by gnulib tests.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "macros.h"
-
-/* Some numbers in the interval [0,1). */
-
-const double randomd[1000] =
-{
- /* Some not so random numbers at the beginning. */
- 0.0,
- /* Then some numbers generated by GNU clisp. */
- 0.89255299921822260894833866359,
- 0.56160033401164667976788987953,
- 0.51743003502243816003616725706,
- 0.78419011286685927826225711525,
- 0.64400370685467819470063888148,
- 0.38151255107934048933308886009,
- 0.279822118770531878839000163945,
- 0.51983544681375980919751125922,
- 0.314601557551148376372971500376,
- 0.44551938964685651088492647794,
- 0.44235192503793823441729544512,
- 0.0040120762636767874958681841509,
- 0.57608572759464216512285032474,
- 0.69151953350396585566714564265,
- 0.65634190642598148152780718322,
- 0.68520459394253807590733184567,
- 0.60728078832107635628786818115,
- 0.376679934380311318950949959986,
- 0.48893422455419005003224231708,
- 0.59664228319132670346209747371,
- 0.70162191594290728927555900075,
- 0.70981089000005327192380201706,
- 0.480574069305863387682360414433,
- 0.369264627455974856929910550376,
- 0.42224495444170593700839286742,
- 0.96974027194201320964041066537,
- 0.69950081092902694549973698004,
- 0.366921803754944985368022837045,
- 0.19460757354611588216534077527,
- 0.046437559879825520495822908204,
- 0.57694149138457596563075731094,
- 0.49632733844850578203860859535,
- 0.80735347459453553970910033766,
- 0.210271595033975357161360058967,
- 0.176539870249396534142059724214,
- 0.75320267419158828905982021879,
- 0.09535042912249636739069790414,
- 0.41433965906065337672703334968,
- 0.62189345390648146852641556292,
- 0.322595610794052908153116342595,
- 0.173860860827838938281708881865,
- 0.55258425878412963601205794028,
- 0.066559056629606284504735241978,
- 0.0193835990781649263368095562556,
- 0.127101629778251450428653553143,
- 0.9603475517586241593077319367,
- 0.68429794014738591042302507235,
- 0.0139808909843634026741151214975,
- 0.0036035679428138856395527711611,
- 0.072656401341518399752950821809,
- 0.229562863635014486626281702425,
- 0.88337277579960676546469424767,
- 0.88850212167800818244030104263,
- 0.208063225990716089095767541316,
- 0.268304917462565269805874454916,
- 0.3195427196271617997151392088,
- 0.59101407246003811289573881403,
- 0.972093867752368095080492689,
- 0.409246208960242309650511849637,
- 0.84250639316418167849010246997,
- 0.063842712141624332977179722113,
- 0.96470327141354888687046060373,
- 0.43109879978424216966175314888,
- 0.14551248610248934836482236208,
- 0.84819094513299136408788493212,
- 0.41166757935215520377191731704,
- 0.96020915727830366672170130175,
- 0.55313106883839046701902022583,
- 0.9796595451013758579218900134,
- 0.74222694300533435700276764516,
- 0.117294243075539310976051880564,
- 0.32216824750097146958151447387,
- 0.59090211400137031908131441,
- 0.116841680533127258304897076543,
- 0.83595865401141052310417569507,
- 0.249488155772987988074361149176,
- 0.67896015287499211280971531326,
- 0.72256498621401843299673078876,
- 0.327315362968271601258667297595,
- 0.37438214921868498405279953481,
- 0.76929694812658272272027330778,
- 0.44282297788821568912463681727,
- 0.59517407740270913902014268964,
- 0.346217547960702024419571713567,
- 0.68339868731911838904373225224,
- 0.057507087039986776837238366719,
- 0.1189343986186977384509521024,
- 0.65646666532916174831489781194,
- 0.80925124288745606089697795707,
- 0.61302937875769552609444313984,
- 0.64367434863387777107222872563,
- 0.059228300879437554416166010005,
- 0.76899237494115809397158171526,
- 0.335797991302131791511629123206,
- 0.72923178692628392090326699514,
- 0.79300056654108221012876564405,
- 0.58866760551158502690719665335,
- 0.65249222174748700395779659047,
- 0.79573528799715877963614353006,
- 0.101363067664632247385474166088,
- 0.392494669960902131436398643207,
- 0.37323453200630776302168616197,
- 0.29857554596542776498065634631,
- 0.9796202149626312305197715787,
- 0.58770219934833805722677794788,
- 0.126574575737099431915356308504,
- 0.51086682994362911961448609847,
- 0.26221303911946316754295166201,
- 0.87331402410090670707406246035,
- 0.08604799064198292716037672196,
- 0.77880380648915901962140523059,
- 0.34131646312914811415381942246,
- 0.422787222735822749759714960156,
- 0.16550478231620269333824890372,
- 0.84087065799129220871741135711,
- 0.96561976597443996963329538915,
- 0.059890627133354026356081805998,
- 0.09359839900604706997291172522,
- 0.61463026659668017286248279853,
- 0.220582135665522265733252389516,
- 0.30146695094150797543070759948,
- 0.406591688270652513808216198946,
- 0.206959751707199812083987569348,
- 0.71382992952779021033600406503,
- 0.98971690700151825984363090029,
- 0.86339958328134745391858859595,
- 0.70037828363249257457230217791,
- 0.97380974339470107231135690474,
- 0.9184635965630883290893011311,
- 0.418605216026507942885819265225,
- 0.61793227858714759711625818653,
- 0.67394880797682685081908511723,
- 0.98871101941805039780826467279,
- 0.65973593853137069988371349845,
- 0.93348525072186907424189028727,
- 0.59164378220465485142298641014,
- 0.95303768733773138214124075961,
- 0.88667310242538944858141870801,
- 0.83785319781204861623008709825,
- 0.54026788227426708201242457367,
- 0.74842599257855801522259951132,
- 0.286624102305531463268442510375,
- 0.41180484980938874161376712508,
- 0.22754664620316922947541651384,
- 0.62360609793949755240041318939,
- 0.3311618194042077047850111557,
- 0.315407885695867020730009836503,
- 0.215221706711430951961780213436,
- 0.168600630933631406101821024413,
- 0.62661489373200405241464923618,
- 0.95357070304277219756741072036,
- 0.5186418766697788447635039428,
- 0.70772930521061953327927296944,
- 0.410376884797056150221504703145,
- 0.39705302343406249619577860633,
- 0.79215885822696034431481699125,
- 0.157831717946112504384603002152,
- 0.26892306298536012837855426922,
- 0.15697088614321016223211167568,
- 0.41395315712905823355235182393,
- 0.043977876945327860015049914653,
- 0.91453495544799358550673657283,
- 0.46230093259088633973148827911,
- 0.79479146768024434444120965094,
- 0.1466704986407674407377422815,
- 0.093614591443204076599999803382,
- 0.66061870961706149406527099303,
- 0.087462146328394574476138187113,
- 0.79683664444310818297700615557,
- 0.39732728185755441060070738751,
- 0.141934473990413594291362391075,
- 0.63111751995951919258061547632,
- 0.78521985432793823024330967029,
- 0.53307346282606806792796696141,
- 0.61679109370763781010143645189,
- 0.40696293619387120891515025426,
- 0.68670343879278712242412028794,
- 0.0115112936831136012901340526452,
- 0.70866056737692430987650236649,
- 0.75378980574358943122474800795,
- 0.17133202766710894969283150847,
- 0.36771201738922655520549864974,
- 0.64614182581953931840374311331,
- 0.354495602088990708111406368474,
- 0.96418771817934443444348833491,
- 0.51633426669933834634574104246,
- 0.064671329812306055349433587193,
- 0.084335079914541732137341401384,
- 0.98578018340150609333535890283,
- 0.32988119060114570391488875477,
- 0.70568290443337103364762141207,
- 0.7501960060851696034137148851,
- 0.141312840936106004164373056114,
- 0.60721022154106372815080238296,
- 0.49179275887283771965744826261,
- 0.85530668893284708999269819019,
- 0.09730053915339358769067661488,
- 0.48817911888023094845428570434,
- 0.37116312252354470380676793579,
- 0.61870369881699387959990992873,
- 0.381874188039839457469043174076,
- 0.68193837613090719561872304949,
- 0.4773618313988618747215621251,
- 0.152383599292709764750406667286,
- 0.54317522808228983459963725598,
- 0.363848788591302782268887022354,
- 0.0105589810271147011378412305973,
- 0.55582445068669939957392951111,
- 0.99910376130213936748996659383,
- 0.90286867348280161480903197439,
- 0.48268382934936288156485037692,
- 0.0976084557356802030533675394,
- 0.29004949962481398455881920169,
- 0.99169758897256717005011514856,
- 0.20722895154834288274430061308,
- 0.50294863638464584121275744208,
- 0.71094033855350495714847377558,
- 0.94078709219520224551350834268,
- 0.48088262771516317628650315489,
- 0.80538698628980761175811796611,
- 0.83495029615293903361580945571,
- 0.67996381940825251937974905761,
- 0.57936805772275234468590364926,
- 0.41778137764942046281708286844,
- 0.161602687591454506771276482303,
- 0.093910625156097743113739432334,
- 0.45716763620641108625606409874,
- 0.96455075374827233820027584808,
- 0.5179966880512917274934448216,
- 0.046797382046060065926143985952,
- 0.83673567319931334127111064225,
- 0.44224504444533247245974476514,
- 0.73281179385894336737033582786,
- 0.5642490153724193432309549673,
- 0.83700200507325250303481208805,
- 0.152714941779871552944298597052,
- 0.38606607994977770238226473985,
- 0.0155140917516105439042442246577,
- 0.51621537013393688713546096688,
- 0.311969390991657895966526156064,
- 0.83890647777450698803932943984,
- 0.54370750820133482930695388638,
- 0.98636765788772465929756760473,
- 0.77334255661128878905675504339,
- 0.57070354296508751519811368688,
- 0.8365252076669013372866223481,
- 0.344601601940890721182485798794,
- 0.92658930620470543221158939208,
- 0.72724523363899270076210273102,
- 0.413672082025645586061788451734,
- 0.5132836422023222169840403333,
- 0.82135610583961360173883281975,
- 0.423835065039748889417547786563,
- 0.87083598844595488941471761572,
- 0.59009392451459866513886634656,
- 0.206124826643305920436961792363,
- 0.288685540685143988030522421633,
- 0.7944357933456167153993184889,
- 0.090945230657758780394996530608,
- 0.52981750421369669363095418817,
- 0.091368944984485824360107751981,
- 0.81824925769562351657564377069,
- 0.083315412912658535228751011063,
- 0.59602276778799576464600065047,
- 0.52258035262146456789454411102,
- 0.394692074165738897132014378974,
- 0.92031214264405188928824363967,
- 0.32812665356161216265971156268,
- 0.79754299890007289545033977389,
- 0.3029021512227565310021437326,
- 0.81425785760698537744367921928,
- 0.85199399843570233736733560413,
- 0.096629890212080240754541391968,
- 0.60643798959967098211181910285,
- 0.75368518979236587723780129098,
- 0.451368813651510369666120626045,
- 0.86189868235067352904955566961,
- 0.239506411296874624231401913963,
- 0.143392266376287906568670938457,
- 0.035585084401323981008798496622,
- 0.89407531932950775763701297226,
- 0.56699767164913732414312190205,
- 0.6107715946195223295493238966,
- 0.980870588312723808697191463,
- 0.37603666613089681502774907483,
- 0.19565477083291620146833762404,
- 0.70326913680165706368122461762,
- 0.98247770640436619202690080984,
- 0.54911931698472764719220618506,
- 0.96749331150477343995263612791,
- 0.9349501605275792139661332597,
- 0.067704019779021886031495084945,
- 0.52883185005352261786874768842,
- 0.03879817199556086106868125058,
- 0.011268895714104342862021635882,
- 0.86781395233112768504418642287,
- 0.73610697666830606371057497872,
- 0.22595829849389174304359852447,
- 0.95990840938724981323147621815,
- 0.5938079875208820675776232526,
- 0.78655922365792476391655372464,
- 0.51099073264725007373467108776,
- 0.66474884887866769539664215292,
- 0.88640025828226102852258218854,
- 0.39889893489572927635368967129,
- 0.76340426725003756852384366924,
- 0.485534753598641026618647825146,
- 0.55957578573824837450384728978,
- 0.50840543283094885180866842941,
- 0.0102415845792896532313226969615,
- 0.74666891036262398733922051708,
- 0.49044748088989431070743849791,
- 0.184017043174756439606592004597,
- 0.0225210121470402648790231578307,
- 0.096909683465740960387467976065,
- 0.0521874432095560437920256545446,
- 0.108114343037383115951564617563,
- 0.77430486784405922952977031491,
- 0.73286432949907824441702845144,
- 0.083559249182272369453587951223,
- 0.074541345541671560054508020717,
- 0.55130541064331728019681677403,
- 0.101450912226971008587146654246,
- 0.74564503962660370005995595861,
- 0.55903832180264925580029280922,
- 0.86098138284846671753408133719,
- 0.76146956314354797691373262733,
- 0.5569854467166466965564479865,
- 0.61138555623626762560168304163,
- 0.93778268377974305185411499629,
- 0.106728342608615813606903105742,
- 0.51139895550624845300079248199,
- 0.8826404150665399364200384063,
- 0.79849755952621824621632991954,
- 0.60058338183244813128378689372,
- 0.57271235605091257806409062354,
- 0.134476676178095582804914204515,
- 0.62710051406343298533266304307,
- 0.21517566131268423511744492316,
- 0.87763268502269127056352092234,
- 0.259516013975152388767641295316,
- 0.54026961752737864438921779715,
- 0.0321012344232942464157113655476,
- 0.047765687217921465801489989111,
- 0.17851281529041807770891682623,
- 0.67864372391481596436180177405,
- 0.27188630999531652193578141334,
- 0.76570352378902765382129471855,
- 0.55727605717645959087760838806,
- 0.40035295538031700787360193533,
- 0.65772683660586524086245866733,
- 0.87515739410383285146563935658,
- 0.51637173718066431535845791928,
- 0.32843440805452173782945632394,
- 0.46789250836790673252530282969,
- 0.153916136058705475580104911632,
- 0.38115724589238346986896925035,
- 0.96911901452270741576104655076,
- 0.327510878721849788805057952285,
- 0.52921188196053063832762822112,
- 0.357891066893689952162669812174,
- 0.8109495999496825638917226258,
- 0.87378695338223548954000159812,
- 0.071735687760291841872657613394,
- 0.22099818521305441851106524174,
- 0.61319403424123059973018445501,
- 0.49185069904977836269777464774,
- 0.8465618819298531473261910176,
- 0.88263955123256235889766657732,
- 0.264605739218701311737446373095,
- 0.157257748694727606809000832224,
- 0.61172692557424578980817509135,
- 0.89224381101792427145783648267,
- 0.049436313890546252030141534714,
- 0.78472068655126867546237630366,
- 0.94890896727672958163705440614,
- 0.61244719025309458330037069759,
- 0.69652639673616920270100103049,
- 0.82306805868313923466426022855,
- 0.4619352653236511042512479492,
- 0.248913888569715263431474781448,
- 0.64972077945521993267494748532,
- 0.058989138867897862567374093665,
- 0.97969837050674699927934092348,
- 0.112860503606029382332397067852,
- 0.9148268966080465389473749031,
- 0.80522292073416096202056634334,
- 0.80810563925192214527344776336,
- 0.082994810842601316055993203972,
- 0.58154183958194788097113770541,
- 0.91401321304178026032151961143,
- 0.064162440925738934087179609749,
- 0.15233762499249088696399602351,
- 0.05051666992337641462246832006,
- 0.138526581114846840617440323377,
- 0.3330645447918149831766264793,
- 0.217487368997014213919568641696,
- 0.61893770768550649722673903221,
- 0.48128956859001312165262121487,
- 0.67074178502738313699688470847,
- 0.74389636308055141796746779725,
- 0.78623735396470085242463142878,
- 0.74044466560335570728816983391,
- 0.44977042205766449238521848558,
- 0.04936658918716696558210777333,
- 0.46898154881467544198433735515,
- 0.86577421926732888331279455256,
- 0.351697801257336354285066689416,
- 0.44607679846684358775746123434,
- 0.68542184287580537292736482205,
- 0.044146424753083577398366558491,
- 0.84496717026871403905274974765,
- 0.20398318496314438897842101827,
- 0.75107700174605698650069666924,
- 0.178571061661964354577482608798,
- 0.67178502534981979941629966218,
- 0.90847842600882488644789391115,
- 0.073076683947302775918335357377,
- 0.33981323802799502107773228774,
- 0.88205531070102240708858032672,
- 0.52395959911163033140017417074,
- 0.339537812421755656306362620887,
- 0.54102447887624739438002987695,
- 0.99615637434542139613844677579,
- 0.91178029521112995461052949527,
- 0.75825739605806537625994927603,
- 0.20376049709427102495755901889,
- 0.414724980644126108685694310425,
- 0.33340705339227162790042902392,
- 0.63442350111338002489027718102,
- 0.79083735924049231993808201264,
- 0.7022290803727963570326957922,
- 0.073051026670174816217706335151,
- 0.50842348505687696224462184336,
- 0.32363091931107924009593033016,
- 0.097074638787613630803324174721,
- 0.79231345620836950165162896374,
- 0.46134517653790366185204412042,
- 0.87767180094474465071641454817,
- 0.30504377737897498569142680272,
- 0.96430402804903305707372788262,
- 0.58722709934909516402891605024,
- 0.36287829330987989626587492725,
- 0.341369045118572012709880807167,
- 0.18622546427505557603629823709,
- 0.71794779555885705340742601105,
- 0.098775720656078510422828040021,
- 0.94170390436210924588938028149,
- 0.6256516749208606216856038288,
- 0.84990648194056707180867958453,
- 0.24897158268824763099382644974,
- 0.67126976686560821454618204853,
- 0.18287142221906188751198231263,
- 0.58301735289988287890086250316,
- 0.39451451502323596545833498888,
- 0.64778726863510310777659172018,
- 0.344060647976610102257104623935,
- 0.8543225374577925606075052273,
- 0.41721025737118350088955048104,
- 0.346301150923723212219486824146,
- 0.430145349151890094004681136873,
- 0.083653676599147505357408467754,
- 0.89927285917733406113015320169,
- 0.87717630249665962395834008139,
- 0.114609060439245285884826496387,
- 0.19079403943711412757743782207,
- 0.095752662525740063245815699042,
- 0.79249438764728213221559489213,
- 0.36889557473162465630046043798,
- 0.076691690566591062968137595944,
- 0.82502767429905549906741868154,
- 0.7665582347663079379259164121,
- 0.40329445688627141530172819257,
- 0.76025417855373928649612014969,
- 0.67742016809536470259225177395,
- 0.56458198627250149175789836481,
- 0.78923506303765674533158921804,
- 0.242546191857944356752822856477,
- 0.5429792204847717222270173404,
- 0.7269010821579782458839227112,
- 0.68884017933657182784660476876,
- 0.037868346502260087811459749823,
- 0.5900507745679403546108564628,
- 0.2867946536016681954708929644,
- 0.47061390957475445523849010039,
- 0.51289737877965767076806069599,
- 0.422963220866519099525024712084,
- 0.056516063514784913538055836342,
- 0.77559606292381102490968685122,
- 0.44812023547000818124896526252,
- 0.8496368064876247362896528731,
- 0.272242276648834925536741986616,
- 0.21366791927514210787832263868,
- 0.458126557153035507756298880855,
- 0.59095285049337797286946531198,
- 0.41387171106200290943847880691,
- 0.040527832792286543640976926214,
- 0.84749051864346812142321430329,
- 0.6591922374100337646083630177,
- 0.30504037894556796180304594549,
- 0.69588062596190762407598122745,
- 0.54615362946297678668402889519,
- 0.27179536774730804380125320985,
- 0.16312965572910266758089041195,
- 0.60443803311418335000528681396,
- 0.76221957063947757300487766314,
- 0.0012561481228798307955579245318,
- 0.38477311712200424042679172286,
- 0.86336953839931184684851388121,
- 0.85132017314817690655384788334,
- 0.79741410166633177181313320738,
- 0.81142674213295830272567127246,
- 0.90095974521916505411272740187,
- 0.461262866736651478343958282766,
- 0.163149749038393754125992055513,
- 0.079563568933303239293664877234,
- 0.0076308467066608702534098522771,
- 0.74020408989686798939059759005,
- 0.68004244363120265645245845544,
- 0.99423282025586676895879517721,
- 0.256512790150101579655974619204,
- 0.15841489307390214447222985222,
- 0.53156533193583516285295078457,
- 0.51195175518666885397864463638,
- 0.2688502522458221215136352473,
- 0.290743998007688539265414246556,
- 0.375642431327791011131765421904,
- 0.73366824563603699669790620984,
- 0.89031055476039433366324605036,
- 0.63269458446317741594059410575,
- 0.79677646360837164675956632,
- 0.91096051787867659208019728176,
- 0.056411022047894420770349313174,
- 0.7117937367428418076554349793,
- 0.494496454398059649677550547185,
- 0.9944698091905991687808626336,
- 0.195654008095567563746040882677,
- 0.33245249703376584453346565181,
- 0.91671965905832444523554539619,
- 0.104159073216349402499760928077,
- 0.78250381705179599027513221262,
- 0.82221952254403323129879405024,
- 0.25404653774104883427079980313,
- 0.89334850648967094099280368977,
- 0.2721479244387740074938025269,
- 0.58627710421889854554604323774,
- 0.80740872172002770008164688167,
- 0.295213737773499230779293451686,
- 0.366266263469556210902410635735,
- 0.72189449997560167388059780325,
- 0.91339160960295327548014703572,
- 0.27978723834100283634925494393,
- 0.44312275285067091147157546317,
- 0.88264479919648468925459438057,
- 0.74860386620420068665117140949,
- 0.97534502025842784289380076051,
- 0.183653687608870314454061893335,
- 0.14143760686328530307343938507,
- 0.7794390875763962068165432699,
- 0.79988123088296718350409621263,
- 0.91344402454829897860268279997,
- 0.3003753710559256572305330721,
- 0.92236868180619898327118824659,
- 0.85128995509445007265453349716,
- 0.51226586850988855988005111668,
- 0.59328586801467434659081264762,
- 0.131543061349700789237108200816,
- 0.97962864281984756641024957818,
- 0.80003961712390827564285728721,
- 0.07332191035039234849987853587,
- 0.33710892945255754021249327366,
- 0.237798240512212115424045579506,
- 0.050628096786899757905464602857,
- 0.36368141580193860149061967396,
- 0.074547282281222729072803274018,
- 0.32013351651022219595136046535,
- 0.50087363542319392259892635316,
- 0.95534128322832584718763016378,
- 0.63089810554419660091974256912,
- 0.45937043591639452731937380837,
- 0.77794827072126710252068287081,
- 0.5833967217973934570703322242,
- 0.89948711130168823436943591707,
- 0.88448792344727137087709578749,
- 0.75774410588649351850782212564,
- 0.51545850808454807305763364038,
- 0.89535564141616759448334976604,
- 0.433876155086630438489414332084,
- 0.263145194001722566517185175524,
- 0.094513715303174637696079970882,
- 0.0067905149976316075236601623182,
- 0.3746548325271489972742277758,
- 0.81418012245523025207375976459,
- 0.7382555515800124086679648947,
- 0.71505454385778976492869269043,
- 0.7698698840252614242858413632,
- 0.53096667868591647121855295207,
- 0.5913146508318579789498085478,
- 0.82865413011200335887487636747,
- 0.246477924915753655378269255135,
- 0.7718625116939460952174295485,
- 0.33088224685104582360581424038,
- 0.077396220323469426942810035952,
- 0.399851739373243384531661374094,
- 0.74828949567652386217126904324,
- 0.55533476993642340021791702209,
- 0.475356366587838670689554086714,
- 0.99199926249299355831492581518,
- 0.60739053074816626181185925167,
- 0.94570422855790142383862352906,
- 0.67410117583869264525962136333,
- 0.99340016295179621471645098914,
- 0.30521664837678549625426072163,
- 0.82786899862234431119578444516,
- 0.0246054418785779831964997687095,
- 0.33057040500642957115284791089,
- 0.325865542252271051046671982904,
- 0.116469964535698881624567000313,
- 0.38792519202192930208550481713,
- 0.147033252049062199325747990948,
- 0.333360890210745561370686771174,
- 0.267717098935309378552279527125,
- 0.473606191830554736751491306975,
- 0.69379726024488030302072707274,
- 0.39866105325920152799379542147,
- 0.075996151521605600512218326895,
- 0.43692155239290098173990417979,
- 0.63183509185797834489905365016,
- 0.327726835190132824885685947736,
- 0.82769389015654780671213364517,
- 0.38036542617183448008870457384,
- 0.06416363778906221378580326597,
- 0.95989693996326393340364540321,
- 0.77473792948077472252492320019,
- 0.73353080354752465520384745159,
- 0.79531316211939777703706647305,
- 0.31887745411495362933791547194,
- 0.5504233366621661345254817397,
- 0.133841546560512334978343647306,
- 0.93323316393590598213508657757,
- 0.219534116905903225236593922786,
- 0.352227557302752346568799070044,
- 0.50699048681296139093781410327,
- 0.56063256677949754339755086295,
- 0.97859418495668224120337606178,
- 0.43217748779939454097021337034,
- 0.6118800794139137562939270606,
- 0.8826339041571606455078384688,
- 0.190654349423411314990846249777,
- 0.0272323818569649486990095499454,
- 0.13501820915175992368033644254,
- 0.34430252524220055863712676536,
- 0.135013324503164182485257894453,
- 0.83301344777287732687815180326,
- 0.71146270180847724757833953093,
- 0.059584725284656364940760846576,
- 0.124388342467555907606115942139,
- 0.86760011350010388002288781466,
- 0.43443235444248399222879725088,
- 0.62257025564267773540408523682,
- 0.42224480338939459869117553607,
- 0.122203729563367693705179104655,
- 0.86763329805228175173701751082,
- 0.61852711996472568821866689006,
- 0.9981036801779161471700405786,
- 0.177126618334123901292041594724,
- 0.37033568941002233661950847289,
- 0.81720705981865203019383851894,
- 0.194752883553301253160228353622,
- 0.5399475493930702257701115294,
- 0.21555050095259535717046390477,
- 0.031480898918419061738395489394,
- 0.0108626235742996694506893658131,
- 0.29439861659506237876675916168,
- 0.25969803792963051605662393213,
- 0.64305111681301349941082616522,
- 0.398301763391130971280749586885,
- 0.82959279528518208376169366062,
- 0.494452121232255582677051524076,
- 0.032046850110252624668328949032,
- 0.304808216164121089322038632124,
- 0.43743086801077933536332835933,
- 0.067635143022119684849606244687,
- 0.062601171413915686472972559687,
- 0.80704249768256597155262089974,
- 0.049090587901867220876053770281,
- 0.14290280489067737067786839775,
- 0.85153414385190808252068833198,
- 0.052035578866778404379096518691,
- 0.84803461110488710482683367176,
- 0.323391780352303842858779454674,
- 0.52713499343541339922976296515,
- 0.91034109375479019837692785976,
- 0.106146556890642346491650008212,
- 0.291532189474064930184344798145,
- 0.330494959183718721493342551525,
- 0.6236537208920888603043773443,
- 0.89122121355780761549659392994,
- 0.51799810738861013193016943087,
- 0.249256177739037963581221438965,
- 0.76322106809612787470242640888,
- 0.97852511972383831461233976406,
- 0.52255677693690499607690355455,
- 0.4450034860583097087122794844,
- 0.79114162250324775713725095404,
- 0.94756217345536380876998110362,
- 0.58677918818329126036021764787,
- 0.84845252924877884299669190981,
- 0.30081720041370757827674016113,
- 0.27920525653128846538023076229,
- 0.33471466998109052439193176801,
- 0.77432114969973711331784009482,
- 0.79975078898170550460312445454,
- 0.90029380309155505829673878957,
- 0.22735855793472972935624370264,
- 0.83917898101167717908999667914,
- 0.96001063929762371813642857618,
- 0.80557845129235602137075744771,
- 0.227828260252387705994553631692,
- 0.45514459312672738783331856798,
- 0.6996049090759249573037751274,
- 0.76407211467383802388153449844,
- 0.35750763601712374361686514082,
- 0.090157662209549066428683554241,
- 0.95043897530001474792481472865,
- 0.97262166470012788338731033975,
- 0.203045895422423613196589718133,
- 0.217437635156560627036179586425,
- 0.5222956932204809424910993278,
- 0.52865060708104384493756729767,
- 0.97715373213739469800445297208,
- 0.5740174414400501666597490431,
- 0.172348314420047937640907870932,
- 0.57197038071649167881433868039,
- 0.26289948915209002196358225729,
- 0.177903112174726341611524884074,
- 0.74917239660013094610681443816,
- 0.59837085384984040836442442706,
- 0.065070324689375259831989322427,
- 0.44807493892928848916566949155,
- 0.59027783360778386064107723777,
- 0.122058971772529617939528531479,
- 0.18965096763129552013799044806,
- 0.179455202785822708296801760066,
- 0.032170979041981235014758366854,
- 0.297222966386620738492021519056,
- 0.91323423393143490893801153646,
- 0.75998869946268189685327906564,
- 0.83934073246383862944110864099,
- 0.17898779712956184324621175982,
- 0.480986398855505957279379560397,
- 0.60860751560721289727164165043,
- 0.298927282590269088379100218673,
- 0.77935020447343759584143119835,
- 0.480545242963934573648858250607,
- 0.85619790637736236353631524289,
- 0.96488893882602300700764346564,
- 0.36351865634843046736230405883,
- 0.82895257550724293657223335349,
- 0.79749691055514662573933190753,
- 0.20106705267868388883102752272,
- 0.33623918491977977623116871123,
- 0.93256466340279772952587363977,
- 0.88648669501682764515636262464,
- 0.47662235152771500250187825963,
- 0.52659238455883068245922982067,
- 0.94111676559395948458425469814,
- 0.323317713690175795284098362026,
- 0.34796405933091263994264450729,
- 0.52445433363119391822452105405,
- 0.525140277317638922334264421,
- 0.64469482443585357444532895759,
- 0.33472685924872903603447879104,
- 0.42400458791646499703641118014,
- 0.8222662798441265944554029489,
- 0.75524567154228028735673060411,
- 0.90790601849806560799894333131,
- 0.75164241313793249434488428193,
- 0.38724602290468111557712203885,
- 0.36352513950081020449187506395,
- 0.078398790907179055722325452963,
- 0.5003676822199407758422514133,
- 0.86055044548361328714384972985,
- 0.66748567445598821900669819042,
- 0.95450644393912187127659765969,
- 0.9536501355878008523425355652,
- 0.56207573012593503802043957099,
- 0.99057795680550440527031916411,
- 0.056136908924222021770088579728,
- 0.89322960593560085272815946927,
- 0.19380351076299398770342941398,
- 0.036881975481577328074706357897,
- 0.38834900979665334617449710449,
- 0.77196507761008668275581490587,
- 0.87539115393397618421355963533,
- 0.9131721846286054396553858461,
- 0.62245648254908013430163665866,
- 0.56021174819199355559539089633,
- 0.86987294559046384230921358438,
- 0.474584307464076041054198211805,
- 0.37224942408757353492416873571,
- 0.198307276357215222087716993615,
- 0.81633548414328354008913860616,
- 0.071192681637945014051745371309,
- 0.227203421058334439883665388655,
- 0.50527083273847576806586104904,
- 0.25911353175247232791676189983,
- 0.103567996992606824957067451526,
- 0.98316826751311017109085781757,
- 0.99206610065531611133123425907,
- 0.63838444880264351660305680771,
- 0.90013304139719692321619239255,
- 0.541419881593941428911392944,
- 0.434681681520065487913409442927,
- 0.0277935905905462584654818408167,
- 0.28736085880215502013374946299,
- 0.204706679291990486471085620508,
- 0.29639415300325412139805373353,
- 0.316818074164048785111401123944,
- 0.58068268044073033182148412246,
- 0.137736206950094621238996907006,
- 0.80907996549523150166492783923,
- 0.73799561611209772635015717353,
- 0.84013433924397440368969968592,
- 0.46126521311414726401422152854,
- 0.78013716447507497359555980298,
- 0.83405708922951231042933175851,
- 0.6366367969739079258896472192,
- 0.77353748358406402598000037557,
- 0.17489624725635947111471117775,
- 0.80267952648428412026314875447,
- 0.80437106861315296029137160672,
- 0.62834462177566783487584779777,
- 0.31539602345858033626133832055,
- 0.50541890853061839219557074283,
- 0.0195874476781850222509795360627,
- 0.011676447193909007242643314705,
- 0.85675479754070644130150816794,
- 0.09391269154749661204040398199,
- 0.369625667102334643216258483376,
- 0.84311577046357953313746551837,
- 0.66438426715728382263582851036,
- 0.70530906415261448155650458603,
- 0.446783684004800041373395690117,
- 0.75627790284213576819810990131,
- 0.57190285913753158265774292274,
- 0.97785681370875218892539297465,
- 0.0244503386494348881614690746194,
- 0.48528430854909558202793141933,
- 0.89436155397807056672243211894,
- 0.40757489194485346255194449191,
- 0.91772837786834838909335779229,
- 0.28020326531649972709359017096,
- 0.28847822326776188982020803144,
- 0.93193769743225684077624356649,
- 0.58336147304815741644785105161,
- 0.4004241800179331174134885947,
- 0.265790823692672203607418801725,
- 0.4137092141145146388568879939,
- 0.0255090449126572366852573357318,
- 0.47601725598948555645487446626,
- 0.69141516452580797436419291497,
- 0.187709862166242786826507443003,
- 0.31177816288567708916778389045,
- 0.79635247302484103596788484137,
- 0.14648403361265752358955335086,
- 0.0088027047060531475573345163528,
- 0.90053967411241805345616039474,
- 0.373822238382428585287035417224,
- 0.94303097002109978273901800507,
- 0.037263906643698883423150604649,
- 0.98416823398276433881119247311,
- 0.257766562836474661728601317803,
- 0.09336855716941364387765222813,
- 0.057604551843195630210060755775,
- 0.37732024813036636644231432449,
- 0.437099108019093398068604946814,
- 0.0298274889889844501626534131975,
- 0.54161045457572229928359302347,
- 0.354192069739745951755754451894,
- 0.9952629304832433588789284291,
- 0.61362350596285189174752077338,
- 0.23176197923774029736185020682,
- 0.259000332877923815426717028414,
- 0.77171708810079063604185854121,
- 0.87278431247491539306511051532,
- 0.386310463821549823085972724515,
- 0.19043920209178263945663905422,
- 0.77200547833114724875436606573,
- 0.2683024354984293205497398925,
- 0.144270112550972640008446091075,
- 0.36996280314557984925474224612,
- 0.163548224543250866742712583905,
- 0.54541238293503241055380526708,
- 0.54270760938500008382580072956,
- 0.7374073253240524865446763851,
- 0.93470960326436177572863031654,
- 0.71417607213823278615975270201,
- 0.65837463356664939532769528292,
- 0.433323451649582925271830911365,
- 0.79664580661766246494864588315,
- 0.392079017934601610514677836005,
- 0.212454387416532999103471570235,
- 0.198678082418012501322802116335,
- 0.61525672800559338657275986197,
- 0.99339589895181138684928419014,
- 0.53563057949945927383392076793,
- 0.68817192513245948798192690082,
- 0.59671938169380086666866042956,
- 0.5686075254645125832635026196,
- 0.25860953535454698758704936914,
- 0.60779864941995215785819783969,
- 0.46515241662568547274625942204,
- 0.8756966078479474164213834749,
- 0.89153160343113076353740745469,
- 0.57055911159151577684982200009,
- 0.39366246576557783924065683256,
- 0.53789676931469921495851209609,
- 0.95842028586447684249630374944,
- 0.25218284880717367924827402845,
- 0.23718965807272971860203662735,
- 0.334222632819004380754702693406,
- 0.6370849366068287810411454729,
- 0.722665796162802454203702773,
- 0.50216248905279887048328225791,
- 0.34529823309520970630714708672,
- 0.45098892404492692601908443802,
- 0.64640019115293913591196874603,
- 0.137077316379736192931987264458,
- 0.29368115076039970149731521521,
- 0.20091822953913855557804069085,
- 0.066267083813833718511605782276,
- 0.88094596104423280074202839474,
- 0.071730322265966936504743175424,
- 0.69735904142296779896396736035,
- 0.91352594564083795862432502567,
- 0.13244220377041278512040316988,
- 0.6283911312781029516331064494,
- 0.34896540167805105781090114462,
- 0.6795367801751911186206756471,
- 0.74898526486791573083377925403,
- 0.71700182398199203349731046015,
- 0.121142833366516620257163901501,
- 0.32678002036857151533698078636,
- 0.327511655875027224450064555456,
- 0.0079152053645354575349489795814,
- 0.84748954479623021059675156738,
- 0.75041561033954009809301550159,
- 0.41101693712463238996746228193,
- 0.90155864029338267639417046915,
- 0.35464670537047753945618208157,
- 0.68848712573944472430623590326,
- 0.08893193373618063124738179594,
- 0.58932830480784385636485098641,
- 0.0501618828375381577588978271165,
- 0.9451968329901169788400753848,
- 0.074994725566097580721185016702,
- 0.191860088196691871607965261685,
- 0.67853841063536805868885844477,
- 0.179445375284033906887325905976,
- 0.84157620913886056000430779083,
- 0.7377942162322144186341324232,
- 0.231126715579023126062082806996,
- 0.127662509645324778320005407937,
- 0.63062414859560283674777403205,
- 0.55283326072907470543330204975,
- 0.81243486031688046850257374808,
- 0.299095175225750536694802628506,
- 0.34284433830834748530634854762,
- 0.92098838107935607957057329632,
- 0.6334432153537539286206936299,
- 0.49203336326915182548719200464,
- 0.70089872986754081776092540042,
- 0.410346112246289262244008861334,
- 0.689375704219352519232614571,
- 0.53543492718830214408075484368,
- 0.78985504761729292283075540625,
- 0.66802245726332267870092702429,
- 0.75600588548341120124374250114,
- 0.83217485519464083512235296359,
- 0.77758150309412736979136465746,
- 0.067382141804836913185384124002,
- 0.7289836962356747770023887674,
- 0.453434776313686590560640460504,
- 0.3160796148757468204057886796,
- 0.0098933475787107681104048511314,
- 0.3620064234142809735084479026,
- 0.85993179373877360456391909506,
- 0.90684883450763884954227285187,
- 0.75959171037325548903969803948,
- 0.91219881792279148536349496306,
- 0.97175430264940118917041244436,
- 0.292364544897748356834218017667,
- 0.126096590956329503351026499397,
- 0.058210669685805595156500555938,
- 0.207143479048534791976348255132,
- 0.202837039257860939456824357966,
- 0.459137240079351948795601640776,
- 0.65480905235794807223708347609
-};
diff --git a/gl/tests/randoml.c b/gl/tests/randoml.c
deleted file mode 100644
index 4e854ddac9..0000000000
--- a/gl/tests/randoml.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/* Some random 'long double' numbers used by gnulib tests.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include "macros.h"
-
-/* Some numbers in the interval [0,1). */
-
-const long double randoml[1000] =
-{
- /* Some not so random numbers at the beginning. */
- 0.0L,
- /* Then some numbers generated by GNU clisp. */
- 0.709874756135422554674614242046304686448L,
- 0.486497838502717923110029188864352615388L,
- 0.474019570990182753146861083750226106848L,
- 0.998821069612940336401792152067298257397L,
- 0.68230324395444341476284133813649237509L,
- 0.0812383212795450007980350531141537177532L,
- 0.43131112016001535977175708439191217567L,
- 0.1596337172541222285215378906083607753005L,
- 0.0447361192177328171952931546845870270203L,
- 0.669148550486018286115665314826153614017L,
- 0.398752708644620313955955676251505325896L,
- 0.600019492390024166744893736290881101244L,
- 0.78337397012688890834008412364808365851L,
- 0.747414410152603863408503379239564644402L,
- 0.550615721371501982864462175362996180322L,
- 0.0073983673767251687422683917248311760491L,
- 0.693846360902780799478892082407382699085L,
- 0.751592057901191172906159475240427353057L,
- 0.74000578784995401707243054106755282117L,
- 0.847264623235961908747497547605068838836L,
- 0.917431426585209425652777605148791919017L,
- 0.267532476015101748449269162884835638528L,
- 0.486834088208986505203048715784492259319L,
- 0.4580154564181484580770749178538567666L,
- 0.391521076582874764982597286237947922907L,
- 0.69173131929214083677828129436922728366L,
- 0.995268639187054867212755710743514657877L,
- 0.553189251912843822062196619876802699895L,
- 0.632300552505301947698796653386744186037L,
- 0.445572801006840927064646197943103543344L,
- 0.993634311396905276414701816228609517838L,
- 0.611582274481091436495638926486363711255L,
- 0.017611091105275929341544154464243038417L,
- 0.598936378040443270534796418637146416803L,
- 0.939730325871014729497001074244817030738L,
- 0.385712528561693907444911228190200940125L,
- 0.48796444333495738271693214259711532603L,
- 0.508634972895891442259656591497940133962L,
- 0.88453398179301716552318999435310293852L,
- 0.509099535482633468613040057130206639612L,
- 0.333677997666677081186230843198919594355L,
- 0.82715349353996770180499230535973424237L,
- 0.0372593663309767971914036990047894757662L,
- 0.932828780275931267421133064996449298348L,
- 0.486099261359133830842098860485004683725L,
- 0.987156392631551825781809767746170502002L,
- 0.824739790678073493124786291053674093535L,
- 0.671869573118280976952523743592826377585L,
- 0.48088844444394888967684860088619551899L,
- 0.017233021606613044454327510797750273989L,
- 0.988102711714879869326666071903065279145L,
- 0.091615081537455465573860363408517029583L,
- 0.0113278995312253231106729997476313183323L,
- 0.294349528513080028346115860151112891433L,
- 0.0097058790914280197566968241982258935964L,
- 0.715113281550035710673074854712220192465L,
- 0.739627170474553083453358265804562580162L,
- 0.588476045636558489860462119645353521893L,
- 0.91330346819098343970944232526748274664L,
- 0.281457572112513183673653575304242456425L,
- 0.784192391468991402261628322552430383283L,
- 0.504857923842698553133786835061714061812L,
- 0.230410937725986177704701374433825197397L,
- 0.535805811877939822805608704986961969659L,
- 0.0508287955596506952822240797812703550548L,
- 0.179399756999629053194209501169297540332L,
- 0.675837373242984020977236431747771655704L,
- 0.981496523455084073391380532008173135055L,
- 0.325845075647804753424852268729037997407L,
- 0.832630951427200447589084239299500129776L,
- 0.825354056334755646582091209610369762364L,
- 0.574731012869980895104127749738122205757L,
- 0.799028354294603017571131513193291020045L,
- 0.537721586879667191016369071169775496218L,
- 0.83846801885738807298552515294277869191L,
- 0.0922901597877978587435698953162723703674L,
- 0.434458505758559675954739433438496373717L,
- 0.308017320632506922735963882703835222897L,
- 0.0192693232310748837390370764187488626234L,
- 0.65275462537999797862908920689650691667L,
- 0.357130585286320841741290333260811815153L,
- 0.359562085720204868627653630044659240449L,
- 0.758320826841831017712067337815543048118L,
- 0.62169722559489484088614873429559348682L,
- 0.17335411409874538731529771306978631118L,
- 0.154077331752487118534287271363344964006L,
- 0.148559174998934930922746358844164455867L,
- 0.881316225913391098839630896554038163768L,
- 0.89289796752480477623907740261818685845L,
- 0.57786655574695620371527391411424563834L,
- 0.318175774295281868509200498351278930862L,
- 0.194978302204782205514236430086515458283L,
- 0.87084962252516402992532937666368998137L,
- 0.362113882465068209502300826516448793743L,
- 0.273446496762640462316848141032810658473L,
- 0.1471399192242189033406154289397228481905L,
- 0.937157507052090331728212622934524925056L,
- 0.600045430164287985733450402316667890373L,
- 0.794478865621258499047814379367829521507L,
- 0.889115878933706260333129391997704491913L,
- 0.631825206206982866021784416451887594472L,
- 0.966422225095067311240936396545408962515L,
- 0.676845470105427028205320649846678927664L,
- 0.671163783319728784750606328490914935783L,
- 0.213726274743505026386536996423761328083L,
- 0.99483340496284948345969144891145513965L,
- 0.362072360280863974302182899205431874295L,
- 0.89135316959373017710710890812308229361L,
- 0.861008403776277958081202417380537907424L,
- 0.518258469677886348298849030872657409393L,
- 0.74995117457421590827489329835282465567L,
- 0.141688060236646135992059548400562463963L,
- 0.231055693687838328234866575264314255906L,
- 0.128367320195147852998795956530756587271L,
- 0.735643745226188370911313880883935933086L,
- 0.481951681233521227023903083881246017963L,
- 0.29797778097740396719094352844253033076L,
- 0.259026843185033526978277511857498182853L,
- 0.76454793636766387350530239448634042225L,
- 0.921742101320371872828332060575170679558L,
- 0.135594574885855893452962438848740230435L,
- 0.249482789438500604376469100084029356821L,
- 0.447893460512394580798054060401740249162L,
- 0.841167533365717681130523968098862274883L,
- 0.063885342343669943206116658917625959392L,
- 0.49268569222220133343083683720155184169L,
- 0.0320364278163828327673837310979596079469L,
- 0.83067006037141488187036282222404336846L,
- 0.32687090604018629599351990634445890267L,
- 0.524229581985562678867475657633756672726L,
- 0.26442137331545990230136529620604338964L,
- 0.1804465247704923307363156457827584866855L,
- 0.219897692414720290686302976466475627349L,
- 0.657372240957848561373923532613997515665L,
- 0.94917951707325275578037456019158874452L,
- 0.999935336870950506894538846120127792282L,
- 0.334292387732229479489367107895450895382L,
- 0.519605753222230586160238890634421180626L,
- 0.2353320030331258205431171147281090084686L,
- 0.697837952881171466097464830413620278996L,
- 0.337355949172173312279209733133367570558L,
- 0.59624609578396787690174902306338541087L,
- 0.430566868363073838098964774826687118822L,
- 0.303143768470597821848720008902412356097L,
- 0.45566572082779255052299434804712613961L,
- 0.63651052470632278377988990008643926753L,
- 0.88355849548999550762491205909993278845L,
- 0.857627182143034336666679544569747793963L,
- 0.579654405386150422035981447661995358225L,
- 0.527551502180559045145630115424486189773L,
- 0.227798290812497436015108334865799792168L,
- 0.860285575656798735433746383563482660567L,
- 0.657434642899561800145850990323893418457L,
- 0.991915916857419346367596676050775541352L,
- 0.0299053482258395117883768309912517801074L,
- 0.494186962160200346319995839440170254278L,
- 0.795837941248740362154274095100822390282L,
- 0.213898349709271555518444444268604992712L,
- 0.635385838537788174234352352696939407706L,
- 0.1161960540496013767418067989853615145483L,
- 0.236636716576793997613161803474856412323L,
- 0.250257128320679509772248555959408855321L,
- 0.754809883956726591031066199439807350575L,
- 0.240047496212680591313028855365466345707L,
- 0.125918185384015376472834932789271923263L,
- 0.830761928512260978768305988740912711273L,
- 0.0833746595456954680423678981938324373477L,
- 0.993235018876045312632920249583820095078L,
- 0.74457886551486005017424251252790500917L,
- 0.904041666312003998553971236017433817041L,
- 0.99682247674917724207607173416904094376L,
- 0.778185258630194559195184600522592063632L,
- 0.617908428541966249479693433082678846704L,
- 0.034201434638706652764862810175677292771L,
- 0.1166825963578175046863759835887066398776L,
- 0.618184997077951045734597662867931774914L,
- 0.67223166229200793562043589747700629457L,
- 0.50367723015643325152991864733820551338L,
- 0.287805524504497224349445840278160308547L,
- 0.418530565562949537953621246456529701546L,
- 0.356577284504836083965140033686046682705L,
- 0.727797226876543100474285620953868682292L,
- 0.261158535215243995918166290296126543963L,
- 0.1233681715943113445590872776925938156L,
- 0.397342365090131218507373938120760734013L,
- 0.33651833905580176460704582099080050591L,
- 0.124851176251609572087737060478799388707L,
- 0.49869389018540295598691678028277690211L,
- 0.603921102513219725593707198424421456834L,
- 0.0288068305492076274901316515486696644854L,
- 0.27635950491121559708402485015430409745L,
- 0.0219820746750707161670181537628175322048L,
- 0.893266704905772978187424688068554761406L,
- 0.055131714446612192984065196401480701447L,
- 0.478917803887421452005543212818108274705L,
- 0.1089109338581245135310441557812062287244L,
- 0.451355129465699006367714322379179082201L,
- 0.933539696310061306235683130737189659555L,
- 0.295046527696521751967458467625754033345L,
- 0.657654030109877699469191835246373699585L,
- 0.699519422709288537538980841108763784234L,
- 0.754780411476609088293217972311402262028L,
- 0.940185229424181440596885768821586612845L,
- 0.641206442188302531301220212171259413504L,
- 0.483623421775598486212538785028426545698L,
- 0.1819507033406890598006456890391145571876L,
- 0.3493992184159313422014002142021878866L,
- 0.2282143482135155999703670773974654680736L,
- 0.65404355620292102948676570623901452325L,
- 0.000126697620991797753719907018394969483701L,
- 0.000128697615694221449450257101713351917085L,
- 0.66277677565136622936757573048183355679L,
- 0.954427508631091518542647272554320259L,
- 0.821452416615550557725422642536361482673L,
- 0.783949133156224682132225528942727293192L,
- 0.883688268329322182794294084718215227776L,
- 0.887198477924019626901140168907684736036L,
- 0.301153686936585019868640358522761168745L,
- 0.97031160152938862140377079439908121466L,
- 0.613591225576913510391808189718881180802L,
- 0.973773801885628446394837963774216539007L,
- 0.969946092528631153860793542995840284225L,
- 0.0552318705490405481104532089875456066346L,
- 0.398506652226642658353465649824893657953L,
- 0.577466681084525459648007205600389579233L,
- 0.538305717497527581210294472297571817608L,
- 0.0378969572225333661087665511893845011475L,
- 0.82821208446292402852221418490682507414L,
- 0.207039760611344134455359310666092356869L,
- 0.278071434395492049592363658721835175976L,
- 0.418157919791356829061560807874478279737L,
- 0.917935426878916775097393966246600470752L,
- 0.968879316988430839484738642933327229065L,
- 0.836847484003257581736597938908686488306L,
- 0.95787762740618523171012745852536482523L,
- 0.381833463284092269744674988738521423563L,
- 0.585758801118634412354899474049588357203L,
- 0.590675098878457580254555486356030743515L,
- 0.999102261786447498899644398829003134788L,
- 0.278723779765613710807952395929736248799L,
- 0.150160483677965826860533794972733497469L,
- 0.39044191915595120943090707935299688844L,
- 0.882025297705744570797306391637391855587L,
- 0.26053886056730883704893455389142056588L,
- 0.530123960707389279621444598593626923328L,
- 0.307497951588709795568291546230129131789L,
- 0.755712717002473210112772528495042985208L,
- 0.403971099596680128749039001982260210321L,
- 0.0955902605698226580325595772471302440213L,
- 0.733946822526846681865131682504158670327L,
- 0.824558199580936798107294631591949429405L,
- 0.355777480091076251706346214380424670616L,
- 0.183210308747040172107746729630689571628L,
- 0.943081072447366944673610412439697363267L,
- 0.823437046917209496498923793615721213912L,
- 0.272212671889142468847791216625072718846L,
- 0.467586497114075237282436742306271250655L,
- 0.965430243779957305809196327799423550657L,
- 0.264527585376739963287684763043832918263L,
- 0.78305929918791974277407705060017330726L,
- 0.1569161089271269079867408493909342109635L,
- 0.385890512318945048667111881493883277209L,
- 0.748768801714747310036929893375463390286L,
- 0.9607241213632062657075501565333113635L,
- 0.681005349771442926258254424282975745535L,
- 0.417404611754855157969846623218352380733L,
- 0.384922954690351156114438668003273806442L,
- 0.0248688875333777009659560293287195312336L,
- 0.289622732329138351547499030028075517487L,
- 0.356660798938142089830284922931103513564L,
- 0.1092119220339924538904809107210351902013L,
- 0.263044604533896828574983495057823392153L,
- 0.72916056882229781356884933113775509031L,
- 0.277279616044198734111166028359400949283L,
- 0.448496025651349045553194567962243478962L,
- 0.397797975606664545700620422788810306397L,
- 0.915573317477921170464219734057440942223L,
- 0.565957191780698852582910000301549192135L,
- 0.0199640867363067059474765492007910956547L,
- 0.380718754942963039702539139065633248878L,
- 0.271561535356661429325107452975658450244L,
- 0.65703383768996023094650337496290243735L,
- 0.810303462640169412310932301780031244584L,
- 0.34389677270659068303923976829417662132L,
- 0.1459701849396526086771469906702178205394L,
- 0.0709566883230581731990192048699199874356L,
- 0.0273188133279639766234319338307950998466L,
- 0.189257375093862859152281617127963424911L,
- 0.483370049027267515091110020077746913052L,
- 0.6121051307445822901845022667347352688L,
- 0.0669683489197768142011855877890933175548L,
- 0.0462440353376468071116256899031962430102L,
- 0.66179099750239749196171922709429044667L,
- 0.331447780875915347204488922360787127231L,
- 0.88878630766137716878808504113561041651L,
- 0.57831688009568937419273238575083437733L,
- 0.1665758643537997337473156606765968668944L,
- 0.609499751553850514507525575752744468325L,
- 0.842660412678850878529299409778020570114L,
- 0.868735885617006579468607975714721515953L,
- 0.518323673739076029376626898444587264186L,
- 0.465048961779768578307935679739067346325L,
- 0.739933063031511059934522150792493137138L,
- 0.366097491036976922528977805725731033037L,
- 0.622890978255856721366594654155975719428L,
- 0.945120241233001881267096151974150875442L,
- 0.711795000549305806399598132955701848342L,
- 0.120093380051693652573317820347038096902L,
- 0.461420048084338423641881546847056927696L,
- 0.201645977777376722385295339631509175754L,
- 0.1479402104137110360277226090924965371445L,
- 0.287960179369955828242600303166176042591L,
- 0.788362667534075941033937374958276358103L,
- 0.610312055398887641020833805884097007991L,
- 0.758450801974187424825814780682156814865L,
- 0.64208882693968320907867911523798381855L,
- 0.255468285690834138126389042932304445888L,
- 0.0370478385689831649949675007793815537737L,
- 0.551880617631056560992613768623601574096L,
- 0.559262357532227558112085482526038868046L,
- 0.129705275018847798920129782613409588523L,
- 0.1076289463968801831500602693982998566697L,
- 0.272506325706516323678193293634687081578L,
- 0.721990855538151706841764025895777805643L,
- 0.523084042169573467351077180119310086396L,
- 0.0858615712848179826840482241961243288956L,
- 0.589714739430299853251893655400362103563L,
- 0.512412326166823937685402214713910254025L,
- 0.802350747297003067442509635888112412853L,
- 0.715817091619681167941132068164905209087L,
- 0.0824951218034037355816988555328185436778L,
- 0.829228234554153070848595829448989414728L,
- 0.59652037694553054648270061009002150308L,
- 0.133585725647906582691822880117773950377L,
- 0.812005216254498654412124509257882599085L,
- 0.808142463854396488512203093936737654517L,
- 0.570217922503074432494487309472855783614L,
- 0.704017977813333280013384719294741845102L,
- 0.0251797587779118690185681150429720019843L,
- 0.676272439608475367571481578590700290242L,
- 0.880796414989798318500723261307937258554L,
- 0.387922631107753361553377889431536170676L,
- 0.282350224157064849683455744598629321323L,
- 0.721001172978128539392551761867898599807L,
- 0.98720056526474911920598612334425157851L,
- 0.9951900286811655251775209231187451065L,
- 0.051844546479017627818996668613208776283L,
- 0.103738972117399718145836730690615155693L,
- 0.228544758674525285763674099492074936604L,
- 0.429309402103194762341587536897342160049L,
- 0.564535575507982971760351294178163523416L,
- 0.999063571593237112671743187500362701266L,
- 0.340374156369508513494787137157934959152L,
- 0.778748988242111504661479799747122556733L,
- 0.471307010869691772647781526213794708743L,
- 0.289707428078962269353959639691462373973L,
- 0.826577651264033230456965284610788939828L,
- 0.860667694131974131835140122175480202008L,
- 0.596405567348984902495263677852931818947L,
- 0.79786093770390728560184577433203234578L,
- 0.85492142888696693237980696048371212203L,
- 0.57242705004809831263405538576519171441L,
- 0.829648119655355629047392239460860046016L,
- 0.783260316181642610272420809845230036294L,
- 0.0941718863377651336163202407301145871807L,
- 0.156372209579300482444127671309443664823L,
- 0.95045258077372510217507306087908380692L,
- 0.1885289021059534081345247308001373861575L,
- 0.660776653890123229320677431688026234587L,
- 0.2333507388961794003755022400755269739225L,
- 0.926661255852332295794894190183342387092L,
- 0.862240624886232672002503279536846219655L,
- 0.093072473040365648693897225471155002338L,
- 0.210437952956145192084247103889970459783L,
- 0.98112543168220233380555460117617724093L,
- 0.740174391774267645790688716222038485627L,
- 0.0209886798500615011013258311339617682421L,
- 0.41833754096087514377582590206105535614L,
- 0.469019942905167330505858885046130048223L,
- 0.715228143253914303084091910768414947468L,
- 0.949215045400946624794326433082702896278L,
- 0.0839262379919984011512905346130401074556L,
- 0.358856470231875479544116669678510859691L,
- 0.676461324144301815445903930221360844898L,
- 0.321802718137104975636543941512529575137L,
- 0.993411285955596090334951526803325817472L,
- 0.860164319140927797258503749506400508873L,
- 0.94773452678939638468420772776729628408L,
- 0.786167026315331965750413583155691260173L,
- 0.45156944204188755542678210840170293585L,
- 0.490807428869058127589400400723875752095L,
- 0.1064150484458768919266881304357565451445L,
- 0.324460881496927069927267886879512784128L,
- 0.892536276084459403262968666925514247957L,
- 0.626906362142556286375622503025155623158L,
- 0.912617117728752553677432546319200457076L,
- 0.670287539555608481364011494943625670644L,
- 0.247614513279178220157281399165275150246L,
- 0.328334024179281412037962820247065990969L,
- 0.829445540957824174480776183273738605512L,
- 0.1787214688659462728637669907628671276175L,
- 0.925570168885833135397413435137754040344L,
- 0.98275386432184844551191217367555375122L,
- 0.364711512670624901280733420446798813805L,
- 0.0676060703890593392691073615176801081634L,
- 0.01088522590112897075539168583333589679446L,
- 0.0611693052224598303672047526429160913973L,
- 0.214589347780615411637055343786045569195L,
- 0.698097005257153990899739747284349971478L,
- 0.0354356066334430559162358810601367856981L,
- 0.0279531560831790454930326667914520406377L,
- 0.939682879995515407044885888120427639943L,
- 0.312419879113847025637130107480365284706L,
- 0.429063186024752762548549652686423948472L,
- 0.198325752893057589388425455067795077316L,
- 0.653970278037364931023007417819508007502L,
- 0.396811027519564931158159336303275106925L,
- 0.50451059823222344440248588902992099958L,
- 0.0862505815838354201964323759027263746603L,
- 0.957096030216378795442646824371057760147L,
- 0.587610162738417619467784731999441435863L,
- 0.582187586992416238476426545279573456436L,
- 0.535716130421670802716666237861890374707L,
- 0.090478847153957807764386571203708454605L,
- 0.788473620511487574655894325144660477707L,
- 0.610237648835883657058234607228408957708L,
- 0.678372723016422015853594971922211368707L,
- 0.0477042323920128297852928999674240977938L,
- 0.916676966783686851658830754268116450562L,
- 0.385373716764729378193009393283577714611L,
- 0.51049308234047313597601380814795899816L,
- 0.1196704708003806819299545192341910042065L,
- 0.446475706132336496196697021305914636716L,
- 0.22995164195921866005337396330755244987L,
- 0.632225374693904589951305492826903497058L,
- 0.1049567841702419598059377515889392050297L,
- 0.66749284825574584532432314559877621928L,
- 0.730750212627697291852996268443402535667L,
- 0.44210748459007730373853303409845654876L,
- 0.165882407048533464405922485111215401752L,
- 0.326102079042974476137893383568312181916L,
- 0.894926469777796621626659556932174565354L,
- 0.829811268916354531033773068150153342864L,
- 0.0607253283595596933368529290946492114805L,
- 0.0677752868787034912813695724240479638585L,
- 0.82861506635734784945473366382511846348L,
- 0.160085543323090657960949278634908144601L,
- 0.232569451519550129004668131405568301759L,
- 0.848363194546104528297512566450812116666L,
- 0.793640414525406609723674517332020118566L,
- 0.0908665486135344605492576594616215607582L,
- 0.98524892289773367881284955458176900047L,
- 0.232277847265217861619371474795084074907L,
- 0.2478103820537262599906715455471023544214L,
- 0.518524645780409202282547691600231775584L,
- 0.726858378884955244314303315523158335615L,
- 0.245545705017836867827662773158398435754L,
- 0.2242602776132220616213985660229694803996L,
- 0.69321599409749039262414070240230983052L,
- 0.0112978587458533729787299027903363211672L,
- 0.201700091442640051051557572594860881596L,
- 0.1553158804742445432796353137546288871905L,
- 0.297307958467221836656545818754009116053L,
- 0.858321137590160233755873079497950982112L,
- 0.66848174756798322137180974713907803341L,
- 0.996344263106353369755981871581860505522L,
- 0.0298469963581545313060582891253178820216L,
- 0.5825562269883888340326171333296281312L,
- 0.493316240919863194534203651249074989694L,
- 0.25506115557073666386519530923416434445L,
- 0.990037777634583670683401168871182857585L,
- 0.111966792328779238876716387539738843995L,
- 0.555536981182848652400091282463345207445L,
- 0.281763605895317871765768390877174374161L,
- 0.902702281907817546029803311979267829958L,
- 0.526223239446627547666226037912343453756L,
- 0.663322588876953268851644820272004691035L,
- 0.925956679854174995001911256195736125327L,
- 0.978687628923344717267490649565202182013L,
- 0.295452218109470204949110043833472171496L,
- 0.763317372768444290934585368155544717374L,
- 0.41484295515622153189510360412010755096L,
- 0.95319138766107113957717501566306191772L,
- 0.449833295238493367386837134824022661087L,
- 0.380903660964162496124546078818966824203L,
- 0.0591435603332779390763767398658188273838L,
- 0.594973116752510574186847848340951992488L,
- 0.66051154347057943107777082783767373976L,
- 0.9590947364014878778361002605613544034L,
- 0.141719503437180601174660143271258240733L,
- 0.72942088503531365739564056985302156428L,
- 0.96229479992042091317494337141213026865L,
- 0.51401712994901482942061876482808737646L,
- 0.09446204537625467018781365109090483186L,
- 0.568441523568450417056301286402539600564L,
- 0.598604342726174263070596195546293250945L,
- 0.774951017988365558347613104226790833317L,
- 0.81892086730816467017537310019875247387L,
- 0.890143355483709851496792149649550808793L,
- 0.2191477338352410954693547610221317715285L,
- 0.726897475480314385643181203422499653L,
- 0.756138778886812022822443490226271392144L,
- 0.36128016023552084266898937740898271179L,
- 0.410782581318000192446155911986931996913L,
- 0.223641334296034708685419059866928946095L,
- 0.0611617201563377229556630546893173872466L,
- 0.0454251140845604672274274573289906520655L,
- 0.292039969549662442463090760177927466818L,
- 0.0892783972345646734854765244000589132126L,
- 0.98769280749877429524697464655962686569L,
- 0.889843464657722517503667653048728011052L,
- 0.651776307404858375062718114948328477704L,
- 0.87617575855504123004785690824244025026L,
- 0.338359170956885135997817905734588127076L,
- 0.734032684330295341291816774804886223887L,
- 0.862422342223053851459695185679195132964L,
- 0.197333977370262353727756586852240555633L,
- 0.586060335783457129849055206578505427124L,
- 0.132898852938756538479400358451026471607L,
- 0.548298096092246267871555639877296879195L,
- 0.301119859270324657077136364646995297056L,
- 0.02186689635349189676964089313754648484195L,
- 0.037538023766844046167768352700498359816L,
- 0.739462465806194132819844936199304370748L,
- 0.306338591475158278790432712666553704959L,
- 0.0349382326130091592369352494672121905505L,
- 0.12659131714329909411210854142389581492L,
- 0.991566243159047696662802015340988687108L,
- 0.265613985138476447081523915107505113653L,
- 0.379928020809782559672193104868857287448L,
- 0.3311424971073397473661763760151895103L,
- 0.702177302636984264408758773725210449873L,
- 0.975045571615360787500646118846671455125L,
- 0.0373462862349996603561237755410350012631L,
- 0.846126776062337124521510357150131165153L,
- 0.604046707233534456382774833817964498043L,
- 0.1981113045697699450375369418161865703455L,
- 0.0223467484405979164693956414316536174577L,
- 0.67121960182601511325776586363807504696L,
- 0.165784481427263519151726479123968726022L,
- 0.721784618575898210943875783221281669927L,
- 0.247408211201465904622132596487935205602L,
- 0.474174174442367430962454680799704832459L,
- 0.38041380356189313505762491005159753494L,
- 0.412834591083812886132307610186713638625L,
- 0.294378742681402760124595985235966036022L,
- 0.319576442623415298744966071520183847465L,
- 0.17227236515412864866186439447886640924L,
- 0.19227796294349462194111033545303573433L,
- 0.701351402612222654905938605774127547107L,
- 0.55598633289035034815584162421930015865L,
- 0.402729648554369906881359212431684355721L,
- 0.595951760748834493622338584190905994085L,
- 0.119840257870361007206544525046135477756L,
- 0.90443395581066590152525534589406902782L,
- 0.205188871300477881549673944463237196075L,
- 0.339175278174772519132232276502457660768L,
- 0.447725444308107151040888910769680233742L,
- 0.541239546708188153505885726785683096117L,
- 0.12984235126732767588700711245028426254L,
- 0.0534701599183773436559514525508752846737L,
- 0.793436019832695131646422778046763975325L,
- 0.718125883729211211336344362949260539072L,
- 0.328649037343445105052694618356980072933L,
- 0.113307342739499399477248133420602576291L,
- 0.87683936228301044929749768481864525904L,
- 0.212591937265603187751611886807532831791L,
- 0.761002958456888912899646497131654914807L,
- 0.220849601519164170820922984026707209176L,
- 0.222305857213559738578093188054272365062L,
- 0.651516500020930005107266726995614198887L,
- 0.1505613416188572288472651067305496894266L,
- 0.166658450989632252583252879193540688162L,
- 0.249417632511505538283736333645627460544L,
- 0.50096054904291170172998992288713266662L,
- 0.173701146801321486346972068110605414347L,
- 0.93433415280052265881674202089278791561L,
- 0.1167900820460300938880016624066890278452L,
- 0.265137084235229705213901240937609442947L,
- 0.110072770364904306470596762714108445086L,
- 0.0670575770615268870829070207384379655213L,
- 0.92447493539224566948960065689964970346L,
- 0.187517201307673207566548753071237315229L,
- 0.935719666366703749433556454391358561756L,
- 0.964002672100646458888742916175546552353L,
- 0.6304136194377902875122727617639812134L,
- 0.497041144725381002743104205240568050483L,
- 0.589232636183711897405482721407549359295L,
- 0.524588285641300028631908965527617181296L,
- 0.786409662511483672510756944887012261427L,
- 0.9924030873238807048291154748671174581L,
- 0.891407534733792276848059682970952672076L,
- 0.308538095910260975496982224956384014562L,
- 0.949088891149549225900320967233005245566L,
- 0.507378396004105004571665876613293881214L,
- 0.348875146873077771786031143309488031474L,
- 0.129717394366372388305812826098578876617L,
- 0.371316171885006633822161450072014737125L,
- 0.550162123072752251266003313454007126843L,
- 0.822171979807031777641565545578299345138L,
- 0.75171547658293988559512988487590040284L,
- 0.329537443635543385256682239450819107475L,
- 0.159687481361602477899361671181005148163L,
- 0.788720723813465707294018605642035752394L,
- 0.1031423865826241581828274573741444954832L,
- 0.1925157943560383416361499973635531049876L,
- 0.771893047929845637497166550933789470487L,
- 0.681189132819106369246924892765206195007L,
- 0.180608768713011918428603967211913698036L,
- 0.0869303304414286810402604783458783443746L,
- 0.63890744831302111307395023326393791462L,
- 0.531696069328179766265158866360885671855L,
- 0.557357572478102464274432325432400878297L,
- 0.765306589402879669413870462450921612475L,
- 0.0941202729911292570046371838018359372082L,
- 0.902333472113108821746674873990738636997L,
- 0.165516366160118370026922089795742876131L,
- 0.0317472434880413278821576585103363607157L,
- 0.706107972335163251316361316043030620453L,
- 0.832472986392763388669796997227437520663L,
- 0.769939001736494466971306881365718899207L,
- 0.83093185023987157595917781461722256739L,
- 0.1143834825195292986705373579359335590854L,
- 0.283326017120251162360393258571085609729L,
- 0.301605389836836671045912951769199753359L,
- 0.855854391727628505548518803309296566532L,
- 0.089938332734139699450960989316391404434L,
- 0.310225946153425747793112265736973169299L,
- 0.96854812596413627994714291059983626441L,
- 0.279767360423571836833858253122290577619L,
- 0.113545981876279916290815278422648489865L,
- 0.943101270554056170747004305255027939268L,
- 0.812274724978801470221644756549524210083L,
- 0.9678011347395447510273023981530290554L,
- 0.514795136336602722878788704708053145966L,
- 0.50560840616487841567055789750974674943L,
- 0.127654209842819812026603428361923670116L,
- 0.273727399985085036497076514726791191553L,
- 0.964821797874257789566527793136425594082L,
- 0.853392912197074096341317268954834390727L,
- 0.914236806849585335611299422695886165192L,
- 0.277335361137281076359079507288838688219L,
- 0.865708792613433194377422367016717680172L,
- 0.761947879929658945814013586634774725302L,
- 0.276975494384441865188273120642155257808L,
- 0.0678895000408079241574268817560335475378L,
- 0.929521528875748672899760603996998763144L,
- 0.44453824299955605846877126958322272066L,
- 0.444318159420536625223816052640621069982L,
- 0.42913762214779045597457741573009821738L,
- 0.98994873802399078252493194985812582986L,
- 0.93065975343157446755652147574743540714L,
- 0.821639107980128580428385838275355600123L,
- 0.031337950421787684669360817154012683829L,
- 0.839516942888416107002513723437531514126L,
- 0.785501376812531727571251496474527490183L,
- 0.247978681554054401906203846371863203863L,
- 0.985774009303654108868853196421131421187L,
- 0.635347409930173147315815281304257764708L,
- 0.40087985483327734740658289294086718422L,
- 0.374059729085540852289174052767716446502L,
- 0.367226053686019780853702834825808619761L,
- 0.166424328898161772576167906091392715805L,
- 0.838115185925303343477055122060982270143L,
- 0.829549684532006011608856001441012324216L,
- 0.059867788238866724897690318151639504149L,
- 0.0253429734563284738087263277549928280781L,
- 0.953315773263436653713242828719775352192L,
- 0.597536998796130884349662459732857817956L,
- 0.0320571321493587106457025626624408278814L,
- 0.477506594803204144826488443400695434979L,
- 0.285541992141868221897101891229394096707L,
- 0.764190678950226854486968785768647879005L,
- 0.895489776830293129781335242249167913705L,
- 0.570740793029533496018083006013191540077L,
- 0.938316924714444954315906773563465846538L,
- 0.56157168133328941481074926451373503549L,
- 0.354184283860505415751320741296599995231L,
- 0.778294119283540721552919906619543293274L,
- 0.434953011661757598127924745629053141294L,
- 0.37156491156117895854194599593687697796L,
- 0.898767478977082606651667259049374990828L,
- 0.21819365919403129548458400006737057993L,
- 0.278163373548978939704874687746089548269L,
- 0.1089005781457343817756962209721573336768L,
- 0.85152888717082537570752846642305937149L,
- 0.2419243481761527583754399630924438738944L,
- 0.69442654829377168239365980152821108287L,
- 0.1512336533453368944625038813397779875445L,
- 0.617712962492924013140729661730350287525L,
- 0.935400762900002313827620435729493050175L,
- 0.79357339902161958573967958515254111256L,
- 0.734250188990467683521536859220675412636L,
- 0.748517858206364295837674601491185485078L,
- 0.82520014781239194590337105462135253912L,
- 0.1240649365160101108753438662971422995014L,
- 0.479769236133748631678854875312914195598L,
- 0.171269492636258554036912204801376697988L,
- 0.833025419245729049117746814929956940986L,
- 0.354429813451205200141830318428840891828L,
- 0.474809123369344367691189422128776480146L,
- 0.692239655770541262287308180705629028608L,
- 0.271366901464125731413801963807240905363L,
- 0.561330233800121182669429172066686942393L,
- 0.0695868383638479426233449148171168522655L,
- 0.627576910684655924911125045007979454546L,
- 0.423331542652214907262628326674848471962L,
- 0.354725031694671387579309719042578580595L,
- 0.312419264533145363169359084710774849388L,
- 0.167819037053563697473931127337972350099L,
- 0.99960836112225007722014049168024866743L,
- 0.820598666739967434549389339457492152643L,
- 0.689495024741546551592649728378054973272L,
- 0.831455766750164249604246627812180304754L,
- 0.515538871956858025876039391193370146897L,
- 0.011724889011994886395520178564059346913L,
- 0.587485679650311054946861235938601293477L,
- 0.113010564497810081892271654273794311467L,
- 0.381261245177928587613552004600730320213L,
- 0.466933821322235841488251157296771536952L,
- 0.646965031311287534221872388017990968767L,
- 0.1811101995014685369939482409137380098995L,
- 0.247896943912780884738461558340983142645L,
- 0.989351208835640462928338658234638846217L,
- 0.924605283008839688813842975338096967047L,
- 0.232010860908797395869871518793187418799L,
- 0.90274859050487649728273938229764570199L,
- 0.664078588165617572819884867627266650356L,
- 0.532118803501055886836301096658125012493L,
- 0.854049566634563277356849166147057535436L,
- 0.756477818237029394317820041473365538516L,
- 0.84578312219074068824832318394711642503L,
- 0.169914247711153055959592721695068126213L,
- 0.50848961455796310913779527189620088788L,
- 0.715231849280217810525151667911662744854L,
- 0.59666585539439202929452535210623694053L,
- 0.72343578283497935670188130618697814035L,
- 0.982228826906846431195861293729527133844L,
- 0.98068755339273420823366752414155272462L,
- 0.805277135157133623039231303778838094716L,
- 0.840154168539481858495551656699708834713L,
- 0.41783933695481411993780663692806809771L,
- 0.070981740672048589027432942629842679319L,
- 0.96664795205679820656636930925268162457L,
- 0.155178444292580006807274171645675417735L,
- 0.276407670358590477524508525465318694191L,
- 0.1054964292635286397825421772930229411286L,
- 0.354205947516472098240472076653525679013L,
- 0.583456972150065135260312420865576513532L,
- 0.338643867118430587299252775116788065723L,
- 0.146467849593879827355466951871059968293L,
- 0.0639448405747942007938896940026153617467L,
- 0.846536583732599902600485371566229612512L,
- 0.599728399399342923058515558777947417833L,
- 0.140387922890235239162309673093379598453L,
- 0.1613160217694973394489944660056369626715L,
- 0.151848582163159668039725770584081620756L,
- 0.663365628518336712743995463098831995163L,
- 0.752166976367665534193146852225632451022L,
- 0.911311062532571765386023433215793121138L,
- 0.692490353635171096989434518397248623866L,
- 0.990512559245857089458980255962574316578L,
- 0.135026433195284768293027372762691869458L,
- 0.82220389984592453325084678614092535756L,
- 0.385471328555065081327630832374267955206L,
- 0.108251633446048989722318564345306848022L,
- 0.429090236713339412878596384043906547999L,
- 0.983421429305507423332481562450757515935L,
- 0.0163920521681887489391607174895946079877L,
- 0.634276319224952361916496263299135133978L,
- 0.53164375434562160610011793242431018808L,
- 0.92801127390978303506935520414803575609L,
- 0.708525110316144414918831897015500504675L,
- 0.722458240987313977092360928226487539067L,
- 0.432028911017122242491499522489684865593L,
- 0.0001754664935299182587224394863719217640876L,
- 0.384266658709383389800969077999970411222L,
- 0.284964603427904715461598563563830112021L,
- 0.1541443027599544245798778784933517572175L,
- 0.958338802063400795313378181913830622686L,
- 0.636927309395779701122460610729048286624L,
- 0.0963946603295477475541191401069719222887L,
- 0.0995190436935072136624400787867889652226L,
- 0.294220607618706451139091631947946466958L,
- 0.180831121994104393794487526888221966969L,
- 0.635403971764105414766318934434540385347L,
- 0.333929089029202997624323059191296321991L,
- 0.498378678845335358166419186432789231466L,
- 0.79769145046274241777533636404451138797L,
- 0.269285209299779365433012558225847643041L,
- 0.110524792990169183853219228066613162975L,
- 0.252694136970632381193559370648931722998L,
- 0.447232396115786457656991370803052298542L,
- 0.136974250599080636030665381278567779455L,
- 0.67243844394695156696032636816317618716L,
- 0.280265952023932940327982570523639258968L,
- 0.960024614746466668963206103951264089396L,
- 0.83595031847062668345135859090890188348L,
- 0.127840531352213174558502027846545305518L,
- 0.333183884044346150282363573006579940787L,
- 0.480504229384957927069515726093850498988L,
- 0.768498913093287331615443023486434378468L,
- 0.940413493411219283289136687423264928073L,
- 0.548648592555019577089750862504091661273L,
- 0.57814360039222917342516307696519676185L,
- 0.752806287004316513987155718410926624384L,
- 0.328211694133870995310455637563825433641L,
- 0.153907665030571878436793446358668488233L,
- 0.694742699178286984320321272531890059073L,
- 0.25435421168640709608520313542078743933L,
- 0.61387638208113240104328972389071498415L,
- 0.250476311300881635346483832554226742174L,
- 0.345809836897231980069633800588202859833L,
- 0.343083789419841923142937785323119943136L,
- 0.319174378869537109008405333721782689566L,
- 0.158111477528301687597604325494967120237L,
- 0.244000500810322900960285910812181460829L,
- 0.23179705702278726416861948783067588642L,
- 0.54682924846605062799436489677774333716L,
- 0.549008127982055819651521103931442895238L,
- 0.262583044663608129412956518168777449925L,
- 0.00126513153702681878410946802239924274583L,
- 0.942613696151881635585127791325641506562L,
- 0.352686443706689559388572818776843215083L,
- 0.90689998425792029984240460273113807702L,
- 0.867511650419363872431681377574762734184L,
- 0.280671949468087158951852027769013272607L,
- 0.162038690615698843560500386213858514888L,
- 0.71179364933082197276587611716632482938L,
- 0.0967402545497599384082792036477527703823L,
- 0.465040868275334873151726613879001199556L,
- 0.621004503662486553272117361134036130264L,
- 0.732964940483576253705474121238830973672L,
- 0.423374863473223783721502627532544136435L,
- 0.490338535425760290944218064913112069833L,
- 0.0243433415988311460557576165617657963508L,
- 0.0502339423891456566961808478207103394328L,
- 0.57668149339841029115236469576085057193L,
- 0.654589079253818313716855283653923913987L,
- 0.1099728579252794893221972017964445810946L,
- 0.95067113980240197864048876003001477344L,
- 0.271440369581834169312179003284604198334L,
- 0.067152474145377434478612939162576726923L,
- 0.77434193893477314687843638736266814713L,
- 0.2095679937785625400917773512669417520444L,
- 0.7681370807102749183539277908648691358L,
- 0.24472807400083103884984122018932641814L,
- 0.191307162486577428460074174309309551616L,
- 0.637215617752531571162184184570005111405L,
- 0.858141525396878877938747690015117846998L,
- 0.338400625200720062249435065450813258281L,
- 0.564981422008979753676981861330327611986L,
- 0.809460314261206431741632790718777271837L,
- 0.879343403409393604462128113991125533726L,
- 0.284697509116613252542034824007026845569L,
- 0.497023470648395180497606069099534119801L,
- 0.650004713241995983979792197286941523L,
- 0.1177129995341492896184329340448111002318L,
- 0.923625966014428778639333261268345799732L,
- 0.698837131343914189577155394009532120604L,
- 0.28242326745092132457477019796509942259L,
- 0.70025600885251684699238650783454037429L,
- 0.876659050276528114198964471020380705343L,
- 0.52914892693002332233566353042454639365L,
- 0.319860854431864688430502078275989809115L,
- 0.83483115610648557287441551698147898778L,
- 0.727639064249568383685922880431792837046L,
- 0.58743287662861037184349933549802687836L,
- 0.510383231616356949495559076196319035197L,
- 0.00229935944348919214521608305418404052343L,
- 0.799567224020488433652933994297769381902L,
- 0.343651210821093611687224166251624444254L,
- 0.405948097827175151257603419529941300798L,
- 0.456473183882957921169800992232941517586L,
- 0.570248304776860782392105323292264026118L,
- 0.534779754769153667870756893044557559557L,
- 0.472965511839676757434979299779809656808L,
- 0.137335340499076127280155831169214403285L,
- 0.51975901660926295231312276736119435645L,
- 0.8085867293332018994761547260739912451L,
- 0.812416413241484848007226874256949892893L,
- 0.852994977709961112714176162016389410712L,
- 0.95270886248643660114015239563660004248L,
- 0.845133719240648570417568652136630304138L,
- 0.4074980021816323645978397907609428101L,
- 0.335850514497730546494305840184055599972L,
- 0.0882622233237065445998153436898044995127L,
- 0.936467561027640943446178111237050277205L,
- 0.56676472173638044722431698799123577376L,
- 0.528427769051008704179988533062745663408L,
- 0.460890427579778855697205646060084318038L,
- 0.754971897131798313468797543428083655928L,
- 0.980733597969419782109470537306886067907L,
- 0.204362127415649555111877580124343815074L,
- 0.424822548090499017266619697426652494042L,
- 0.790847149074521364262028407892114384257L,
- 0.559922683392730473870877613727301497865L,
- 0.779993507158626042106006393237738208875L,
- 0.30516368089713691312418593599115685319L,
- 0.68918765842229398168455844072311006826L,
- 0.972291357858071465096079542885284602882L,
- 0.92204286423973856982373873105566928589L,
- 0.488649453783638471576482476648021023315L,
- 0.467124744623849284659862825278549932824L,
- 0.548051233865943557014854568009331816852L,
- 0.306838990296265483205551142903402056051L,
- 0.497005516835688988273805238236922199451L,
- 0.341504433884138135798086132528045458722L,
- 0.969816416247460790089503289400709886528L,
- 0.63656435610220447227337751650167349487L,
- 0.83588076122262875881859751942918794857L,
- 0.647568600604975972308348018018445212894L,
- 0.916061870307308870029862807808332479077L,
- 0.767988745496844638880672392122527991445L,
- 0.1623230195628039449666927123215281227666L,
- 0.0791082835859634251558587844284289799848L,
- 0.575858643610197202634665099752882990844L,
- 0.559159434263749620344702466000799724913L,
- 0.063765998380760211208741798736948488376L,
- 0.230557913975359017084357477142151415967L,
- 0.702854691657277602758421942319022953845L,
- 0.789516660466782621905392733079230211954L,
- 0.491496186820051632244513986127898500904L,
- 0.171499215418269578563458417238340672634L,
- 0.626470061831746666081979158043673024967L,
- 0.258903137813870706268979320963343541457L,
- 0.64156850108405218894694811301875120511L,
- 0.534043520260340661507140771088018906496L,
- 0.388275182018399247097875416106759899469L,
- 0.920936363560998030495046998224168162945L,
- 0.826139404694006088220407338888245165242L,
- 0.343561253523163451528918423980552161597L,
- 0.921521003270491194867019217479780072647L,
- 0.656212467754097185125864111703195343744L,
- 0.628186262290474398328350301885606581942L,
- 0.573227336542237665153422986363073650388L,
- 0.94178975003001342039795597242477049832L,
- 0.0408103561362355768975182155847755354614L,
- 0.382581672073273072487550945526454964287L,
- 0.152851256046525520308098129538613498254L,
- 0.966735024597183045592313880114075824298L,
- 0.215564894798334550271993595018433286244L,
- 0.776491530531523589201618375156272004616L,
- 0.912460554179311241821569665648929177608L,
- 0.632880016212040018958086886452474382272L,
- 0.711577891112709305169603082360885583086L,
- 0.1120655756066491784920471129299439607153L,
- 0.691106483958832651050573402690448368687L,
- 0.227442567846797646970770128970529357636L,
- 0.837435613090485891584882062239924101455L,
- 0.524389161590691896070067767400758142565L,
- 0.591360583466508186135247682666313136762L,
- 0.103155847462960450706124014839446958843L,
- 0.98360160577671960281465138408293984545L,
- 0.197665014114674630647437622579741018817L,
- 0.1099709194312379594014239398842185159354L,
- 0.394053373921474751303577685990936074485L,
- 0.94945354787200894450508557094182436657L,
- 0.372593716084661547440393809983835348274L,
- 0.62514674616343692328572382301636412566L,
- 0.2001871481416310130073795585638383984926L,
- 0.148432902421401306477690922498335475507L,
- 0.687921673269487018193347305425182239764L,
- 0.470940334348984370262797433659013738143L,
- 0.1592476430730276812200821020958787823795L,
- 0.296776110696565927524970058176467314578L,
- 0.1491253105142218631726813695413369166796L,
- 0.579194717868638955003571989739802264354L,
- 0.0730543936466744761440131951539370917776L,
- 0.941296077873340797733875467209629660594L,
- 0.76720024949523806992504865943580486187L,
- 0.419526107681583337049761526455092560735L,
- 0.00688594806937144144337797612615981618743L,
- 0.931682704636487927763651991274577493318L,
- 0.660524215847727125058815911433184924133L,
- 0.71780972384903067744609138100002205676L,
- 0.02961791918271995070621856302848439458175L,
- 0.692791206212428997136050006631240567502L,
- 0.162762426697948445642880183096693062538L,
- 0.183637795551464341949019870428026949035L,
- 0.51263789620316407488619761125039609046L,
- 0.90238698122728366178818828411640824056L,
- 0.229784208410123517024401367798925386038L,
- 0.227218480059027721044118324890061381517L,
- 0.6555059570778176955459672492237825867L,
- 0.929815767583615624563413584598741896834L,
- 0.188559597559312695774663933876436875041L,
- 0.396184448063913762028147791554346199354L,
- 0.656329540957568516760105602115555736073L,
- 0.1410678455413176345310401990667063246115L,
- 0.621004667838855651847651367745487628637L,
- 0.01277988784767030635209958407461792778387L,
- 0.69482142276844418673788732511112265014L,
- 0.925705031133221932065307191539105635005L,
- 0.925744341385232535963050430363763081603L,
- 0.24189467813699258571134382505828701386L,
- 0.646009544609703485845605410919901799L,
- 0.051119212999532673562206731603906295406L,
- 0.85076142804383409765024452942896578158L
-};
diff --git a/gl/tests/setenv.c b/gl/tests/setenv.c
deleted file mode 100644
index 995a0f26a1..0000000000
--- a/gl/tests/setenv.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if !_LIBC
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-# define _GL_ARG_NONNULL(params)
-
-# define _GL_USE_STDLIB_ALLOC 1
-# include <config.h>
-#endif
-
-#include <alloca.h>
-
-/* Specification. */
-#include <stdlib.h>
-
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <string.h>
-#if _LIBC || HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if !_LIBC
-# include "malloca.h"
-#endif
-
-#if _LIBC || !HAVE_SETENV
-
-#if !_LIBC
-# define __environ environ
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of 'environ'. */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean. */
-#ifdef _LIBC
-# define setenv __setenv
-# define clearenv __clearenv
-# define tfind __tfind
-# define tsearch __tsearch
-#endif
-
-/* In the GNU C library implementation we try to be more clever and
- allow arbitrarily many changes of the environment given that the used
- values are from a small set. Outside glibc this will eat up all
- memory after a while. */
-#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
- && defined __GNUC__)
-# define USE_TSEARCH 1
-# include <search.h>
-typedef int (*compar_fn_t) (const void *, const void *);
-
-/* This is a pointer to the root of the search tree with the known
- values. */
-static void *known_values;
-
-# define KNOWN_VALUE(Str) \
- ({ \
- void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \
- value != NULL ? *(char **) value : NULL; \
- })
-# define STORE_VALUE(Str) \
- tsearch (Str, &known_values, (compar_fn_t) strcmp)
-
-#else
-# undef USE_TSEARCH
-
-# define KNOWN_VALUE(Str) NULL
-# define STORE_VALUE(Str) do { } while (0)
-
-#endif
-
-
-/* If this variable is not a null pointer we allocated the current
- environment. */
-static char **last_environ;
-
-
-/* This function is used by 'setenv' and 'putenv'. The difference between
- the two functions is that for the former must create a new string which
- is then placed in the environment, while the argument of 'putenv'
- must be used directly. This is all complicated by the fact that we try
- to reuse values once generated for a 'setenv' call since we can never
- free the strings. */
-int
-__add_to_environ (const char *name, const char *value, const char *combined,
- int replace)
-{
- char **ep;
- size_t size;
- const size_t namelen = strlen (name);
- const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
-
- LOCK;
-
- /* We have to get the pointer now that we have the lock and not earlier
- since another thread might have created a new environment. */
- ep = __environ;
-
- size = 0;
- if (ep != NULL)
- {
- for (; *ep != NULL; ++ep)
- if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
- break;
- else
- ++size;
- }
-
- if (ep == NULL || *ep == NULL)
- {
- char **new_environ;
-#ifdef USE_TSEARCH
- char *new_value;
-#endif
-
- /* We allocated this space; we can extend it. */
- new_environ =
- (char **) (last_environ == NULL
- ? malloc ((size + 2) * sizeof (char *))
- : realloc (last_environ, (size + 2) * sizeof (char *)));
- if (new_environ == NULL)
- {
- /* It's easier to set errno to ENOMEM than to rely on the
- 'malloc-posix' and 'realloc-posix' gnulib modules. */
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
- /* If the whole entry is given add it. */
- if (combined != NULL)
- /* We must not add the string to the search tree since it belongs
- to the user. */
- new_environ[size] = (char *) combined;
- else
- {
- /* See whether the value is already known. */
-#ifdef USE_TSEARCH
-# ifdef _LIBC
- new_value = (char *) alloca (namelen + 1 + vallen);
- __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
- value, vallen);
-# else
- new_value = (char *) malloca (namelen + 1 + vallen);
- if (new_value == NULL)
- {
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
- memcpy (new_value, name, namelen);
- new_value[namelen] = '=';
- memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
- new_environ[size] = KNOWN_VALUE (new_value);
- if (new_environ[size] == NULL)
-#endif
- {
- new_environ[size] = (char *) malloc (namelen + 1 + vallen);
- if (new_environ[size] == NULL)
- {
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
-#ifdef USE_TSEARCH
- memcpy (new_environ[size], new_value, namelen + 1 + vallen);
-#else
- memcpy (new_environ[size], name, namelen);
- new_environ[size][namelen] = '=';
- memcpy (&new_environ[size][namelen + 1], value, vallen);
-#endif
- /* And save the value now. We cannot do this when we remove
- the string since then we cannot decide whether it is a
- user string or not. */
- STORE_VALUE (new_environ[size]);
- }
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- }
-
- if (__environ != last_environ)
- memcpy ((char *) new_environ, (char *) __environ,
- size * sizeof (char *));
-
- new_environ[size + 1] = NULL;
-
- last_environ = __environ = new_environ;
- }
- else if (replace)
- {
- char *np;
-
- /* Use the user string if given. */
- if (combined != NULL)
- np = (char *) combined;
- else
- {
-#ifdef USE_TSEARCH
- char *new_value;
-# ifdef _LIBC
- new_value = alloca (namelen + 1 + vallen);
- __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
- value, vallen);
-# else
- new_value = malloca (namelen + 1 + vallen);
- if (new_value == NULL)
- {
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
- memcpy (new_value, name, namelen);
- new_value[namelen] = '=';
- memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
- np = KNOWN_VALUE (new_value);
- if (np == NULL)
-#endif
- {
- np = (char *) malloc (namelen + 1 + vallen);
- if (np == NULL)
- {
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
-#ifdef USE_TSEARCH
- memcpy (np, new_value, namelen + 1 + vallen);
-#else
- memcpy (np, name, namelen);
- np[namelen] = '=';
- memcpy (&np[namelen + 1], value, vallen);
-#endif
- /* And remember the value. */
- STORE_VALUE (np);
- }
-#if defined USE_TSEARCH && !defined _LIBC
- freea (new_value);
-#endif
- }
-
- *ep = np;
- }
-
- UNLOCK;
-
- return 0;
-}
-
-int
-setenv (const char *name, const char *value, int replace)
-{
- if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- return __add_to_environ (name, value, NULL, replace);
-}
-
-/* The 'clearenv' was planned to be added to POSIX.1 but probably
- never made it. Nevertheless the POSIX.9 standard (POSIX bindings
- for Fortran 77) requires this function. */
-int
-clearenv (void)
-{
- LOCK;
-
- if (__environ == last_environ && __environ != NULL)
- {
- /* We allocated this environment so we can free it. */
- free (__environ);
- last_environ = NULL;
- }
-
- /* Clear the environment pointer removes the whole environment. */
- __environ = NULL;
-
- UNLOCK;
-
- return 0;
-}
-
-#ifdef _LIBC
-static void
-free_mem (void)
-{
- /* Remove all traces. */
- clearenv ();
-
- /* Now remove the search tree. */
- __tdestroy (known_values, free);
- known_values = NULL;
-}
-text_set_element (__libc_subfreeres, free_mem);
-
-
-# undef setenv
-# undef clearenv
-weak_alias (__setenv, setenv)
-weak_alias (__clearenv, clearenv)
-#endif
-
-#endif /* _LIBC || !HAVE_SETENV */
-
-/* The rest of this file is called into use when replacing an existing
- but buggy setenv. Known bugs include failure to diagnose invalid
- name, and consuming a leading '=' from value. */
-#if HAVE_SETENV
-
-# undef setenv
-# if !HAVE_DECL_SETENV
-extern int setenv (const char *, const char *, int);
-# endif
-# define STREQ(a, b) (strcmp (a, b) == 0)
-
-int
-rpl_setenv (const char *name, const char *value, int replace)
-{
- int result;
- if (!name || !*name || strchr (name, '='))
- {
- errno = EINVAL;
- return -1;
- }
- /* Call the real setenv even if replace is 0, in case implementation
- has underlying data to update, such as when environ changes. */
- result = setenv (name, value, replace);
- if (result == 0 && replace && *value == '=')
- {
- char *tmp = getenv (name);
- if (!STREQ (tmp, value))
- {
- int saved_errno;
- size_t len = strlen (value);
- tmp = malloca (len + 2);
- /* Since leading '=' is eaten, double it up. */
- *tmp = '=';
- memcpy (tmp + 1, value, len + 1);
- result = setenv (name, tmp, replace);
- saved_errno = errno;
- freea (tmp);
- errno = saved_errno;
- }
- }
- return result;
-}
-
-#endif /* HAVE_SETENV */
diff --git a/gl/tests/strerror-override.c b/gl/tests/strerror-override.c
new file mode 100644
index 0000000000..d0ed2fb86a
--- /dev/null
+++ b/gl/tests/strerror-override.c
@@ -0,0 +1,302 @@
+/* strerror-override.c --- POSIX compatible system error routine
+
+ Copyright (C) 2010-2013 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010. */
+
+#include <config.h>
+
+#include "strerror-override.h"
+
+#include <errno.h>
+
+#if GNULIB_defined_EWINSOCK /* native Windows platforms */
+# if HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
+#endif
+
+/* If ERRNUM maps to an errno value defined by gnulib, return a string
+ describing the error. Otherwise return NULL. */
+const char *
+strerror_override (int errnum)
+{
+ /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
+ switch (errnum)
+ {
+#if REPLACE_STRERROR_0
+ case 0:
+ return "Success";
+#endif
+
+#if GNULIB_defined_ESOCK /* native Windows platforms with older <errno.h> */
+ case EINPROGRESS:
+ return "Operation now in progress";
+ case EALREADY:
+ return "Operation already in progress";
+ case ENOTSOCK:
+ return "Socket operation on non-socket";
+ case EDESTADDRREQ:
+ return "Destination address required";
+ case EMSGSIZE:
+ return "Message too long";
+ case EPROTOTYPE:
+ return "Protocol wrong type for socket";
+ case ENOPROTOOPT:
+ return "Protocol not available";
+ case EPROTONOSUPPORT:
+ return "Protocol not supported";
+ case EOPNOTSUPP:
+ return "Operation not supported";
+ case EAFNOSUPPORT:
+ return "Address family not supported by protocol";
+ case EADDRINUSE:
+ return "Address already in use";
+ case EADDRNOTAVAIL:
+ return "Cannot assign requested address";
+ case ENETDOWN:
+ return "Network is down";
+ case ENETUNREACH:
+ return "Network is unreachable";
+ case ECONNRESET:
+ return "Connection reset by peer";
+ case ENOBUFS:
+ return "No buffer space available";
+ case EISCONN:
+ return "Transport endpoint is already connected";
+ case ENOTCONN:
+ return "Transport endpoint is not connected";
+ case ETIMEDOUT:
+ return "Connection timed out";
+ case ECONNREFUSED:
+ return "Connection refused";
+ case ELOOP:
+ return "Too many levels of symbolic links";
+ case EHOSTUNREACH:
+ return "No route to host";
+ case EWOULDBLOCK:
+ return "Operation would block";
+#endif
+#if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */
+ case ETXTBSY:
+ return "Text file busy";
+ case ENODATA:
+ return "No data available";
+ case ENOSR:
+ return "Out of streams resources";
+ case ENOSTR:
+ return "Device not a stream";
+ case ETIME:
+ return "Timer expired";
+ case EOTHER:
+ return "Other error";
+#endif
+#if GNULIB_defined_EWINSOCK /* native Windows platforms */
+ case ESOCKTNOSUPPORT:
+ return "Socket type not supported";
+ case EPFNOSUPPORT:
+ return "Protocol family not supported";
+ case ESHUTDOWN:
+ return "Cannot send after transport endpoint shutdown";
+ case ETOOMANYREFS:
+ return "Too many references: cannot splice";
+ case EHOSTDOWN:
+ return "Host is down";
+ case EPROCLIM:
+ return "Too many processes";
+ case EUSERS:
+ return "Too many users";
+ case EDQUOT:
+ return "Disk quota exceeded";
+ case ESTALE:
+ return "Stale NFS file handle";
+ case EREMOTE:
+ return "Object is remote";
+# if HAVE_WINSOCK2_H
+ /* WSA_INVALID_HANDLE maps to EBADF */
+ /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
+ /* WSA_INVALID_PARAMETER maps to EINVAL */
+ case WSA_OPERATION_ABORTED:
+ return "Overlapped operation aborted";
+ case WSA_IO_INCOMPLETE:
+ return "Overlapped I/O event object not in signaled state";
+ case WSA_IO_PENDING:
+ return "Overlapped operations will complete later";
+ /* WSAEINTR maps to EINTR */
+ /* WSAEBADF maps to EBADF */
+ /* WSAEACCES maps to EACCES */
+ /* WSAEFAULT maps to EFAULT */
+ /* WSAEINVAL maps to EINVAL */
+ /* WSAEMFILE maps to EMFILE */
+ /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
+ /* WSAEINPROGRESS maps to EINPROGRESS */
+ /* WSAEALREADY maps to EALREADY */
+ /* WSAENOTSOCK maps to ENOTSOCK */
+ /* WSAEDESTADDRREQ maps to EDESTADDRREQ */
+ /* WSAEMSGSIZE maps to EMSGSIZE */
+ /* WSAEPROTOTYPE maps to EPROTOTYPE */
+ /* WSAENOPROTOOPT maps to ENOPROTOOPT */
+ /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */
+ /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
+ /* WSAEOPNOTSUPP maps to EOPNOTSUPP */
+ /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
+ /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */
+ /* WSAEADDRINUSE maps to EADDRINUSE */
+ /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */
+ /* WSAENETDOWN maps to ENETDOWN */
+ /* WSAENETUNREACH maps to ENETUNREACH */
+ /* WSAENETRESET maps to ENETRESET */
+ /* WSAECONNABORTED maps to ECONNABORTED */
+ /* WSAECONNRESET maps to ECONNRESET */
+ /* WSAENOBUFS maps to ENOBUFS */
+ /* WSAEISCONN maps to EISCONN */
+ /* WSAENOTCONN maps to ENOTCONN */
+ /* WSAESHUTDOWN is ESHUTDOWN */
+ /* WSAETOOMANYREFS is ETOOMANYREFS */
+ /* WSAETIMEDOUT maps to ETIMEDOUT */
+ /* WSAECONNREFUSED maps to ECONNREFUSED */
+ /* WSAELOOP maps to ELOOP */
+ /* WSAENAMETOOLONG maps to ENAMETOOLONG */
+ /* WSAEHOSTDOWN is EHOSTDOWN */
+ /* WSAEHOSTUNREACH maps to EHOSTUNREACH */
+ /* WSAENOTEMPTY maps to ENOTEMPTY */
+ /* WSAEPROCLIM is EPROCLIM */
+ /* WSAEUSERS is EUSERS */
+ /* WSAEDQUOT is EDQUOT */
+ /* WSAESTALE is ESTALE */
+ /* WSAEREMOTE is EREMOTE */
+ case WSASYSNOTREADY:
+ return "Network subsystem is unavailable";
+ case WSAVERNOTSUPPORTED:
+ return "Winsock.dll version out of range";
+ case WSANOTINITIALISED:
+ return "Successful WSAStartup not yet performed";
+ case WSAEDISCON:
+ return "Graceful shutdown in progress";
+ case WSAENOMORE: case WSA_E_NO_MORE:
+ return "No more results";
+ case WSAECANCELLED: case WSA_E_CANCELLED:
+ return "Call was canceled";
+ case WSAEINVALIDPROCTABLE:
+ return "Procedure call table is invalid";
+ case WSAEINVALIDPROVIDER:
+ return "Service provider is invalid";
+ case WSAEPROVIDERFAILEDINIT:
+ return "Service provider failed to initialize";
+ case WSASYSCALLFAILURE:
+ return "System call failure";
+ case WSASERVICE_NOT_FOUND:
+ return "Service not found";
+ case WSATYPE_NOT_FOUND:
+ return "Class type not found";
+ case WSAEREFUSED:
+ return "Database query was refused";
+ case WSAHOST_NOT_FOUND:
+ return "Host not found";
+ case WSATRY_AGAIN:
+ return "Nonauthoritative host not found";
+ case WSANO_RECOVERY:
+ return "Nonrecoverable error";
+ case WSANO_DATA:
+ return "Valid name, no data record of requested type";
+ /* WSA_QOS_* omitted */
+# endif
+#endif
+
+#if GNULIB_defined_ENOMSG
+ case ENOMSG:
+ return "No message of desired type";
+#endif
+
+#if GNULIB_defined_EIDRM
+ case EIDRM:
+ return "Identifier removed";
+#endif
+
+#if GNULIB_defined_ENOLINK
+ case ENOLINK:
+ return "Link has been severed";
+#endif
+
+#if GNULIB_defined_EPROTO
+ case EPROTO:
+ return "Protocol error";
+#endif
+
+#if GNULIB_defined_EMULTIHOP
+ case EMULTIHOP:
+ return "Multihop attempted";
+#endif
+
+#if GNULIB_defined_EBADMSG
+ case EBADMSG:
+ return "Bad message";
+#endif
+
+#if GNULIB_defined_EOVERFLOW
+ case EOVERFLOW:
+ return "Value too large for defined data type";
+#endif
+
+#if GNULIB_defined_ENOTSUP
+ case ENOTSUP:
+ return "Not supported";
+#endif
+
+#if GNULIB_defined_ENETRESET
+ case ENETRESET:
+ return "Network dropped connection on reset";
+#endif
+
+#if GNULIB_defined_ECONNABORTED
+ case ECONNABORTED:
+ return "Software caused connection abort";
+#endif
+
+#if GNULIB_defined_ESTALE
+ case ESTALE:
+ return "Stale NFS file handle";
+#endif
+
+#if GNULIB_defined_EDQUOT
+ case EDQUOT:
+ return "Disk quota exceeded";
+#endif
+
+#if GNULIB_defined_ECANCELED
+ case ECANCELED:
+ return "Operation canceled";
+#endif
+
+#if GNULIB_defined_EOWNERDEAD
+ case EOWNERDEAD:
+ return "Owner died";
+#endif
+
+#if GNULIB_defined_ENOTRECOVERABLE
+ case ENOTRECOVERABLE:
+ return "State not recoverable";
+#endif
+
+#if GNULIB_defined_EILSEQ
+ case EILSEQ:
+ return "Invalid or incomplete multibyte or wide character";
+#endif
+
+ default:
+ return NULL;
+ }
+}
diff --git a/gl/tests/strerror-override.h b/gl/tests/strerror-override.h
new file mode 100644
index 0000000000..3b8f24b995
--- /dev/null
+++ b/gl/tests/strerror-override.h
@@ -0,0 +1,56 @@
+/* strerror-override.h --- POSIX compatible system error routine
+
+ Copyright (C) 2010-2013 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _GL_STRERROR_OVERRIDE_H
+# define _GL_STRERROR_OVERRIDE_H
+
+# include <errno.h>
+# include <stddef.h>
+
+/* Reasonable buffer size that should never trigger ERANGE; if this
+ proves too small, we intentionally abort(), to remind us to fix
+ this value. */
+# define STACKBUF_LEN 256
+
+/* If ERRNUM maps to an errno value defined by gnulib, return a string
+ describing the error. Otherwise return NULL. */
+# if REPLACE_STRERROR_0 \
+ || GNULIB_defined_ESOCK \
+ || GNULIB_defined_ESTREAMS \
+ || GNULIB_defined_EWINSOCK \
+ || GNULIB_defined_ENOMSG \
+ || GNULIB_defined_EIDRM \
+ || GNULIB_defined_ENOLINK \
+ || GNULIB_defined_EPROTO \
+ || GNULIB_defined_EMULTIHOP \
+ || GNULIB_defined_EBADMSG \
+ || GNULIB_defined_EOVERFLOW \
+ || GNULIB_defined_ENOTSUP \
+ || GNULIB_defined_ENETRESET \
+ || GNULIB_defined_ECONNABORTED \
+ || GNULIB_defined_ESTALE \
+ || GNULIB_defined_EDQUOT \
+ || GNULIB_defined_ECANCELED \
+ || GNULIB_defined_EOWNERDEAD \
+ || GNULIB_defined_ENOTRECOVERABLE \
+ || GNULIB_defined_EILSEQ
+extern const char *strerror_override (int errnum);
+# else
+# define strerror_override(ignored) NULL
+# endif
+
+#endif /* _GL_STRERROR_OVERRIDE_H */
diff --git a/gl/tests/strerror.c b/gl/tests/strerror.c
new file mode 100644
index 0000000000..80a2f2eea4
--- /dev/null
+++ b/gl/tests/strerror.c
@@ -0,0 +1,70 @@
+/* strerror.c --- POSIX compatible system error routine
+
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <string.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "intprops.h"
+#include "strerror-override.h"
+#include "verify.h"
+
+/* Use the system functions, not the gnulib overrides in this file. */
+#undef sprintf
+
+char *
+strerror (int n)
+#undef strerror
+{
+ static char buf[STACKBUF_LEN];
+ size_t len;
+
+ /* Cast away const, due to the historical signature of strerror;
+ callers should not be modifying the string. */
+ const char *msg = strerror_override (n);
+ if (msg)
+ return (char *) msg;
+
+ msg = strerror (n);
+
+ /* Our strerror_r implementation might use the system's strerror
+ buffer, so all other clients of strerror have to see the error
+ copied into a buffer that we manage. This is not thread-safe,
+ even if the system strerror is, but portable programs shouldn't
+ be using strerror if they care about thread-safety. */
+ if (!msg || !*msg)
+ {
+ static char const fmt[] = "Unknown error %d";
+ verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n));
+ sprintf (buf, fmt, n);
+ errno = EINVAL;
+ return buf;
+ }
+
+ /* Fix STACKBUF_LEN if this ever aborts. */
+ len = strlen (msg);
+ if (sizeof buf <= len)
+ abort ();
+
+ return memcpy (buf, msg, len + 1);
+}
diff --git a/gl/tests/test-argp-2.sh b/gl/tests/test-argp-2.sh
deleted file mode 100755
index cd6cd499b1..0000000000
--- a/gl/tests/test-argp-2.sh
+++ /dev/null
@@ -1,113 +0,0 @@
-#! /bin/sh
-# Test suite for argp.
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
-# This file is part of the GNUlib Library.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-TMP=argp.$$
-
-unset ARGP_HELP_FMT
-ERR=0
-
-func_compare() {
-# If argp was compiled without base_name, it will display full program name.
-# If run on mingw, it will display the program name with a .exe suffix.
- sed '1{
- s,: [^ ]*/test-argp,: test-argp,
- s,: test-argp\.exe,: test-argp,
- }' | LC_ALL=C tr -d '\r' | diff -c $TMP -
-}
-
-####
-# Test --usage output
-cat > $TMP <<EOT
-Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
- [--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga]
- [--sonet] [--option] [--optional[=ARG]] [--limerick] [--poem]
- [--help] [--usage] [--version] ARGS...
-EOT
-
-./test-argp$EXEEXT --usage | func_compare || ERR=1
-
-####
-# Test working usage-indent format
-
-cat > $TMP <<EOT
-Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
-[--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga] [--sonet]
-[--option] [--optional[=ARG]] [--limerick] [--poem] [--help] [--usage]
-[--version] ARGS...
-EOT
-
-ARGP_HELP_FMT='usage-indent=0' ./test-argp$EXEEXT --usage | func_compare || ERR=1
-
-####
-# Test --help output
-cat >$TMP <<EOT
-Usage: test-argp [OPTION...] ARGS...
-documentation string
-
- Main options
- -t, --test
-
- Option Group 1
- -f, -r, --file=FILE, --input=FILE, --read=FILE
- Option with a mandatory argument
- -v, --verbose Simple option without arguments
-
- Option Group 1.1
- -C, --cantiga create a cantiga
- -S, --sonet create a sonet
-
- Option Group 2
- -O, --option An option
-
- -o, --optional[=ARG] Option with an optional argument. ARG is one of
- the following:
-
- many many units
- one one unit
- two two units
-
- Option Group 2.1
- -l, --limerick create a limerick
- -p, --poem create a poem
-
- -?, --help give this help list
- --usage give a short usage message
- -V, --version print program version
-
-Mandatory or optional arguments to long options are also mandatory or optional
-for any corresponding short options.
-
-Report bugs to <>.
-EOT
-
-# Compare --help output, but filter out any bug-reporting email address.
-./test-argp$EXEEXT --help \
- | sed 's/^\(Report bugs to \)<[^>]*>.$/\1<>./' | func_compare || ERR=1
-
-####
-# Test ambiguous option handling
-
-./test-argp$EXEEXT --optio 2>/dev/null && ERR=1
-
-####
-# Run built-in tests
-./test-argp$EXEEXT || ERR=1
-
-rm $TMP
-
-exit $ERR
diff --git a/gl/tests/test-argp.c b/gl/tests/test-argp.c
deleted file mode 100644
index a96dee86a1..0000000000
--- a/gl/tests/test-argp.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* Test suite for argp.
- Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNUlib Library.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "argp.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#include "progname.h"
-
-struct test_args
-{
- int test;
- int verbose;
- char *file;
- int read;
- char *hidden;
- int opt;
- char *optional;
- int optional_set;
- int group_2_1_option;
- int group_1_1_option;
-};
-
-static struct argp_option group1_option[] = {
- { NULL, 0, NULL, 0, "Option Group 1", 0 },
- { "verbose", 'v', NULL, 0, "Simple option without arguments", 1 },
- { "file", 'f', "FILE", 0, "Option with a mandatory argument", 1 },
- { "input", 0, NULL, OPTION_ALIAS, NULL, 1 },
- { "read", 'r', NULL, OPTION_ALIAS, NULL, 1 },
- { "hidden", 'H', "FILE", OPTION_HIDDEN, "Hidden option", 1 },
- { NULL, 0, NULL, 0, NULL, 0 }
-};
-
-static error_t
-group1_parser (int key, char *arg, struct argp_state *state)
-{
- struct test_args *args = state->input;
-
- switch (key)
- {
- case 'v':
- args->verbose++;
- break;
-
- case 'r':
- args->read = 1;
- /* fall through */
- case 'f':
- args->file = arg;
- break;
-
- case 'H':
- args->hidden = arg;
- break;
-
- default:
- return ARGP_ERR_UNKNOWN;
- }
- return 0;
-}
-
-struct argp group1_argp = {
- group1_option,
- group1_parser
-};
-
-struct argp_child group1_child = {
- &group1_argp,
- 0,
- "",
- 1
-};
-
-
-static struct argp_option group1_1_option[] = {
- { NULL, 0, NULL, 0, "Option Group 1.1", 0 },
- { "cantiga", 'C', NULL, 0, "create a cantiga" },
- { "sonet", 'S', NULL, 0, "create a sonet" },
- { NULL, 0, NULL, 0, NULL, 0 }
-};
-
-static error_t
-group1_1_parser (int key, char *arg, struct argp_state *state)
-{
- struct test_args *args = state->input;
- switch (key)
- {
- case 'C':
- case 'S':
- args->group_1_1_option = key;
- break;
- default:
- return ARGP_ERR_UNKNOWN;
- }
- return 0;
-}
-
-struct argp group1_1_argp = {
- group1_1_option,
- group1_1_parser
-};
-
-struct argp_child group1_1_child = {
- &group1_1_argp,
- 0,
- "",
- 2
-};
-
-
-static struct argp_option group2_option[] = {
- { NULL, 0, NULL, 0, "Option Group 2", 0 },
- { "option", 'O', NULL, 0, "An option", 1 },
- { "optional", 'o', "ARG", OPTION_ARG_OPTIONAL,
- "Option with an optional argument. ARG is one of the following:", 2 },
- { "one", 0, NULL, OPTION_DOC | OPTION_NO_TRANS, "one unit", 3 },
- { "two", 0, NULL, OPTION_DOC | OPTION_NO_TRANS, "two units", 3 },
- { "many", 0, NULL, OPTION_DOC | OPTION_NO_TRANS, "many units", 3 },
- { NULL, 0, NULL, 0, NULL, 0 }
-};
-
-static error_t
-group2_parser (int key, char *arg, struct argp_state *state)
-{
- struct test_args *args = state->input;
-
- switch (key)
- {
- case 'O':
- args->opt = 1;
- break;
-
- case 'o':
- args->optional_set = 1;
- args->optional = arg;
- break;
-
- default:
- return ARGP_ERR_UNKNOWN;
- }
- return 0;
-}
-
-struct argp group2_argp = {
- group2_option,
- group2_parser
-};
-
-struct argp_child group2_child = {
- &group2_argp,
- 0,
- "",
- 2
-};
-
-
-static struct argp_option group2_1_option[] = {
- { NULL, 0, NULL, 0, "Option Group 2.1", 0 },
- { "poem", 'p', NULL, 0, "create a poem" },
- { "limerick", 'l', NULL, 0, "create a limerick" },
- { NULL, 0, NULL, 0, NULL, 0 }
-};
-
-static error_t
-group2_1_parser (int key, char *arg, struct argp_state *state)
-{
- struct test_args *args = state->input;
- switch (key)
- {
- case 'p':
- case 'e':
- args->group_2_1_option = key;
- break;
- default:
- return ARGP_ERR_UNKNOWN;
- }
- return 0;
-}
-
-struct argp group2_1_argp = {
- group2_1_option,
- group2_1_parser
-};
-
-struct argp_child group2_1_child = {
- &group2_1_argp,
- 0,
- "",
- 2
-};
-
-
-static struct argp_option main_options[] = {
- { NULL, 0, NULL, 0, "Main options", 0 },
- { "test", 't', NULL, 0, NULL, 1 },
- { NULL, 0, NULL, 0, NULL, 0 }
-};
-
-static error_t
-parse_opt (int key, char *arg, struct argp_state *state)
-{
- struct test_args *args = state->input;
- int i;
-
- switch (key)
- {
- case ARGP_KEY_INIT:
- for (i = 0; state->root_argp->children[i].argp; i++)
- state->child_inputs[i] = args;
- break;
-
- case 't':
- args->test = 1;
- break;
-
- default:
- return ARGP_ERR_UNKNOWN;
- }
- return 0;
-}
-
-const char *argp_program_version = "test_argp (" PACKAGE_NAME ") " VERSION;
-const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
-static char doc[] = "documentation string";
-
-struct argp test_argp = {
- main_options,
- parse_opt,
- "ARGS...",
- doc,
- NULL,
- NULL,
- NULL
-};
-
-#define NARGS(a) (sizeof(a) / sizeof((a)[0]) - 1)
-#define ARGV0 "test-argp"
-#define init_args(a) memset (&(a), 0, sizeof (a));
-
-#define INIT_TEST_COMMON(n) \
- int argc = NARGS (argv); \
- struct test_args test_args; \
- init_args (test_args); \
- test_number = n;
-
-#define INIT_TEST1(n, arg1) \
- char *argv[] = { ARGV0, arg1, NULL }; \
- INIT_TEST_COMMON (n)
-
-#define INIT_TEST2(n, arg1, arg2) \
- char *argv[] = { ARGV0, arg1, arg2, NULL }; \
- INIT_TEST_COMMON (n)
-
-#define INIT_TEST3(n, arg1, arg2, arg3) \
- char *argv[] = { ARGV0, arg1, arg2, arg3, NULL }; \
- INIT_TEST_COMMON (n)
-
-int test_number;
-unsigned failure_count = 0;
-
-void
-fail (const char *msg)
-{
- fprintf (stderr, "Test %d: %s\n", test_number, msg);
- failure_count++;
-}
-
-void
-test1 (struct argp *argp)
-{
- INIT_TEST1 (1, "--test");
- if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
- fail ("argp_parse failed");
- else if (test_args.test != 1)
- fail ("option not processed");
-}
-
-void
-test2 (struct argp *argp)
-{
- INIT_TEST1 (2, "-t");
- if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
- fail ("argp_parse failed");
- else if (test_args.test != 1)
- fail ("option not processed");
-}
-
-void
-test_file (struct argp *argp, int argc, char **argv, struct test_args *args)
-{
- if (argp_parse (argp, argc, argv, 0, NULL, args))
- fail ("argp_parse failed");
- else if (!args->file)
- fail ("option not processed");
- else if (strcmp (args->file, "FILE"))
- fail ("option processed incorrectly");
-}
-
-void
-test3 (struct argp *argp)
-{
- INIT_TEST1 (3, "--file=FILE");
- test_file (argp, argc, argv, &test_args);
-}
-
-void
-test4 (struct argp *argp)
-{
- INIT_TEST2 (4, "--file", "FILE");
- test_file (argp, argc, argv, &test_args);
-}
-
-void
-test5 (struct argp *argp)
-{
- INIT_TEST1 (5, "--input=FILE");
- test_file (argp, argc, argv, &test_args);
-}
-
-void
-test6 (struct argp *argp)
-{
- INIT_TEST2 (6, "--input", "FILE");
- test_file (argp, argc, argv, &test_args);
-}
-
-void
-test_optional (struct argp *argp, int argc, char **argv,
- struct test_args *args, const char *val, const char *a)
-{
- int index;
- if (argp_parse (argp, argc, argv, 0, &index, args))
- fail ("argp_parse failed");
- else if (!args->optional_set)
- fail ("option not processed");
-
- if (!val)
- {
- if (args->optional)
- fail ("option processed incorrectly");
- }
- else if (strcmp (args->optional, val))
- fail ("option processed incorrectly");
-
- if (a)
- {
- if (index == argc)
- fail ("expected command line argument not found");
- else if (strcmp (argv[index], a))
- fail ("expected command line argument does not match");
- }
-}
-
-void
-test7 (struct argp *argp)
-{
- INIT_TEST1 (7, "-oARG");
- test_optional (argp, argc, argv, &test_args, "ARG", NULL);
-}
-
-void
-test8 (struct argp *argp)
-{
- INIT_TEST2 (8, "-o", "ARG");
- test_optional (argp, argc, argv, &test_args, NULL, "ARG");
-}
-
-void
-test9 (struct argp *argp)
-{
- INIT_TEST1 (9, "--optional=ARG");
- test_optional (argp, argc, argv, &test_args, "ARG", NULL);
-}
-
-void
-test10 (struct argp *argp)
-{
- INIT_TEST2 (10, "--optional", "ARG");
- test_optional (argp, argc, argv, &test_args, NULL, "ARG");
-}
-
-void
-test11 (struct argp *argp)
-{
- INIT_TEST1 (11, "--optiona=ARG");
- test_optional (argp, argc, argv, &test_args, "ARG", NULL);
-}
-
-void
-test12 (struct argp *argp)
-{
- INIT_TEST3 (12, "--option", "--optional=OPT", "FILE");
- test_optional (argp, argc, argv, &test_args, "OPT", "FILE");
-}
-
-void
-test13 (struct argp *argp)
-{
- INIT_TEST1 (1, "--cantiga");
- if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
- fail ("argp_parse failed");
- else if (test_args.group_1_1_option != 'C')
- fail ("option not processed");
-}
-
-void
-test14 (struct argp *argp)
-{
- INIT_TEST1 (1, "--limerick");
- if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
- fail ("argp_parse failed");
- else if (test_args.group_2_1_option != 'l')
- fail ("option not processed");
-}
-
-void
-test15 (struct argp *argp)
-{
- INIT_TEST2 (1, "-r", "FILE");
- test_file (argp, argc, argv, &test_args);
- if (!test_args.read)
- fail ("short alias not recognized properly");
-}
-
-
-typedef void (*test_fp) (struct argp *argp);
-
-test_fp test_fun[] = {
- test1, test2, test3, test4,
- test5, test6, test7, test8,
- test9, test10, test11, test12,
- test13, test14, test15,
- NULL
-};
-
-int
-main (int argc, char **argv)
-{
- struct argp_child argp_children[3], group1_children[2], group2_children[2];
- test_fp *fun;
-
- set_program_name (argv[0]);
-
- group1_children[0] = group1_1_child;
- group1_children[1].argp = NULL;
- group1_argp.children = group1_children;
-
- group2_children[0] = group2_1_child;
- group2_children[1].argp = NULL;
- group2_argp.children = group2_children;
-
- argp_children[0] = group1_child;
- argp_children[1] = group2_child;
- argp_children[2].argp = NULL;
- test_argp.children = argp_children;
-
- if (argc > 0)
- {
- struct test_args test_args;
- init_args (test_args);
- return argp_parse (&test_argp, argc, argv, 0, NULL, &test_args);
- }
-
- for (fun = test_fun; *fun; fun++)
- (*fun) (&test_argp);
-
- if (failure_count)
- return 1;
-
- return 0;
-}
diff --git a/gl/tests/test-dirent.c b/gl/tests/test-dirent.c
deleted file mode 100644
index 34ef5d94e6..0000000000
--- a/gl/tests/test-dirent.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Test of <dirent.h> substitute.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009. */
-
-#include <config.h>
-
-#include <dirent.h>
-
-/* Check for existence of required types. */
-static DIR *dir _GL_UNUSED;
-static struct dirent d;
-static ino_t i;
-
-int
-main (void)
-{
- return d.d_name[0] + i;
-}
diff --git a/gl/tests/test-environ.c b/gl/tests/test-environ.c
deleted file mode 100644
index cb3d9f6021..0000000000
--- a/gl/tests/test-environ.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Test of environ variable.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2008. */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include <string.h>
-
-int
-main ()
-{
- /* The environment variables that are set even in the weirdest situations
- are HOME and PATH.
- POSIX says that HOME is initialized by the system, and that PATH may be
- unset. But in practice it's more frequent to see HOME unset and PATH
- set. So we test the presence of PATH. */
- char **remaining_variables = environ;
- char *string;
-
- for (; (string = *remaining_variables) != NULL; remaining_variables++)
- {
- if (strncmp (string, "PATH=", 5) == 0)
- /* Found the PATH environment variable. */
- return 0;
- }
- /* Failed to find the PATH environment variable. */
- return 1;
-}
diff --git a/gl/tests/test-fprintf-posix.h b/gl/tests/test-fprintf-posix.h
deleted file mode 100644
index a5b72c781a..0000000000
--- a/gl/tests/test-fprintf-posix.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Test of POSIX compatible vsprintf() and sprintf() functions.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include "infinity.h"
-
-static void
-test_function (int (*my_fprintf) (FILE *, const char *, ...))
-{
- /* Here we don't test output that may be platform dependent.
- The bulk of the tests is done as part of the 'vasnprintf-posix' module. */
-
- /* Test support of size specifiers as in C99. */
-
- my_fprintf (stdout, "%ju %d\n", (uintmax_t) 12345671, 33, 44, 55);
-
- my_fprintf (stdout, "%zu %d\n", (size_t) 12345672, 33, 44, 55);
-
- my_fprintf (stdout, "%tu %d\n", (ptrdiff_t) 12345673, 33, 44, 55);
-
- /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal
- output of floating-point numbers. */
-
- /* Positive zero. */
- my_fprintf (stdout, "%a %d\n", 0.0, 33, 44, 55);
-
- /* Positive infinity. */
- my_fprintf (stdout, "%a %d\n", Infinityd (), 33, 44, 55);
-
- /* Negative infinity. */
- my_fprintf (stdout, "%a %d\n", - Infinityd (), 33, 44, 55);
-
- /* FLAG_ZERO with infinite number. */
- my_fprintf (stdout, "%010a %d\n", Infinityd (), 33, 44, 55);
-
- /* Test the support of the %f format directive. */
-
- /* A positive number. */
- my_fprintf (stdout, "%f %d\n", 12.75, 33, 44, 55);
-
- /* A larger positive number. */
- my_fprintf (stdout, "%f %d\n", 1234567.0, 33, 44, 55);
-
- /* A negative number. */
- my_fprintf (stdout, "%f %d\n", -0.03125, 33, 44, 55);
-
- /* Positive zero. */
- my_fprintf (stdout, "%f %d\n", 0.0, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_fprintf (stdout, "%015f %d\n", 1234.0, 33, 44, 55);
-
- /* Precision. */
- my_fprintf (stdout, "%.f %d\n", 1234.0, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_fprintf (stdout, "%.2f %d\n", 999.95, 33, 44, 55);
-
- /* Precision with rounding. */
- my_fprintf (stdout, "%.2f %d\n", 999.996, 33, 44, 55);
-
- /* A positive number. */
- my_fprintf (stdout, "%Lf %d\n", 12.75L, 33, 44, 55);
-
- /* A larger positive number. */
- my_fprintf (stdout, "%Lf %d\n", 1234567.0L, 33, 44, 55);
-
- /* A negative number. */
- my_fprintf (stdout, "%Lf %d\n", -0.03125L, 33, 44, 55);
-
- /* Positive zero. */
- my_fprintf (stdout, "%Lf %d\n", 0.0L, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_fprintf (stdout, "%015Lf %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision. */
- my_fprintf (stdout, "%.Lf %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_fprintf (stdout, "%.2Lf %d\n", 999.95L, 33, 44, 55);
-
- /* Precision with rounding. */
- my_fprintf (stdout, "%.2Lf %d\n", 999.996L, 33, 44, 55);
-
- /* Test the support of the %F format directive. */
-
- /* A positive number. */
- my_fprintf (stdout, "%F %d\n", 12.75, 33, 44, 55);
-
- /* A larger positive number. */
- my_fprintf (stdout, "%F %d\n", 1234567.0, 33, 44, 55);
-
- /* A negative number. */
- my_fprintf (stdout, "%F %d\n", -0.03125, 33, 44, 55);
-
- /* Positive zero. */
- my_fprintf (stdout, "%F %d\n", 0.0, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_fprintf (stdout, "%015F %d\n", 1234.0, 33, 44, 55);
-
- /* Precision. */
- my_fprintf (stdout, "%.F %d\n", 1234.0, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_fprintf (stdout, "%.2F %d\n", 999.95, 33, 44, 55);
-
- /* Precision with rounding. */
- my_fprintf (stdout, "%.2F %d\n", 999.996, 33, 44, 55);
-
- /* A positive number. */
- my_fprintf (stdout, "%LF %d\n", 12.75L, 33, 44, 55);
-
- /* A larger positive number. */
- my_fprintf (stdout, "%LF %d\n", 1234567.0L, 33, 44, 55);
-
- /* A negative number. */
- my_fprintf (stdout, "%LF %d\n", -0.03125L, 33, 44, 55);
-
- /* Positive zero. */
- my_fprintf (stdout, "%LF %d\n", 0.0L, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_fprintf (stdout, "%015LF %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision. */
- my_fprintf (stdout, "%.LF %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_fprintf (stdout, "%.2LF %d\n", 999.95L, 33, 44, 55);
-
- /* Precision with rounding. */
- my_fprintf (stdout, "%.2LF %d\n", 999.996L, 33, 44, 55);
-
- /* Test the support of the POSIX/XSI format strings with positions. */
-
- my_fprintf (stdout, "%2$d %1$d\n", 33, 55);
-}
diff --git a/gl/tests/test-frexp.c b/gl/tests/test-frexp.c
deleted file mode 100644
index 6e3e000931..0000000000
--- a/gl/tests/test-frexp.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Test of splitting a double into fraction and mantissa.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <math.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (frexp, double, (double, int *));
-
-#include <float.h>
-
-#include "isnand-nolibm.h"
-#include "minus-zero.h"
-#include "infinity.h"
-#include "nan.h"
-#include "macros.h"
-
-/* Avoid some warnings from "gcc -Wshadow".
- This file doesn't use the exp() function. */
-#undef exp
-#define exp exponent
-
-#undef INFINITY
-#undef NAN
-
-#define DOUBLE double
-/* The use of 'volatile' guarantees that excess precision bits are dropped
- when dealing with denormalized numbers. It is necessary on x86 systems
- where double-floats are not IEEE compliant by default, to avoid that the
- results become platform and compiler option dependent. 'volatile' is a
- portable alternative to gcc's -ffloat-store option. */
-#define VOLATILE volatile
-#define ISNAN isnand
-#define INFINITY Infinityd ()
-#define NAN NaNd ()
-#define L_(literal) literal
-#define MINUS_ZERO minus_zerod
-#define MAX_EXP DBL_MAX_EXP
-#define MIN_EXP DBL_MIN_EXP
-#define MIN_NORMAL_EXP DBL_MIN_EXP
-#define FREXP frexp
-#define RANDOM randomd
-#include "test-frexp.h"
-
-int
-main ()
-{
- test_function ();
-
- return 0;
-}
diff --git a/gl/tests/test-frexp.h b/gl/tests/test-frexp.h
deleted file mode 100644
index e50be148ae..0000000000
--- a/gl/tests/test-frexp.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Test of splitting a double into fraction and mantissa.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-static DOUBLE
-my_ldexp (DOUBLE x, int d)
-{
- for (; d > 0; d--)
- x *= L_(2.0);
- for (; d < 0; d++)
- x *= L_(0.5);
- return x;
-}
-
-static void
-test_function (void)
-{
- int i;
- VOLATILE DOUBLE x;
-
- { /* NaN. */
- int exp = -9999;
- DOUBLE mantissa;
- x = NAN;
- mantissa = FREXP (x, &exp);
- ASSERT (ISNAN (mantissa));
- }
-
- { /* Positive infinity. */
- int exp = -9999;
- DOUBLE mantissa;
- x = INFINITY;
- mantissa = FREXP (x, &exp);
- ASSERT (mantissa == x);
- }
-
- { /* Negative infinity. */
- int exp = -9999;
- DOUBLE mantissa;
- x = - INFINITY;
- mantissa = FREXP (x, &exp);
- ASSERT (mantissa == x);
- }
-
- { /* Positive zero. */
- int exp = -9999;
- DOUBLE mantissa;
- x = L_(0.0);
- mantissa = FREXP (x, &exp);
- ASSERT (exp == 0);
- ASSERT (mantissa == x);
- ASSERT (!signbit (mantissa));
- }
-
- { /* Negative zero. */
- int exp = -9999;
- DOUBLE mantissa;
- x = MINUS_ZERO;
- mantissa = FREXP (x, &exp);
- ASSERT (exp == 0);
- ASSERT (mantissa == x);
- ASSERT (signbit (mantissa));
- }
-
- for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == L_(0.5));
- }
- for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == L_(0.5));
- }
- for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == L_(0.5));
- }
-
- for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == - L_(0.5));
- }
- for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == - L_(0.5));
- }
- for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == - L_(0.5));
- }
-
- for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == L_(0.505));
- }
- for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == L_(0.505));
- }
- for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa >= L_(0.5));
- ASSERT (mantissa < L_(1.0));
- ASSERT (mantissa == my_ldexp (x, - exp));
- }
-
- for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == L_(0.866025));
- }
- for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i);
- ASSERT (mantissa == L_(0.866025));
- }
- for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (exp == i || exp == i + 1);
- ASSERT (mantissa >= L_(0.5));
- ASSERT (mantissa < L_(1.0));
- ASSERT (mantissa == my_ldexp (x, - exp));
- }
-
- /* Randomized tests. */
- for (i = 0; i < SIZEOF (RANDOM); i++)
- {
- x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
- {
- int exp = -9999;
- DOUBLE mantissa = FREXP (x, &exp);
- ASSERT (x == my_ldexp (mantissa, exp));
- }
- }
-}
diff --git a/gl/tests/test-frexpl.c b/gl/tests/test-frexpl.c
deleted file mode 100644
index 5a5eae52c4..0000000000
--- a/gl/tests/test-frexpl.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Test of splitting a 'long double' into fraction and mantissa.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <math.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (frexpl, long double, (long double, int *));
-
-#include <float.h>
-
-#include "fpucw.h"
-#include "isnanl-nolibm.h"
-#include "minus-zero.h"
-#include "infinity.h"
-#include "nan.h"
-#include "macros.h"
-
-/* Avoid some warnings from "gcc -Wshadow".
- This file doesn't use the exp() function. */
-#undef exp
-#define exp exponent
-
-#undef INFINITY
-#undef NAN
-
-#define DOUBLE long double
-#define VOLATILE
-#define ISNAN isnanl
-#define INFINITY Infinityl ()
-#define NAN NaNl ()
-#define L_(literal) literal##L
-#define MINUS_ZERO minus_zerol
-#define MAX_EXP LDBL_MAX_EXP
-#define MIN_EXP LDBL_MIN_EXP
-/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
- exponent for 'long double' is -964. Similarly, on PowerPC machines,
- LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double'
- is -968. For exponents below that, the precision may be truncated to the
- precision used for 'double'. */
-#ifdef __sgi
-# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57)
-#elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
-# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
-#else
-# define MIN_NORMAL_EXP LDBL_MIN_EXP
-#endif
-#define FREXP frexpl
-#define RANDOM randoml
-#include "test-frexp.h"
-
-int
-main ()
-{
- DECL_LONG_DOUBLE_ROUNDING
-
- BEGIN_LONG_DOUBLE_ROUNDING ();
-
- test_function ();
-
- return 0;
-}
diff --git a/gl/tests/test-fseterr.c b/gl/tests/test-fseterr.c
deleted file mode 100644
index 7390b46638..0000000000
--- a/gl/tests/test-fseterr.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Test setting the error indicator of a stream.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include "fseterr.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main ()
-{
- /* All streams are initially created with the error indicator cleared. */
- if (ferror (stdout))
- abort ();
-
- /* Verify that fseterr() works. */
- fseterr (stdout);
- if (!ferror (stdout))
- abort ();
-
- /* Verify fseterr's effect can be undone by clearerr(). */
- clearerr (stdout);
- if (ferror (stdout))
- abort ();
-
- return 0;
-}
diff --git a/gl/tests/test-getopt.c b/gl/tests/test-getopt.c
deleted file mode 100644
index 7caf0273fd..0000000000
--- a/gl/tests/test-getopt.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Test of command line argument processing.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
-
-#include <config.h>
-
-/* None of the files accessed by this test are large, so disable the
- ftell link warning if we are not using the gnulib ftell module. */
-#define _GL_NO_LARGE_FILES
-
-#if GNULIB_TEST_GETOPT_GNU
-# include <getopt.h>
-
-# ifndef __getopt_argv_const
-# define __getopt_argv_const const
-# endif
-# include "signature.h"
-SIGNATURE_CHECK (getopt_long, int, (int, char *__getopt_argv_const *,
- char const *, struct option const *,
- int *));
-SIGNATURE_CHECK (getopt_long_only, int, (int, char *__getopt_argv_const *,
- char const *, struct option const *,
- int *));
-
-#endif
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (getopt, int, (int, char * const[], char const *));
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* This test intentionally remaps stderr. So, we arrange to have fd 10
- (outside the range of interesting fd's during the test) set up to
- duplicate the original stderr. */
-
-#define BACKUP_STDERR_FILENO 10
-#define ASSERT_STREAM myerr
-#include "macros.h"
-
-static FILE *myerr;
-
-#include "test-getopt.h"
-#if GNULIB_TEST_GETOPT_GNU
-# include "test-getopt_long.h"
-#endif
-
-int
-main (void)
-{
- /* This test validates that stderr is used correctly, so move the
- original into fd 10. */
- if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
- || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
- return 2;
-
- ASSERT (freopen ("test-getopt.tmp", "w", stderr) == stderr);
-
- /* These default values are required by POSIX. */
- ASSERT (optind == 1);
- ASSERT (opterr != 0);
-
- setenv ("POSIXLY_CORRECT", "1", 1);
- test_getopt ();
-
-#if GNULIB_TEST_GETOPT_GNU
- test_getopt_long_posix ();
-#endif
-
- unsetenv ("POSIXLY_CORRECT");
- test_getopt ();
-
-#if GNULIB_TEST_GETOPT_GNU
- test_getopt_long ();
- test_getopt_long_only ();
-#endif
-
- ASSERT (fclose (stderr) == 0);
- ASSERT (remove ("test-getopt.tmp") == 0);
-
- return 0;
-}
diff --git a/gl/tests/test-getopt.h b/gl/tests/test-getopt.h
deleted file mode 100644
index 450cf0d31a..0000000000
--- a/gl/tests/test-getopt.h
+++ /dev/null
@@ -1,1391 +0,0 @@
-/* Test of command line argument processing.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
-
-#include <stdbool.h>
-
-/* The glibc/gnulib implementation of getopt supports setting optind =
- 0, but not all other implementations do. This matters for getopt.
- But for getopt_long, we require GNU compatibility. */
-#if defined __GETOPT_PREFIX || (__GLIBC__ >= 2 && !defined __UCLIBC__)
-# define OPTIND_MIN 0
-#elif HAVE_DECL_OPTRESET
-# define OPTIND_MIN (optreset = 1)
-#else
-# define OPTIND_MIN 1
-#endif
-
-static void
-getopt_loop (int argc, const char **argv,
- const char *options,
- int *a_seen, int *b_seen,
- const char **p_value, const char **q_value,
- int *non_options_count, const char **non_options,
- int *unrecognized, bool *message_issued)
-{
- int c;
- int pos = ftell (stderr);
-
- while ((c = getopt (argc, (char **) argv, options)) != -1)
- {
- switch (c)
- {
- case 'a':
- (*a_seen)++;
- break;
- case 'b':
- (*b_seen)++;
- break;
- case 'p':
- *p_value = optarg;
- break;
- case 'q':
- *q_value = optarg;
- break;
- case '\1':
- /* Must only happen with option '-' at the beginning. */
- ASSERT (options[0] == '-');
- non_options[(*non_options_count)++] = optarg;
- break;
- case ':':
- /* Must only happen with option ':' at the beginning. */
- ASSERT (options[0] == ':'
- || ((options[0] == '-' || options[0] == '+')
- && options[1] == ':'));
- /* fall through */
- case '?':
- *unrecognized = optopt;
- break;
- default:
- *unrecognized = c;
- break;
- }
- }
-
- *message_issued = pos < ftell (stderr);
-}
-
-static void
-test_getopt (void)
-{
- int start;
- bool posixly = !!getenv ("POSIXLY_CORRECT");
- /* See comment in getopt.c:
- glibc gets a LSB-compliant getopt.
- Standalone applications get a POSIX-compliant getopt. */
-#if defined __GETOPT_PREFIX || !(__GLIBC__ >= 2 || defined __MINGW32__)
- /* Using getopt from gnulib or from a non-glibc system. */
- posixly = true;
-#endif
-
- /* Test processing of boolean options. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-a";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "ab",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-b";
- argv[argc++] = "-a";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "ab",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-ba";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "ab",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-ab";
- argv[argc++] = "-a";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "ab",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 2);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- ASSERT (!output);
- }
-
- /* Test processing of options with arguments. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-pfoo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "p:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "p:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-ab";
- argv[argc++] = "-q";
- argv[argc++] = "baz";
- argv[argc++] = "-pfoo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- ASSERT (!output);
- }
-
-#if GNULIB_TEST_GETOPT_GNU
- /* Test processing of options with optional arguments. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-pfoo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "p::q::",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "p::q::",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "abp::q::",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- ASSERT (!output);
- }
-#endif /* GNULIB_TEST_GETOPT_GNU */
-
- /* Check that invalid options are recognized; and that both opterr
- and leading ':' can silence output. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-x";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 42;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'x');
- ASSERT (optind == 5);
- ASSERT (output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-x";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 0;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'x');
- ASSERT (optind == 5);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-x";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, ":abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'x');
- ASSERT (optind == 5);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-:";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 42;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == ':');
- ASSERT (optind == 5);
- ASSERT (output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-:";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 0;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == ':');
- ASSERT (optind == 5);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-:";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, ":abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == ':');
- ASSERT (optind == 5);
- ASSERT (!output);
- }
-
- /* Check for missing argument behavior. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-ap";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'p');
- ASSERT (optind == 2);
- ASSERT (output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-ap";
- argv[argc] = NULL;
- optind = start;
- opterr = 0;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'p');
- ASSERT (optind == 2);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-ap";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, ":abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'p');
- ASSERT (optind == 2);
- ASSERT (!output);
- }
-
- /* Check that by default, non-options arguments are moved to the end. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- if (posixly)
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- ASSERT (!output);
- }
- else
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "donald") == 0);
- ASSERT (strcmp (argv[5], "duck") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- ASSERT (!output);
- }
- }
-
- /* Check that '--' ends the argument processing. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[20];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "--";
- argv[argc++] = "-b";
- argv[argc++] = "foo";
- argv[argc++] = "-q";
- argv[argc++] = "johnny";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- if (posixly)
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "--") == 0);
- ASSERT (strcmp (argv[7], "-b") == 0);
- ASSERT (strcmp (argv[8], "foo") == 0);
- ASSERT (strcmp (argv[9], "-q") == 0);
- ASSERT (strcmp (argv[10], "johnny") == 0);
- ASSERT (strcmp (argv[11], "bar") == 0);
- ASSERT (argv[12] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- ASSERT (!output);
- }
- else
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "--") == 0);
- ASSERT (strcmp (argv[5], "donald") == 0);
- ASSERT (strcmp (argv[6], "duck") == 0);
- ASSERT (strcmp (argv[7], "-b") == 0);
- ASSERT (strcmp (argv[8], "foo") == 0);
- ASSERT (strcmp (argv[9], "-q") == 0);
- ASSERT (strcmp (argv[10], "johnny") == 0);
- ASSERT (strcmp (argv[11], "bar") == 0);
- ASSERT (argv[12] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- ASSERT (!output);
- }
- }
-
-#if GNULIB_TEST_GETOPT_GNU
- /* Check that the '-' flag causes non-options to be returned in order. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "-abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 3);
- ASSERT (strcmp (non_options[0], "donald") == 0);
- ASSERT (strcmp (non_options[1], "duck") == 0);
- ASSERT (strcmp (non_options[2], "bar") == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 7);
- ASSERT (!output);
- }
-
- /* Check that '--' ends the argument processing. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[20];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "--";
- argv[argc++] = "-b";
- argv[argc++] = "foo";
- argv[argc++] = "-q";
- argv[argc++] = "johnny";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "-abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "--") == 0);
- ASSERT (strcmp (argv[7], "-b") == 0);
- ASSERT (strcmp (argv[8], "foo") == 0);
- ASSERT (strcmp (argv[9], "-q") == 0);
- ASSERT (strcmp (argv[10], "johnny") == 0);
- ASSERT (strcmp (argv[11], "bar") == 0);
- ASSERT (argv[12] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (!output);
- if (non_options_count == 2)
- {
- /* glibc behaviour. */
- ASSERT (non_options_count == 2);
- ASSERT (strcmp (non_options[0], "donald") == 0);
- ASSERT (strcmp (non_options[1], "duck") == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 7);
- }
- else
- {
- /* Another valid behaviour. */
- ASSERT (non_options_count == 7);
- ASSERT (strcmp (non_options[0], "donald") == 0);
- ASSERT (strcmp (non_options[1], "duck") == 0);
- ASSERT (strcmp (non_options[2], "-b") == 0);
- ASSERT (strcmp (non_options[3], "foo") == 0);
- ASSERT (strcmp (non_options[4], "-q") == 0);
- ASSERT (strcmp (non_options[5], "johnny") == 0);
- ASSERT (strcmp (non_options[6], "bar") == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 12);
- }
- }
-
- /* Check that the '-' flag has to come first. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "abp:q:-",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- if (posixly)
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- ASSERT (!output);
- }
- else
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "donald") == 0);
- ASSERT (strcmp (argv[5], "duck") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- ASSERT (!output);
- }
- }
-
- /* Check that the '+' flag causes the first non-option to terminate the
- loop. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "+abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-+";
- argv[argc] = NULL;
- optind = start;
- getopt_loop (argc, argv, "+abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == '+');
- ASSERT (optind == 2);
- ASSERT (output);
- }
-
- /* Check that '--' ends the argument processing. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[20];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "--";
- argv[argc++] = "-b";
- argv[argc++] = "foo";
- argv[argc++] = "-q";
- argv[argc++] = "johnny";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "+abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "--") == 0);
- ASSERT (strcmp (argv[7], "-b") == 0);
- ASSERT (strcmp (argv[8], "foo") == 0);
- ASSERT (strcmp (argv[9], "-q") == 0);
- ASSERT (strcmp (argv[10], "johnny") == 0);
- ASSERT (strcmp (argv[11], "bar") == 0);
- ASSERT (argv[12] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- ASSERT (!output);
- }
-#endif /* GNULIB_TEST_GETOPT_GNU */
-
- /* Check that the '+' flag has to come first. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "abp:q:+",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- if (posixly)
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- ASSERT (!output);
- }
- else
- {
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "donald") == 0);
- ASSERT (strcmp (argv[5], "duck") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- ASSERT (!output);
- }
- }
-
-#if GNULIB_TEST_GETOPT_GNU
- /* If GNU extensions are supported, require compliance with POSIX
- interpretation on leading '+' behavior.
- http://austingroupbugs.net/view.php?id=191 */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- getopt_loop (argc, argv, "+:abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc] = NULL;
- optind = start;
- getopt_loop (argc, argv, "+:abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'p');
- ASSERT (optind == 2);
- ASSERT (!output);
- }
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int a_seen = 0;
- int b_seen = 0;
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- bool output;
- int argc = 0;
- const char *argv[10];
-
- argv[argc++] = "program";
- argv[argc++] = "-b";
- argv[argc++] = "-p";
- argv[argc] = NULL;
- optind = start;
- getopt_loop (argc, argv, "+:abp:q:",
- &a_seen, &b_seen, &p_value, &q_value,
- &non_options_count, non_options, &unrecognized, &output);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'p');
- ASSERT (optind == 3);
- ASSERT (!output);
- }
-
- /* Check that 'W' does not dump core:
- http://sourceware.org/bugzilla/show_bug.cgi?id=12922
- Technically, POSIX says the presence of ';' in the opt-string
- gives unspecified behavior, so we only test this when GNU compliance
- is desired. */
- for (start = OPTIND_MIN; start <= 1; start++)
- {
- int argc = 0;
- const char *argv[10];
- int pos = ftell (stderr);
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc++] = "dummy";
- argv[argc] = NULL;
- optind = start;
- opterr = 1;
- ASSERT (getopt (argc, (char **) argv, "W;") == 'W');
- ASSERT (ftell (stderr) == pos);
- ASSERT (optind == 2);
- }
-#endif /* GNULIB_TEST_GETOPT_GNU */
-}
diff --git a/gl/tests/test-getopt_long.h b/gl/tests/test-getopt_long.h
deleted file mode 100644
index 345a796ad4..0000000000
--- a/gl/tests/test-getopt_long.h
+++ /dev/null
@@ -1,2144 +0,0 @@
-/* Test of command line argument processing.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
-
-static int a_seen;
-static int b_seen;
-static int q_seen;
-
-static const struct option long_options_required[] =
- {
- { "alpha", no_argument, NULL, 'a' },
- { "beta", no_argument, &b_seen, 1 },
- { "prune", required_argument, NULL, 'p' },
- { "quetsche", required_argument, &q_seen, 1 },
- { "xtremely-",no_argument, NULL, 1003 },
- { "xtra", no_argument, NULL, 1001 },
- { "xtreme", no_argument, NULL, 1002 },
- { "xtremely", no_argument, NULL, 1003 },
- { NULL, 0, NULL, 0 }
- };
-
-static const struct option long_options_optional[] =
- {
- { "alpha", no_argument, NULL, 'a' },
- { "beta", no_argument, &b_seen, 1 },
- { "prune", optional_argument, NULL, 'p' },
- { "quetsche", optional_argument, &q_seen, 1 },
- { NULL, 0, NULL, 0 }
- };
-
-static void
-getopt_long_loop (int argc, const char **argv,
- const char *options, const struct option *long_options,
- const char **p_value, const char **q_value,
- int *non_options_count, const char **non_options,
- int *unrecognized)
-{
- int option_index = -1;
- int c;
-
- opterr = 0;
- q_seen = 0;
- while ((c = getopt_long (argc, (char **) argv, options, long_options,
- &option_index))
- != -1)
- {
- switch (c)
- {
- case 0:
- /* An option with a non-NULL flag pointer was processed. */
- if (q_seen)
- *q_value = optarg;
- break;
- case 'a':
- a_seen++;
- break;
- case 'b':
- b_seen = 1;
- break;
- case 'p':
- *p_value = optarg;
- break;
- case 'q':
- *q_value = optarg;
- break;
- case '\1':
- /* Must only happen with option '-' at the beginning. */
- ASSERT (options[0] == '-');
- non_options[(*non_options_count)++] = optarg;
- break;
- case ':':
- /* Must only happen with option ':' at the beginning. */
- ASSERT (options[0] == ':'
- || ((options[0] == '-' || options[0] == '+')
- && options[1] == ':'));
- /* fall through */
- case '?':
- *unrecognized = optopt;
- break;
- default:
- *unrecognized = c;
- break;
- }
- }
-}
-
-/* Reduce casting, so we can use string literals elsewhere.
- getopt_long takes an array of char*, but luckily does not modify
- those elements, so we can pass const char*. */
-static int
-do_getopt_long (int argc, const char **argv, const char *shortopts,
- const struct option *longopts, int *longind)
-{
- return getopt_long (argc, (char **) argv, shortopts, longopts, longind);
-}
-
-static void
-test_getopt_long (void)
-{
- int start;
-
- /* Test disambiguation of options. */
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--x";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xt";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xtr";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xtra";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == 1001);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xtre";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xtrem";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xtreme";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == 1002);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xtremel";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == 1003);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--xtremely";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
- ASSERT (c == 1003);
- }
-
- /* Check that -W handles unknown options. */
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 'W');
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-Wunknown";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index);
- /* glibc and BSD behave differently here, but for now, we allow
- both behaviors since W support is not frequently used. */
- if (c == '?')
- {
- ASSERT (optopt == 0);
- ASSERT (optarg == NULL);
- }
- else
- {
- ASSERT (c == 'W');
- ASSERT (strcmp (optarg, "unknown") == 0);
- }
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc++] = "unknown";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index);
- /* glibc and BSD behave differently here, but for now, we allow
- both behaviors since W support is not frequently used. */
- if (c == '?')
- {
- ASSERT (optopt == 0);
- ASSERT (optarg == NULL);
- }
- else
- {
- ASSERT (c == 'W');
- ASSERT (strcmp (optarg, "unknown") == 0);
- }
- }
-
- /* Test that 'W' does not dump core:
- http://sourceware.org/bugzilla/show_bug.cgi?id=12922 */
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc++] = "dummy";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long (argc, argv, "W;", NULL, &option_index);
- ASSERT (c == 'W');
- ASSERT (optind == 2);
- }
-
- /* Test processing of boolean short options. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-a";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-b";
- argv[argc++] = "-a";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-ba";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-ab";
- argv[argc++] = "-a";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 2);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
-
- /* Test processing of boolean long options. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--alpha";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--beta";
- argv[argc++] = "--alpha";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--alpha";
- argv[argc++] = "--beta";
- argv[argc++] = "--alpha";
- argv[argc++] = "--beta";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 2);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- }
-
- /* Test processing of boolean long options via -W. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-Walpha";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abW;", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc++] = "beta";
- argv[argc++] = "-W";
- argv[argc++] = "alpha";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "aW;b", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-Walpha";
- argv[argc++] = "-Wbeta";
- argv[argc++] = "-Walpha";
- argv[argc++] = "-Wbeta";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "W;ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 2);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- }
-
- /* Test processing of short options with arguments. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-pfoo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-ab";
- argv[argc++] = "-q";
- argv[argc++] = "baz";
- argv[argc++] = "-pfoo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- }
-
- /* Test processing of long options with arguments. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--p=foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--p";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-ab";
- argv[argc++] = "--q";
- argv[argc++] = "baz";
- argv[argc++] = "--p=foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- }
-
- /* Test processing of long options with arguments via -W. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-Wp=foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p:q:W;", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc++] = "p";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p:W;q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-ab";
- argv[argc++] = "-Wq";
- argv[argc++] = "baz";
- argv[argc++] = "-W";
- argv[argc++] = "p=foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "W;abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 6);
- }
-
- /* Test processing of short options with optional arguments. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-pfoo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
-
- /* Test processing of long options with optional arguments. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--p=foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--p";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--p=";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && *p_value == '\0');
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "--p";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
-
- /* Test processing of long options with optional arguments via -W. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-Wp=foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::q::W;", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-Wp";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::q::W;", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-Wp=";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "W;p::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && *p_value == '\0');
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc++] = "p=";
- argv[argc++] = "foo";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "W;p::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && *p_value == '\0');
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 3);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-W";
- argv[argc++] = "p";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "W;abp::q::", long_options_optional,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- /* ASSERT (p_value == NULL); */
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- }
-
- /* Check that invalid options are recognized. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-x";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'x');
- ASSERT (optind == 5);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "-:";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == ':');
- ASSERT (optind == 5);
- }
-
- /* Check that unexpected arguments are recognized. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "--a=";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 'a');
- ASSERT (optind == 4);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "foo";
- argv[argc++] = "--b=";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- /* When flag is non-zero, glibc sets optopt anyway, but BSD
- leaves optopt unchanged. */
- ASSERT (unrecognized == 1 || unrecognized == 0);
- ASSERT (optind == 4);
- }
-
- /* Check that by default, non-options arguments are moved to the end. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "donald") == 0);
- ASSERT (strcmp (argv[5], "duck") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- }
-
- /* Check that '--' ends the argument processing. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[20];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "--";
- argv[argc++] = "-b";
- argv[argc++] = "foo";
- argv[argc++] = "-q";
- argv[argc++] = "johnny";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "--") == 0);
- ASSERT (strcmp (argv[5], "donald") == 0);
- ASSERT (strcmp (argv[6], "duck") == 0);
- ASSERT (strcmp (argv[7], "-b") == 0);
- ASSERT (strcmp (argv[8], "foo") == 0);
- ASSERT (strcmp (argv[9], "-q") == 0);
- ASSERT (strcmp (argv[10], "johnny") == 0);
- ASSERT (strcmp (argv[11], "bar") == 0);
- ASSERT (argv[12] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 5);
- }
-
- /* Check that the '-' flag causes non-options to be returned in order. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "-abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 3);
- ASSERT (strcmp (non_options[0], "donald") == 0);
- ASSERT (strcmp (non_options[1], "duck") == 0);
- ASSERT (strcmp (non_options[2], "bar") == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 7);
- }
-
- /* Check that '--' ends the argument processing. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[20];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "--";
- argv[argc++] = "-b";
- argv[argc++] = "foo";
- argv[argc++] = "-q";
- argv[argc++] = "johnny";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "-abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "--") == 0);
- ASSERT (strcmp (argv[7], "-b") == 0);
- ASSERT (strcmp (argv[8], "foo") == 0);
- ASSERT (strcmp (argv[9], "-q") == 0);
- ASSERT (strcmp (argv[10], "johnny") == 0);
- ASSERT (strcmp (argv[11], "bar") == 0);
- ASSERT (argv[12] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- if (non_options_count == 2)
- {
- /* glibc behaviour. */
- ASSERT (non_options_count == 2);
- ASSERT (strcmp (non_options[0], "donald") == 0);
- ASSERT (strcmp (non_options[1], "duck") == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 7);
- }
- else
- {
- /* Another valid behaviour. */
- ASSERT (non_options_count == 7);
- ASSERT (strcmp (non_options[0], "donald") == 0);
- ASSERT (strcmp (non_options[1], "duck") == 0);
- ASSERT (strcmp (non_options[2], "-b") == 0);
- ASSERT (strcmp (non_options[3], "foo") == 0);
- ASSERT (strcmp (non_options[4], "-q") == 0);
- ASSERT (strcmp (non_options[5], "johnny") == 0);
- ASSERT (strcmp (non_options[6], "bar") == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 12);
- }
- }
-
- /* Check that the '-' flag has to come first. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:-", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "donald") == 0);
- ASSERT (strcmp (argv[5], "duck") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- }
-
- /* Check that the '+' flag causes the first non-option to terminate the
- loop. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "+abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- }
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-+";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "+abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == '+');
- ASSERT (optind == 2);
- }
-
- /* Check that '--' ends the argument processing. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[20];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "--";
- argv[argc++] = "-b";
- argv[argc++] = "foo";
- argv[argc++] = "-q";
- argv[argc++] = "johnny";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "+abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "--") == 0);
- ASSERT (strcmp (argv[7], "-b") == 0);
- ASSERT (strcmp (argv[8], "foo") == 0);
- ASSERT (strcmp (argv[9], "-q") == 0);
- ASSERT (strcmp (argv[10], "johnny") == 0);
- ASSERT (strcmp (argv[11], "bar") == 0);
- ASSERT (argv[12] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- }
-
- /* Check that the '+' flag has to come first. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:+", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "-p") == 0);
- ASSERT (strcmp (argv[2], "billy") == 0);
- ASSERT (strcmp (argv[3], "-a") == 0);
- ASSERT (strcmp (argv[4], "donald") == 0);
- ASSERT (strcmp (argv[5], "duck") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 0);
- ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- }
-}
-
-/* Test behavior of getopt_long when POSIXLY_CORRECT is set in the
- environment. Options with optional arguments should not change
- behavior just because of an environment variable.
- http://lists.gnu.org/archive/html/bug-m4/2006-09/msg00028.html */
-static void
-test_getopt_long_posix (void)
-{
- int start;
-
- /* Check that POSIXLY_CORRECT stops parsing the same as leading '+'. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "donald";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc++] = "duck";
- argv[argc++] = "-a";
- argv[argc++] = "bar";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "abp:q:", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (strcmp (argv[0], "program") == 0);
- ASSERT (strcmp (argv[1], "donald") == 0);
- ASSERT (strcmp (argv[2], "-p") == 0);
- ASSERT (strcmp (argv[3], "billy") == 0);
- ASSERT (strcmp (argv[4], "duck") == 0);
- ASSERT (strcmp (argv[5], "-a") == 0);
- ASSERT (strcmp (argv[6], "bar") == 0);
- ASSERT (argv[7] == NULL);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 1);
- }
-
- /* Check that POSIXLY_CORRECT doesn't change optional arguments. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-p";
- argv[argc++] = "billy";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "p::", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 0);
- ASSERT (b_seen == 0);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 2);
- }
-
- /* Check that leading - still sees options after non-options. */
- for (start = 0; start <= 1; start++)
- {
- const char *p_value = NULL;
- const char *q_value = NULL;
- int non_options_count = 0;
- const char *non_options[10];
- int unrecognized = 0;
- int argc = 0;
- const char *argv[10];
- a_seen = 0;
- b_seen = 0;
-
- argv[argc++] = "program";
- argv[argc++] = "-a";
- argv[argc++] = "billy";
- argv[argc++] = "-b";
- argv[argc] = NULL;
- optind = start;
- getopt_long_loop (argc, argv, "-ab", long_options_required,
- &p_value, &q_value,
- &non_options_count, non_options, &unrecognized);
- ASSERT (a_seen == 1);
- ASSERT (b_seen == 1);
- ASSERT (p_value == NULL);
- ASSERT (q_value == NULL);
- ASSERT (non_options_count == 1);
- ASSERT (strcmp (non_options[0], "billy") == 0);
- ASSERT (unrecognized == 0);
- ASSERT (optind == 4);
- }
-}
-
-/* Reduce casting, so we can use string literals elsewhere.
- getopt_long_only takes an array of char*, but luckily does not
- modify those elements, so we can pass const char*. */
-static int
-do_getopt_long_only (int argc, const char **argv, const char *shortopts,
- const struct option *longopts, int *longind)
-{
- return getopt_long_only (argc, (char **) argv, shortopts, longopts, longind);
-}
-
-static void
-test_getopt_long_only (void)
-{
- /* Test disambiguation of options. */
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-x";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "ab", long_options_required,
- &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-x";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "abx", long_options_required,
- &option_index);
- ASSERT (c == 'x');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--x";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "abx", long_options_required,
- &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-b";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- b_seen = 0;
- c = do_getopt_long_only (argc, argv, "abx", long_options_required,
- &option_index);
- ASSERT (c == 'b');
- ASSERT (b_seen == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "--b";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- b_seen = 0;
- c = do_getopt_long_only (argc, argv, "abx", long_options_required,
- &option_index);
- ASSERT (c == 0);
- ASSERT (b_seen == 1);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-xt";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "ab", long_options_required,
- &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-xt";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "abx", long_options_required,
- &option_index);
- ASSERT (c == '?');
- ASSERT (optopt == 0);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-xtra";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "ab", long_options_required,
- &option_index);
- ASSERT (c == 1001);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-xtreme";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "abx:", long_options_required,
- &option_index);
- ASSERT (c == 1002);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-xtremel";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "ab", long_options_required,
- &option_index);
- /* glibc getopt_long_only is intentionally different from
- getopt_long when handling a prefix that is common to two
- spellings, when both spellings have the same option directives.
- BSD getopt_long_only treats both cases the same. */
- ASSERT (c == 1003 || c == '?');
- ASSERT (optind == 2);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-xtremel";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "abx::", long_options_required,
- &option_index);
- /* glibc getopt_long_only is intentionally different from
- getopt_long when handling a prefix that is common to two
- spellings, when both spellings have the same option directives.
- BSD getopt_long_only treats both cases the same. */
- ASSERT (c == 1003 || c == '?');
- ASSERT (optind == 2);
- ASSERT (optarg == NULL);
- }
- {
- int argc = 0;
- const char *argv[10];
- int option_index;
- int c;
-
- argv[argc++] = "program";
- argv[argc++] = "-xtras";
- argv[argc] = NULL;
- optind = 1;
- opterr = 0;
- c = do_getopt_long_only (argc, argv, "abx::", long_options_required,
- &option_index);
- ASSERT (c == 'x');
- ASSERT (strcmp (optarg, "tras") == 0);
- }
-}
diff --git a/gl/tests/test-isnand-nolibm.c b/gl/tests/test-isnand-nolibm.c
deleted file mode 100644
index 2d57d079cd..0000000000
--- a/gl/tests/test-isnand-nolibm.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Test of isnand() substitute.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "isnand-nolibm.h"
-
-#include "test-isnand.h"
diff --git a/gl/tests/test-isnand.h b/gl/tests/test-isnand.h
deleted file mode 100644
index 7ea72e98a3..0000000000
--- a/gl/tests/test-isnand.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Test of isnand() substitute.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <limits.h>
-
-#include "minus-zero.h"
-#include "infinity.h"
-#include "nan.h"
-#include "macros.h"
-
-int
-main ()
-{
- /* Finite values. */
- ASSERT (!isnand (3.141));
- ASSERT (!isnand (3.141e30));
- ASSERT (!isnand (3.141e-30));
- ASSERT (!isnand (-2.718));
- ASSERT (!isnand (-2.718e30));
- ASSERT (!isnand (-2.718e-30));
- ASSERT (!isnand (0.0));
- ASSERT (!isnand (minus_zerod));
- /* Infinite values. */
- ASSERT (!isnand (Infinityd ()));
- ASSERT (!isnand (- Infinityd ()));
- /* Quiet NaN. */
- ASSERT (isnand (NaNd ()));
-#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
- /* Signalling NaN. */
- {
- #define NWORDS \
- ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { double value; unsigned int word[NWORDS]; } memory_double;
- memory_double m;
- m.value = NaNd ();
-# if DBL_EXPBIT0_BIT > 0
- m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
-# else
- m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- |= (unsigned int) 1 << DBL_EXPBIT0_BIT;
- ASSERT (isnand (m.value));
- }
-#endif
- return 0;
-}
diff --git a/gl/tests/test-isnanf-nolibm.c b/gl/tests/test-isnanf-nolibm.c
deleted file mode 100644
index 924dccb37a..0000000000
--- a/gl/tests/test-isnanf-nolibm.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Test of isnanf() substitute.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "isnanf-nolibm.h"
-
-#include "test-isnanf.h"
diff --git a/gl/tests/test-isnanf.h b/gl/tests/test-isnanf.h
deleted file mode 100644
index 60499b5732..0000000000
--- a/gl/tests/test-isnanf.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Test of isnanf() substitute.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <limits.h>
-
-#include "minus-zero.h"
-#include "infinity.h"
-#include "nan.h"
-#include "macros.h"
-
-int
-main ()
-{
- /* Finite values. */
- ASSERT (!isnanf (3.141f));
- ASSERT (!isnanf (3.141e30f));
- ASSERT (!isnanf (3.141e-30f));
- ASSERT (!isnanf (-2.718f));
- ASSERT (!isnanf (-2.718e30f));
- ASSERT (!isnanf (-2.718e-30f));
- ASSERT (!isnanf (0.0f));
- ASSERT (!isnanf (minus_zerof));
- /* Infinite values. */
- ASSERT (!isnanf (Infinityf ()));
- ASSERT (!isnanf (- Infinityf ()));
- /* Quiet NaN. */
- ASSERT (isnanf (NaNf ()));
-#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
- /* Signalling NaN. */
- {
- #define NWORDS \
- ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { float value; unsigned int word[NWORDS]; } memory_float;
- memory_float m;
- m.value = NaNf ();
-# if FLT_EXPBIT0_BIT > 0
- m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1);
-# else
- m.word[FLT_EXPBIT0_WORD + (FLT_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- if (FLT_EXPBIT0_WORD < NWORDS / 2)
- m.word[FLT_EXPBIT0_WORD + 1] |= (unsigned int) 1 << FLT_EXPBIT0_BIT;
- else
- m.word[0] |= (unsigned int) 1;
- ASSERT (isnanf (m.value));
- }
-#endif
- return 0;
-}
diff --git a/gl/tests/test-isnanl-nolibm.c b/gl/tests/test-isnanl-nolibm.c
deleted file mode 100644
index 8f44de2fd6..0000000000
--- a/gl/tests/test-isnanl-nolibm.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Test of isnanl() substitute.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include "isnanl-nolibm.h"
-
-#include "test-isnanl.h"
diff --git a/gl/tests/test-isnanl.h b/gl/tests/test-isnanl.h
deleted file mode 100644
index 06e6a7cefa..0000000000
--- a/gl/tests/test-isnanl.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Test of isnanl() substitute.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <float.h>
-#include <limits.h>
-
-#include "minus-zero.h"
-#include "infinity.h"
-#include "nan.h"
-#include "macros.h"
-
-int
-main ()
-{
- #define NWORDS \
- ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { unsigned int word[NWORDS]; long double value; }
- memory_long_double;
-
- /* Finite values. */
- ASSERT (!isnanl (3.141L));
- ASSERT (!isnanl (3.141e30L));
- ASSERT (!isnanl (3.141e-30L));
- ASSERT (!isnanl (-2.718L));
- ASSERT (!isnanl (-2.718e30L));
- ASSERT (!isnanl (-2.718e-30L));
- ASSERT (!isnanl (0.0L));
- ASSERT (!isnanl (minus_zerol));
- /* Infinite values. */
- ASSERT (!isnanl (Infinityl ()));
- ASSERT (!isnanl (- Infinityl ()));
- /* Quiet NaN. */
- ASSERT (isnanl (NaNl ()));
-
-#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
- /* A bit pattern that is different from a Quiet NaN. With a bit of luck,
- it's a Signalling NaN. */
- {
- memory_long_double m;
- m.value = NaNl ();
-# if LDBL_EXPBIT0_BIT > 0
- m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 1);
-# else
- m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- |= (unsigned int) 1 << LDBL_EXPBIT0_BIT;
- ASSERT (isnanl (m.value));
- }
-#endif
-
-#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
-/* Representation of an 80-bit 'long double' as an initializer for a sequence
- of 'unsigned int' words. */
-# ifdef WORDS_BIGENDIAN
-# define LDBL80_WORDS(exponent,manthi,mantlo) \
- { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
- ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \
- (unsigned int) (mantlo) << 16 \
- }
-# else
-# define LDBL80_WORDS(exponent,manthi,mantlo) \
- { mantlo, manthi, exponent }
-# endif
- { /* Quiet NaN. */
- static memory_long_double x =
- { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
- ASSERT (isnanl (x.value));
- }
- {
- /* Signalling NaN. */
- static memory_long_double x =
- { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
- ASSERT (isnanl (x.value));
- }
- /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities,
- Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in
- Intel IA-64 Architecture Software Developer's Manual, Volume 1:
- Application Architecture.
- Table 5-2 "Floating-Point Register Encodings"
- Figure 5-6 "Memory to Floating-Point Register Data Translation"
- */
- { /* Pseudo-NaN. */
- static memory_long_double x =
- { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
- ASSERT (isnanl (x.value));
- }
- { /* Pseudo-Infinity. */
- static memory_long_double x =
- { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
- ASSERT (isnanl (x.value));
- }
- { /* Pseudo-Zero. */
- static memory_long_double x =
- { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
- ASSERT (isnanl (x.value));
- }
- { /* Unnormalized number. */
- static memory_long_double x =
- { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
- ASSERT (isnanl (x.value));
- }
- { /* Pseudo-Denormal. */
- static memory_long_double x =
- { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
- ASSERT (isnanl (x.value));
- }
-#endif
-
- return 0;
-}
diff --git a/gl/tests/test-malloc-gnu.c b/gl/tests/test-malloc-gnu.c
deleted file mode 100644
index ca0eafa479..0000000000
--- a/gl/tests/test-malloc-gnu.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Test of malloc function.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <stdlib.h>
-
-int
-main ()
-{
- /* Check that malloc (0) is not a NULL pointer. */
- if (malloc (0) == NULL)
- return 1;
-
- return 0;
-}
diff --git a/gl/tests/test-malloca.c b/gl/tests/test-malloca.c
deleted file mode 100644
index 7d5e62e87a..0000000000
--- a/gl/tests/test-malloca.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Test of safe automatic memory allocation.
- Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005. */
-
-#include <config.h>
-
-#include "malloca.h"
-
-#include <stdlib.h>
-
-static void
-do_allocation (int n)
-{
- void *ptr = malloca (n);
- freea (ptr);
- safe_alloca (n);
-}
-
-void (*func) (int) = do_allocation;
-
-int
-main ()
-{
- int i;
-
- /* This slows down malloc a lot. */
- unsetenv ("MALLOC_PERTURB_");
-
- /* Repeat a lot of times, to make sure there's no memory leak. */
- for (i = 0; i < 50000; i++)
- {
- /* Try various values.
- n = 0 gave a crash on Alpha with gcc-2.5.8.
- Some versions of Mac OS X have a stack size limit of 512 KB. */
- func (34);
- func (134);
- func (399);
- func (510823);
- func (129321);
- func (0);
- func (4070);
- func (4095);
- func (1);
- func (16582);
- }
-
- return 0;
-}
diff --git a/gl/tests/test-math.c b/gl/tests/test-math.c
deleted file mode 100644
index f7d944cbf8..0000000000
--- a/gl/tests/test-math.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Test of <math.h> substitute.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <math.h>
-
-#ifndef NAN
-# error NAN should be defined
-choke me
-#endif
-
-#ifndef HUGE_VALF
-# error HUGE_VALF should be defined
-choke me
-#endif
-
-#ifndef HUGE_VAL
-# error HUGE_VAL should be defined
-choke me
-#endif
-
-#ifndef HUGE_VALL
-# error HUGE_VALL should be defined
-choke me
-#endif
-
-#ifndef FP_ILOGB0
-# error FP_ILOGB0 should be defined
-choke me
-#endif
-
-#ifndef FP_ILOGBNAN
-# error FP_ILOGBNAN should be defined
-choke me
-#endif
-
-#include <limits.h>
-
-#include "macros.h"
-
-#if 0
-/* Check that NAN expands into a constant expression. */
-static float n = NAN;
-#endif
-
-/* Compare two numbers with ==.
- This is a separate function because IRIX 6.5 "cc -O" miscompiles an
- 'x == x' test. */
-static int
-numeric_equalf (float x, float y)
-{
- return x == y;
-}
-static int
-numeric_equald (double x, double y)
-{
- return x == y;
-}
-static int
-numeric_equall (long double x, long double y)
-{
- return x == y;
-}
-
-int
-main (void)
-{
- double d = NAN;
- double zero = 0.0;
- ASSERT (!numeric_equald (d, d));
-
- d = HUGE_VAL;
- ASSERT (numeric_equald (d, 1.0 / zero));
-
- ASSERT (numeric_equalf (HUGE_VALF, HUGE_VALF + HUGE_VALF));
-
- ASSERT (numeric_equald (HUGE_VAL, HUGE_VAL + HUGE_VAL));
-
- ASSERT (numeric_equall (HUGE_VALL, HUGE_VALL + HUGE_VALL));
-
- /* Check the value of FP_ILOGB0. */
- ASSERT (FP_ILOGB0 == INT_MIN || FP_ILOGB0 == - INT_MAX);
-
- /* Check the value of FP_ILOGBNAN. */
- ASSERT (FP_ILOGBNAN == INT_MIN || FP_ILOGBNAN == INT_MAX);
-
- return 0;
-}
diff --git a/gl/tests/test-printf-frexp.c b/gl/tests/test-printf-frexp.c
deleted file mode 100644
index 5ecf198555..0000000000
--- a/gl/tests/test-printf-frexp.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Test of splitting a double into fraction and mantissa.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include "printf-frexp.h"
-
-#include <float.h>
-
-#include "macros.h"
-
-static double
-my_ldexp (double x, int d)
-{
- for (; d > 0; d--)
- x *= 2.0;
- for (; d < 0; d++)
- x *= 0.5;
- return x;
-}
-
-int
-main ()
-{
- int i;
- /* The use of 'volatile' guarantees that excess precision bits are dropped
- when dealing with denormalized numbers. It is necessary on x86 systems
- where double-floats are not IEEE compliant by default, to avoid that the
- results become platform and compiler option dependent. 'volatile' is a
- portable alternative to gcc's -ffloat-store option. */
- volatile double x;
-
- for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.0);
- }
- for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.0);
- }
- for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == DBL_MIN_EXP - 1);
- ASSERT (mantissa == my_ldexp (1.0, i - DBL_MIN_EXP));
- }
-
- for (i = 1, x = 1.01; i <= DBL_MAX_EXP; i++, x *= 2.0)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.01);
- }
- for (i = 1, x = 1.01; i >= DBL_MIN_EXP; i--, x *= 0.5)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.01);
- }
- for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == DBL_MIN_EXP - 1);
- ASSERT (mantissa >= my_ldexp (1.0, i - DBL_MIN_EXP));
- ASSERT (mantissa <= my_ldexp (2.0, i - DBL_MIN_EXP));
- ASSERT (mantissa == my_ldexp (x, - exp));
- }
-
- for (i = 1, x = 1.73205; i <= DBL_MAX_EXP; i++, x *= 2.0)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.73205);
- }
- for (i = 1, x = 1.73205; i >= DBL_MIN_EXP; i--, x *= 0.5)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.73205);
- }
- for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
- {
- int exp = -9999;
- double mantissa = printf_frexp (x, &exp);
- ASSERT (exp == DBL_MIN_EXP - 1);
- ASSERT (mantissa >= my_ldexp (1.0, i - DBL_MIN_EXP));
- ASSERT (mantissa <= my_ldexp (2.0, i - DBL_MIN_EXP));
- ASSERT (mantissa == my_ldexp (x, - exp));
- }
-
- return 0;
-}
diff --git a/gl/tests/test-printf-frexpl.c b/gl/tests/test-printf-frexpl.c
deleted file mode 100644
index 0aa3d18bed..0000000000
--- a/gl/tests/test-printf-frexpl.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Test of splitting a 'long double' into fraction and mantissa.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include "printf-frexpl.h"
-
-#include <float.h>
-
-#include "fpucw.h"
-#include "macros.h"
-
-/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
- exponent for 'long double' is -964. Similarly, on PowerPC machines,
- LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double'
- is -968. For exponents below that, the precision may be truncated to the
- precision used for 'double'. */
-#ifdef __sgi
-# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57)
-# define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP
-#elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
-# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
-# define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP
-#else
-# define MIN_NORMAL_EXP LDBL_MIN_EXP
-# define MIN_SUBNORMAL_EXP (LDBL_MIN_EXP - 100)
-#endif
-
-static long double
-my_ldexp (long double x, int d)
-{
- for (; d > 0; d--)
- x *= 2.0L;
- for (; d < 0; d++)
- x *= 0.5L;
- return x;
-}
-
-int
-main ()
-{
- int i;
- long double x;
- DECL_LONG_DOUBLE_ROUNDING
-
- BEGIN_LONG_DOUBLE_ROUNDING ();
-
- for (i = 1, x = 1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.0L);
- }
- for (i = 1, x = 1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.0L);
- }
- for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == LDBL_MIN_EXP - 1);
- ASSERT (mantissa == my_ldexp (1.0L, i - LDBL_MIN_EXP));
- }
-
- for (i = 1, x = 1.01L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.01L);
- }
- for (i = 1, x = 1.01L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.01L);
- }
- for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == LDBL_MIN_EXP - 1);
- ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP));
- ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP));
- ASSERT (mantissa == my_ldexp (x, - exp));
- }
-
- for (i = 1, x = 1.73205L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.73205L);
- }
- for (i = 1, x = 1.73205L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == i - 1);
- ASSERT (mantissa == 1.73205L);
- }
- for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L)
- {
- int exp = -9999;
- long double mantissa = printf_frexpl (x, &exp);
- ASSERT (exp == LDBL_MIN_EXP - 1);
- ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP));
- ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP));
- ASSERT (mantissa == my_ldexp (x, - exp));
- }
-
- return 0;
-}
diff --git a/gl/tests/test-printf-posix.h b/gl/tests/test-printf-posix.h
deleted file mode 100644
index eca40051e6..0000000000
--- a/gl/tests/test-printf-posix.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Test of POSIX compatible vsprintf() and sprintf() functions.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include "infinity.h"
-
-static void
-test_function (int (*my_printf) (const char *, ...))
-{
- /* Here we don't test output that may be platform dependent.
- The bulk of the tests is done as part of the 'vasnprintf-posix' module. */
-
- /* Test support of size specifiers as in C99. */
-
- my_printf ("%ju %d\n", (uintmax_t) 12345671, 33, 44, 55);
-
- my_printf ("%zu %d\n", (size_t) 12345672, 33, 44, 55);
-
- my_printf ("%tu %d\n", (ptrdiff_t) 12345673, 33, 44, 55);
-
- /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal
- output of floating-point numbers. */
-
- /* Positive zero. */
- my_printf ("%a %d\n", 0.0, 33, 44, 55);
-
- /* Positive infinity. */
- my_printf ("%a %d\n", Infinityd (), 33, 44, 55);
-
- /* Negative infinity. */
- my_printf ("%a %d\n", - Infinityd (), 33, 44, 55);
-
- /* FLAG_ZERO with infinite number. */
- /* "0000000inf 33" is not a valid result; see
- <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
- my_printf ("%010a %d\n", Infinityd (), 33, 44, 55);
-
- /* Test the support of the %f format directive. */
-
- /* A positive number. */
- my_printf ("%f %d\n", 12.75, 33, 44, 55);
-
- /* A larger positive number. */
- my_printf ("%f %d\n", 1234567.0, 33, 44, 55);
-
- /* A negative number. */
- my_printf ("%f %d\n", -0.03125, 33, 44, 55);
-
- /* Positive zero. */
- my_printf ("%f %d\n", 0.0, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_printf ("%015f %d\n", 1234.0, 33, 44, 55);
-
- /* Precision. */
- my_printf ("%.f %d\n", 1234.0, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_printf ("%.2f %d\n", 999.95, 33, 44, 55);
-
- /* Precision with rounding. */
- my_printf ("%.2f %d\n", 999.996, 33, 44, 55);
-
- /* A positive number. */
- my_printf ("%Lf %d\n", 12.75L, 33, 44, 55);
-
- /* A larger positive number. */
- my_printf ("%Lf %d\n", 1234567.0L, 33, 44, 55);
-
- /* A negative number. */
- my_printf ("%Lf %d\n", -0.03125L, 33, 44, 55);
-
- /* Positive zero. */
- my_printf ("%Lf %d\n", 0.0L, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_printf ("%015Lf %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision. */
- my_printf ("%.Lf %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_printf ("%.2Lf %d\n", 999.95L, 33, 44, 55);
-
- /* Precision with rounding. */
- my_printf ("%.2Lf %d\n", 999.996L, 33, 44, 55);
-
- /* Test the support of the %F format directive. */
-
- /* A positive number. */
- my_printf ("%F %d\n", 12.75, 33, 44, 55);
-
- /* A larger positive number. */
- my_printf ("%F %d\n", 1234567.0, 33, 44, 55);
-
- /* A negative number. */
- my_printf ("%F %d\n", -0.03125, 33, 44, 55);
-
- /* Positive zero. */
- my_printf ("%F %d\n", 0.0, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_printf ("%015F %d\n", 1234.0, 33, 44, 55);
-
- /* Precision. */
- my_printf ("%.F %d\n", 1234.0, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_printf ("%.2F %d\n", 999.95, 33, 44, 55);
-
- /* Precision with rounding. */
- my_printf ("%.2F %d\n", 999.996, 33, 44, 55);
-
- /* A positive number. */
- my_printf ("%LF %d\n", 12.75L, 33, 44, 55);
-
- /* A larger positive number. */
- my_printf ("%LF %d\n", 1234567.0L, 33, 44, 55);
-
- /* A negative number. */
- my_printf ("%LF %d\n", -0.03125L, 33, 44, 55);
-
- /* Positive zero. */
- my_printf ("%LF %d\n", 0.0L, 33, 44, 55);
-
- /* FLAG_ZERO. */
- my_printf ("%015LF %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision. */
- my_printf ("%.LF %d\n", 1234.0L, 33, 44, 55);
-
- /* Precision with no rounding. */
- my_printf ("%.2LF %d\n", 999.95L, 33, 44, 55);
-
- /* Precision with rounding. */
- my_printf ("%.2LF %d\n", 999.996L, 33, 44, 55);
-
- /* Test the support of the POSIX/XSI format strings with positions. */
-
- my_printf ("%2$d %1$d\n", 33, 55);
-}
diff --git a/gl/tests/test-printf-posix.output b/gl/tests/test-printf-posix.output
deleted file mode 100644
index 618825bb7b..0000000000
--- a/gl/tests/test-printf-posix.output
+++ /dev/null
@@ -1,40 +0,0 @@
-12345671 33
-12345672 33
-12345673 33
-0x0p+0 33
-inf 33
--inf 33
- inf 33
-12.750000 33
-1234567.000000 33
--0.031250 33
-0.000000 33
-00001234.000000 33
-1234 33
-999.95 33
-1000.00 33
-12.750000 33
-1234567.000000 33
--0.031250 33
-0.000000 33
-00001234.000000 33
-1234 33
-999.95 33
-1000.00 33
-12.750000 33
-1234567.000000 33
--0.031250 33
-0.000000 33
-00001234.000000 33
-1234 33
-999.95 33
-1000.00 33
-12.750000 33
-1234567.000000 33
--0.031250 33
-0.000000 33
-00001234.000000 33
-1234 33
-999.95 33
-1000.00 33
-55 33
diff --git a/gl/tests/test-rawmemchr.c b/gl/tests/test-rawmemchr.c
deleted file mode 100644
index e31104a98c..0000000000
--- a/gl/tests/test-rawmemchr.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2008-2013 Free Software Foundation, Inc.
- * Written by Eric Blake and Bruno Haible
- *
- * This program 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.
- *
- * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <string.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (rawmemchr, void *, (void const *, int));
-
-#include <stdlib.h>
-
-#include "zerosize-ptr.h"
-#include "macros.h"
-
-/* Calculating void * + int is not portable, so this wrapper converts
- to char * to make the tests easier to write. */
-#define RAWMEMCHR (char *) rawmemchr
-
-int
-main (void)
-{
- size_t n = 0x100000;
- char *input = malloc (n + 1);
- ASSERT (input);
-
- input[0] = 'a';
- input[1] = 'b';
- memset (input + 2, 'c', 1024);
- memset (input + 1026, 'd', n - 1028);
- input[n - 2] = 'e';
- input[n - 1] = 'a';
- input[n] = '\0';
-
- /* Basic behavior tests. */
- ASSERT (RAWMEMCHR (input, 'a') == input);
- ASSERT (RAWMEMCHR (input, 'b') == input + 1);
- ASSERT (RAWMEMCHR (input, 'c') == input + 2);
- ASSERT (RAWMEMCHR (input, 'd') == input + 1026);
-
- ASSERT (RAWMEMCHR (input + 1, 'a') == input + n - 1);
- ASSERT (RAWMEMCHR (input + 1, 'e') == input + n - 2);
- ASSERT (RAWMEMCHR (input + 1, 0x789abc00 | 'e') == input + n - 2);
-
- ASSERT (RAWMEMCHR (input, '\0') == input + n);
-
- /* Alignment tests. */
- {
- int i, j;
- for (i = 0; i < 32; i++)
- {
- for (j = 0; j < 256; j++)
- input[i + j] = j;
- for (j = 0; j < 256; j++)
- {
- ASSERT (RAWMEMCHR (input + i, j) == input + i + j);
- }
- }
- }
-
- /* Ensure that no unaligned oversized reads occur. */
- {
- char *page_boundary = (char *) zerosize_ptr ();
- size_t i;
-
- if (!page_boundary)
- page_boundary = input + 4096;
- memset (page_boundary - 512, '1', 511);
- page_boundary[-1] = '2';
- for (i = 1; i <= 512; i++)
- ASSERT (RAWMEMCHR (page_boundary - i, (i * 0x01010100) | '2')
- == page_boundary - 1);
- }
-
- free (input);
-
- return 0;
-}
diff --git a/gl/tests/test-setenv.c b/gl/tests/test-setenv.c
deleted file mode 100644
index 0a53ac4644..0000000000
--- a/gl/tests/test-setenv.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Tests of setenv.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009. */
-
-#include <config.h>
-
-#include <stdlib.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (setenv, int, (char const *, char const *, int));
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
- /* Test overwriting. */
- ASSERT (setenv ("a", "==", -1) == 0);
- ASSERT (setenv ("a", "2", 0) == 0);
- ASSERT (strcmp (getenv ("a"), "==") == 0);
-
- /* Required to fail with EINVAL. */
- errno = 0;
- ASSERT (setenv ("", "", 1) == -1);
- ASSERT (errno == EINVAL);
- errno = 0;
- ASSERT (setenv ("a=b", "", 0) == -1);
- ASSERT (errno == EINVAL);
-#if 0
- /* glibc and gnulib's implementation guarantee this, but POSIX no
- longer requires it: http://austingroupbugs.net/view.php?id=185 */
- errno = 0;
- ASSERT (setenv (NULL, "", 0) == -1);
- ASSERT (errno == EINVAL);
-#endif
-
- return 0;
-}
diff --git a/gl/tests/test-signbit.c b/gl/tests/test-signbit.c
deleted file mode 100644
index e8ea097ce4..0000000000
--- a/gl/tests/test-signbit.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Test of signbit() substitute.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <math.h>
-
-/* signbit must be a macro. */
-#ifndef signbit
-# error missing declaration
-#endif
-
-#include <float.h>
-#include <limits.h>
-
-#include "minus-zero.h"
-#include "infinity.h"
-#include "macros.h"
-
-float zerof = 0.0f;
-double zerod = 0.0;
-long double zerol = 0.0L;
-
-static void
-test_signbitf ()
-{
- /* Finite values. */
- ASSERT (!signbit (3.141f));
- ASSERT (!signbit (3.141e30f));
- ASSERT (!signbit (3.141e-30f));
- ASSERT (signbit (-2.718f));
- ASSERT (signbit (-2.718e30f));
- ASSERT (signbit (-2.718e-30f));
- /* Zeros. */
- ASSERT (!signbit (0.0f));
- if (1.0f / minus_zerof < 0)
- ASSERT (signbit (minus_zerof));
- else
- ASSERT (!signbit (minus_zerof));
- /* Infinite values. */
- ASSERT (!signbit (Infinityf ()));
- ASSERT (signbit (- Infinityf ()));
- /* Quiet NaN. */
- (void) signbit (zerof / zerof);
-#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
- /* Signalling NaN. */
- {
- #define NWORDS \
- ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { float value; unsigned int word[NWORDS]; } memory_float;
- memory_float m;
- m.value = zerof / zerof;
-# if FLT_EXPBIT0_BIT > 0
- m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1);
-# else
- m.word[FLT_EXPBIT0_WORD + (FLT_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- if (FLT_EXPBIT0_WORD < NWORDS / 2)
- m.word[FLT_EXPBIT0_WORD + 1] |= (unsigned int) 1 << FLT_EXPBIT0_BIT;
- else
- m.word[0] |= (unsigned int) 1;
- (void) signbit (m.value);
- #undef NWORDS
- }
-#endif
-}
-
-static void
-test_signbitd ()
-{
- /* Finite values. */
- ASSERT (!signbit (3.141));
- ASSERT (!signbit (3.141e30));
- ASSERT (!signbit (3.141e-30));
- ASSERT (signbit (-2.718));
- ASSERT (signbit (-2.718e30));
- ASSERT (signbit (-2.718e-30));
- /* Zeros. */
- ASSERT (!signbit (0.0));
- if (1.0 / minus_zerod < 0)
- ASSERT (signbit (minus_zerod));
- else
- ASSERT (!signbit (minus_zerod));
- /* Infinite values. */
- ASSERT (!signbit (Infinityd ()));
- ASSERT (signbit (- Infinityd ()));
- /* Quiet NaN. */
- (void) signbit (zerod / zerod);
-#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
- /* Signalling NaN. */
- {
- #define NWORDS \
- ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { double value; unsigned int word[NWORDS]; } memory_double;
- memory_double m;
- m.value = zerod / zerod;
-# if DBL_EXPBIT0_BIT > 0
- m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
-# else
- m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- |= (unsigned int) 1 << DBL_EXPBIT0_BIT;
- (void) signbit (m.value);
- #undef NWORDS
- }
-#endif
-}
-
-static void
-test_signbitl ()
-{
- /* Finite values. */
- ASSERT (!signbit (3.141L));
- ASSERT (!signbit (3.141e30L));
- ASSERT (!signbit (3.141e-30L));
- ASSERT (signbit (-2.718L));
- ASSERT (signbit (-2.718e30L));
- ASSERT (signbit (-2.718e-30L));
- /* Zeros. */
- ASSERT (!signbit (0.0L));
- if (1.0L / minus_zerol < 0)
- ASSERT (signbit (minus_zerol));
- else
- ASSERT (!signbit (minus_zerol));
- /* Infinite values. */
- ASSERT (!signbit (Infinityl ()));
- ASSERT (signbit (- Infinityl ()));
- /* Quiet NaN. */
- (void) signbit (zerol / zerol);
-#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
- /* Signalling NaN. */
- {
- #define NWORDS \
- ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { long double value; unsigned int word[NWORDS]; } memory_long_double;
- memory_long_double m;
- m.value = zerol / zerol;
-# if LDBL_EXPBIT0_BIT > 0
- m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 1);
-# else
- m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- |= (unsigned int) 1 << LDBL_EXPBIT0_BIT;
- (void) signbit (m.value);
- #undef NWORDS
- }
-#endif
-}
-
-int
-main ()
-{
- test_signbitf ();
- test_signbitd ();
- test_signbitl ();
- return 0;
-}
diff --git a/gl/tests/test-sleep.c b/gl/tests/test-sleep.c
deleted file mode 100644
index d232cd0a97..0000000000
--- a/gl/tests/test-sleep.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Test of sleep() function.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (sleep, unsigned int, (unsigned int));
-
-#include <signal.h>
-
-#include "macros.h"
-
-#if HAVE_DECL_ALARM
-static void
-handle_alarm (int sig)
-{
- if (sig != SIGALRM)
- _exit (1);
-}
-#endif
-
-int
-main (void)
-{
- ASSERT (sleep (1) <= 1);
-
- ASSERT (sleep (0) == 0);
-
-#if HAVE_DECL_ALARM
- {
- const unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */
- unsigned int remaining;
- signal (SIGALRM, handle_alarm);
- alarm (1);
- remaining = sleep (pentecost);
- ASSERT (pentecost - 10 < remaining && remaining <= pentecost);
- }
-#endif
-
- return 0;
-}
diff --git a/gl/tests/test-strchrnul.c b/gl/tests/test-strchrnul.c
deleted file mode 100644
index ac3b3dd8e4..0000000000
--- a/gl/tests/test-strchrnul.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2008-2013 Free Software Foundation, Inc.
- * Written by Eric Blake and Bruno Haible
- *
- * This program 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.
- *
- * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <string.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (strchrnul, char *, (char const *, int));
-
-#include <stdlib.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
- size_t n = 0x100000;
- char *input = malloc (n + 1);
- ASSERT (input);
-
- input[0] = 'a';
- input[1] = 'b';
- memset (input + 2, 'c', 1024);
- memset (input + 1026, 'd', n - 1028);
- input[n - 2] = 'e';
- input[n - 1] = 'a';
- input[n] = '\0';
-
- /* Basic behavior tests. */
- ASSERT (strchrnul (input, 'a') == input);
- ASSERT (strchrnul (input, 'b') == input + 1);
- ASSERT (strchrnul (input, 'c') == input + 2);
- ASSERT (strchrnul (input, 'd') == input + 1026);
-
- ASSERT (strchrnul (input + 1, 'a') == input + n - 1);
- ASSERT (strchrnul (input + 1, 'e') == input + n - 2);
-
- ASSERT (strchrnul (input, 'f') == input + n);
- ASSERT (strchrnul (input, '\0') == input + n);
-
- /* Check that a very long haystack is handled quickly if the byte is
- found near the beginning. */
- {
- size_t repeat = 10000;
- for (; repeat > 0; repeat--)
- {
- ASSERT (strchrnul (input, 'c') == input + 2);
- }
- }
-
- /* Alignment tests. */
- {
- int i, j;
- for (i = 0; i < 32; i++)
- {
- for (j = 0; j < 256; j++)
- input[i + j] = (j + 1) & 0xff;
- for (j = 1; j < 256; j++)
- {
- ASSERT (strchrnul (input + i, j) == input + i + j - 1);
- input[i + j - 1] = (j == 1 ? 2 : 1);
- ASSERT (strchrnul (input + i, j) == input + i + 255);
- input[i + j - 1] = j;
- }
- }
- }
-
- free (input);
-
- return 0;
-}
diff --git a/gl/tests/test-sysexits.c b/gl/tests/test-sysexits.c
deleted file mode 100644
index 1d3d24d472..0000000000
--- a/gl/tests/test-sysexits.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Test of <sysexits.h> substitute.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <sysexits.h>
-
-int exitcode;
-
-int
-main ()
-{
- /* Check that all EX_* symbols are defined to integer constant expressions
- with mutually different values. */
- switch (exitcode)
- {
- case EX_OK:
- case EX_USAGE:
- case EX_DATAERR:
- case EX_NOINPUT:
- case EX_NOUSER:
- case EX_NOHOST:
- case EX_UNAVAILABLE:
- case EX_SOFTWARE:
- case EX_OSERR:
- case EX_OSFILE:
- case EX_CANTCREAT:
- case EX_IOERR:
- case EX_TEMPFAIL:
- case EX_PROTOCOL:
- case EX_NOPERM:
- case EX_CONFIG:
- break;
- }
-
- return 0;
-}
diff --git a/gl/tests/test-unsetenv.c b/gl/tests/test-unsetenv.c
deleted file mode 100644
index c369e2afc8..0000000000
--- a/gl/tests/test-unsetenv.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Tests of unsetenv.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009. */
-
-#include <config.h>
-
-#include <stdlib.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (unsetenv, int, (char const *));
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
- char entry[] = "b=2";
-
- /* Test removal when multiple entries present. */
- ASSERT (putenv ((char *) "a=1") == 0);
- ASSERT (putenv (entry) == 0);
- entry[0] = 'a'; /* Unspecified what getenv("a") would be at this point. */
- ASSERT (unsetenv ("a") == 0); /* Both entries will be removed. */
- ASSERT (getenv ("a") == NULL);
- ASSERT (unsetenv ("a") == 0);
-
- /* Required to fail with EINVAL. */
- errno = 0;
- ASSERT (unsetenv ("") == -1);
- ASSERT (errno == EINVAL);
- errno = 0;
- ASSERT (unsetenv ("a=b") == -1);
- ASSERT (errno == EINVAL);
-#if 0
- /* glibc and gnulib's implementation guarantee this, but POSIX no
- longer requires it: http://austingroupbugs.net/view.php?id=185 */
- errno = 0;
- ASSERT (unsetenv (NULL) == -1);
- ASSERT (errno == EINVAL);
-#endif
-
- return 0;
-}
diff --git a/gl/tests/test-version-etc.c b/gl/tests/test-version-etc.c
deleted file mode 100644
index 66027f3190..0000000000
--- a/gl/tests/test-version-etc.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Test suite for version-etc.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNUlib Library.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include "version-etc.h"
-
-#include "progname.h"
-
-#define AUTHORS "Sergey Poznyakoff", "Eric Blake"
-
-int
-main (int argc _GL_UNUSED, char **argv)
-{
- set_program_name (argv[0]);
- version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
- (const char *) NULL);
- return 0;
-}
diff --git a/gl/tests/test-version-etc.sh b/gl/tests/test-version-etc.sh
deleted file mode 100755
index 466c959208..0000000000
--- a/gl/tests/test-version-etc.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/sh
-# Test suite for version-etc.
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
-# This file is part of the GNUlib Library.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-TMP=ve-expected.tmp
-LC_ALL=C
-export LC_ALL
-ERR=0
-
-cat > $TMP <<EOT
-test-version-etc (PROJECT) VERSION
-COPYRIGHT Free Software Foundation, Inc.
-License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.
-
-Written by Sergey Poznyakoff and Eric Blake.
-EOT
-
-./test-version-etc${EXEEXT} --version |
- sed '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/
- /^Packaged by/d
- 2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
- tr -d '\015' |
- diff -c $TMP - || ERR=1
-
-rm $TMP
-
-exit $ERR
diff --git a/gl/tests/test-vfprintf-posix.c b/gl/tests/test-vfprintf-posix.c
deleted file mode 100644
index 53f951c034..0000000000
--- a/gl/tests/test-vfprintf-posix.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Test of POSIX compatible vfprintf() function.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (vfprintf, int, (FILE *, char const *, va_list));
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "macros.h"
-
-#include "test-fprintf-posix.h"
-
-static int
-my_fprintf (FILE *fp, const char *format, ...)
-{
- va_list args;
- int ret;
-
- va_start (args, format);
- ret = vfprintf (fp, format, args);
- va_end (args);
- return ret;
-}
-
-int
-main (int argc, char *argv[])
-{
- test_function (my_fprintf);
- return 0;
-}
diff --git a/gl/tests/test-vfprintf-posix.sh b/gl/tests/test-vfprintf-posix.sh
deleted file mode 100755
index 74339ba080..0000000000
--- a/gl/tests/test-vfprintf-posix.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles t-vfprintf-posix.tmp t-vfprintf-posix.out"
-./test-vfprintf-posix${EXEEXT} > t-vfprintf-posix.tmp || exit 1
-LC_ALL=C tr -d '\r' < t-vfprintf-posix.tmp > t-vfprintf-posix.out || exit 1
-
-: ${DIFF=diff}
-${DIFF} "${srcdir}/test-printf-posix.output" t-vfprintf-posix.out
-result=$?
-
-rm -fr $tmpfiles
-
-exit $result
diff --git a/gl/tests/test-vprintf-posix.c b/gl/tests/test-vprintf-posix.c
deleted file mode 100644
index 3593b1dbff..0000000000
--- a/gl/tests/test-vprintf-posix.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Test of POSIX compatible vfprintf() function.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (vprintf, int, (char const *, va_list));
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "macros.h"
-
-#include "test-printf-posix.h"
-
-static int
-my_printf (const char *format, ...)
-{
- va_list args;
- int ret;
-
- va_start (args, format);
- ret = vprintf (format, args);
- va_end (args);
- return ret;
-}
-
-int
-main (int argc, char *argv[])
-{
- test_function (my_printf);
- return 0;
-}
diff --git a/gl/tests/test-vprintf-posix.sh b/gl/tests/test-vprintf-posix.sh
deleted file mode 100755
index 968a8b2a8d..0000000000
--- a/gl/tests/test-vprintf-posix.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles t-vprintf-posix.tmp t-vprintf-posix.out"
-./test-vprintf-posix${EXEEXT} > t-vprintf-posix.tmp || exit 1
-LC_ALL=C tr -d '\r' < t-vprintf-posix.tmp > t-vprintf-posix.out || exit 1
-
-: ${DIFF=diff}
-${DIFF} "${srcdir}/test-printf-posix.output" t-vprintf-posix.out
-result=$?
-
-rm -fr $tmpfiles
-
-exit $result
diff --git a/gl/tests/unsetenv.c b/gl/tests/unsetenv.c
deleted file mode 100644
index c58c82f4f4..0000000000
--- a/gl/tests/unsetenv.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program 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.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-/* Specification. */
-#include <stdlib.h>
-
-#include <errno.h>
-#if !_LIBC
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <string.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __environ environ
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of 'environ'. */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean. */
-#ifdef _LIBC
-# define unsetenv __unsetenv
-#endif
-
-#if _LIBC || !HAVE_UNSETENV
-
-int
-unsetenv (const char *name)
-{
- size_t len;
- char **ep;
-
- if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- len = strlen (name);
-
- LOCK;
-
- ep = __environ;
- while (*ep != NULL)
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
- {
- /* Found it. Remove this pointer by moving later ones back. */
- char **dp = ep;
-
- do
- dp[0] = dp[1];
- while (*dp++);
- /* Continue the loop in case NAME appears again. */
- }
- else
- ++ep;
-
- UNLOCK;
-
- return 0;
-}
-
-#ifdef _LIBC
-# undef unsetenv
-weak_alias (__unsetenv, unsetenv)
-#endif
-
-#else /* HAVE_UNSETENV */
-
-# undef unsetenv
-# if !HAVE_DECL_UNSETENV
-# if VOID_UNSETENV
-extern void unsetenv (const char *);
-# else
-extern int unsetenv (const char *);
-# endif
-# endif
-
-/* Call the underlying unsetenv, in case there is hidden bookkeeping
- that needs updating beyond just modifying environ. */
-int
-rpl_unsetenv (const char *name)
-{
- int result = 0;
- if (!name || !*name || strchr (name, '='))
- {
- errno = EINVAL;
- return -1;
- }
- while (getenv (name))
-# if !VOID_UNSETENV
- result =
-# endif
- unsetenv (name);
- return result;
-}
-
-#endif /* HAVE_UNSETENV */