diff options
author | Marco Paland <marco@paland.com> | 2019-01-26 15:57:10 +0100 |
---|---|---|
committer | Marco Paland <marco@paland.com> | 2019-01-26 15:57:10 +0100 |
commit | 80b42fef5f070c980584b45de7b4a84322c749a0 (patch) | |
tree | 2f16f1e4b4e0db2bd181e8e0271fb8c6eb925069 /test | |
parent | bf72dfb8dee9ee57463c7082aca520004cb7cb7c (diff) | |
download | printf-80b42fef5f070c980584b45de7b4a84322c749a0.tar.gz printf-80b42fef5f070c980584b45de7b4a84322c749a0.tar.bz2 printf-80b42fef5f070c980584b45de7b4a84322c749a0.zip |
fix(printf): fixed support of NaN
(hot) fixes #37
Diffstat (limited to 'test')
-rw-r--r-- | test/test_suite.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_suite.cpp b/test/test_suite.cpp index 66ba5f3..2103a5b 100644 --- a/test/test_suite.cpp +++ b/test/test_suite.cpp @@ -31,6 +31,7 @@ #include "catch.hpp"
#include <string.h>
+#include <math.h>
namespace test {
// use functions in own test namespace to avoid stdio conflicts
@@ -1019,6 +1020,9 @@ TEST_CASE("length", "[]" ) { TEST_CASE("float", "[]" ) {
char buffer[100];
+ test::sprintf(buffer, "%.4f", NAN); // using the NAN macro of math.h
+ REQUIRE(!strcmp(buffer, "nan"));
+
test::sprintf(buffer, "%.4f", 3.1415354);
REQUIRE(!strcmp(buffer, "3.1415"));
|