diff options
| author | Damian Tarnawski <gthetarnav@gmail.com> | 2025-08-23 12:55:07 +0200 |
|---|---|---|
| committer | Damian Tarnawski <gthetarnav@gmail.com> | 2025-08-23 12:55:07 +0200 |
| commit | 05706864b7cdbd8fabf09dd8cb4d55e1e9174acf (patch) | |
| tree | d857214424c25cc8c6d2a5186373e8c77e09c1a3 /tests | |
| parent | 2b6ed996be472d282fbe8cc74ee1f62f035cabac (diff) | |
Support using allocator resize in `_reserve_soa` (fixes #5615)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/core/runtime/test_core_runtime.odin | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/core/runtime/test_core_runtime.odin b/tests/core/runtime/test_core_runtime.odin index 65312a523..d74edd3f8 100644 --- a/tests/core/runtime/test_core_runtime.odin +++ b/tests/core/runtime/test_core_runtime.odin @@ -180,6 +180,32 @@ test_map_get :: proc(t: ^testing.T) { } @(test) +test_soa_array_allocator_resize :: proc(t: ^testing.T) { + arena: runtime.Arena + context.allocator = runtime.arena_allocator(&arena) + defer runtime.arena_destroy(&arena) + + array, err := make(#soa[dynamic][2]int, 2, 3) + array[0] = [2]int{1, 2} + array[1] = [2]int{3, 4} + + testing.expect_value(t, err, nil) + testing.expect_value(t, len(array), 2) + testing.expect_value(t, cap(array), 3) + + err = resize(&array, 4) + + testing.expect_value(t, err, nil) + testing.expect_value(t, len(array), 4) + testing.expect_value(t, cap(array), 4) + + testing.expect_value(t, array[0], [2]int{1, 2}) + testing.expect_value(t, array[1], [2]int{3, 4}) + testing.expect_value(t, array[2], [2]int{0, 0}) + testing.expect_value(t, array[3], [2]int{0, 0}) +} + +@(test) test_memory_equal :: proc(t: ^testing.T) { data: [256]u8 cmp: [256]u8 |