X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Fsprintf_test.c;h=5e68e79fff77ecfb92e5ead6e78e87bb2522dc41;hb=64969cdb6b48f50b642178779baf9e1e317e0645;hp=b793f97b0138eb982b52972eae08c88f0b0bc052;hpb=955809a5fea19ac29e086605a2338ec6d3e3e32d;p=bertos.git 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; }