* tests/test-totalorder.h: Include <math.h>.
(positive_NaN_with_payload, negative_NaN_with_payload): New functions.
(main): Test quiet NaNs of each sign with different payload.
* tests/test-totalorder.c (TOTALORDER_POSITIVE_NAN,
TOTALORDER_NEGATIVE_NAN): Remove macros.
(TOTALORDER_SETPAYLOAD): New macro.
* tests/test-totalorderf.c (TOTALORDER_POSITIVE_NAN,
TOTALORDER_NEGATIVE_NAN): Remove macros.
(TOTALORDER_SETPAYLOAD): New macro.
* tests/test-totalorderl.c (TOTALORDER_POSITIVE_NAN,
TOTALORDER_NEGATIVE_NAN): Remove macros.
(TOTALORDER_SETPAYLOAD): New macro.
* modules/totalorder-tests (Depends-on): Add setpayload.
(Makefile.am): Link test-totalorder with $(SETPAYLOAD_LIBM).
* modules/totalorderf-tests (Depends-on): Add setpayloadf.
(Makefile.am): Link test-totalorderf with $(SETPAYLOADF_LIBM).
* modules/totalorderl-tests (Depends-on): Add setpayloadl.
(Makefile.am): Link test-totalorderl with $(SETPAYLOADL_LIBM).
+2024-04-17 Bruno Haible <bruno@clisp.org>
+
+ totalorder* tests: Strengthen tests.
+ * tests/test-totalorder.h: Include <math.h>.
+ (positive_NaN_with_payload, negative_NaN_with_payload): New functions.
+ (main): Test quiet NaNs of each sign with different payload.
+ * tests/test-totalorder.c (TOTALORDER_POSITIVE_NAN,
+ TOTALORDER_NEGATIVE_NAN): Remove macros.
+ (TOTALORDER_SETPAYLOAD): New macro.
+ * tests/test-totalorderf.c (TOTALORDER_POSITIVE_NAN,
+ TOTALORDER_NEGATIVE_NAN): Remove macros.
+ (TOTALORDER_SETPAYLOAD): New macro.
+ * tests/test-totalorderl.c (TOTALORDER_POSITIVE_NAN,
+ TOTALORDER_NEGATIVE_NAN): Remove macros.
+ (TOTALORDER_SETPAYLOAD): New macro.
+ * modules/totalorder-tests (Depends-on): Add setpayload.
+ (Makefile.am): Link test-totalorder with $(SETPAYLOAD_LIBM).
+ * modules/totalorderf-tests (Depends-on): Add setpayloadf.
+ (Makefile.am): Link test-totalorderf with $(SETPAYLOADF_LIBM).
+ * modules/totalorderl-tests (Depends-on): Add setpayloadl.
+ (Makefile.am): Link test-totalorderl with $(SETPAYLOADL_LIBM).
+
2024-04-17 Bruno Haible <bruno@clisp.org>
gnulib-tool.py: Use same warning style as gnulib-tool.sh.
Depends-on:
signed-nan
signed-snan
+setpayload
configure.ac:
Makefile.am:
TESTS += test-totalorder
check_PROGRAMS += test-totalorder
-test_totalorder_LDADD = $(LDADD) @TOTALORDER_LIBM@
+test_totalorder_LDADD = $(LDADD) @TOTALORDER_LIBM@ $(SETPAYLOAD_LIBM)
Depends-on:
signed-nan
signed-snan
+setpayloadf
configure.ac:
Makefile.am:
TESTS += test-totalorderf
check_PROGRAMS += test-totalorderf
-test_totalorderf_LDADD = $(LDADD) @TOTALORDERF_LIBM@
+test_totalorderf_LDADD = $(LDADD) @TOTALORDERF_LIBM@ $(SETPAYLOADF_LIBM)
Depends-on:
signed-nan
signed-snan
+setpayloadl
configure.ac:
Makefile.am:
TESTS += test-totalorderl
check_PROGRAMS += test-totalorderl
-test_totalorderl_LDADD = $(LDADD) @TOTALORDERL_LIBM@
+test_totalorderl_LDADD = $(LDADD) @TOTALORDERL_LIBM@ $(SETPAYLOADL_LIBM)
#define TOTALORDER_TYPE memory_double
#define TOTALORDER_INF Infinityd
#define TOTALORDER_MINUS_ZERO minus_zerod
-#define TOTALORDER_POSITIVE_NAN positive_NaNd
-#define TOTALORDER_NEGATIVE_NAN negative_NaNd
+#define TOTALORDER_SETPAYLOAD setpayload
#define TOTALORDER_HAVE_SNAN HAVE_SNAND
#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNd
#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNd
#include <stdio.h>
+#include <math.h>
#include "infinity.h"
#include "macros.h"
#include "minus-zero.h"
#include "signed-nan.h"
#include "signed-snan.h"
+static TOTALORDER_TYPE
+positive_NaN_with_payload (int payload)
+{
+ TOTALORDER_TYPE x;
+ ASSERT (TOTALORDER_SETPAYLOAD (&x.value, payload) == 0);
+ return x;
+}
+
+static TOTALORDER_TYPE
+negative_NaN_with_payload (int payload)
+{
+ TOTALORDER_TYPE x;
+ ASSERT (TOTALORDER_SETPAYLOAD (&x.value, payload) == 0);
+ x.value = - x.value;
+ return x;
+}
+
int
main ()
{
TOTALORDER_TYPE x[] =
{
- { TOTALORDER_NEGATIVE_NAN () },
+ negative_NaN_with_payload (1729),
+ negative_NaN_with_payload (641),
#if TOTALORDER_HAVE_SNAN
TOTALORDER_NEGATIVE_SNAN (),
#endif
#if TOTALORDER_HAVE_SNAN
TOTALORDER_POSITIVE_SNAN (),
#endif
- { TOTALORDER_POSITIVE_NAN () }
+ positive_NaN_with_payload (641),
+ positive_NaN_with_payload (1729)
};
int n = SIZEOF (x);
int result = 0;
#define TOTALORDER_TYPE memory_float
#define TOTALORDER_INF Infinityf
#define TOTALORDER_MINUS_ZERO minus_zerof
-#define TOTALORDER_POSITIVE_NAN positive_NaNf
-#define TOTALORDER_NEGATIVE_NAN negative_NaNf
+#define TOTALORDER_SETPAYLOAD setpayloadf
#define TOTALORDER_HAVE_SNAN HAVE_SNANF
#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNf
#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNf
#define TOTALORDER_TYPE memory_long_double
#define TOTALORDER_INF Infinityl
#define TOTALORDER_MINUS_ZERO minus_zerol
-#define TOTALORDER_POSITIVE_NAN positive_NaNl
-#define TOTALORDER_NEGATIVE_NAN negative_NaNl
+#define TOTALORDER_SETPAYLOAD setpayloadl
#define TOTALORDER_HAVE_SNAN HAVE_SNANL
#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNl
#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNl