1 package imagefn 2 3 import ( 4 "image" 5 "testing" 6 ) 7 8 func TestInvert(t *testing.T) { 9 for n, test := range [...]struct { 10 In, Out *image.Gray 11 }{ 12 { 13 newGray(3, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8), 14 newGray(3, 3, 255, 254, 253, 252, 251, 250, 249, 248, 247), 15 }, 16 } { 17 if !testImage(Invert(test.In), test.Out) { 18 t.Errorf("test %d: images do not match", n+1) 19 } 20 } 21 }