golang.org/toolchain@v0.0.1-go1.9rc2.windows-amd64/blog/content/cover/pkg_test.go (about) 1 package size 2 3 import "testing" 4 5 type Test struct { 6 in int 7 out string 8 } 9 10 var tests = []Test{ 11 {-1, "negative"}, 12 {5, "small"}, 13 } 14 15 func TestSize(t *testing.T) { 16 for i, test := range tests { 17 size := Size(test.in) 18 if size != test.out { 19 t.Errorf("#%d: Size(%d)=%s; want %s", i, test.in, size, test.out) 20 } 21 } 22 }