Port tests\core\math, math\linalg\glsl and math\noise

This commit is contained in:
Jeroen van Rijn
2024-06-02 14:47:09 -04:00
committed by Feoramund
parent d7bfbe0552
commit b0faab29e0
5 changed files with 180 additions and 313 deletions
@@ -1,24 +1,10 @@
// Tests "linalg_glsl_math.odin" in "core:math/linalg/glsl".
// Must be run with `-collection:tests=` flag, e.g.
// ./odin run tests/core/math/linalg/glsl/test_linalg_glsl_math.odin -collection:tests=./tests
package test_core_math_linalg_glsl_math
import glsl "core:math/linalg/glsl"
import "core:fmt"
import "core:math"
import "core:testing"
import tc "tests:common"
main :: proc() {
t := testing.T{}
test_fract_f32(&t)
test_fract_f64(&t)
tc.report(&t)
}
@test
test_fract_f32 :: proc(t: ^testing.T) {
@@ -45,7 +31,7 @@ test_fract_f32 :: proc(t: ^testing.T) {
for d, i in data {
assert(i == d.i)
r = glsl.fract(d.v)
tc.expect(t, r == d.e, fmt.tprintf("i:%d %s(%v (%h)) -> %v (%h) != %v", i, #procedure, d.v, d.v, r, r, d.e))
testing.expectf(t, r == d.e, "%v (%h) -> %v (%h) != %v", d.v, d.v, r, r, d.e)
}
}
@@ -74,6 +60,6 @@ test_fract_f64 :: proc(t: ^testing.T) {
for d, i in data {
assert(i == d.i)
r = glsl.fract(d.v)
tc.expect(t, r == d.e, fmt.tprintf("i:%d %s(%v (%h)) -> %v (%h) != %v", i, #procedure, d.v, d.v, r, r, d.e))
testing.expectf(t, r == d.e, "%v (%h) -> %v (%h) != %v", d.v, d.v, r, r, d.e)
}
}
}