From 2b406f107b94eabebf92d20bb189d2c223e5d51c Mon Sep 17 00:00:00 2001 From: bel2125 Date: Sun, 27 Aug 2017 20:27:49 +0200 Subject: [PATCH] Generate NAN and INFINITY in case they are not defined by the system headers --- tests/check_check_sub.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/check_check_sub.c b/tests/check_check_sub.c index dfde2f9..c446f38 100644 --- a/tests/check_check_sub.c +++ b/tests/check_check_sub.c @@ -27,6 +27,17 @@ #include #include "check_check.h" +#if !defined(NAN) +/* According to POSIX, NAN and INFINITY are defined in math.h, see + * http://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html + * Hovever, older Visual Studio compilers do not define these values. + */ +double NAN; +#endif +#if !defined(INFINITY) +double INFINITY; +#endif + START_TEST(test_lno) { record_test_name(tcase_name()); @@ -2965,6 +2976,13 @@ Suite *make_sub_suite(void) TCase *tc_exit_handlers; #endif +#if !defined(NAN) + NAN /= NAN; /* division of 0 by 0 */ +#endif +#if !defined(INFINITY) + INFINITY = 1.0 / INFINITY; /* division of 1 by 0 */ +#endif + s = suite_create("Check Servant"); tc_simple = tcase_create("Simple Tests"); -- 2.50.1