MCPcopy
hub / github.com/etcd-io/bbolt / TestFreeList_init

Function TestFreeList_init

internal/freelist/freelist_test.go:237–253  ·  internal/freelist/freelist_test.go::TestFreeList_init
(t *testing.T)

Source from the content-addressed store, hash-verified

235}
236
237func TestFreeList_init(t *testing.T) {
238 buf := make([]byte, 4096)
239 f := newTestFreelist()
240 f.Init(common.Pgids{5, 6, 8})
241
242 p := common.LoadPage(buf)
243 f.Write(p)
244
245 f2 := newTestFreelist()
246 f2.Read(p)
247 require.Equal(t, common.Pgids{5, 6, 8}, f2.freePageIds())
248
249 // When initializing the freelist with an empty list of page ID,
250 // it should reset the freelist page IDs.
251 f2.Init([]common.Pgid{})
252 require.Equal(t, common.Pgids{}, f2.freePageIds())
253}
254
255func TestFreeList_reload(t *testing.T) {
256 buf := make([]byte, 4096)

Callers

nothing calls this directly

Calls 6

LoadPageFunction · 0.92
newTestFreelistFunction · 0.85
InitMethod · 0.65
WriteMethod · 0.65
ReadMethod · 0.65
freePageIdsMethod · 0.65

Tested by

no test coverage detected