(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestFreelistHashmap_allocate(t *testing.T) { |
| 24 | f := NewHashMapFreelist() |
| 25 | |
| 26 | ids := []common.Pgid{3, 4, 5, 6, 7, 9, 12, 13, 18} |
| 27 | f.Init(ids) |
| 28 | |
| 29 | f.Allocate(1, 3) |
| 30 | if x := f.FreeCount(); x != 6 { |
| 31 | t.Fatalf("exp=6; got=%v", x) |
| 32 | } |
| 33 | |
| 34 | f.Allocate(1, 2) |
| 35 | if x := f.FreeCount(); x != 4 { |
| 36 | t.Fatalf("exp=4; got=%v", x) |
| 37 | } |
| 38 | f.Allocate(1, 1) |
| 39 | if x := f.FreeCount(); x != 3 { |
| 40 | t.Fatalf("exp=3; got=%v", x) |
| 41 | } |
| 42 | |
| 43 | f.Allocate(1, 0) |
| 44 | if x := f.FreeCount(); x != 3 { |
| 45 | t.Fatalf("exp=3; got=%v", x) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestFreelistHashmap_mergeWithExist(t *testing.T) { |
| 50 | bm1 := pidSet{1: struct{}{}} |
nothing calls this directly
no test coverage detected