select the middle of a graph

selection
Jordan Orelli 4 years ago
parent 00ba88a520
commit df36c8073c

@ -27,8 +27,7 @@ func (test *selectionTest) Run(t *testing.T) {
XLeavesWanted := wantStrings("leaf xnode labels", test.xleaves...)
for _, X := range test.selection.xnodes() {
leaves := X.leaves()
for _, leaf := range leaves {
for _, leaf := range X.leaves() {
XLeavesWanted.add(leaf.label())
}
}
@ -188,6 +187,32 @@ func TestSelections(t *testing.T) {
}
})
add(func() selectionTest {
root := NewSelection(A)
b := root.Child(B)
c := root.Child(C)
b.Child(D)
e := b.And(c).Child(E)
f := c.Child(F)
e.Child(G).Child(J).Child(M)
h := e.And(f).Child(H)
l := f.Child(I).Child(L)
k := h.Child(K)
k.And(l).Child(N)
return selectionTest{
label: "criss-crossing-partial",
selection: e,
lnodes: []string{"E"},
xnodes: []string{"E.0.B", "E.1.C"},
xleaves: []string{
"M.0.J", // A B E G J M
"M.1.J", // A C E G J M
"N.0.K", // A B E H K N
"N.1.K", // A C E H K N
},
}
})
for _, test := range tests {
t.Run(test.label, test.Run)
}

Loading…
Cancel
Save