From 79a235ffd4713d62d952c1dbff8ce53721aae6d2 Mon Sep 17 00:00:00 2001 From: bernie Date: Fri, 18 Feb 2005 12:48:26 +0000 Subject: [PATCH] Add a few more paranoic tests. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@379 38d2e660-2303-0410-9eaa-f027e97ec537 --- mware/sprintf_test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; } -- 2.25.1