summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/tests/main.c1
-rw-r--r--src/kernel/tests/tests.h2
-rw-r--r--src/kernel/tests/util.c78
-rw-r--r--src/kernel/tests/vfs.c4
4 files changed, 2 insertions, 83 deletions
diff --git a/src/kernel/tests/main.c b/src/kernel/tests/main.c
index f9c9413..8a6921a 100644
--- a/src/kernel/tests/main.c
+++ b/src/kernel/tests/main.c
@@ -7,7 +7,6 @@ bool _did_tests_fail;
void tests_all(void) {
_did_tests_fail = false;
- tests_utils();
tests_vfs();
if (_did_tests_fail)
diff --git a/src/kernel/tests/tests.h b/src/kernel/tests/tests.h
index aa8597b..0f8693a 100644
--- a/src/kernel/tests/tests.h
+++ b/src/kernel/tests/tests.h
@@ -1,6 +1,4 @@
#pragma once
void tests_all(void);
-
-void tests_utils(void);
void tests_vfs(void);
diff --git a/src/kernel/tests/util.c b/src/kernel/tests/util.c
deleted file mode 100644
index b7123b4..0000000
--- a/src/kernel/tests/util.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <kernel/tests/base.h>
-#include <kernel/tests/tests.h>
-#include <shared/container/ring.h>
-#include <shared/mem.h>
-
-TEST(memcmp) {
- // basic equality checks
- TEST_COND(0 == memcmp("some", "thing", 0));
- TEST_COND(0 != memcmp("some", "thing", 1));
- TEST_COND(0 != memcmp("some", "thing", 4));
-
- TEST_COND(0 == memcmp("test", "tennis", 0));
- TEST_COND(0 == memcmp("test", "tennis", 1));
- TEST_COND(0 == memcmp("test", "tennis", 2));
- TEST_COND(0 != memcmp("test", "tennis", 3));
- TEST_COND(0 != memcmp("test", "tennis", 4));
- TEST_COND(0 != memcmp("test", "tennis", 5));
-
- // test signs. does anyone even use that?
- TEST_COND(0 > memcmp("foo", "moo", 4));
- TEST_COND(0 < memcmp("moo", "foo", 4));
- TEST_COND(0 > memcmp("555", "654", 3));
- TEST_COND(0 < memcmp("654", "555", 3));
-}
-
-TEST(strcmp) {
- TEST_COND(0 == strcmp("string", "string"));
- TEST_COND(0 > strcmp("str", "string"));
- TEST_COND(0 < strcmp("string", "str"));
-
- TEST_COND(0 != strcmp("stress", "string"));
-}
-
-TEST(ring) {
- char backbuf[16], cmpbuf[16];
- size_t num_read = 0, num_written = 0;
- uint8_t c;
-
- ring_t r = {backbuf, 16, 0, 0};
-
- // test aliasing
- for (size_t i = 0; i < 16; i++) {
- TEST_COND(ring_size(&r) == 0);
- ring_put(&r, "11 bytes...", 11);
- TEST_COND(ring_size(&r) == 11);
-
- memset(cmpbuf, 0, sizeof cmpbuf);
- TEST_COND(ring_get(&r, cmpbuf, 16) == 11);
- TEST_COND(memcmp(cmpbuf, "11 bytes...", 11) == 0);
- }
-
- TEST_COND(ring_size(&r) == 0);
- for (size_t i = 0; i < 7; i++)
- ring_put1b(&r, num_written++);
- TEST_COND(ring_size(&r) == 7);
- for (size_t i = 0; i < 3; i++) {
- ring_get(&r, &c, 1);
- TEST_COND(num_read++ == c);
- }
- TEST_COND(ring_size(&r) == 4);
-
- for (size_t j = 0; j < 40; j++) {
- for (size_t i = 0; i < 7; i++)
- ring_put1b(&r, num_written++ & 0xff);
- TEST_COND(ring_size(&r) == 11);
- for (size_t i = 0; i < 7; i++) {
- ring_get(&r, &c, 1);
- TEST_COND((num_read++ & 0xff) == c);
- }
- TEST_COND(ring_size(&r) == 4);
- }
-}
-
-void tests_utils(void) {
- TEST_RUN(memcmp);
- TEST_RUN(strcmp);
- TEST_RUN(ring);
-}
diff --git a/src/kernel/tests/vfs.c b/src/kernel/tests/vfs.c
index 8b749b4..7b353e8 100644
--- a/src/kernel/tests/vfs.c
+++ b/src/kernel/tests/vfs.c
@@ -39,8 +39,8 @@ TEST(path_simplify) {
TEST_WRAPPER("/asdf//.", "/asdf/");
TEST_WRAPPER("/foo/bar/..", "/foo/");
- TEST_WRAPPER("/foo/bar/../bar", "/foo/bar");
- TEST_WRAPPER("/foo/bar/../bar/", "/foo/bar/");
+ TEST_WRAPPER("/foo/bar/../baz", "/foo/baz");
+ TEST_WRAPPER("/foo/bar/../baz/", "/foo/baz/");
TEST_WRAPPER("/foo/bar/xyz/..", "/foo/bar/");
TEST_WRAPPER("/foo/bar/xyz/../", "/foo/bar/");