Strip old test runner back out of internal, issues and vendor

This commit is contained in:
Jeroen van Rijn
2024-06-02 21:15:25 +02:00
parent 9d8d864400
commit 60d0c03134
16 changed files with 282 additions and 582 deletions
+1 -1
View File
@@ -5,4 +5,4 @@ set PATH_TO_ODIN==..\..\odin
echo ---
echo Running vendor:glfw tests
echo ---
%PATH_TO_ODIN% run glfw %COMMON% -out:vendor_glfw.exe || exit /b
%PATH_TO_ODIN% test glfw %COMMON% -out:vendor_glfw.exe || exit /b
+8 -36
View File
@@ -1,49 +1,21 @@
package test_vendor_glfw
import "core:testing"
import "core:fmt"
import "vendor:glfw"
import "core:os"
GLFW_MAJOR :: 3
GLFW_MINOR :: 4
GLFW_PATCH :: 0
TEST_count := 0
TEST_fail := 0
when ODIN_TEST {
expect :: testing.expect
log :: testing.log
} else {
expect :: proc(t: ^testing.T, condition: bool, message: string, loc := #caller_location) {
fmt.printf("[%v] ", loc)
TEST_count += 1
if !condition {
TEST_fail += 1
fmt.println(message)
return
}
fmt.println(" PASS")
}
log :: proc(t: ^testing.T, v: any, loc := #caller_location) {
fmt.printf("[%v] ", loc)
fmt.printf("log: %v\n", v)
}
}
main :: proc() {
t := testing.T{}
test_glfw(&t)
fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count)
if TEST_fail > 0 {
os.exit(1)
}
}
@(test)
test_glfw :: proc(t: ^testing.T) {
major, minor, patch := glfw.GetVersion()
expect(t, major == GLFW_MAJOR && minor == GLFW_MINOR, fmt.tprintf("Expected GLFW.GetVersion: %v.%v.%v, got %v.%v.%v instead", GLFW_MAJOR, GLFW_MINOR, GLFW_PATCH, major, minor, patch))
testing.expectf(
t,
major == GLFW_MAJOR && \
minor == GLFW_MINOR,
"Expected GLFW.GetVersion: %v.%v.%v, got %v.%v.%v instead",
GLFW_MAJOR, GLFW_MINOR, GLFW_PATCH,
major, minor, patch,
)
}