fix(package): [algorithm] handle empty iterative searches (#399)

This commit is contained in:
Yusuf Efe authored and GitHub committed 2026-10-22 10:28:04 +08:00
1 parent 13b7b1c61e
commit e49a01e725
2 files changed
+14

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
package algorithm
import "testing"
func TestBinaryIterativeSearchEmpty(t *testing.T) {
for _, source := range [][]int{nil, {}} {
if got := BinaryIterativeSearch(source, 1, 0, 0, &intComparator{}); got != -1 {
t.Errorf("got %d, want -1", got)
}
}
}