awesome-patterns/playground/codecoverage/size_test.go
Bruce b97231eecb
Practice code coverage
Signed-off-by: Bruce <weichou1229@gmail.com>
2019-02-20 14:52:34 +08:00

27 lines
392 B
Go

package codecoverage
import "testing"
type Test struct {
in int
out string
}
var tests = []Test{
{-1, "negative"},
{0, "zero"},
{5, "small"},
{99, "big"},
{100, "huge"},
{10001, "enormous"},
}
func TestSize(t *testing.T) {
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)
}
}
}