Improve core:math procedures and add loads of unit tests

This commit is contained in:
gingerBill
2022-11-29 11:39:44 +00:00
parent e5c243ee93
commit 0c25f7cdc5
3 changed files with 884 additions and 14 deletions
+7 -1
View File
@@ -12,15 +12,21 @@ TEST_fail := 0
when ODIN_TEST {
expect :: testing.expect
log :: testing.log
errorf :: testing.errorf
} else {
expect :: proc(t: ^testing.T, condition: bool, message: string, loc := #caller_location) {
TEST_count += 1
if !condition {
TEST_fail += 1
fmt.printf("[%v] FAIL %v\n", loc, message)
fmt.printf("[%v:%s] FAIL %v\n", loc, loc.procedure, message)
return
}
}
errorf :: proc(t: ^testing.T, message: string, args: ..any, loc := #caller_location) {
TEST_fail += 1
fmt.printf("[%v:%s] Error %v\n", loc, loc.procedure, fmt.tprintf(message, ..args))
return
}
log :: proc(t: ^testing.T, v: any, loc := #caller_location) {
fmt.printf("[%v] ", loc)
fmt.printf("log: %v\n", v)