#include "test.h" #include "monitor.h" #include #include "sys.h" #define TEST_KMALLOC(var, sz) void *var = kmalloc(sz); ASSERT(var > 0xE0000000); #define TEST_KFREE(var) if (var != 0) { kfree(var); } void test_run() { monitor_write("Unit tests:\n\tkmalloc:"); int i; for (i = 1; i <= 7; i++) { monitor_write(" #"); monitor_writeDec(i); TEST_KMALLOC(a, 32); TEST_KMALLOC(b, 64); TEST_KMALLOC(c, 256); TEST_KMALLOC(d, 512); TEST_KMALLOC(e, 1024); TEST_KMALLOC(f, 4096); TEST_KMALLOC(g, 16384); TEST_KFREE(b); TEST_KFREE(c); TEST_KFREE(d); TEST_KFREE(e); TEST_KFREE(f); TEST_KFREE(g); } monitor_write("\n >> Tests OK\n"); }