Commit 6f2440d5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1539fe57
...@@ -141,11 +141,9 @@ def topoEncode(treeStruct): ...@@ -141,11 +141,9 @@ def topoEncode(treeStruct):
1/0 1/0
# AllStructs generates all possible BTree structures for BTrees with specified # AllStructs generates subset of all possible BTree structures for BTrees with
# keys and btree depth up-to maxdepth. Eatch tree node is split by up-to # specified keys and btree depth up-to maxdepth. Eatch tree node is split by
# maxsplit points. # up-to maxsplit points.
#
# XXX skipped cases
def AllStructs(keys, maxdepth, maxsplit): # -> i[] of Tree def AllStructs(keys, maxdepth, maxsplit): # -> i[] of Tree
assert isinstance(maxdepth, int); assert maxdepth >= 0 assert isinstance(maxdepth, int); assert maxdepth >= 0
assert isinstance(maxsplit, int); assert maxsplit >= 0 assert isinstance(maxsplit, int); assert maxsplit >= 0
......
...@@ -114,7 +114,6 @@ def test_AllStructs(): ...@@ -114,7 +114,6 @@ def test_AllStructs():
T([], B(1,3))) T([], B(1,3)))
] ]
print('\n\nAAA\n\n')
assert X([1,3], 1, 1) == [ assert X([1,3], 1, 1) == [
# T/ # T/
T([], B(1,3)), # nsplit=0 T([], B(1,3)), # nsplit=0
...@@ -197,19 +196,16 @@ def test_AllStructs(): ...@@ -197,19 +196,16 @@ def test_AllStructs():
T([2], T([2],
T([0], B(), B(1)), T([0], B(), B(1)),
T([4], B(3), B())), T([4], B(3), B())),
T([2], # nsplit=1,(1,0)
T([2], # nsplit=1,(1,0) XXX merge ^^^
T([1], B(), B(1)), T([1], B(), B(1)),
T([], B(3))), T([], B(3))),
T([2], # nsplit=1,(1,1)
T([2], # nsplit=1,(1,1) XXX merge ^^^
T([1], B(), B(1)), T([1], B(), B(1)),
T([3], B(), B(3))), T([3], B(), B(3))),
T([2], T([2],
T([1], B(), B(1)), T([1], B(), B(1)),
T([4], B(3), B())), T([4], B(3), B())),
# T3/ # T3/
T([3], B(1), B(3)), # nsplit=1 T([3], B(1), B(3)), # nsplit=1
T([3], # nsplit=1,(0,0) T([3], # nsplit=1,(0,0)
...@@ -224,18 +220,16 @@ def test_AllStructs(): ...@@ -224,18 +220,16 @@ def test_AllStructs():
T([3], # nsplit=1,(1,1) T([3], # nsplit=1,(1,1)
T([0], B(), B(1)), T([0], B(), B(1)),
T([4], B(3), B())), T([4], B(3), B())),
T([3], # nsplit=1,(1,0)
T([3], # XXX vvv merge ^^^ ?
T([1], B(), B(1)), T([1], B(), B(1)),
T([], B(3))), T([], B(3))),
T([3], # nsplit=1,(1,1)
T([3],
T([1], B(), B(1)), T([1], B(), B(1)),
T([4], B(3), B())), T([4], B(3), B())),
T([3], T([3], # nsplit=1,(1,0)
T([2], B(1), B()), T([2], B(1), B()),
T([], B(3))), T([], B(3))),
T([3], T([3], # nsplit=1,(1,1)
T([2], B(1), B()), T([2], B(1), B()),
T([4], B(3), B())), T([4], B(3), B())),
...@@ -259,149 +253,10 @@ def test_AllStructs(): ...@@ -259,149 +253,10 @@ def test_AllStructs():
T([], B())), T([], B())),
# nsplit=1,(1,1) -> ø # nsplit=1,(1,1) -> ø
] ]
return
print('\n\nBBB\n\n')
assert X([1,3], 1, 1) == [
# nsplit=0, depth=0
T([], B(1,3)),
# nsplit=0,0, depth=1
T([],
T([], B(1,3))),
# nsplit=0,1, depth=1
T([],
T([0], B(), B(1,3))),
T([],
T([1], B(), B(1,3))),
T([],
T([2], B(1), B(3))),
T([],
T([3], B(1), B(3))),
T([],
T([4], B(1,3), B())),
# nsplit=1, depth=0
T([0], B(), B(1,3)),
T([1], B(), B(1,3)),
T([2], B(1), B(3)),
T([3], B(1), B(3)),
T([4], B(1,3), B()),
# nsplit=1,0 depth=1
T([0],
T([], B()),
T([], B(1,3))),
T([1],
T([], B()),
T([], B(1,3))),
T([2],
T([], B(1)),
T([], B(3))),
T([3],
T([], B(1)),
T([], B(3))),
T([4],
T([], B(1,3)),
T([], B())),
# nsplit=1,(0|1,0|1) depth=1
T([0], # T0/
T([], B()),
T([1], B(), B(1,3))),
T([0],
T([], B()),
T([2], B(1), B(3))),
T([0],
T([], B()),
T([3], B(1), B(3))),
T([0],
T([], B()),
T([4], B(1,3), B())),
T([1], # T1/
T([], B()), # nsplit=1,(0,1)
T([2], B(1), B(3))),
T([1],
T([], B()),
T([3], B(1), B(3))),
T([1],
T([], B()),
T([4], B(1,3), B())),
T([1], # nsplit=1,(1,0)
T([0], B(), B()),
T([], B(1,3))),
T([1], # nsplit=1,(1,1)
T([0], B(), B()),
T([2], B(1), B(3))),
T([1],
T([0], B(), B()),
T([3], B(1), B(3))),
T([1],
T([0], B(), B()),
T([4], B(1,3), B())),
T([2], # T2/
T([], B(1)), # nsplit=1,(0,1)
T([3], B(), B(3))),
T([2],
T([], B(1)),
T([4], B(3), B())),
T([2], # nsplit=1,(1,0)
T([0], B(), B(1)),
T([], B(3))),
T([2],
T([1], B(), B(1)),
T([], B(3))),
T([2], # nsplit=1,(1,1)
T([0], B(), B(1)),
T([3], B(), B(3))),
T([2],
T([0], B(), B(1)),
T([4], B(3), B())),
T([2],
T([1], B(), B(1)),
T([3], B(), B(3))),
T([2],
T([1], B(), B(1)),
T([4], B(3), B())),
T([3], # T3/
T([], B(1)), # nsplit=1,(0,1)
T([4], B(3), B())),
T([3], # nsplit=1,(1,0)
T([0], B(), B(1)),
T([], B(3))),
T([3],
T([1], B(), B(1)),
T([], B(3))),
T([3],
T([2], B(1), B()),
T([], B(3))),
T([3], # nsplit=1,(1,1)
T([0], B(), B(1)),
T([4], B(3), B())),
T([3],
T([1], B(), B(1)),
T([4], B(3), B())),
T([3],
T([2], B(1), B()),
T([4], B(3), B())),
T([4], # T4/
T([0], B(), B(1,3)),
T([], B())),
T([4],
T([1], B(), B(1,3)),
T([], B())),
T([4],
T([2], B(1), B(3)),
T([], B())),
T([4],
T([3], B(1), B(3)),
T([], B())),
]
return return
assert X([1,3], 0, 2) == [ T([], B(1,3)), assert X([1,3], 0, 2) == [ T([], B(1,3)),
# nsplit=1 # nsplit=1
T([0], B(), B(1,3)), T([0], B(), B(1,3)),
......
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