MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestBinaryIterative

Function TestBinaryIterative

search/binary_test.go:20–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18}
19
20func TestBinaryIterative(t *testing.T) {
21 for _, test := range searchTests {
22 actualValue, actualError := BinaryIterative(test.data, test.key)
23 if actualValue != test.expected {
24 t.Errorf("test '%s' failed: input array '%v' with key '%d', expected '%d', get '%d'", test.name, test.data, test.key, test.expected, actualValue)
25 }
26 if !errors.Is(test.expectedError, actualError) {
27 t.Errorf("test '%s' failed: input array '%v' with key '%d', expected error '%s', get error '%s'", test.name, test.data, test.key, test.expectedError, actualError)
28 }
29 }
30}
31
32func TestLowerBound(t *testing.T) {
33 for _, test := range lowerBoundTests {

Callers

nothing calls this directly

Calls 1

BinaryIterativeFunction · 0.85

Tested by

no test coverage detected