From: bernie Date: Fri, 18 Feb 2005 12:48:26 +0000 (+0000) Subject: Add a few more paranoic tests. X-Git-Tag: 1.0.0~862 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=79a235ffd4713d62d952c1dbff8ce53721aae6d2;p=bertos.git Add a few more paranoic tests. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@379 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/mware/sprintf_test.c b/mware/sprintf_test.c index b793f97b..5e68e79f 100755 --- a/mware/sprintf_test.c +++ b/mware/sprintf_test.c @@ -17,9 +17,6 @@ int main(UNUSED_ARG(int, argc), UNUSED_ARG(char **,argv)) snprintf(buf, sizeof buf, "%S", test_string_pgm); assert(strcmp(buf, test_string_pgm) == 0); - snprintf(buf, sizeof buf, "%s", NULL); - assert(strcmp(buf, "") == 0); - snprintf(buf, sizeof buf, "%d", 12345); assert(strcmp(buf, "12345") == 0); @@ -29,5 +26,14 @@ int main(UNUSED_ARG(int, argc), UNUSED_ARG(char **,argv)) snprintf(buf, sizeof buf, "%lu", 4294967295UL); assert(strcmp(buf, "4294967295") == 0); + /* + * Stress tests. + */ + snprintf(buf, sizeof buf, "%s", NULL); + assert(strcmp(buf, "") == 0); + snprintf(buf, sizeof buf, "%k"); + assert(strcmp(buf, "???") == 0); + sprintf(NULL, test_string); /* must not crash */ + return 0; }