(t *testing.T)
| 530 | } |
| 531 | |
| 532 | func TestCacheCapacity(t *testing.T) { |
| 533 | t.Parallel() |
| 534 | |
| 535 | // given |
| 536 | cache, _ := New(context.Background(), Config{ |
| 537 | Shards: 8, |
| 538 | LifeWindow: time.Second, |
| 539 | MaxEntriesInWindow: 1, |
| 540 | MaxEntrySize: 256, |
| 541 | }) |
| 542 | keys := 1337 |
| 543 | |
| 544 | // when |
| 545 | for i := 0; i < keys; i++ { |
| 546 | cache.Set(fmt.Sprintf("key%d", i), []byte("value")) |
| 547 | } |
| 548 | |
| 549 | // then |
| 550 | assertEqual(t, keys, cache.Len()) |
| 551 | assertEqual(t, 40960, cache.Capacity()) |
| 552 | } |
| 553 | |
| 554 | func TestCacheInitialCapacity(t *testing.T) { |
| 555 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…