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
7d2e4509
Commit
7d2e4509
authored
Jun 21, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e8d30e1d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
53 deletions
+14
-53
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+14
-53
No files found.
wcfs/internal/xbtree/δbtail_test.go
View file @
7d2e4509
...
...
@@ -1001,7 +1001,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
,
t0
,
t1
,
xat
,
/*trackSet=*/
ø
)
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
db
,
treeRoot
,
t0
,
t1
,
xat
,
/*trackSet=*/
ø
)
// XXX ^^^ + vδT=ø
xverifyΔBTail_rebuild_TR
(
t
,
db
,
δbtail
,
t1
,
treeRoot
,
xat
,
// after Track(keys1)
...
...
@@ -1017,7 +1017,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// tracked keys1 becomes tracked keys1_2 after Update(t1->t2)
// keys1_2 := kadj12.Map(keys1)
keys1_2
:=
kadj12
.
Map
(
kadj01
.
Map
(
keys1_0
))
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
t1
,
t2
,
xat
,
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1_2
))
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
db
,
treeRoot
,
t1
,
t2
,
xat
,
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1_2
))
// XXX +vδT=δkv1_2, δkv2_2
// tRestKeys2 = tAllKeys - keys1
...
...
@@ -1093,16 +1093,19 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
}
// xverifyΔBTail_rebuild_U verifies ΔBTree state after Update(ti->tj).
func
xverifyΔBTail_rebuild_U
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
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
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
ti
,
tj
*
tTreeCommit
,
xat
map
[
zodb
.
Tid
]
string
,
trackSet
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
X
:=
exc
.
Raiseif
ø
:=
PPTreeSubSet
{}
subj
:=
fmt
.
Sprintf
(
"after Update(@%s→@%s)"
,
xat
[
ti
.
at
],
xat
[
tj
.
at
])
// Update ati -> atj
δB
,
err
:=
δbtail
.
Update
(
tj
.
δZ
);
X
(
err
)
// XXX assert δB.Rev = tj.at; δB = δ(ti,tj)/initially tracked
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"after Update(@%s→@%s)"
,
xat
[
ti
.
at
],
xat
[
tj
.
at
])
,
trackSet
,
ø
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
ø
)
_
=
δB
assertΔTtail
(
t
,
subj
,
δbtail
,
db
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
}
// xverifyΔBTail_rebuild_TR verifies ΔBTree state after Track(keys) + rebuild.
...
...
@@ -1122,66 +1125,24 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
err
=
δbtail
.
Track
(
k
,
path
);
X
(
err
)
}
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"@%s: after Track%v"
,
xat
[
tj
.
at
],
keys
),
trackSet
,
trackNew
)
subj
:=
fmt
.
Sprintf
(
"@%s: after Track%v"
,
xat
[
tj
.
at
],
keys
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
trackNew
)
// XXX vδB=[ø]
δbtail
.
rebuildAll
()
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"@%s: after Track%v + rebuild"
,
xat
[
tj
.
at
],
keys
),
trackSetAfterRebuild
,
ø
)
subj
+=
"+ rebuild"
δbtail
.
assertTrack
(
t
,
subj
,
trackSetAfterRebuild
,
ø
)
// XXX assert vδB=[δ1/T(keys)]
// XXX verify Get
// verify δbtail.vδTbyRoot[treeRoot]
xverifyΔTtail
(
t
,
fmt
.
Sprintf
(
"@%s: after Track%v + rebuild"
,
xat
[
tj
.
at
],
keys
),
db
,
δbtail
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
/*
// verify SliceByRootRev XXX -> verify δbtail.byRoot[treeRoot] directly
// XXX +KVAtTail, +lastRevOf
l := len(vδTok)
vatOK := []zodb.Tid{}
vδTok_ := []map[Key]Δstring{}
t0 := tj
for i := 0; i<l; i++ {
// empty vδTok entries means they should be absent in vδT
if δTok := vδTok[l-i-1]; len(δTok) != 0 {
vatOK = append([]zodb.Tid{t0.at}, vatOK...)
vδTok_ = append([]map[Key]Δstring{δTok}, vδTok_...)
}
t0 = t0.prev
}
vδTok = vδTok_
lo := t0.at
hi := tj.at
vδToid := δbtail.SliceByRootRev(treeRoot, lo, hi)
l = len(vδToid)
vat := make([]zodb.Tid, l)
vδT := []map[Key]Δstring{}
atPrev := lo
for i, δToid := range vδToid {
vat[i] = δToid.Rev
δT := XGetδKV(db, atPrev, δToid.Rev, δToid.ΔKV) // {} k -> δ(ZBlk(oid).data)
vδT = append(vδT, δT)
atPrev = δToid.Rev
}
if !(reflect.DeepEqual(vat, vatOK) && reflect.DeepEqual(vδT, vδTok)) {
have := ""
for i := 0; i<len(vδT); i++ {
have += fmt.Sprintf("\n\t@%s: %v", xat[vat[i]], vδT[i])
}
want := ""
for i := 0; i<len(vδTok); i++ {
want += fmt.Sprintf("\n\t@%s: %v", xat[vatOK[i]], vδTok[i])
}
t.Errorf("@%s: after Track%v + rebuild: SliceByRootRev:\nhave: %v\nwant: %v", xat[tj.at], keys, have, want)
}
*/
assertΔTtail
(
t
,
subj
,
δbtail
,
db
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
}
//
xverify
ΔTtail verifies state of ΔTtail that corresponds to treeRoot in δbtail.
func
xverifyΔTtail
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
vδTok
...
map
[
Key
]
Δstring
)
{
//
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
)
{
t
.
Helper
()
// XXX +KVAtTail, +lastRevOf
...
...
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