(t *testing.T)
| 253 | } |
| 254 | |
| 255 | func TestFreeList_reload(t *testing.T) { |
| 256 | buf := make([]byte, 4096) |
| 257 | f := newTestFreelist() |
| 258 | f.Init(common.Pgids{5, 6, 8}) |
| 259 | |
| 260 | p := common.LoadPage(buf) |
| 261 | f.Write(p) |
| 262 | |
| 263 | f2 := newTestFreelist() |
| 264 | f2.Read(p) |
| 265 | require.Equal(t, common.Pgids{5, 6, 8}, f2.freePageIds()) |
| 266 | |
| 267 | f2.Free(common.Txid(5), common.NewPage(10, common.LeafPageFlag, 0, 2)) |
| 268 | |
| 269 | // reload shouldn't affect the pending list |
| 270 | f2.Reload(p) |
| 271 | |
| 272 | require.Equal(t, common.Pgids{5, 6, 8}, f2.freePageIds()) |
| 273 | require.Equal(t, []common.Pgid{10, 11, 12}, f2.pendingPageIds()[5].ids) |
| 274 | } |
| 275 | |
| 276 | // Ensure that the txIDx swap, less and len are properly implemented |
| 277 | func TestTxidSorting(t *testing.T) { |
nothing calls this directly
no test coverage detected