Commit 4bcbfb16 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 805a9653
...@@ -68,6 +68,10 @@ class Tree: ...@@ -68,6 +68,10 @@ class Tree:
__repr__ = __str__ __repr__ = __str__
# TODO def dot() -> str for graphviz
# TODO def TopoEncode() -> str with topology encoding
# TODO @staticmethod def TopoDecode(in) <- Tree from topology string
# Bucked represents a bucket node. # Bucked represents a bucket node.
class Bucket: class Bucket:
# .keyv () of keys # .keyv () of keys
......
...@@ -86,20 +86,20 @@ def test_AllStructs(): ...@@ -86,20 +86,20 @@ def test_AllStructs():
#assert X([], 0, 1) == [ T([], B()), T([0], B(), B()) ] #assert X([], 0, 1) == [ T([], B()), T([0], B(), B()) ]
assert X([], 1, 0) == X([], 0,0) + [ assert X([], 1, 0) == [ T([], B()),
T([], T([],
T([], B())) T([], B())) ]
]
assert X([], 2, 0) == X([], 1,0) + [ assert X([], 2, 0) == [ T([], B()),
T([],
T([], B())),
T([], T([],
T([], T([],
T([], B()))) T([], B()))) ]
]
assert X([1,3], 0, 0) == [ T([], B(1,3)) ] assert X([1,3], 0, 0) == [ T([], B(1,3)) ]
assert X([1,3], 0, 1) == X([1,3], 0,0) + [ assert X([1,3], 0, 1) == [ T([], B(1,3)),
# nsplit=1 # nsplit=1
T([0], B(), B(1,3)), T([0], B(), B(1,3)),
T([1], B(), B(1,3)), T([1], B(), B(1,3)),
...@@ -108,15 +108,16 @@ def test_AllStructs(): ...@@ -108,15 +108,16 @@ def test_AllStructs():
T([4], B(1,3), B()), T([4], B(1,3), B()),
] ]
assert X([1,3], 1, 0) == X([1,3], 0,0) + [ assert X([1,3], 1, 0) == [ T([], B(1,3)),
# depth=1 # depth=1
T([], T([],
T([], B(1,3))) T([], B(1,3)))
] ]
return print('\n\nAAA\n\n')
assert X([1,3], 1, 1) == [
assert X([1,3], 1, 1) == [ T([], B(1,3)), # nsplit=0, depth=0
T([], B(1,3)),
# nsplit=0,0, depth=1 # nsplit=0,0, depth=1
T([], T([],
T([], B(1,3))), T([], B(1,3))),
...@@ -153,8 +154,8 @@ def test_AllStructs(): ...@@ -153,8 +154,8 @@ def test_AllStructs():
T([4], T([4],
T([], B(1,3)), T([], B(1,3)),
T([], B())), T([], B())),
# nsplit=1,1 depth=1 # nsplit=1,(0|1,0|1) depth=1
T([0], # /0 T([0], # T0/
T([], B()), T([], B()),
T([1], B(), B(1,3))), T([1], B(), B(1,3))),
T([0], T([0],
...@@ -166,7 +167,20 @@ def test_AllStructs(): ...@@ -166,7 +167,20 @@ def test_AllStructs():
T([0], T([0],
T([], B()), T([], B()),
T([4], B(1,3), B())), T([4], B(1,3), B())),
T([1], # /1
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([0], B(), B()),
T([2], B(1), B(3))), T([2], B(1), B(3))),
T([1], T([1],
...@@ -175,7 +189,20 @@ def test_AllStructs(): ...@@ -175,7 +189,20 @@ def test_AllStructs():
T([1], T([1],
T([0], B(), B()), T([0], B(), B()),
T([4], B(1,3), B())), T([4], B(1,3), B())),
T([2], # /2
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([0], B(), B(1)),
T([3], B(), B(3))), T([3], B(), B(3))),
T([2], T([2],
...@@ -187,7 +214,8 @@ def test_AllStructs(): ...@@ -187,7 +214,8 @@ def test_AllStructs():
T([2], T([2],
T([1], B(), B(1)), T([1], B(), B(1)),
T([4], B(3), B())), T([4], B(3), B())),
T([3], # /3
T([3], # T3/
T([0], B(), B(1)), T([0], B(), B(1)),
T([4], B(3), B())), T([4], B(3), B())),
T([3], T([3],
...@@ -196,7 +224,8 @@ def test_AllStructs(): ...@@ -196,7 +224,8 @@ def test_AllStructs():
T([3], T([3],
T([2], B(1), B()), T([2], B(1), B()),
T([4], B(3), B())), T([4], B(3), B())),
T([4], # /4
T([4], # T4/
T([0], B(), B(1,3)), T([0], B(), B(1,3)),
T([], B())), T([], B())),
T([4], T([4],
...@@ -212,6 +241,7 @@ def test_AllStructs(): ...@@ -212,6 +241,7 @@ def test_AllStructs():
# ... XXX continue # ... XXX continue
] ]
return
assert X([1,3], 0, 2) == [ T([], B(1,3)), assert X([1,3], 0, 2) == [ T([], 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