Commit 133a8a8e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7cdf3e06
...@@ -276,8 +276,8 @@ def AllStructs(zstor, kv1txt, kv2txt, n, seed=None): ...@@ -276,8 +276,8 @@ def AllStructs(zstor, kv1txt, kv2txt, n, seed=None):
# AllStructs generates topologies for subset of all possible tree changes in # AllStructs generates topologies for subset of all possible tree changes in
# between kv1 and kv2. See top-level documentation for details. # between kv1 and kv2. See top-level documentation for details.
@func @func
def AllStructs(kv1txt, kv2txt, n, seed=None): def AllStructs(kv1txt, kv2txt, maxdepth, maxsplit, n, seed=None):
zstor = MappingStorage() # in RAM storage to ... XXX writy why we need it zstor = MappingStorage() # in RAM storage to create native ZODB topologies
zctx = ZCtx(zstor) zctx = ZCtx(zstor)
defer(zctx.close) defer(zctx.close)
...@@ -300,8 +300,6 @@ def AllStructs(kv1txt, kv2txt, n, seed=None): ...@@ -300,8 +300,6 @@ def AllStructs(kv1txt, kv2txt, n, seed=None):
t2struct0 = xbtree.StructureOf(ztree) t2struct0 = xbtree.StructureOf(ztree)
# all tree topologies that can represent kv1 and kv2 # all tree topologies that can represent kv1 and kv2
maxdepth=2 # XXX -> 3?
maxsplit=1 # XXX -> 2?
t1AllStructs = list(xbtree.AllStructs(kv1.keys(), maxdepth, maxsplit, kv=kv1)) t1AllStructs = list(xbtree.AllStructs(kv1.keys(), maxdepth, maxsplit, kv=kv1))
t2AllStructs = list(xbtree.AllStructs(kv2.keys(), maxdepth, maxsplit, kv=kv2)) t2AllStructs = list(xbtree.AllStructs(kv2.keys(), maxdepth, maxsplit, kv=kv2))
...@@ -309,7 +307,7 @@ def AllStructs(kv1txt, kv2txt, n, seed=None): ...@@ -309,7 +307,7 @@ def AllStructs(kv1txt, kv2txt, n, seed=None):
if seed is None: if seed is None:
seed = int(time.now()) seed = int(time.now())
random.seed(seed) random.seed(seed)
print("# n=%d seed=%d" % (n, seed)) print("# maxdepth=%d maxsplit=%d n=%d seed=%d" % (maxdepth, maxsplit, n, seed))
# all tree1 and tree2 topologies jumps in between we are going to emit: # all tree1 and tree2 topologies jumps in between we are going to emit:
# native + n random ones. # native + n random ones.
...@@ -448,12 +446,14 @@ def TopoDecode(zctx, text): ...@@ -448,12 +446,14 @@ def TopoDecode(zctx, text):
@func @func
def cmd_allstructs(argv): def cmd_allstructs(argv):
if len(argv) != 3: if len(argv) != 3:
print("Usage: treegen allstructs <n> <kv1> <kv2>", file=sys.stderr) print("Usage: treegen allstructs <maxdepth> <maxsplit> <n> <kv1> <kv2>", file=sys.stderr)
sys.exit(1) sys.exit(1)
n = int(argv[0]) maxdepth = int(argv[0])
kv1, kv2 = argv[1:] maxsplit = int(argv[1])
AllStructs(kv1, kv2, n) n = int(argv[2])
kv1, kv2 = argv[3:]
AllStructs(kv1, kv2, maxdepth, maxsplit, n)
@func @func
def cmd_trees(argv): def cmd_trees(argv):
......
...@@ -445,6 +445,9 @@ func TestΔBTreeAllStructs(t *testing.T) { ...@@ -445,6 +445,9 @@ func TestΔBTreeAllStructs(t *testing.T) {
// XXX given (kv1, kv2) test on automatically generated (tree1 -> tree2) // XXX given (kv1, kv2) test on automatically generated (tree1 -> tree2)
//testing.Short() //testing.Short()
maxdepth = 2 // XXX -> 3?
maxsplit = 1 // XXX -> 2?
} }
......
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