* tests/test-totalorder.h: Include signed-snan.h.
(main): Change the array initializer to contain memory_* objects rather
than floating-point numbers. This is needed for i386 and x86_64 CPUs.
* tests/test-totalorder.c (TOTALORDER_TYPE): Use memory_double.
(TOTALORDER_HAVE_SNAN, TOTALORDER_POSITIVE_SNAN,
TOTALORDER_NEGATIVE_SNAN): New macros.
* tests/test-totalorderf.c (TOTALORDER_TYPE): Use memory_float.
(TOTALORDER_HAVE_SNAN, TOTALORDER_POSITIVE_SNAN,
TOTALORDER_NEGATIVE_SNAN): New macros.
* tests/test-totalorderl.c (TOTALORDER_TYPE): Use memory_long_double.
(TOTALORDER_HAVE_SNAN, TOTALORDER_POSITIVE_SNAN,
TOTALORDER_NEGATIVE_SNAN): New macros.
* modules/totalorder-tests (Depends-on): Add signed-snan.
* modules/totalorderf-tests (Depends-on): Likewise.
* modules/totalorderl-tests (Depends-on): Likewise.
+2023-10-14 Bruno Haible <bruno@clisp.org>
+
+ totalorder* tests: Test also the signalling NaNs.
+ * tests/test-totalorder.h: Include signed-snan.h.
+ (main): Change the array initializer to contain memory_* objects rather
+ than floating-point numbers. This is needed for i386 and x86_64 CPUs.
+ * tests/test-totalorder.c (TOTALORDER_TYPE): Use memory_double.
+ (TOTALORDER_HAVE_SNAN, TOTALORDER_POSITIVE_SNAN,
+ TOTALORDER_NEGATIVE_SNAN): New macros.
+ * tests/test-totalorderf.c (TOTALORDER_TYPE): Use memory_float.
+ (TOTALORDER_HAVE_SNAN, TOTALORDER_POSITIVE_SNAN,
+ TOTALORDER_NEGATIVE_SNAN): New macros.
+ * tests/test-totalorderl.c (TOTALORDER_TYPE): Use memory_long_double.
+ (TOTALORDER_HAVE_SNAN, TOTALORDER_POSITIVE_SNAN,
+ TOTALORDER_NEGATIVE_SNAN): New macros.
+ * modules/totalorder-tests (Depends-on): Add signed-snan.
+ * modules/totalorderf-tests (Depends-on): Likewise.
+ * modules/totalorderl-tests (Depends-on): Likewise.
+
2023-10-14 Bruno Haible <bruno@clisp.org>
totalorder* tests: Make it easier to debug failures.
Depends-on:
signed-nan
+signed-snan
configure.ac:
Depends-on:
signed-nan
+signed-snan
configure.ac:
Depends-on:
signed-nan
+signed-snan
configure.ac:
SIGNATURE_CHECK (totalorderf, int, (const float *, const float *));
#define TOTALORDER totalorder
-#define TOTALORDER_TYPE double
+#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_HAVE_SNAN HAVE_SNAND
+#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNd
+#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNd
#include "test-totalorder.h"
#include "macros.h"
#include "minus-zero.h"
#include "signed-nan.h"
+#include "signed-snan.h"
int
main ()
{
TOTALORDER_TYPE x[] =
{
- TOTALORDER_NEGATIVE_NAN (), -TOTALORDER_INF (), -1e37, -1, -1e-5,
- TOTALORDER_MINUS_ZERO, 0,
- 1e-5, 1, 1e37, TOTALORDER_INF (), TOTALORDER_POSITIVE_NAN ()
+ { .value = TOTALORDER_NEGATIVE_NAN () },
+#if TOTALORDER_HAVE_SNAN
+ TOTALORDER_NEGATIVE_SNAN (),
+#endif
+ { .value = -TOTALORDER_INF () },
+ { .value = -1e37 },
+ { .value = -1 },
+ { .value = -1e-5 },
+ { .value = TOTALORDER_MINUS_ZERO },
+ { .value = 0 },
+ { .value = 1e-5 },
+ { .value = 1 },
+ { .value = 1e37 },
+ { .value = TOTALORDER_INF () },
+#if TOTALORDER_HAVE_SNAN
+ TOTALORDER_POSITIVE_SNAN (),
+#endif
+ { .value = TOTALORDER_POSITIVE_NAN () }
};
int n = SIZEOF (x);
int result = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
- if (!(!!TOTALORDER (&x[i], &x[j]) == (i <= j)))
+ if (!(!!TOTALORDER (&x[i].value, &x[j].value) == (i <= j)))
{
fprintf (stderr, "Failed: i=%d j=%d\n", i, j);
result = 1;
SIGNATURE_CHECK (totalorderf, int, (const float *, const float *));
#define TOTALORDER totalorderf
-#define TOTALORDER_TYPE float
+#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_HAVE_SNAN HAVE_SNANF
+#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNf
+#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNf
#include "test-totalorder.h"
SIGNATURE_CHECK (totalorderl, int, (const long double *, const long double *));
#define TOTALORDER totalorderl
-#define TOTALORDER_TYPE long double
+#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_HAVE_SNAN HAVE_SNANL
+#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNl
+#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNl
#include "test-totalorder.h"