diff options
| author | Hector <rope.hmg@proton.me> | 2023-11-25 16:26:29 +0000 |
|---|---|---|
| committer | Hector <rope.hmg@proton.me> | 2023-11-25 16:26:29 +0000 |
| commit | 82088e4a75f4c9449fee4341e34df1e8f43c42dd (patch) | |
| tree | 5940109316c599ccaea42942b5c7b539adedad75 /tests | |
| parent | b12bfe407d5dfcfbcf623e70abb2b98316afe68a (diff) | |
Used `strings.builder_reset` instead of `clear` for the string builder
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/core/slice/test_core_slice.odin | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/core/slice/test_core_slice.odin b/tests/core/slice/test_core_slice.odin index 81ea65226..06329ddda 100644 --- a/tests/core/slice/test_core_slice.odin +++ b/tests/core/slice/test_core_slice.odin @@ -185,20 +185,22 @@ test_sort_by_indices :: proc(t: ^testing.T) { @test test_binary_search :: proc(t: ^testing.T) { - index: int - found: bool builder := strings.Builder{} + defer strings.builder_destroy(&builder) test_search :: proc(t: ^testing.T, b: ^strings.Builder, s: []i32, v: i32) -> (int, bool) { log(t, fmt.sbprintf(b, "Searching for %v in %v", v, s)) - clear(&b.buf) + strings.builder_reset(b) index, found := slice.binary_search(s, v) log(t, fmt.sbprintf(b, "index: %v, found: %v", index, found)) - clear(&b.buf) + strings.builder_reset(b ) return index, found } + index: int + found: bool + s := []i32{0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55} index, found = test_search(t, &builder, s, 13) |