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

Function TestNode_split_SinglePage

node_test.go:153–169  ·  view source on GitHub ↗

Ensure that a node that has keys that all fit on a page just returns one leaf.

(t *testing.T)

Source from the content-addressed store, hash-verified

151
152// Ensure that a node that has keys that all fit on a page just returns one leaf.
153func TestNode_split_SinglePage(t *testing.T) {
154 // Create a node.
155 m := &common.Meta{}
156 m.SetPgid(1)
157 n := &node{inodes: make(common.Inodes, 0), bucket: &Bucket{tx: &Tx{db: &DB{}, meta: m}}}
158 n.put([]byte("00000001"), []byte("00000001"), []byte("0123456701234567"), 0, 0)
159 n.put([]byte("00000002"), []byte("00000002"), []byte("0123456701234567"), 0, 0)
160 n.put([]byte("00000003"), []byte("00000003"), []byte("0123456701234567"), 0, 0)
161 n.put([]byte("00000004"), []byte("00000004"), []byte("0123456701234567"), 0, 0)
162 n.put([]byte("00000005"), []byte("00000005"), []byte("0123456701234567"), 0, 0)
163
164 // Split.
165 n.split(4096)
166 if n.parent != nil {
167 t.Fatalf("expected nil parent")
168 }
169}

Callers

nothing calls this directly

Calls 4

SetPgidMethod · 0.95
putMethod · 0.95
splitMethod · 0.95
FatalfMethod · 0.65

Tested by

no test coverage detected