From 9411ac625b15ba636c2b55909e5e08d9f179c54a Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Tue, 7 Nov 2023 14:20:01 +0100 Subject: [PATCH] tests: Use NAN and INFINITY of C99 and C++11 Effectively reverts commit f6f5d9bb4cc05fb9544ec92e0c3e6a44013cbc1f. --- expat/tests/acc_tests.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/expat/tests/acc_tests.c b/expat/tests/acc_tests.c index f2dee34d..8061048d 100644 --- a/expat/tests/acc_tests.c +++ b/expat/tests/acc_tests.c @@ -41,6 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include /* NAN, INFINITY */ #include #include @@ -285,16 +286,6 @@ START_TEST(test_accounting_precision) { } END_TEST -static float -portableNAN(void) { - return strtof("nan", NULL); -} - -static float -portableINFINITY(void) { - return strtof("infinity", NULL); -} - START_TEST(test_billion_laughs_attack_protection_api) { XML_Parser parserWithoutParent = XML_ParserCreate(NULL); XML_Parser parserWithParent @@ -313,7 +304,7 @@ START_TEST(test_billion_laughs_attack_protection_api) { == XML_TRUE) fail("Call with non-root parser is NOT supposed to succeed"); if (XML_SetBillionLaughsAttackProtectionMaximumAmplification( - parserWithoutParent, portableNAN()) + parserWithoutParent, NAN) == XML_TRUE) fail("Call with NaN limit is NOT supposed to succeed"); if (XML_SetBillionLaughsAttackProtectionMaximumAmplification( @@ -335,7 +326,7 @@ START_TEST(test_billion_laughs_attack_protection_api) { == XML_FALSE) fail("Call with positive limit >=1.0 is supposed to succeed"); if (XML_SetBillionLaughsAttackProtectionMaximumAmplification( - parserWithoutParent, portableINFINITY()) + parserWithoutParent, INFINITY) == XML_FALSE) fail("Call with positive limit >=1.0 is supposed to succeed");