From abf1964953e6206900b14a47f0b4bc94a639b024 Mon Sep 17 00:00:00 2001 From: Gitea Date: Mon, 21 Dec 2020 12:56:24 -0600 Subject: [PATCH] Made freestanding; tests removed - 's for libc.a --- arch/i386/init.c | 95 ------------------------------------------------ 1 file changed, 95 deletions(-) diff --git a/arch/i386/init.c b/arch/i386/init.c index 9b966b3..20fb901 100755 --- a/arch/i386/init.c +++ b/arch/i386/init.c @@ -1,104 +1,10 @@ #include -#include -#include #include -#include #include #include "gdt.h" int tss[16][2]; -int test_libc(void) { - int failed = 0; - - printf("==Testing stdio.h==\n"); - - printf("printf(\"%%d\", 10): %d (expected 10)\n", 10); - printf("printf(\"%%o\", 14): %o (expected 16)\n", 14); - printf("printf(\"%%u\", 10): %u (expected 10)\n", 10); - printf("printf(\"%%x\", 26): %x (expected 1a)\n", 26); - printf("printf(\"%%X\", 0xC9A): %x (expected C9A)\n", 0xC9A); - printf("printf(\"%%p\", &i): %p (expected 0x[hex])\n", &failed); - printf("printf(\"%%n\"): %n (expected 14)\n"); - - printf("==Testing math.h==\n"); - if(cos(0) == 1.0) { - printf("["); - /* I want the status to be coloured. How do I do that? */ - printf("OK"); - printf("] cos()\n"); - } - else { - printf("["); - printf("FAIL"); - printf("] cos()\n"); - failed++; - } - - if(fabs(-2.3) == 2.3) { - printf("["); - printf("OK"); - printf("] fabs()\n"); - } - else { - printf("["); - printf("FAIL"); - printf("] fabs()\n"); - failed++; - } - - printf("==Testing time.h==\n"); - printf("time(0): Current UNIX time: %d\n", time(0)); - - printf("==Testing stdlib.h==\n"); - - if(abs(-5) == 5) { - printf("["); - printf("OK"); - printf("] abs()\n"); - } - else { - printf("["); - printf("FAIL"); - printf("] abs(); expected 5, got %d\n", abs(-5)); - failed++; - } - - srand(time(0)); - int rand_test = rand(); - printf("rand() output with seed time(0): %d\n", rand_test); - - printf("==Testing string.h==\n"); - - if(strcmp("Hi", "Hi") == 0 && strcmp("Hi", "Hello") != 0) { - printf("["); - printf("OK"); - printf("] strcmp()\n"); - } - else { - printf("["); - printf("FAIL"); - printf("] strcmp()\n"); - failed++; - } - - if(strcspn("Hello!", "!e") == 1) { - printf("["); - printf("OK"); - printf("] strcspn()\n"); - } - else { - printf("["); - printf("FAIL"); - printf("] strcspn(); expected 1, got %d\n", strcspn("Hello!", "!e")); - failed++; - } - - printf("Tests failed: %d\n", failed); - - return failed; -} - void NMI_disable(void) { outb(0x70, inb(0x70) | 0x80); } @@ -138,5 +44,4 @@ int init(void) { A20_enable(); setup_gdt(); printf("Fenix Dev Pre-release v0.0.3\n"); - return test_libc(); }