summaryrefslogtreecommitdiff
path: root/snprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'snprintf.c')
-rw-r--r--snprintf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/snprintf.c b/snprintf.c
index 1e563e5..8d06add 100644
--- a/snprintf.c
+++ b/snprintf.c
@@ -95,6 +95,10 @@ int test_snprintf(void)
int err=0;
char b[500], *s;
+ TEST(i, snprintf(0, 0, "%d", 123456), 6, "length returned %d != %d");
+ TEST(i, snprintf(0, 0, "%.4s", "hello"), 4, "length returned %d != %d");
+ TEST(i, snprintf(b, 0, "%.0s", "goodbye"), 0, "length returned %d != %d");
+
strcpy(b, "xxxxxxxx");
TEST(i, snprintf(b, 4, "%d", 123456), 6, "length returned %d != %d");
TEST_S(b, "123", "incorrect output");