shad-go/lectures/04-testing/size/size_test.go

22 lines
326 B
Go

package size
import "testing"
func TestSize(t *testing.T) {
type Test struct {
in int
out string
}
var tests = []Test{
{-1, "negative"},
{5, "small"},
}
for i, test := range tests {
size := Size(test.in)
if size != test.out {
t.Errorf("#%d: Size(%d)=%s; want %s", i, test.in, size, test.out)
}
}
}