mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Port tests\core\math, math\linalg\glsl and math\noise
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user