mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-09-01 02:34:55 +00:00
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).
This commit is contained in:
@@ -1,3 +1,25 @@
|
||||
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.
|
||||
|
||||
@@ -9,10 +9,11 @@ tests/macros.h
|
||||
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)
|
||||
|
||||
@@ -9,10 +9,11 @@ tests/macros.h
|
||||
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)
|
||||
|
||||
@@ -9,10 +9,11 @@ tests/macros.h
|
||||
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)
|
||||
|
||||
@@ -26,8 +26,7 @@ SIGNATURE_CHECK (totalorder, int, (const double *, const 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_SETPAYLOAD setpayload
|
||||
#define TOTALORDER_HAVE_SNAN HAVE_SNAND
|
||||
#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNd
|
||||
#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNd
|
||||
|
||||
+22
-2
@@ -16,18 +16,37 @@
|
||||
|
||||
#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
|
||||
@@ -44,7 +63,8 @@ main ()
|
||||
#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;
|
||||
|
||||
@@ -26,8 +26,7 @@ SIGNATURE_CHECK (totalorderf, int, (const float *, const 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_SETPAYLOAD setpayloadf
|
||||
#define TOTALORDER_HAVE_SNAN HAVE_SNANF
|
||||
#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNf
|
||||
#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNf
|
||||
|
||||
@@ -26,8 +26,7 @@ SIGNATURE_CHECK (totalorderl, int, (const long double *, const 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_SETPAYLOAD setpayloadl
|
||||
#define TOTALORDER_HAVE_SNAN HAVE_SNANL
|
||||
#define TOTALORDER_POSITIVE_SNAN memory_positive_SNaNl
|
||||
#define TOTALORDER_NEGATIVE_SNAN memory_negative_SNaNl
|
||||
|
||||
Reference in New Issue
Block a user