sub1 为子测试,只做加法测试
(t *testing.T)
| 8 | |
| 9 | // sub1 为子测试,只做加法测试 |
| 10 | func sub1(t *testing.T) { |
| 11 | var a = 1 |
| 12 | var b = 2 |
| 13 | var expected = 3 |
| 14 | |
| 15 | actual := gotest.Add(a, b) |
| 16 | if actual != expected { |
| 17 | t.Errorf("Add(%d, %d) = %d; expected: %d", a, b, actual, expected) |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | // sub2 为子测试,只做加法测试 |
| 22 | func sub2(t *testing.T) { |