MCPcopy Create free account
hub / github.com/AdRoll/baker / Test_NewCache

Function Test_NewCache

pkg/buffercache/cache_test.go:10–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func Test_NewCache(t *testing.T) {
11 cfg := Config{
12 MaxBufferLength: 128,
13 MaxCapacity: 256,
14 CellsPerBucket: 64,
15 OnFlush: func([]byte) {},
16 }
17
18 c, _ := New(cfg)
19 if len(c.m.m) != 0 {
20 t.Errorf("Wrong hm: %v", c.m.m)
21 }
22 if c.cold == nil {
23 t.Errorf("Wrong cold cache initialization")
24 }
25 if c.hot.maxbuflen != cfg.MaxBufferLength {
26 t.Errorf("got c.maxBufferLength = %d, want: %d", c.hot.maxbuflen, cfg.MaxBufferLength)
27 }
28 if c.hot.maxcap != cfg.MaxCapacity {
29 t.Errorf("got c.maxCapacity = %d, want: %d", c.hot.maxcap, cfg.MaxCapacity)
30 }
31}
32
33func Test_isInColdCache(t *testing.T) {
34 tests := []struct {

Callers

nothing calls this directly

Calls 1

NewFunction · 0.70

Tested by

no test coverage detected