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
f0df1b1e
Commit
f0df1b1e
authored
Jun 15, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7df766ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+24
-8
No files found.
wcfs/δbtail_test.go
View file @
f0df1b1e
...
...
@@ -458,7 +458,10 @@ func XGetBucket(db *zodb.DB, at zodb.Tid, root zodb.Oid) ... {
//
// it is known that @at1 and @at2 the tree has xkv1 and xkv2 values correspondingly.
// it is known that for at1->at2 ZODB-level change is δZ.
func
xverifyΔBTail
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
at1
,
at2
zodb
.
Tid
,
xkv1
,
xkv2
RBucketSet
,
δZ
*
zodb
.
EventCommit
)
{
// XXX +kadjOK
//
// kadjOK may be optionally provided. if kadjOK != nil computed adjacency
// matrix is verified against it.
func
xverifyΔBTail
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
at1
,
at2
zodb
.
Tid
,
xkv1
,
xkv2
RBucketSet
,
δZ
*
zodb
.
EventCommit
,
kadjOK
map
[
Key
]
SetKey
)
{
d12
:=
kvdiff
(
xkvFlatten
(
xkv1
),
xkvFlatten
(
xkv2
))
// verify transition at1->at2 for all initial states of tracked {keys} from kv1 + kv2 + ∞
...
...
@@ -515,6 +518,10 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
kadj
[
k
]
=
ka
}
if
kadjOK
!=
nil
&&
!
reflect
.
DeepEqual
(
kadj
,
kadjOK
)
{
panic
(
fmt
.
Sprintf
(
"BUG: computed kadj is wrong:
\n
kadjOK: %v
\n
kadj : %v"
,
kadjOK
,
kadj
))
}
for
kidx
:=
range
IntSets
(
len
(
allKeyv
))
{
keys
:=
SetKey
{}
...
...
@@ -633,8 +640,16 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
}
}
// ΔBTestEntry represents one entry in ΔBTail tests.
// XXX -> ΔBTestCase?
type
ΔBTestEntry
struct
{
tree
string
// next tree topology
kadjOK
map
[
Key
]
SetKey
// adjacency matrix against previous case
}
// testΔBTail verifies ΔBTail on sequence of tree topologies coming from testq.
func
testΔBTail
(
t
*
testing
.
T
,
testq
chan
string
)
{
func
testΔBTail
(
t
*
testing
.
T
,
testq
chan
ΔBTestEntry
)
{
X
:=
exc
.
Raiseif
work
,
err
:=
ioutil
.
TempDir
(
""
,
"δBTail"
);
X
(
err
)
...
...
@@ -683,13 +698,14 @@ func testΔBTail(t *testing.T, testq chan string) {
at1
:=
tg
.
head
xkv1
:=
XGetTree
(
db
,
at1
,
tg
.
treeRoot
)
tree1
:=
"ø"
// initial
for
tree2
:=
range
testq
{
for
test
:=
range
testq
{
tree2
:=
test
.
tree
δZ
:=
XCommitTree
(
tree2
)
at2
:=
δZ
.
Tid
xkv2
:=
XGetTree
(
db
,
at2
,
tg
.
treeRoot
)
subj
:=
fmt
.
Sprintf
(
"%s -> %s"
,
tree1
,
tree2
)
xverifyΔBTail
(
t
,
subj
,
db
,
tg
.
treeRoot
,
at1
,
at2
,
xkv1
,
xkv2
,
δZ
)
xverifyΔBTail
(
t
,
subj
,
db
,
tg
.
treeRoot
,
at1
,
at2
,
xkv1
,
xkv2
,
δZ
,
test
.
kadjOK
)
at1
=
at2
xkv1
=
xkv2
...
...
@@ -752,11 +768,11 @@ func TestΔBTail(t *testing.T) {
testv
=
append
(
testv
,
testv
[
i
])
}
testq
:=
make
(
chan
string
)
testq
:=
make
(
chan
ΔBTestEntry
)
go
func
()
{
defer
close
(
testq
)
for
_
,
tree
:=
range
testv
{
testq
<-
tree
testq
<-
ΔBTestEntry
{
tree
,
nil
}
}
}()
testΔBTail
(
t
,
testq
)
...
...
@@ -825,7 +841,7 @@ func TestΔBTreeAllStructs(t *testing.T) {
return
vv
[
i
:
i
+
1
]
}
testq
:=
make
(
chan
string
)
testq
:=
make
(
chan
ΔBTestEntry
)
go
func
()
{
defer
close
(
testq
)
for
i
:=
range
keysv1
{
...
...
@@ -845,7 +861,7 @@ func TestΔBTreeAllStructs(t *testing.T) {
}
for
_
,
tree
:=
range
treev
{
testq
<-
tree
testq
<-
ΔBTestEntry
{
tree
,
nil
}
}
}
...
...
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