mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2024-11-25 22:36:05 +03:00
b97231eecb
Signed-off-by: Bruce <weichou1229@gmail.com>
27 lines
392 B
Go
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)
|
|
}
|
|
}
|
|
}
|