Add test and make it pass

This commit is contained in:
kortschak 2014-08-12 10:13:39 +09:30
parent aad21b0585
commit 99d44e3228
2 changed files with 10 additions and 2 deletions

View file

@ -19,6 +19,7 @@ import (
"compress/bzip2" "compress/bzip2"
"compress/gzip" "compress/gzip"
"io" "io"
"reflect"
"strings" "strings"
"sync" "sync"
"testing" "testing"
@ -358,9 +359,16 @@ func TestQueries(t *testing.T) {
continue continue
} }
// TODO(kortschak) Be more rigorous in this result validation.
if len(got) != len(test.expect) { 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) 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])
} }
} }
} }

View file

@ -70,7 +70,7 @@ func (it *And) Optimize() (graph.Iterator, bool) {
// now a permutation of itself, but the contents are unchanged. // now a permutation of itself, but the contents are unchanged.
its = optimizeOrder(its) its = optimizeOrder(its)
its = materializeIts(its) //its = materializeIts(its)
// Okay! At this point we have an optimized order. // Okay! At this point we have an optimized order.