@@ -33,24 +33,24 @@ type reverseBitsTest struct {
3333}
3434
3535var deflateTests = []* deflateTest {
36- {[]byte {}, 0 , []byte {0x3 , 0x0 }},
37- {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
38- {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
39- {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
40-
41- {[]byte {0x11 }, 0 , []byte {0x0 , 0x1 , 0x0 , 0xfe , 0xff , 0x11 , 0x3 , 0x0 }},
42- {[]byte {0x11 , 0x12 }, 0 , []byte {0x0 , 0x2 , 0x0 , 0xfd , 0xff , 0x11 , 0x12 , 0x3 , 0x0 }},
43- {[]byte {0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 }, 0 ,
36+ 0 : {[]byte {}, 0 , []byte {0x3 , 0x0 }},
37+ 1 : {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
38+ 2 : {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
39+ 3 : {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
40+
41+ 4 : {[]byte {0x11 }, 0 , []byte {0x0 , 0x1 , 0x0 , 0xfe , 0xff , 0x11 , 0x3 , 0x0 }},
42+ 5 : {[]byte {0x11 , 0x12 }, 0 , []byte {0x0 , 0x2 , 0x0 , 0xfd , 0xff , 0x11 , 0x12 , 0x3 , 0x0 }},
43+ 6 : {[]byte {0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 }, 0 ,
4444 []byte {0x0 , 0x8 , 0x0 , 0xf7 , 0xff , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x3 , 0x0 },
4545 },
46- {[]byte {}, 1 , []byte {0x3 , 0x0 }},
47- {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
48- {[]byte {0x11 , 0x12 }, BestCompression , []byte {0x12 , 0x14 , 0x2 , 0xc , 0x0 }},
49- {[]byte {0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 }, BestCompression , []byte {0x12 , 0x84 , 0x2 , 0xc0 , 0x0 }},
50- {[]byte {}, 9 , []byte {0x3 , 0x0 }},
51- {[]byte {0x11 }, 9 , []byte {0x12 , 0x4 , 0xc , 0x0 }},
52- {[]byte {0x11 , 0x12 }, 9 , []byte {0x12 , 0x14 , 0x2 , 0xc , 0x0 }},
53- {[]byte {0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 }, 9 , []byte {0x12 , 0x84 , 0x2 , 0xc0 , 0x0 }},
46+ 7 : {[]byte {}, 1 , []byte {0x3 , 0x0 }},
47+ 8 : {[]byte {0x11 }, BestCompression , []byte {0x12 , 0x4 , 0xc , 0x0 }},
48+ 9 : {[]byte {0x11 , 0x12 }, BestCompression , []byte {0x12 , 0x14 , 0x2 , 0xc , 0x0 }},
49+ 10 : {[]byte {0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 }, BestCompression , []byte {0x12 , 0x84 , 0x1 , 0xc0 , 0x0 }},
50+ 11 : {[]byte {}, 9 , []byte {0x3 , 0x0 }},
51+ 12 : {[]byte {0x11 }, 9 , []byte {0x12 , 0x4 , 0xc , 0x0 }},
52+ 13 : {[]byte {0x11 , 0x12 }, 9 , []byte {0x12 , 0x14 , 0x2 , 0xc , 0x0 }},
53+ 14 : {[]byte {0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 , 0x11 }, 9 , []byte {0x12 , 0x84 , 0x1 , 0xc0 , 0x0 }},
5454}
5555
5656var deflateInflateTests = []* deflateInflateTest {
@@ -120,7 +120,7 @@ func TestDeflate(t *testing.T) {
120120 w .Write (h .in )
121121 w .Close ()
122122 if ! bytes .Equal (buf .Bytes (), h .out ) {
123- t .Errorf ("%d: Deflate(%d, %x) = \n %#v, want \n %#v" , i , h .level , h .in , buf .Bytes (), h .out )
123+ t .Errorf ("%d: Deflate(%d, %x) got \n %#v, want \n %#v" , i , h .level , h .in , buf .Bytes (), h .out )
124124 }
125125 }
126126}
@@ -331,6 +331,8 @@ func testToFromWithLevelAndLimit(t *testing.T, level int, input []byte, name str
331331 }
332332 r .Close ()
333333 if ! bytes .Equal (input , out ) {
334+ os .WriteFile ("testdata/fails/" + t .Name ()+ ".got" , out , os .ModePerm )
335+ os .WriteFile ("testdata/fails/" + t .Name ()+ ".want" , input , os .ModePerm )
334336 t .Errorf ("decompress(compress(data)) != data: level=%d input=%s" , level , name )
335337 return
336338 }
0 commit comments