ディレクトリ構成

cal/calc.go

cal/calc_test.go

calc.go

```
package calc
func sum(a, b int) int {
return a + b
}
func minus(a, b int) int {
return a - b
}
```

calc_test.go

```
package calc
import "testing"
func TestSum(t *testing.T) {
if sum(1, 2) != 3 {
t.Fatal("sum(1,2) should be 3, but doesn't match")
}
if sum(4, 9) != 12 {
t.Fatal("sum(4,9) should be 13, but doesn't match")
}
}
func TestMinus(t *testing.T) {
}
```

テストの実行

```
go test -v ./calc
```

```
=== RUN TestSum
--- FAIL: TestSum (0.00s)
calc_test.go:11: sum(4,9) should be 13, but doesn't match
=== RUN TestMinus
--- PASS: TestMinus (0.00s)
FAIL
FAIL _/Users/bob/calc 0.010s
```

テストのカバレッジを確認

```
go test -cover ./calc
```

```
--- FAIL: TestSum (0.00s)
calc_test.go:11: sum(4,9) should be 13, but doesn't match
FAIL
coverage: 50.0% of statements
FAIL _/Users/bob/calc 0.011s
```