summaryrefslogtreecommitdiff
path: root/src/user/app/tests/printf.c
diff options
context:
space:
mode:
authordzwdz2022-08-04 23:23:50 +0200
committerdzwdz2022-08-04 23:23:50 +0200
commit749a150e37fbfdaf33a8d6738e95306e6d95e8b5 (patch)
tree73e6191443113be4ec613c30281ce9c56ee7b20a /src/user/app/tests/printf.c
parentce00d1677d7a419b427e7f11963eee982a55a231 (diff)
move the kernel util tests to userland
Diffstat (limited to 'src/user/app/tests/printf.c')
-rw-r--r--src/user/app/tests/printf.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/user/app/tests/printf.c b/src/user/app/tests/printf.c
deleted file mode 100644
index 4dc45bb..0000000
--- a/src/user/app/tests/printf.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "tests.h"
-#include <stdio.h>
-#include <string.h>
-
-static void test_printf(void) {
- char buf[64];
- memset(buf, '?', 64);
-
- /* test proper overflow handling in snprintf */
- test(13 == snprintf(buf, 15, "That's 0x%x", 0x1337));
- test(!memcmp(buf, "That's 0x1337\0??", 16));
- test(17 == snprintf(buf, 15, "%05x %05x %05x", 0, 0, 0));
- test(!memcmp(buf, "00000 00000 00\0?", 16));
-
- /* all the other stuff */
- snprintf(buf, sizeof buf, "%010x", 0x1BABE);
- test(!strcmp(buf, "000001babe"));
- snprintf(buf, sizeof buf, "%10x", 0x1BABE);
- test(!strcmp(buf, " 1babe"));
- snprintf(buf, sizeof buf, "%10s", "hello");
- test(!strcmp(buf, " hello"));
-
- snprintf(buf, sizeof buf, "%s%%%s", "ab", "cd");
- test(!strcmp(buf, "ab%cd"));
-
- snprintf(buf, sizeof buf, "%05u %05u", 1234, 56789);
- test(!strcmp(buf, "01234 56789"));
-
- snprintf(buf, sizeof buf, "%u %x", 0, 0);
- test(!strcmp(buf, "0 0"));
-}
-
-void r_printf(void) {
- run_test(test_printf);
-}