Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
6f2440d5
Commit
6f2440d5
authored
May 06, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1539fe57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
156 deletions
+9
-156
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+3
-5
wcfs/internal/xbtree_test.py
wcfs/internal/xbtree_test.py
+6
-151
No files found.
wcfs/internal/xbtree.py
View file @
6f2440d5
...
@@ -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
...
...
wcfs/internal/xbtree_test.py
View file @
6f2440d5
...
@@ -114,7 +114,6 @@ def test_AllStructs():
...
@@ -114,7 +114,6 @@ def test_AllStructs():
T
([],
B
(
1
,
3
)))
T
([],
B
(
1
,
3
)))
]
]
print
(
'
\
n
\
n
AAA
\
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
\
n
BBB
\
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
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment