(t *testing.T)
| 2268 | } |
| 2269 | |
| 2270 | func TestDecoderDictDelete(t *testing.T) { |
| 2271 | dictContent := []byte("test dictionary content for decompression testing purposes") |
| 2272 | |
| 2273 | dec, err := NewReader(nil, WithDecoderDictRaw(100, dictContent), WithDecoderDictRaw(200, dictContent)) |
| 2274 | if err != nil { |
| 2275 | t.Fatal(err) |
| 2276 | } |
| 2277 | defer dec.Close() |
| 2278 | |
| 2279 | if len(dec.o.dicts) != 2 { |
| 2280 | t.Fatalf("expected 2 dicts, got %d", len(dec.o.dicts)) |
| 2281 | } |
| 2282 | |
| 2283 | // Delete specific dict |
| 2284 | err = dec.ResetWithOptions(nil, WithDecoderDictDelete(100)) |
| 2285 | if err != nil { |
| 2286 | t.Fatal(err) |
| 2287 | } |
| 2288 | if len(dec.o.dicts) != 1 { |
| 2289 | t.Errorf("expected 1 dict after delete, got %d", len(dec.o.dicts)) |
| 2290 | } |
| 2291 | if _, ok := dec.o.dicts[200]; !ok { |
| 2292 | t.Error("dict 200 should still exist") |
| 2293 | } |
| 2294 | |
| 2295 | // Add another dict |
| 2296 | err = dec.ResetWithOptions(nil, WithDecoderDictRaw(300, dictContent)) |
| 2297 | if err != nil { |
| 2298 | t.Fatal(err) |
| 2299 | } |
| 2300 | if len(dec.o.dicts) != 2 { |
| 2301 | t.Errorf("expected 2 dicts after add, got %d", len(dec.o.dicts)) |
| 2302 | } |
| 2303 | |
| 2304 | // Delete all dicts with no arguments |
| 2305 | err = dec.ResetWithOptions(nil, WithDecoderDictDelete()) |
| 2306 | if err != nil { |
| 2307 | t.Fatal(err) |
| 2308 | } |
| 2309 | if len(dec.o.dicts) != 0 { |
| 2310 | t.Errorf("expected 0 dicts after delete all, got %d", len(dec.o.dicts)) |
| 2311 | } |
| 2312 | } |
| 2313 | |
| 2314 | func TestDecoderDictDeleteMultiple(t *testing.T) { |
| 2315 | dictContent := []byte("test dictionary content") |
nothing calls this directly
no test coverage detected
searching dependent graphs…