Commit 205c6247 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 129fe522
......@@ -289,18 +289,47 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
}
assert.Equal(roots, []zodb.Oid{treeRoot})
δT := δB.ByRoot[treeRoot] // {} k -> oid
δTstr := XGetKV(db, at2, δT) // {} k -> ZBlk(oid).data
δToid := δB.ByRoot[treeRoot] // {} k -> oid
δT := XGetKV(db, at2, δToid) // {} k -> ZBlk(oid).data
fmt.Println("d12:", d12)
fmt.Println("δT: ", δTstr)
fmt.Println("δT: ", δT)
var badv []string
badf := func(format string, argv ...interface{}) {
badv = append(badv, fmt.Sprintf(format, argv...))
}
// δT must be subset of d12.
// changed keys, that are
// - in tracked set -> must be present in δT
// - outside tracked set -> may be present in δT
//
// all keys from d12/tracked are present in δT
// subset
for k := range δT {
_, ind12 := d12[k]
if ind12 {
badf("δT: extra key %s", k)
}
}
// all keys from d12/tracked are in δT
for k,v := range d12 {
_, inδT := δT[k]
// k ∈ tracked set -> must be present in δT
// k ∉ tracked set -> may be present in δT
if initialTrackedKeys.Has(k) {
if !inδT {
badf("δT: missing key %s", k)
}
}
if inδT {
if δT[k] != d12[k] {
badf("δT[%s] != d12[%s]", k, k)
}
}
}
//for (k,v) in d12:
// if k in initialTrackedKeys:
// assert k in δT
......@@ -308,8 +337,12 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
// else:
// if k in δT:
// assert δT[k] == v
//
// XXX all keys from δT are present in d12
if badv != nil {
emsg := fmt.Sprintf("d12: %v\nδT: %v\n\n", d12, δT)
emsg += strings.Join(badv, "\n")
t.Fatal(emsg)
}
}
func TestΔBTail(t *testing.T) {
......
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