1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package gpu_tests
import bk "../backend"
import gl_backend "../backend/opengl"
import "core:testing"
Test_Pool_Entry :: struct {
active: bool,
value: int,
}
@(test)
test_opengl_active_pool_entry_validates_bounds_and_active_state :: proc(t: ^testing.T) {
pool: [4]Test_Pool_Entry
pool[1] = {
active = true,
value = 42,
}
pool[2] = {
active = false,
value = 99,
}
entry, valid_ok := gl_backend.active_pool_entry(&pool, bk.Buffer_Handle(1))
testing.expect(t, valid_ok)
testing.expect_value(t, entry.value, 42)
_, null_ok := gl_backend.active_pool_entry(&pool, bk.NULL_BUFFER)
testing.expect(t, !null_ok)
_, inactive_ok := gl_backend.active_pool_entry(&pool, bk.Buffer_Handle(2))
testing.expect(t, !inactive_ok)
_, out_of_range_ok := gl_backend.active_pool_entry(&pool, bk.Buffer_Handle(4))
testing.expect(t, !out_of_range_ok)
}