(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func TestAdd(t *testing.T) { |
| 9 | t.Parallel() |
| 10 | type testCase struct { |
| 11 | a, b float64 |
| 12 | want float64 |
| 13 | } |
| 14 | testCases := []testCase{ |
| 15 | {a: 2, b: 2, want: 4}, |
| 16 | {a: 1, b: 1, want: 2}, |
| 17 | {a: 5, b: 0, want: 5}, |
| 18 | } |
| 19 | for _, tc := range testCases { |
| 20 | got := calculator.Add(tc.a, tc.b) |
| 21 | if tc.want != got { |
| 22 | t.Errorf("Add(%f, %f): want %f, got %f", |
| 23 | tc.a, tc.b, tc.want, got) |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func TestSubtract(t *testing.T) { |
| 29 | t.Parallel() |
nothing calls this directly
no outgoing calls
no test coverage detected