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

Function TestPage_typ

internal/common/page_test.go:11–27  ·  view source on GitHub ↗

Ensure that the page type can be returned in human readable format.

(t *testing.T)

Source from the content-addressed store, hash-verified

9
10// Ensure that the page type can be returned in human readable format.
11func 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.
30func TestPage_dump(t *testing.T) {

Callers

nothing calls this directly

Calls 2

TypMethod · 0.80
FatalfMethod · 0.65

Tested by

no test coverage detected