(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestLerp(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | name string |
| 12 | testValues []float64 |
| 13 | answer float64 |
| 14 | }{ |
| 15 | {"Lerp(1,1,1)", []float64{1, 1, 1}, 1}, |
| 16 | {"Lerp(0,1,1)", []float64{0, 1, 1}, 1}, |
| 17 | {"Lerp(0,1,0.5)", []float64{0, 1, 0.5}, 0.5}, |
| 18 | {"Lerp(0,1,0.1)", []float64{0, 1, 0.1}, 0.1}, |
| 19 | } |
| 20 | for _, test := range tests { |
| 21 | t.Run(test.name, func(t *testing.T) { |
| 22 | got := algmath.Lerp(test.testValues[0], test.testValues[1], test.testValues[2]) |
| 23 | if got != test.answer { |
| 24 | t.Errorf("Lerp(%f,%f,%f) = %v, want %v", got, test.testValues[0], |
| 25 | test.testValues[1], test.testValues[2], test.answer) |
| 26 | } |
| 27 | }) |
| 28 | } |
| 29 | } |
nothing calls this directly
no outgoing calls
no test coverage detected