Harbor

branch main
showing the latest snapshot on main
resource_test.odin 1.1 KB · Plain text
tests/resource_test.odin 0644 Raw
package gpu_tests

import resource "../resource"
import "core:testing"

@(test)
test_gen_grid_geometry_batches_lines_into_one_mesh :: proc(t: ^testing.T) {
	verts, indices := resource.gen_grid_geometry(10, 1, 0.01)
	defer delete(verts)
	defer delete(indices)

	testing.expect_value(t, len(verts), 88)
	testing.expect_value(t, len(indices), 264)
	testing.expect_value(t, verts[0].position, [3]f32{-5.005, 0, -5})
	testing.expect_value(t, verts[1].position, [3]f32{-4.995, 0, -5})
	testing.expect_value(t, verts[2].position, [3]f32{-4.995, 0, 5})
	testing.expect_value(t, verts[3].position, [3]f32{-5.005, 0, 5})
	testing.expect_value(t, indices[0], u32(0))
	testing.expect_value(t, indices[1], u32(2))
	testing.expect_value(t, indices[2], u32(1))
	testing.expect_value(t, indices[3], u32(0))
	testing.expect_value(t, indices[4], u32(3))
	testing.expect_value(t, indices[5], u32(2))
	testing.expect_value(t, indices[6], u32(0))
	testing.expect_value(t, indices[7], u32(1))
	testing.expect_value(t, indices[8], u32(2))
	testing.expect_value(t, indices[9], u32(0))
	testing.expect_value(t, indices[10], u32(2))
	testing.expect_value(t, indices[11], u32(3))
}