aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_suite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_suite.cpp')
-rw-r--r--test/test_suite.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/test_suite.cpp b/test/test_suite.cpp
index 875fa82..27efa4e 100644
--- a/test/test_suite.cpp
+++ b/test/test_suite.cpp
@@ -1045,9 +1045,19 @@ TEST_CASE("length", "[]" ) {
TEST_CASE("float", "[]" ) {
char buffer[100];
- test::sprintf(buffer, "%8f", NAN); // using the NAN macro of math.h
+ // test special-case floats using math.h macros
+ test::sprintf(buffer, "%8f", NAN);
REQUIRE(!strcmp(buffer, " nan"));
+ test::sprintf(buffer, "%8f", INFINITY);
+ REQUIRE(!strcmp(buffer, " inf"));
+
+ test::sprintf(buffer, "%-8f", -INFINITY);
+ REQUIRE(!strcmp(buffer, "-inf "));
+
+ test::sprintf(buffer, "%+8e", INFINITY);
+ REQUIRE(!strcmp(buffer, " +inf"));
+
test::sprintf(buffer, "%.4f", 3.1415354);
REQUIRE(!strcmp(buffer, "3.1415"));