Commit dd1413fb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 69bd173f
...@@ -116,6 +116,9 @@ def test_topoEncoding(): ...@@ -116,6 +116,9 @@ def test_topoEncoding():
def test_allStructs(): def test_allStructs():
T = xbtree.Tree T = xbtree.Tree
B = xbtree.Bucket B = xbtree.Bucket
# X = AllStructs(..., allowEmptyBuckets=True)
# Y = AllStructs(..., allowEmptyBuckets=False)
# XY = X = Y + assert X == Y
def X(keys, maxdepth, maxsplit, allowEmptyBuckets=True): def X(keys, maxdepth, maxsplit, allowEmptyBuckets=True):
return list(xbtree.AllStructs(keys, maxdepth, maxsplit, allowEmptyBuckets)) return list(xbtree.AllStructs(keys, maxdepth, maxsplit, allowEmptyBuckets))
def Y(keys, maxdepth, maxsplit): def Y(keys, maxdepth, maxsplit):
...@@ -407,10 +410,16 @@ def test_restructure(): ...@@ -407,10 +410,16 @@ def test_restructure():
zconn.add(ztree) zconn.add(ztree)
for k in keys: for k in keys:
ztree[k] = X[k] ztree[k] = X[k]
# check all keys via iterating (this verifies firstbucket and B->next pointers)
keys2 = set(ztree.keys())
assert keys2 == set(keys)
# check all keys by [] access
for k in keys:
assert ztree[k] is X[k]
return ztree return ztree
# XXX check all keys by [] access
# XXX check all keys via iterating (this verifies firstbucket and B->next pointers)
# R restructures ztree to have specified new topology. # R restructures ztree to have specified new topology.
def R(ztree, newtopo): def R(ztree, newtopo):
......
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