Commit b9a470e7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ea457e4a
......@@ -289,6 +289,13 @@ class XLOTree(LOBTree):
max_internal_size = 2
def crack_btree(ztree):
return bcheck.crack_btree(ztree, is_mapping=True)
def crack_bucket(zbucket):
return bcheck.crack_bucket(zbucket, is_mapping=True)
def test_restructure():
#T = xbtree.Tree
#B = xbtree.Bucket
......@@ -323,22 +330,22 @@ def test_restructure():
# Z0 creates new empty tree
def Z0():
z = Z()
assert bcheck.crack_btree() == (BTREE_EMPTY, [], [])
assert crack_btree(z) == (BTREE_EMPTY, [], [])
return z
# ø -> T/B
z = Z0()
R(z, 'T/B')
assert bcheck.crack_btree(z) == (BTREE_NORMAL, [], LOBucket()) # XXX -> BTREE_ONE
assert crack_btree(z) == (BTREE_NORMAL, [], LOBucket()) # XXX -> BTREE_ONE
# ø -> T/T/B
z = Z0()
R(z, 'T/T/B')
kind, keys, kids = bcheck.crack_btree(z)
kind, keys, kids = crack_btree(z)
assert kind, keys == (BTREE_NORMAL, [])
assert len(kids) == 0
assert isinstance(kids[0], XLOTree)
kind, keys, kids = bcheck.crack_btree(kids[0])
kind, keys, kids = crack_btree(kids[0])
assert kind, keys == (BTREE_NORMAL, []) # XXX or should it be BTREE_ONE here?
# XXX no: we need to wire bucket->next properly
assert len(kids) == 0
......@@ -352,7 +359,7 @@ def test_restructure():
# tree with one not-yet committed bucket
z = Z(1, 3)
assert bcheck.crack_btree() == (BTREE_ONE, (1, X[1], 3, X[3]), None)
assert crack_btree(z) == (BTREE_ONE, (1, X[1], 3, X[3]), None)
# XXX tree with one committed bucket
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment