From 7a9953e7426e2eba46253c2b83f688b84268a8b0 Mon Sep 17 00:00:00 2001 From: Eyal Rozenberg Date: Tue, 3 Aug 2021 22:41:56 +0300 Subject: [PATCH] Added a testcase check exposing issue #120 - and corrected the expected output in two other testcase, which was indeed what the library was producing, but is invalid ("%e" output with a two-digit integral part). --- test/test_suite.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_suite.cpp b/test/test_suite.cpp index 1f912f49..b3975003 100644 --- a/test/test_suite.cpp +++ b/test/test_suite.cpp @@ -770,7 +770,7 @@ TEST_CASE("float", "[]" ) { CAPTURE_AND_PRINT(test::sprintf_, buffer, "%.0f", (double) ((int64_t)1 * 1000 * 1000 * 1000 * 1000) ); if (PRINTF_FLOAT_NOTATION_THRESHOLD < 10e+11) { - CHECK(!strcmp(buffer, "10e+11")); + CHECK(!strcmp(buffer, "1e+12")); } else { CHECK(!strcmp(buffer, "1000000000000")); @@ -778,7 +778,7 @@ TEST_CASE("float", "[]" ) { CAPTURE_AND_PRINT(test::sprintf_, buffer, "%.0f", (double) ((int64_t)1 * 1000 * 1000 * 1000 * 1000 * 1000) ); if (PRINTF_FLOAT_NOTATION_THRESHOLD < 10e+14) { - CHECK(!strcmp(buffer, "10e+14")); + CHECK(!strcmp(buffer, "1e+15")); } else { CHECK(!strcmp(buffer, "1000000000000000")); @@ -826,6 +826,7 @@ TEST_CASE("float", "[]" ) { PRINTING_CHECK("+001.234e-05", ==, test::sprintf_, buffer, "%+012.4g", 0.00001234); PRINTING_CHECK("-1.23e-308", ==, test::sprintf_, buffer, "%.3g", -1.2345e-308); PRINTING_CHECK("+1.230E+308", ==, test::sprintf_, buffer, "%+.3E", 1.23e+308); + PRINTING_CHECK("1.000e+01", ==, test::sprintf_, buffer, "%.3e", 9.9996); #endif // out of range for float: should switch to exp notation if supported, else empty