Slide 20
Slide 20 text
従来のテスト (testing.T)
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCalcPoint(t *testing.T) {
for _, tc := range []struct {
name string
text string
oya bool
tsumo bool
res []int
err error
}{
{
name: "タンヤオ",
text: "s222678m333456p8 8",
oya: false,
tsumo: false,
res: []int{1300},
err: nil,
},
} {
t.Run(tc.name, func(t *testing.T) {
res, err := CalcPoint(tc.text, tc.oya, tc.tsumo)
assert.Equal(t, tc.res, res)
assert.Equal(t, tc.err, err)
})
}
}