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

Function TestInterpolation

search/interpolation_test.go:5–15  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

InterpolationFunction · 0.85

Tested by

no test coverage detected