Ensure that the page type can be returned in human readable format.
(t *testing.T)
| 9 | |
| 10 | // Ensure that the page type can be returned in human readable format. |
| 11 | func TestPage_typ(t *testing.T) { |
| 12 | if typ := (&Page{flags: BranchPageFlag}).Typ(); typ != "branch" { |
| 13 | t.Fatalf("exp=branch; got=%v", typ) |
| 14 | } |
| 15 | if typ := (&Page{flags: LeafPageFlag}).Typ(); typ != "leaf" { |
| 16 | t.Fatalf("exp=leaf; got=%v", typ) |
| 17 | } |
| 18 | if typ := (&Page{flags: MetaPageFlag}).Typ(); typ != "meta" { |
| 19 | t.Fatalf("exp=meta; got=%v", typ) |
| 20 | } |
| 21 | if typ := (&Page{flags: FreelistPageFlag}).Typ(); typ != "freelist" { |
| 22 | t.Fatalf("exp=freelist; got=%v", typ) |
| 23 | } |
| 24 | if typ := (&Page{flags: 20000}).Typ(); typ != "unknown<4e20>" { |
| 25 | t.Fatalf("exp=unknown<4e20>; got=%v", typ) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // Ensure that the hexdump debugging function doesn't blow up. |
| 30 | func TestPage_dump(t *testing.T) { |