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
05644ccc
Commit
05644ccc
authored
Jun 24, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
986e4a38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
10 deletions
+39
-10
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+39
-10
No files found.
wcfs/internal/xbtree/δbtail_test.go
View file @
05644ccc
...
...
@@ -983,7 +983,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// assert trackSet=ø, trackNew=ø, vδB=[]
δbtail
.
assertTrack
(
t
,
"@at0"
,
ø
,
ø
)
// XXX + vδB
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
db
,
treeRoot
,
t0
,
t1
,
xat
,
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
treeRoot
,
t0
,
t1
,
xat
,
/*trackSet=*/
ø
,
/*vδT=ø*/
)
xverifyΔBTail_rebuild_TR
(
t
,
db
,
δbtail
,
t1
,
treeRoot
,
xat
,
...
...
@@ -1022,7 +1022,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
}
}
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
db
,
treeRoot
,
t1
,
t2
,
xat
,
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
treeRoot
,
t1
,
t2
,
xat
,
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1R2
),
/*vδT=*/
δkv1_k1R2
,
δkv2_k1R2
)
...
...
@@ -1096,7 +1096,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// XXX move vvv to separate test (out of this inner loop)
// ΔBtail.Clone had bug that aliased klon data to orig
assertΔTtail
(
t
,
"BUG: after clone check"
,
δbtail
,
db
,
t2
,
treeRoot
,
xat
,
assertΔTtail
(
t
,
"BUG: after clone check"
,
δbtail
,
t2
,
treeRoot
,
xat
,
/*vδT=*/
δkv1_k1R2
,
δkv2_k1R2
)
//})
}
...
...
@@ -1107,7 +1107,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
}
// xverifyΔBTail_rebuild_U verifies ΔBtail state after Update(ti->tj).
func
xverifyΔBTail_rebuild_U
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
ti
,
tj
*
tTreeCommit
,
xat
map
[
zodb
.
Tid
]
string
,
trackSet
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
func
xverifyΔBTail_rebuild_U
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
treeRoot
zodb
.
Oid
,
ti
,
tj
*
tTreeCommit
,
xat
map
[
zodb
.
Tid
]
string
,
trackSet
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
X
:=
exc
.
Raiseif
ø
:=
PPTreeSubSet
{}
...
...
@@ -1116,10 +1116,39 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, db *zodb.DB, treeR
// Update ati -> atj
δB
,
err
:=
δbtail
.
Update
(
tj
.
δZ
);
X
(
err
)
// XXX assert δB.Rev = tj.at; δB = δ(ti,tj)/tracked (= vδTok[-1])
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
ø
)
_
=
δB
assertΔTtail
(
t
,
subj
,
δbtail
,
db
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
assertΔTtail
(
t
,
subj
,
δbtail
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
// assert δB = vδTok[-1]
var
δT
,
δTok
map
[
Key
]
Δstring
if
l
:=
len
(
vδTok
);
l
>
0
{
δTok
=
vδTok
[
l
-
1
]
}
if
len
(
δTok
)
==
0
{
δTok
=
nil
}
δrootsOK
:=
1
if
δTok
==
nil
{
δrootsOK
=
0
}
δroots
:=
SetOid
{}
for
root
:=
range
δbtail
.
vδTbyRoot
{
δroots
.
Add
(
root
)
}
δToid
,
ok
:=
δB
.
ΔByRoot
[
treeRoot
]
if
ok
{
δT
=
XGetδKV
(
δbtail
.
db
,
ti
.
at
,
tj
.
at
,
δToid
)
}
if
δB
.
Rev
!=
tj
.
at
{
t
.
Errorf
(
"%s: δB.Rev: have %s ; want %s"
,
subj
,
δB
.
Rev
,
tj
.
at
)
}
if
len
(
δB
.
ΔByRoot
)
!=
δrootsOK
{
t
.
Errorf
(
"%s: len(δB.ΔByRoot) != %d ; δroots=%v"
,
subj
,
δrootsOK
,
δroots
)
}
if
!
reflect
.
DeepEqual
(
δT
,
δTok
)
{
t
.
Errorf
(
"%s: δB.ΔBByRoot[%s]:
\n
have: %v
\n
want: %v"
,
subj
,
treeRoot
,
δT
,
δTok
)
}
}
// xverifyΔBTail_rebuild_TR verifies ΔBtail state after Track(keys) + rebuild.
...
...
@@ -1143,11 +1172,11 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
// XXX verify Get
// verify δbtail.vδTbyRoot[treeRoot]
assertΔTtail
(
t
,
subj
,
δbtail
,
db
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
assertΔTtail
(
t
,
subj
,
δbtail
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
}
// assertΔTtail verifies state of ΔTtail that corresponds to treeRoot in δbtail.
func
assertΔTtail
(
t
*
testing
.
T
,
subj
string
,
δbtail
*
ΔBtail
,
db
*
zodb
.
DB
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
vδTok
...
map
[
Key
]
Δstring
)
{
func
assertΔTtail
(
t
*
testing
.
T
,
subj
string
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
// XXX +KVAtTail, +lastRevOf
...
...
@@ -1176,7 +1205,7 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, db *zodb.DB, tj
atPrev
:=
t0
.
at
for
_
,
δToid
:=
range
vδToid
{
vat
=
append
(
vat
,
δToid
.
Rev
)
δT
:=
XGetδKV
(
db
,
atPrev
,
δToid
.
Rev
,
δToid
.
ΔKV
)
// {} k -> δ(ZBlk(oid).data)
δT
:=
XGetδKV
(
δbtail
.
db
,
atPrev
,
δToid
.
Rev
,
δToid
.
ΔKV
)
// {} k -> δ(ZBlk(oid).data)
vδT
=
append
(
vδT
,
δT
)
atPrev
=
δToid
.
Rev
}
...
...
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