From ead84f05c3116fec519a27be776b1206416195d9 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 27 Mar 2011 23:59:51 -0400 Subject: new snprintf and swprintf tests --- snprintf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'snprintf.c') 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"); -- cgit v1.2.1