Ensure that a node that has keys that all fit on a page just returns one leaf.
(t *testing.T)
| 151 | |
| 152 | // Ensure that a node that has keys that all fit on a page just returns one leaf. |
| 153 | func 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 | } |