rewrite testing code to be a bit more durable and clean.

This commit is contained in:
2025-09-17 16:52:18 +02:00
parent e623a352d2
commit 47d34b3f7d
8 changed files with 218 additions and 304 deletions

19
test/test.c Normal file
View File

@@ -0,0 +1,19 @@
/* Copyright (c) 2025 Quinn
* Licensed under the MIT Licence. See LICENSE for details */
#include "test.h"
#include "../src/util/intdef.h"
uint test_okay = 0;
uint test_fail = 0;
int test_process(int res, const char *restrict file, uint ln, const char *restrict function, const char *restrict expression) {
const char *status = res ?
"[\033[32;1m OK \033[0m]" :
"[\033[31;1m FAIL \033[0m]";
test_okay += !!res;
test_fail += !res;
printf("%s\t%s:%u-%s\t-> %s\n", status, file, ln, function, expression);
return res;
}