diff options
author | Marco Paland <marco@paland.com> | 2018-06-05 17:52:30 +0200 |
---|---|---|
committer | Marco Paland <marco@paland.com> | 2018-06-05 17:52:30 +0200 |
commit | 7616d6f5e7a94890deadadaa4d3594cda0b62c4c (patch) | |
tree | cd9561ac3ff21257f84e0bb2af4a9065e88d8d89 /test | |
parent | 9fa6e64941c11da5ae6cf641df08a6198709c1db (diff) | |
download | printf-7616d6f5e7a94890deadadaa4d3594cda0b62c4c.tar.gz printf-7616d6f5e7a94890deadadaa4d3594cda0b62c4c.tar.bz2 printf-7616d6f5e7a94890deadadaa4d3594cda0b62c4c.zip |
test(test_suite): added vsnprintf() test case
Diffstat (limited to 'test')
-rw-r--r-- | test/test_suite.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_suite.cpp b/test/test_suite.cpp index 8aaf67a..c2fd0f2 100644 --- a/test/test_suite.cpp +++ b/test/test_suite.cpp @@ -83,6 +83,24 @@ TEST_CASE("snprintf", "[]" ) { }
+TEST_CASE("vsnprintf", "[]" ) {
+ char buffer[100];
+
+ // mock argument list
+ const struct tag_args {
+ int a;
+ int b;
+ char* s;
+ } args = { -1, -1000, "test" };
+
+ test::vsnprintf(buffer, 100U, "%d %d %s", (char*)&args);
+ REQUIRE(!strcmp(buffer, "-1 -1000 test"));
+
+ test::vsnprintf(buffer, 3U, "%d", (char*)&args);
+ REQUIRE(!strcmp(buffer, "-1"));
+}
+
+
TEST_CASE("space flag", "[]" ) {
char buffer[100];
|