summaryrefslogtreecommitdiffstats
path: root/kernel/kernel.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-11-04 12:13:43 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-11-04 12:13:43 +0100
commit0fc6d68615c4921bbe73ee415ef06a921ff666e2 (patch)
treecc753d7275602b17cc6c07549c94e022e3371254 /kernel/kernel.c
parentb85a42da521dac79a7cf478168c2777ea7897070 (diff)
downloadjeyzuos-0fc6d68615c4921bbe73ee415ef06a921ff666e2.zip
jeyzuos-0fc6d68615c4921bbe73ee415ef06a921ff666e2.tar.gz
add tests
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index d65b07d..d81c8a7 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -1,4 +1,5 @@
#include "tty.h"
+#include "stdlib.h"
/* this only work for the 32-bit ix86 targets. */
#if !defined(__i386__)
@@ -8,8 +9,30 @@
#if defined(__cplusplus)
extern "C" /* Use C linkage for kernel_main. */
#endif
+
+static void test(int ok)
+{
+ tty_puts(ok ? " ok\n" : " ko\n");
+}
+
void kernel_main()
{
+ char ch0[16];
+
tty_init();
- tty_writestring("Hello, kernel World!\n");
+ tty_puts("\nHello, kernel World!\n");
+
+ memset(ch0, 'x', 4);
+ memcpy(ch0+4, ch0, 4);
+ ch0[0] = ' ';
+ ch0[7] = '\n';
+ ch0[8] = '\0';
+ tty_puts(ch0);
+
+ test(strncmp("abc", "abd", 8) < 0);
+ test(strncmp("abd", "abc", 8) > 0);
+ test(strncmp("abc", "abc", 8) == 0);
+ test(strncmp("abca", "abcb", 3) == 0);
+
+ tty_puts("done.\n");
}