MCPcopy
hub / github.com/RainbowMango/GoExpertProgramming / sub3

Function sub3

source/gotest/subunit_test.go:34–43  ·  view source on GitHub ↗

sub3 为子测试,只做加法测试

(t *testing.T)

Source from the content-addressed store, hash-verified

32
33// sub3 为子测试,只做加法测试
34func sub3(t *testing.T) {
35 var a = 1
36 var b = 2
37 var expected = 3
38
39 actual := gotest.Add(a, b)
40 if actual != expected {
41 t.Errorf("Add(%d, %d) = %d; expected: %d", a, b, actual, expected)
42 }
43}
44
45// TestSub 内部调用sub1、sub2和sub3三个子测试
46func TestSub(t *testing.T) {

Callers

nothing calls this directly

Calls 1

AddFunction · 0.92

Tested by

no test coverage detected