Commit 3ca2d3c8 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 78f260d6
...@@ -343,23 +343,10 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, ...@@ -343,23 +343,10 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
} }
} }
// Verify ΔBTail for explicitly provided tree topologies. // testΔBTail verifies ΔBTail on sequence of tree topologies coming from testq.
func TestΔBTail(t *testing.T) { func testΔBTail(t *testing.T, testq chan string) {
X := exc.Raiseif X := exc.Raiseif
// test known cases going through tree1 -> tree2 -> ...
testv := []string {
"T/B:",
"T/B1:a",
"T/B2:b",
// XXX
}
// direct tree_i -> tree_{i+1} -> _{i+2} ... plus
// reverse ... tree_i <- _{i+1} <- _{i+2}
for i := len(testv)-2; i >= 0; i-- {
testv = append(testv, testv[i])
}
work, err := ioutil.TempDir("", "δBTail"); X(err) work, err := ioutil.TempDir("", "δBTail"); X(err)
defer func() { defer func() {
err := os.RemoveAll(work); X(err) err := os.RemoveAll(work); X(err)
...@@ -406,7 +393,7 @@ func TestΔBTail(t *testing.T) { ...@@ -406,7 +393,7 @@ func TestΔBTail(t *testing.T) {
at1 := tg.head at1 := tg.head
kv1 := XGetTree(db, at1, tg.treeRoot) kv1 := XGetTree(db, at1, tg.treeRoot)
tree1 := "ø" // initial tree1 := "ø" // initial
for _, tree2 := range testv { for tree2 := range testq {
δZ := XCommitTree(tree2) δZ := XCommitTree(tree2)
at2 := δZ.Tid at2 := δZ.Tid
kv2 := XGetTree(db, at2, tg.treeRoot) kv2 := XGetTree(db, at2, tg.treeRoot)
...@@ -420,8 +407,35 @@ func TestΔBTail(t *testing.T) { ...@@ -420,8 +407,35 @@ func TestΔBTail(t *testing.T) {
} }
} }
// Verify ΔBTail for explicitly provided tree topologies.
func TestΔBTail(t *testing.T) {
// test known cases going through tree1 -> tree2 -> ...
testv := []string {
"T/B:",
"T/B1:a",
"T/B2:b",
// XXX
}
// direct tree_i -> tree_{i+1} -> _{i+2} ... plus
// reverse ... tree_i <- _{i+1} <- _{i+2}
for i := len(testv)-2; i >= 0; i-- {
testv = append(testv, testv[i])
}
testq := make(chan string)
go func() {
defer close(testq)
for _, tree := range testv {
testq <- tree
}
}()
testΔBTail(t, testq)
}
func TestΔBTreeAllStructs(t *testing.T) { func TestΔBTreeAllStructs(t *testing.T) {
// XXX given (kv1, kv2) test on automatically generated (tree1 -> tree2) // XXX given (kv1, kv2) test on automatically generated (tree1 -> tree2)
//testing.Short()
} }
......
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