X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Fsprintf_test.c;h=390b6c314becd60bd1763ebb24663f736be6a4c4;hb=HEAD;hp=5e68e79fff77ecfb92e5ead6e78e87bb2522dc41;hpb=79a235ffd4713d62d952c1dbff8ce53721aae6d2;p=bertos.git diff --git a/mware/sprintf_test.c b/mware/sprintf_test.c deleted file mode 100755 index 5e68e79f..00000000 --- a/mware/sprintf_test.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "sprintf.c" -#include "formatwr.c" - -#include /* assert() */ -#include /* strcmp() */ - - -int main(UNUSED_ARG(int, argc), UNUSED_ARG(char **,argv)) -{ - char buf[256]; - static const char test_string[] = "Hello, world!\n"; - static const pgm_char test_string_pgm[] = "Hello, world!\n"; - - snprintf(buf, sizeof buf, "%s", test_string); - assert(strcmp(buf, test_string) == 0); - - snprintf(buf, sizeof buf, "%S", test_string_pgm); - assert(strcmp(buf, test_string_pgm) == 0); - - snprintf(buf, sizeof buf, "%d", 12345); - assert(strcmp(buf, "12345") == 0); - - snprintf(buf, sizeof buf, "%ld", 123456789L); - assert(strcmp(buf, "123456789") == 0); - - 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; -}