summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/tests/tests.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/user/app/tests/tests.c b/src/user/app/tests/tests.c
index 1d1156e..4390747 100644
--- a/src/user/app/tests/tests.c
+++ b/src/user/app/tests/tests.c
@@ -237,6 +237,15 @@ static void test_execbuf(void) {
test_fail();
}
+static void test_snprintf(void) {
+ char buf[16];
+ memset(buf, '?', 16);
+ assert(13 == snprintf(buf, 15, "That's 0x%x", 0x1337));
+ assert(!memcmp(buf, "That's 0x1337\0??", 16));
+ assert(17 == snprintf(buf, 15, "%05x %05x %05x", 0, 0, 0));
+ assert(!memcmp(buf, "00000 00000 00\0?", 16));
+}
+
static void test_misc(void) {
assert(_syscall(~0, 0, 0, 0, 0, 0) < 0); /* try making an invalid syscall */
}
@@ -254,6 +263,7 @@ int main(void) {
run_forked(test_semaphore);
run_forked(test_efault);
run_forked(test_execbuf);
+ run_forked(test_snprintf);
run_forked(test_misc);
return 1;
}