diff options
Diffstat (limited to 'internal/compress/flate/dict_decoder_test.go')
| -rw-r--r-- | internal/compress/flate/dict_decoder_test.go | 193 |
1 files changed, 169 insertions, 24 deletions
diff --git a/internal/compress/flate/dict_decoder_test.go b/internal/compress/flate/dict_decoder_test.go index 9275cff7..8bc48a3e 100644 --- a/internal/compress/flate/dict_decoder_test.go +++ b/internal/compress/flate/dict_decoder_test.go @@ -41,38 +41,183 @@ func TestDictDecoder(t *testing.T) { "And that has made all the difference.\n" ) - var poemRefs = []struct { + poemRefs := []struct { dist int // Backward distance (0 if this is an insertion) length int // Length of copy or insertion }{ - {0, 38}, {33, 3}, {0, 48}, {79, 3}, {0, 11}, {34, 5}, {0, 6}, {23, 7}, - {0, 8}, {50, 3}, {0, 2}, {69, 3}, {34, 5}, {0, 4}, {97, 3}, {0, 4}, - {43, 5}, {0, 6}, {7, 4}, {88, 7}, {0, 12}, {80, 3}, {0, 2}, {141, 4}, - {0, 1}, {196, 3}, {0, 3}, {157, 3}, {0, 6}, {181, 3}, {0, 2}, {23, 3}, - {77, 3}, {28, 5}, {128, 3}, {110, 4}, {70, 3}, {0, 4}, {85, 6}, {0, 2}, - {182, 6}, {0, 4}, {133, 3}, {0, 7}, {47, 5}, {0, 20}, {112, 5}, {0, 1}, - {58, 3}, {0, 8}, {59, 3}, {0, 4}, {173, 3}, {0, 5}, {114, 3}, {0, 4}, - {92, 5}, {0, 2}, {71, 3}, {0, 2}, {76, 5}, {0, 1}, {46, 3}, {96, 4}, - {130, 4}, {0, 3}, {360, 3}, {0, 3}, {178, 5}, {0, 7}, {75, 3}, {0, 3}, - {45, 6}, {0, 6}, {299, 6}, {180, 3}, {70, 6}, {0, 1}, {48, 3}, {66, 4}, - {0, 3}, {47, 5}, {0, 9}, {325, 3}, {0, 1}, {359, 3}, {318, 3}, {0, 2}, - {199, 3}, {0, 1}, {344, 3}, {0, 3}, {248, 3}, {0, 10}, {310, 3}, {0, 3}, - {93, 6}, {0, 3}, {252, 3}, {157, 4}, {0, 2}, {273, 5}, {0, 14}, {99, 4}, - {0, 1}, {464, 4}, {0, 2}, {92, 4}, {495, 3}, {0, 1}, {322, 4}, {16, 4}, - {0, 3}, {402, 3}, {0, 2}, {237, 4}, {0, 2}, {432, 4}, {0, 1}, {483, 5}, - {0, 2}, {294, 4}, {0, 2}, {306, 3}, {113, 5}, {0, 1}, {26, 4}, {164, 3}, - {488, 4}, {0, 1}, {542, 3}, {248, 6}, {0, 5}, {205, 3}, {0, 8}, {48, 3}, - {449, 6}, {0, 2}, {192, 3}, {328, 4}, {9, 5}, {433, 3}, {0, 3}, {622, 25}, - {615, 5}, {46, 5}, {0, 2}, {104, 3}, {475, 10}, {549, 3}, {0, 4}, {597, 8}, - {314, 3}, {0, 1}, {473, 6}, {317, 5}, {0, 1}, {400, 3}, {0, 3}, {109, 3}, - {151, 3}, {48, 4}, {0, 4}, {125, 3}, {108, 3}, {0, 2}, + {0, 38}, + {33, 3}, + {0, 48}, + {79, 3}, + {0, 11}, + {34, 5}, + {0, 6}, + {23, 7}, + {0, 8}, + {50, 3}, + {0, 2}, + {69, 3}, + {34, 5}, + {0, 4}, + {97, 3}, + {0, 4}, + {43, 5}, + {0, 6}, + {7, 4}, + {88, 7}, + {0, 12}, + {80, 3}, + {0, 2}, + {141, 4}, + {0, 1}, + {196, 3}, + {0, 3}, + {157, 3}, + {0, 6}, + {181, 3}, + {0, 2}, + {23, 3}, + {77, 3}, + {28, 5}, + {128, 3}, + {110, 4}, + {70, 3}, + {0, 4}, + {85, 6}, + {0, 2}, + {182, 6}, + {0, 4}, + {133, 3}, + {0, 7}, + {47, 5}, + {0, 20}, + {112, 5}, + {0, 1}, + {58, 3}, + {0, 8}, + {59, 3}, + {0, 4}, + {173, 3}, + {0, 5}, + {114, 3}, + {0, 4}, + {92, 5}, + {0, 2}, + {71, 3}, + {0, 2}, + {76, 5}, + {0, 1}, + {46, 3}, + {96, 4}, + {130, 4}, + {0, 3}, + {360, 3}, + {0, 3}, + {178, 5}, + {0, 7}, + {75, 3}, + {0, 3}, + {45, 6}, + {0, 6}, + {299, 6}, + {180, 3}, + {70, 6}, + {0, 1}, + {48, 3}, + {66, 4}, + {0, 3}, + {47, 5}, + {0, 9}, + {325, 3}, + {0, 1}, + {359, 3}, + {318, 3}, + {0, 2}, + {199, 3}, + {0, 1}, + {344, 3}, + {0, 3}, + {248, 3}, + {0, 10}, + {310, 3}, + {0, 3}, + {93, 6}, + {0, 3}, + {252, 3}, + {157, 4}, + {0, 2}, + {273, 5}, + {0, 14}, + {99, 4}, + {0, 1}, + {464, 4}, + {0, 2}, + {92, 4}, + {495, 3}, + {0, 1}, + {322, 4}, + {16, 4}, + {0, 3}, + {402, 3}, + {0, 2}, + {237, 4}, + {0, 2}, + {432, 4}, + {0, 1}, + {483, 5}, + {0, 2}, + {294, 4}, + {0, 2}, + {306, 3}, + {113, 5}, + {0, 1}, + {26, 4}, + {164, 3}, + {488, 4}, + {0, 1}, + {542, 3}, + {248, 6}, + {0, 5}, + {205, 3}, + {0, 8}, + {48, 3}, + {449, 6}, + {0, 2}, + {192, 3}, + {328, 4}, + {9, 5}, + {433, 3}, + {0, 3}, + {622, 25}, + {615, 5}, + {46, 5}, + {0, 2}, + {104, 3}, + {475, 10}, + {549, 3}, + {0, 4}, + {597, 8}, + {314, 3}, + {0, 1}, + {473, 6}, + {317, 5}, + {0, 1}, + {400, 3}, + {0, 3}, + {109, 3}, + {151, 3}, + {48, 4}, + {0, 4}, + {125, 3}, + {108, 3}, + {0, 2}, } var got, want bytes.Buffer var dd dictDecoder dd.init(1<<11, nil) - var writeCopy = func(dist, length int) { + writeCopy := func(dist, length int) { for length > 0 { cnt := dd.tryWriteCopy(dist, length) if cnt == 0 { @@ -85,7 +230,7 @@ func TestDictDecoder(t *testing.T) { } } } - var writeString = func(str string) { + writeString := func(str string) { for len(str) > 0 { cnt := copy(dd.writeSlice(), str) str = str[cnt:] |
