From 99d44e3228305ea4bbd56c20aa66bf6a45250e74 Mon Sep 17 00:00:00 2001 From: kortschak Date: Tue, 12 Aug 2014 10:13:39 +0930 Subject: [PATCH] Add test and make it pass --- cayley_test.go | 10 +++++++++- graph/iterator/and_iterator_optimize.go | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cayley_test.go b/cayley_test.go index d108f85..1a0466d 100644 --- a/cayley_test.go +++ b/cayley_test.go @@ -19,6 +19,7 @@ import ( "compress/bzip2" "compress/gzip" "io" + "reflect" "strings" "sync" "testing" @@ -358,9 +359,16 @@ func TestQueries(t *testing.T) { continue } - // TODO(kortschak) Be more rigorous in this result validation. if len(got) != len(test.expect) { t.Errorf("Unexpected number of results, got:%d expect:%d on %s.", len(got), len(test.expect), test.message) + continue + } + if reflect.DeepEqual(got, test.expect) { + continue + } + t.Errorf("Unexpected results for %s:\n", test.message) + for i := range got { + t.Errorf("\n\tgot:%#v\n\texpect:%#v\n", got[i], test.expect[i]) } } } diff --git a/graph/iterator/and_iterator_optimize.go b/graph/iterator/and_iterator_optimize.go index 774904d..28c6fec 100644 --- a/graph/iterator/and_iterator_optimize.go +++ b/graph/iterator/and_iterator_optimize.go @@ -70,7 +70,7 @@ func (it *And) Optimize() (graph.Iterator, bool) { // now a permutation of itself, but the contents are unchanged. its = optimizeOrder(its) - its = materializeIts(its) + //its = materializeIts(its) // Okay! At this point we have an optimized order.