Commit f1f995cc authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 38d545b2
...@@ -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\thave: %v\n\twant: %v", subj, trackIdx, trackIdxOK) t.Errorf("%s:\n\thave: %v\n\twant: %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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment