Commit 21ccc7ba authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5d32b4b0
......@@ -691,6 +691,22 @@ type ΔBTestEntry struct {
kadjOK map[Key]SetKey // adjacency matrix against previous case
}
// ΔBTest converts xtest into ΔBTestEntry.
// xtest can be string|ΔBTestEntry.
func ΔBTest(xtest interface{}) ΔBTestEntry {
var test ΔBTestEntry
switch xtest := xtest.(type) {
case string:
test.tree = xtest
test.kadjOK = nil
case ΔBTestEntry:
test = xtest
default:
panic(fmt.Sprintf("BUG: ΔBTest: bad type %T", xtest))
}
return test
}
// testΔBTail verifies ΔBTail on sequence of tree topologies coming from testq.
func testΔBTail(t *testing.T, testq chan ΔBTestEntry) {
X := exc.Raiseif
......@@ -881,25 +897,18 @@ func TestΔBTail(t *testing.T) {
}
// direct tree_i -> tree_{i+1} -> _{i+2} ... plus
// reverse ... tree_i <- _{i+1} <- _{i+2}
kadjOK := ΔBTest(testv[len(testv)-1]).kadjOK
for i := len(testv)-2; i >= 0; i-- {
testv = append(testv, testv[i])
test := ΔBTest(testv[i])
kadjOK, test.kadjOK = test.kadjOK, kadjOK
testv = append(testv, test)
}
testq := make(chan ΔBTestEntry)
go func() {
defer close(testq)
for _, xtest := range testv {
var test ΔBTestEntry
switch xtest := xtest.(type) {
case string:
test.tree = xtest
test.kadjOK = nil
case ΔBTestEntry:
test = xtest
default:
panic(fmt.Sprintf("BUG: bad type in testv: %T", xtest))
}
testq <- test
for _, test := range testv {
testq <- ΔBTest(test)
}
}()
testΔBTail(t, testq)
......
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