awesome-patterns/playground/codecoverage/size_test.go

27 lines
392 B
Go
Raw Permalink Normal View History

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)
}
}
}