Files
quantum-utils/test_stuff/src/main.c
Wesley Irvin 16e45e4675 Logging
Got a very basic logger up and working. Can be used with the Q[LEVEL]
macros. Still needs some work to add coloring to the console and to be
able to write logs out to files.
2024-02-10 09:50:02 -05:00

56 lines
1.4 KiB
C

#include <defines.h>
#include <logger/logger.h>
#include <memory/zone.h>
#include <stdio.h>
int main() {
printf("Size of i16: %" PRId16 "\n", sizeof(i16));
printf("Size of u16: %" PRIu16 "\n", sizeof(u16));
printf("Size of i32: %" PRId32 "\n", sizeof(i32));
printf("Size of u32: %" PRIu32 "\n", sizeof(u32));
printf("Size of i64: %" PRId64 "\n", sizeof(i64));
printf("Size of u64: %" PRIu64 "\n", sizeof(u64));
printf("Size of f32: %lu\n", sizeof(f32));
printf("Size of f64: %lu\n", sizeof(f64));
QFATAL("Test");
QERROR("Test");
QWARN("Test");
QINFO("Test");
QDEBUG("Test");
printf("\nCreating new zone 4K in size...\n");
Zone *test_zone = zoneCreate(4096);
void *test_alloc = zoneAlloc(test_zone, 4);
void *test_alloc2 = zoneAlloc(test_zone, 4);
printf("Address of test_zone: %p\n", (void *)test_zone);
printf("Address of test_alloc: %p\n", test_alloc);
printf("Address of test_alloc2: %p\n\n", test_alloc2);
zoneClear(test_zone);
u64 *test_free = zoneAlloc(test_zone, sizeof(u64));
printf("Address of test_free: %p\n", (void *)test_free);
printf("Freeing test_free...\n");
zoneFree(&test_free, sizeof(u64));
printf("Is test_free NULL: %s\n\n", test_free == NULL ? "true" : "false");
zoneDestroy(test_zone);
const u64 FOUR_GIGS = (u64)4 * 1024 * 1024 * 1024;
Zone *break_zone = zoneCreate(FOUR_GIGS);
while (zoneAlloc(break_zone, 1024 * 1024 * 1024) != NULL) {
}
zoneDestroy(break_zone);
return 0;
}