Commit 476da755 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a090c92b
...@@ -773,13 +773,21 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod ...@@ -773,13 +773,21 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// xverifyΔBtail_Get verifies δBtail.Get on series of vt ZODB changes. // xverifyΔBtail_Get verifies δBtail.Get on series of vt ZODB changes.
// XXX // XXX
func xverifyΔBTail_Get(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, vt ...*tTreeCommit) { func xverifyΔBTail_Get(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt ...*tTreeCommit) {
subj = vt[0].tree subj := vt[0].tree
for _, t := range vt[1:] { for _, t := range vt[1:] {
subj += "→" + t.tree subj += "→" + t.tree
} }
t.Run(fmt.Sprintf("Get/%s", subj), func(t *testing.T) { t.Run(fmt.Sprintf("Get/%s", subj), func(t *testing.T) {
// tid -> "at_i"
xat := map[zodb.Tid]string{}
for i := range vt {
xat[vt[i].at] = fmt.Sprintf("at%d", i)
fmt.Printf("@%s: %v\n", xat[vt[i].at], xkvFlatten(vt[i].xkv))
}
tkeys := allTestKeys(vt...) tkeys := allTestKeys(vt...)
tkeyv := tkeys.SortedKeys() tkeyv := tkeys.SortedKeys()
...@@ -792,21 +800,14 @@ func xverifyΔBTail_Get(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oi ...@@ -792,21 +800,14 @@ func xverifyΔBTail_Get(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oi
} }
t.Run(fmt.Sprintf("track=%s", keys), func(t *testing.T) { t.Run(fmt.Sprintf("track=%s", keys), func(t *testing.T) {
xverifyΔBTail_Get1(t, db, treeRoot, vt, keys) xverifyΔBTail_Get1(t, db, treeRoot, vt, xat, keys)
}) })
} }
}) })
} }
func xverifyΔBTail_Get1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt []*tTreeCommit, keys SetKey) { func xverifyΔBTail_Get1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt []*tTreeCommit, xat map[zodb.Tid]string, keys SetKey) {
X := exc.Raiseif X := exc.Raiseif
// XXX tracked / ?
// tid -> "at_i"
xat := map[zodb.Tid]string{}
for i := range vt {
xat[vt[i].at] = fmt.Sprintf("at%d", i)
}
// t1->t2-> ... -> tn // t1->t2-> ... -> tn
δbtail := NewΔBtail(vt[0].at, db) δbtail := NewΔBtail(vt[0].at, db)
...@@ -854,7 +855,7 @@ func xverifyΔBTail_Get1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt []*tTr ...@@ -854,7 +855,7 @@ func xverifyΔBTail_Get1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt []*tTr
if !(v == v_ && ok == ok_ && rev == rev_ && revExact == revExact_) { if !(v == v_ && ok == ok_ && rev == rev_ && revExact == revExact_) {
t.Errorf("Get(%d, @%s) ->\nhave: %s, %v, @%s, %v\nwant: %s, %v, @%s, %v", t.Errorf("Get(%d, @%s) ->\nhave: %s, %v, @%s, %v\nwant: %s, %v, @%s, %v",
k, at, k, xat[at],
v, ok, xat[rev], revExact, v, ok, xat[rev], revExact,
v_, ok_, xat[rev_], revExact_) v_, ok_, xat[rev_], revExact_)
} }
...@@ -966,10 +967,10 @@ func testΔBTail(t *testing.T, testq chan ΔBTestEntry) { ...@@ -966,10 +967,10 @@ func testΔBTail(t *testing.T, testq chan ΔBTestEntry) {
xverifyΔBTail_Update(t, subj, db, tg.treeRoot, t1,t2, test.kadjOK) xverifyΔBTail_Update(t, subj, db, tg.treeRoot, t1,t2, test.kadjOK)
// ΔBTail.Get // ΔBTail.Get
xverifyΔBTail_Get(t, "XXX", db, tg.treeRoot, t2) xverifyΔBTail_Get(t, db, tg.treeRoot, t2)
xverifyΔBTail_Get(t, "XXX", db, tg.treeRoot, t1, t2) xverifyΔBTail_Get(t, db, tg.treeRoot, t1, t2)
if t0 != nil { if t0 != nil {
xverifyΔBTail_Get(t, "XXX", db, tg.treeRoot, t0, t1, t2) xverifyΔBTail_Get(t, db, tg.treeRoot, t0, t1, t2)
} }
// XXX ΔBTail.SliceByRootRev // XXX ΔBTail.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