From df36c8073c1413ac0665f427284ec2bb802d82e5 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sun, 2 Aug 2020 03:05:42 +0000 Subject: [PATCH] select the middle of a graph --- selection_test.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/selection_test.go b/selection_test.go index 99cc3f1..40a53ff 100644 --- a/selection_test.go +++ b/selection_test.go @@ -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) }