sub2 为子测试,只做加法测试
(t *testing.T)
| 20 | |
| 21 | // sub2 为子测试,只做加法测试 |
| 22 | func sub2(t *testing.T) { |
| 23 | var a = 1 |
| 24 | var b = 2 |
| 25 | var expected = 3 |
| 26 | |
| 27 | actual := gotest.Add(a, b) |
| 28 | if actual != expected { |
| 29 | t.Errorf("Add(%d, %d) = %d; expected: %d", a, b, actual, expected) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // sub3 为子测试,只做加法测试 |
| 34 | func sub3(t *testing.T) { |