diff options
author | Marco Paland <marco@paland.com> | 2018-09-14 13:48:27 +0200 |
---|---|---|
committer | Marco Paland <marco@paland.com> | 2018-09-14 13:48:27 +0200 |
commit | 6dae1687b5fd4dd7ee104079da0df906fe393263 (patch) | |
tree | 9769d32b33e0ab86d2285b71d62398f589a5f296 /test | |
parent | f8a2be378d6df840ee16e0019435cadc659348c1 (diff) | |
download | printf-6dae1687b5fd4dd7ee104079da0df906fe393263.tar.gz printf-6dae1687b5fd4dd7ee104079da0df906fe393263.tar.bz2 printf-6dae1687b5fd4dd7ee104079da0df906fe393263.zip |
fix(printf): fix negative argument precision
Fixes #25
Diffstat (limited to 'test')
-rw-r--r-- | test/test_suite.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/test_suite.cpp b/test/test_suite.cpp index 05b95f7..e693851 100644 --- a/test/test_suite.cpp +++ b/test/test_suite.cpp @@ -1226,6 +1226,9 @@ TEST_CASE("misc", "[]" ) { test::sprintf(buffer, "%.*f", 2, 0.33333333);
REQUIRE(!strcmp(buffer, "0.33"));
+ test::sprintf(buffer, "%.*d", -1, 1);
+ REQUIRE(!strcmp(buffer, "1"));
+
test::sprintf(buffer, "%.3s", "foobar");
REQUIRE(!strcmp(buffer, "foo"));
|