summaryrefslogtreecommitdiff
path: root/snprintf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-27 23:59:51 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-27 23:59:51 -0400
commitead84f05c3116fec519a27be776b1206416195d9 (patch)
treed4058054b047c7f6ac59283adf0531e1bef5199b /snprintf.c
parenta9baddd7d07b9fe15e212985a808a79773ec72e4 (diff)
downloadlibc-testsuite-ead84f05c3116fec519a27be776b1206416195d9.tar.gz
new snprintf and swprintf tests
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");