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

Function TestLinear

search/linear_test.go:7–17  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5)
6
7func TestLinear(t *testing.T) {
8 for _, test := range searchTests {
9 actualValue, actualError := Linear(test.data, test.key)
10 if actualValue != test.expected {
11 t.Errorf("test '%s' failed: input array '%v' with key '%d', expected '%d', get '%d'", test.name, test.data, test.key, test.expected, actualValue)
12 }
13 if actualError != test.expectedError {
14 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)
15 }
16 }
17}
18
19func BenchmarkLinear(b *testing.B) {
20 testCase := generateBenchmarkTestCase()

Callers

nothing calls this directly

Calls 1

LinearFunction · 0.85

Tested by

no test coverage detected