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