Commit cb6b12ed authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 333b6877
...@@ -516,7 +516,7 @@ func (S PPTreeSubSet) ApplyΔ(δ *ΔPPTreeSubSet) { ...@@ -516,7 +516,7 @@ func (S PPTreeSubSet) ApplyΔ(δ *ΔPPTreeSubSet) {
// XXX kill
// XXX returns PPTreeSubSet that corresponds to nodes that correspond to δtkeycov. // XXX returns PPTreeSubSet that corresponds to nodes that correspond to δtkeycov.
// XXX correct? // XXX correct?
func (δ *ΔPPTreeSubSet) XXXδtkeycovSet() (S PPTreeSubSet) { func (δ *ΔPPTreeSubSet) XXXδtkeycovSet() (S PPTreeSubSet) {
......
...@@ -679,7 +679,7 @@ func xverifyΔBTail_Update(t *testing.T, subj string, db *zodb.DB, treeRoot zodb ...@@ -679,7 +679,7 @@ func xverifyΔBTail_Update(t *testing.T, subj string, db *zodb.DB, treeRoot zodb
// tracked state defined by initialTrackedKeys. // tracked state defined by initialTrackedKeys.
func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, xkv1,xkv2 RBucketSet, δZ *zodb.EventCommit, d12 map[Key]Δstring, initialTrackedKeys SetKey, kadj KAdjMatrix) { func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, xkv1,xkv2 RBucketSet, δZ *zodb.EventCommit, d12 map[Key]Δstring, initialTrackedKeys SetKey, kadj KAdjMatrix) {
X := exc.Raiseif X := exc.Raiseif
// t.Logf("\n>>> Track=%s\n", initialTrackedKeys) t.Logf("\n>>> Track=%s\n", initialTrackedKeys)
var TrackedδZ SetKey = nil var TrackedδZ SetKey = nil
var kadjTrackedδZ SetKey = nil var kadjTrackedδZ SetKey = nil
...@@ -791,27 +791,35 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod ...@@ -791,27 +791,35 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
ø := PPTreeSubSet{} ø := PPTreeSubSet{}
// verify δbtail.trackSet against @at1
// trackSet1 = xkv1[tracked1] // trackSet1 = xkv1[tracked1]
// trackSet2 = xkv2[tracked2] ( = xkv2[kadj[tracked1]]
trackSet1, tkeyCov1 := xkv1.trackSetWithCov(initialTrackedKeys) trackSet1, tkeyCov1 := xkv1.trackSetWithCov(initialTrackedKeys)
/* trackSet2, tkeyCov2 := xkv2.trackSetWithCov(initialTrackedKeys.Union(kadjTrackedδZ))
if !δbtail.trackSet.Equal(ø) {
badf("δbtail.trackSet1 wrong:\n\thave: %v\n\twant: %v", δbtail.trackSet, ø)
}
if !δbtail.trackNew.Equal(trackSet1) {
badf("δbtail.trackNew1 wrong:\n\thave: %v\n\twant: %v", δbtail.trackNew, trackSet1)
}
*/
δbtail.assertTrack(t, "1", ø, trackSet1)
// verify δbtail.trackSet against @at1
δbtail.assertTrack(t, "1", ø, trackSet1)
// δB <- δZ // δB <- δZ
// //
// also call _Update1 directly to verify δtkeycov return from treediff // also call _Update1 directly to verify δtkeycov return from treediff
// the result of Update and _Update1 should be the same since δbtail is initially empty. // the result of Update and _Update1 should be the same since δbtail is initially empty.
δbtail_ := δbtail.Clone() δbtail_ := δbtail.Clone()
δB, err := δbtail.Update(δZ); X(err)
δB1, err := δbtail_._Update1(δZ); X(err) δB1, err := δbtail_._Update1(δZ); X(err)
// assert δtkeycov == δ(tkeyCov1, tkeyCov2)
δtkeycovOK := tkeyCov2.Difference(tkeyCov1)
//fmt.Printf("tkeyCov1: %s\n", tkeyCov1)
//fmt.Printf("tkeyCov2: %s\n", tkeyCov2)
//fmt.Printf("δtkeycov: %s\n", δtkeycovOK)
δtkeycov := &RangedKeySet{}
if __, ok := δB1.ByRoot[treeRoot]; ok {
δtkeycov = __.δtkeycov1
}
if !δtkeycov.Equal(δtkeycovOK) {
badf("δtkeycov wrong:\nhave: %s\nwant: %s", δtkeycov, δtkeycovOK)
}
δB, err := δbtail.Update(δZ); X(err)
// XXX assert δB.roots == δTKeyCov roots // XXX assert δB.roots == δTKeyCov roots
// XXX assert δBtail[root].vδT = δBtail_[root].vδT // XXX assert δBtail[root].vδT = δBtail_[root].vδT
...@@ -821,32 +829,9 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod ...@@ -821,32 +829,9 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
} }
// verify δbtail.trackSet against @at2 // verify δbtail.trackSet against @at2
// trackSet2 = xkv2[tracked2] ( = xkv2[kadj[tracked1]]
trackSet2, tkeyCov2 := xkv2.trackSetWithCov(initialTrackedKeys.Union(kadjTrackedδZ))
/*
if !δbtail.trackSet.Equal(trackSet2) {
badf("δbtail.trackSet2 wrong:\n\thave: %v\n\twant: %v", δbtail.trackSet, trackSet2)
}
if !δbtail.trackNew.Equal(ø) {
badf("δbtail.trackNew2 wrong:\n\thave: %v\n\twant: %v", δbtail.trackNew, ø)
}
*/
δbtail.assertTrack(t, "2", trackSet2, ø) δbtail.assertTrack(t, "2", trackSet2, ø)
// assert δtkeycov == δ(tkeyCov1, tkeyCov2)
δtkeycovOK := tkeyCov2.Difference(tkeyCov1)
fmt.Printf("tkeyCov1: %s\n", tkeyCov1)
fmt.Printf("tkeyCov2: %s\n", tkeyCov2)
fmt.Printf("δtkeycov: %s\n", δtkeycovOK)
δtkeycov := &RangedKeySet{}
if __, ok := δB1.ByRoot[treeRoot]; ok {
δtkeycov = __.δtkeycov1
}
if !δtkeycov.Equal(δtkeycovOK) {
badf("δtkeycov wrong:\nhave: %s\nwant: %s", δtkeycov, δtkeycovOK)
}
// assert δB.ByRoot == {treeRoot -> ...} if δTok != ø // assert δB.ByRoot == {treeRoot -> ...} if δTok != ø
// == ø if δTok == ø // == ø if δTok == ø
rootsOK := SetOid{} rootsOK := SetOid{}
......
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