Skip to content

Commit b0a038f

Browse files
committed
add benchmark
1 parent 397d331 commit b0a038f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

jpeg/jpeg_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ func BenchmarkDecode(b *testing.B) {
6363
}
6464
}
6565

66+
func BenchmarkDecodeCMYK(b *testing.B) {
67+
raw, err := ioutil.ReadFile("./../test/images/testdata/video-001.cmyk.jpeg")
68+
if err != nil {
69+
b.Error("cannot find cmyk image")
70+
}
71+
72+
for i := 0; i < b.N; i++ {
73+
img, err := jpeg.Decode(bytes.NewReader(raw), &jpeg.DecoderOptions{})
74+
if err != nil {
75+
b.Errorf("Got Error: %v", err)
76+
} else if img == nil {
77+
b.Error("got a nil")
78+
}
79+
}
80+
}
81+
6682
func BenchmarkDecodeIntoRGB(b *testing.B) {
6783
for i := 0; i < b.N; i++ {
6884
for _, file := range naturalImageFiles {

0 commit comments

Comments
 (0)