aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarco Paland <marco@paland.com>2019-03-25 23:10:37 +0100
committerMarco Paland <marco@paland.com>2019-03-25 23:10:37 +0100
commit637df9333d481028a97621e65c76c8df3535f49d (patch)
tree643c22e9e595f5d9cd615f7a397fe7bd17b12bcf /test
parent87e1c834f75249d25e426c674b65419ccfa41b20 (diff)
downloadprintf-637df9333d481028a97621e65c76c8df3535f49d.tar.gz
printf-637df9333d481028a97621e65c76c8df3535f49d.tar.bz2
printf-637df9333d481028a97621e65c76c8df3535f49d.zip
feat(printf): added vprintf() support
Closes #43
Diffstat (limited to 'test')
-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 d76a07d..dc15321 100644
--- a/test/test_suite.cpp
+++ b/test/test_suite.cpp
@@ -85,6 +85,13 @@ TEST_CASE("snprintf", "[]" ) {
REQUIRE(!strcmp(buffer, "-1"));
}
+static void vprintf_builder_1(char* buffer, ...)
+{
+ va_list args;
+ va_start(args, buffer);
+ test::vprintf("%d", args);
+ va_end(args);
+}
static void vsnprintf_builder_1(char* buffer, ...)
{
@@ -103,6 +110,17 @@ static void vsnprintf_builder_3(char* buffer, ...)
}
+TEST_CASE("vprintf", "[]" ) {
+ char buffer[100];
+ printf_idx = 0U;
+ memset(printf_buffer, 0xCC, 100U);
+ vprintf_builder_1(buffer, 2345);
+ REQUIRE(printf_buffer[4] == (char)0xCC);
+ printf_buffer[4] = 0;
+ REQUIRE(!strcmp(printf_buffer, "2345"));
+}
+
+
TEST_CASE("vsnprintf", "[]" ) {
char buffer[100];