(t *testing.T)
| 431 | } |
| 432 | |
| 433 | func TestCompress4XReuseActually(t *testing.T) { |
| 434 | rng := rand.NewSource(0x1337) |
| 435 | var s Scratch |
| 436 | s.Reuse = ReusePolicyAllow |
| 437 | for i := range 255 { |
| 438 | if testing.Short() && i > 10 { |
| 439 | break |
| 440 | } |
| 441 | t.Run(fmt.Sprint("test-", i), func(t *testing.T) { |
| 442 | buf0 := make([]byte, BlockSizeMax) |
| 443 | for j := range buf0 { |
| 444 | buf0[j] = byte(rng.Int63() & 7) |
| 445 | } |
| 446 | |
| 447 | tbSz, dSz, reSz, _ := EstimateSizes(buf0, &s) |
| 448 | b, re, err := Compress4X(buf0, &s) |
| 449 | if err != nil { |
| 450 | t.Fatal(err) |
| 451 | } |
| 452 | if b == nil { |
| 453 | t.Error("got no output") |
| 454 | return |
| 455 | } |
| 456 | if len(s.OutData) == 0 { |
| 457 | t.Error("got no data output") |
| 458 | } |
| 459 | if re && i == 0 { |
| 460 | t.Error("Claimed to have re-used on first loop.") |
| 461 | } |
| 462 | if !re && i > 0 { |
| 463 | t.Error("Expected table to be reused") |
| 464 | } |
| 465 | t.Logf("Estimate: table %d, got %d, data %d, got %d, reuse: %d", tbSz, len(s.OutTable), dSz, len(s.OutData), reSz) |
| 466 | t.Logf("%s: %d -> %d bytes (%.2f:1) %t (table: %d bytes)", t.Name(), len(buf0), len(b), float64(len(buf0))/float64(len(b)), re, len(s.OutTable)) |
| 467 | }) |
| 468 | } |
| 469 | } |
| 470 | func TestCompress1XReuse(t *testing.T) { |
| 471 | for _, test := range testfiles { |
| 472 | t.Run(test.name, func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…