From 1550eced046c61fed1121fa6245af6d564ba3149 Mon Sep 17 00:00:00 2001 From: fleandro <3987005+flga@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:58:03 +0000 Subject: [PATCH] also add a test for non power of 2 N for good measure --- tests/core/runtime/test_core_runtime.odin | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/core/runtime/test_core_runtime.odin b/tests/core/runtime/test_core_runtime.odin index d2ced2504..c1a3ed718 100644 --- a/tests/core/runtime/test_core_runtime.odin +++ b/tests/core/runtime/test_core_runtime.odin @@ -109,6 +109,37 @@ test_map_get :: proc(t: ^testing.T) { check(t, m) } + + // small keys; 3 values per cell + { + val :: struct #packed { + a, b: int, + c: i32, + } + m := map[int]val{ + 1 = val{10, 100, 1000}, + 2 = val{20, 200, 2000}, + 3 = val{30, 300, 3000}, + } + defer delete(m) + check(t, m) + } + + // 3 keys per cell; small values + { + key :: struct #packed { + a, b: int, + c: i32, + } + m := map[key]int{ + key{10, 100, 1000} = 1, + key{20, 200, 2000} = 2, + key{30, 300, 3000} = 3, + } + defer delete(m) + check(t, m) + } + // small keys; value bigger than a chacheline { m := map[int][9]int{