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
f1f995cc
Commit
f1f995cc
authored
Apr 29, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
38d545b2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+21
-11
No files found.
wcfs/δbtail_test.go
View file @
f1f995cc
...
@@ -793,10 +793,17 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -793,10 +793,17 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
func
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackIdx
,
trackIdxOK
trackIndex
)
{
func
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackIdx
,
trackIdxOK
trackIndex
)
{
if
!
reflect
.
DeepEqual
(
trackIdx
,
trackIdxOK
)
{
if
!
reflect
.
DeepEqual
(
trackIdx
,
trackIdxOK
)
{
t
.
Errorf
(
"%s:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
trackIdx
,
trackIdxOK
)
t
.
Errorf
(
"%s:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
trackIdx
,
trackIdxOK
)
//t.Fatalf("%s:\n\thave: %v\n\twant: %v", subj, trackIdx, trackIdxOK)
}
}
}
}
// assertTrack verifies state of .trackIdx and .newTrackIdx.
// XXX place
func
(
δbtail
*
ΔBtail
)
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackIdxOK
,
newTrackIdxOK
trackIndex
)
{
assertTrack
(
t
,
subj
+
": trackIdx"
,
δbtail
.
trackIdx
,
trackIdxOK
)
// XXX reenable
// assertTrack(t, subj + ": newTrackIdx", δbtail.newTrackIdx, newTrackIdxOK)
}
// xverifyΔBTail_rebuild verifies δBtail.rebuild during t0->t1->t2 transition.
// xverifyΔBTail_rebuild verifies δBtail.rebuild during t0->t1->t2 transition.
//
//
// t0->t1 exercises from-scratch rebuild,
// t0->t1 exercises from-scratch rebuild,
...
@@ -842,11 +849,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -842,11 +849,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
δbtail
:=
NewΔBtail
(
t0
.
at
,
db
)
δbtail
:=
NewΔBtail
(
t0
.
at
,
db
)
// assert trackIdx=ø, newTrackIdx=ø, vδB=[]
// assert trackIdx=ø, newTrackIdx=ø, vδB=[]
assertTrack
(
t
,
"@at0 trackIdx"
,
δbtail
.
trackIdx
,
ø
)
// XXX + newTrackIdx, XXX vδB
δbtail
.
assertTrack
(
t
,
"@at0"
,
ø
,
ø
)
// XXX + vδB
xverifyΔBTail_rebuild1
(
t
,
db
,
δbtail
,
t0
,
t1
,
treeRoot
,
xat
,
assertTrack
(
t
,
"@at1 trackIdx"
,
δbtail
.
trackIdx
,
t1
.
xkv
.
trackIdx
(
keys1
))
xverifyΔBTail_rebuild1
(
t
,
db
,
δbtail
,
t0
,
t1
,
treeRoot
,
// after Update(t0->t1):
// after Update(t0->t1):
/*trackIdx=*/
ø
,
/*trackIdx=*/
ø
,
...
@@ -858,6 +862,9 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -858,6 +862,9 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
/*trackIdx=*/
t1
.
xkv
.
trackIdx
(
keys1
),
/*trackIdx=*/
t1
.
xkv
.
trackIdx
(
keys1
),
/*vδB=*/
/*XXX temp*/
nil
/*[δ1/Tadj(keys1)*/
)
/*vδB=*/
/*XXX temp*/
nil
/*[δ1/Tadj(keys1)*/
)
assertTrack
(
t
,
"@at1 trackIdx"
,
δbtail
.
trackIdx
,
t1
.
xkv
.
trackIdx
(
keys1
))
/* TODO reenable
/* TODO reenable
// tRestKeys2 = tAllKeys - keys1
// tRestKeys2 = tAllKeys - keys1
...
@@ -884,14 +891,15 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -884,14 +891,15 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// xverifyΔBTail_rebuild1 verifies ΔBTree state:
// xverifyΔBTail_rebuild1 verifies ΔBTree state:
// 1. after Update(ti->tj),
// 1. after Update(ti->tj),
// 2. after further Track(keys), rebuild
// 2. after further Track(keys), rebuild
func
xverifyΔBTail_rebuild1
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
δbtail
*
ΔBtail
,
ti
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
trackIdx
trackIndex
,
keys
SetKey
,
newTrackIdx
,
trackIdxAfterRebuild
trackIndex
,
vδBok
[]
ΔB
)
{
func
xverifyΔBTail_rebuild1
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
δbtail
*
ΔBtail
,
ti
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
trackIdx
trackIndex
,
keys
SetKey
,
newTrackIdx
,
trackIdxAfterRebuild
trackIndex
,
vδBok
[]
ΔB
)
{
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
ø
:=
trackIndex
{}
// Update ati -> atj
// Update ati -> atj
δB
,
err
:=
δbtail
.
Update
(
tj
.
δZ
);
X
(
err
)
δB
,
err
:=
δbtail
.
Update
(
tj
.
δZ
);
X
(
err
)
// XXX assert δB.Rev = tj.at; δB = δ(ti,tj)/initially tracked
// XXX assert δB.Rev = tj.at; δB = δ(ti,tj)/initially tracked
// XXX assertTrack(δbtail.
trackIdx, ø)
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"after Update(@%s→@%s)"
,
xat
[
ti
.
at
],
xat
[
tj
.
at
]),
trackIdx
,
ø
)
// XXX
assertTrack(δbtail.newTrackIdx, ø),
vδB=[ø]
// XXX vδB=[ø]
_
=
δB
_
=
δB
// Track(keys)
// Track(keys)
...
@@ -905,11 +913,13 @@ func xverifyΔBTail_rebuild1(t *testing.T, db *zodb.DB, δbtail *ΔBtail, ti, tj
...
@@ -905,11 +913,13 @@ func xverifyΔBTail_rebuild1(t *testing.T, db *zodb.DB, δbtail *ΔBtail, ti, tj
err
=
δbtail
.
Track
(
k
,
ok
,
path
);
X
(
err
)
err
=
δbtail
.
Track
(
k
,
ok
,
path
);
X
(
err
)
}
}
// XXX assert trackIdx=ø, newTrackIdx=T(keys), vδB=[ø]
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"@%s: after Track(%v)"
,
xat
[
tj
.
at
],
keys
),
trackIdx
,
newTrackIdx
)
// XXX vδB=[ø]
δbtail
.
rebuild
()
δbtail
.
rebuild
()
// XXX assert trackIdx=T(keys), newTrackIdx=ø, vδB=[δ1/T(keys)]
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"@%s: after rebuild"
,
xat
[
tj
.
at
]),
trackIdxAfterRebuild
,
ø
)
// XXX assert vδB=[δ1/T(keys)]
// XXX verify Get
// XXX verify Get
// XXX verify SliceByRootRev
// XXX verify SliceByRootRev
...
...
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