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.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_suite.cpp b/test/test_suite.cpp
index d990309..ab8f7e5 100644
--- a/test/test_suite.cpp
+++ b/test/test_suite.cpp
@@ -79,6 +79,12 @@ TEST_CASE("space flag", "[]" ) {
test::sprintf(buffer, "% 15d", -42);
REQUIRE(!strcmp(buffer, " -42"));
+ test::sprintf(buffer, "% 15.3f", -42.987);
+ REQUIRE(!strcmp(buffer, " -42.987"));
+
+ test::sprintf(buffer, "% 15.3f", 42.987);
+ REQUIRE(!strcmp(buffer, " 42.987"));
+
test::sprintf(buffer, "% s", "Hello testing");
REQUIRE(!strcmp(buffer, "Hello testing"));
@@ -211,6 +217,15 @@ TEST_CASE("0 flag", "[]" ) {
test::sprintf(buffer, "%015d", -42);
REQUIRE(!strcmp(buffer, "-00000000000042"));
+
+ test::sprintf(buffer, "%015.2f", 42.1234);
+ REQUIRE(!strcmp(buffer, "000000000042.12"));
+
+ test::sprintf(buffer, "%015.3f", 42.9876);
+ REQUIRE(!strcmp(buffer, "00000000042.988"));
+
+ test::sprintf(buffer, "%015.5f", -42.9876);
+ REQUIRE(!strcmp(buffer, "-00000042.98760"));
}
@@ -485,6 +500,9 @@ TEST_CASE("width -20", "[]" ) {
test::sprintf(buffer, "%-20u", 1024);
REQUIRE(!strcmp(buffer, "1024 "));
+ test::sprintf(buffer, "%-20.4f", 1024.1234);
+ REQUIRE(!strcmp(buffer, "1024.1234 "));
+
test::sprintf(buffer, "%-20u", 4294966272U);
REQUIRE(!strcmp(buffer, "4294966272 "));