Test MatchAllMatcher, NoMatchMatcher Go bindings.

Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ab62643f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ab62643f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ab62643f

Branch: refs/heads/master
Commit: ab62643f19ca164cb58781ea33812dd27dd1f71b
Parents: be4b75d
Author: Marvin Humphrey <[email protected]>
Authored: Fri Sep 11 18:06:56 2015 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Tue Sep 15 15:54:51 2015 -0700

----------------------------------------------------------------------
 go/lucy/search_test.go | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/ab62643f/go/lucy/search_test.go
----------------------------------------------------------------------
diff --git a/go/lucy/search_test.go b/go/lucy/search_test.go
index 02881d2..d227e5f 100644
--- a/go/lucy/search_test.go
+++ b/go/lucy/search_test.go
@@ -328,6 +328,37 @@ func TestSeriesMatcherBasics(t *testing.T) {
        checkMatcher(t, matcher, false)
 }
 
+func TestMatchAllMatcherBasics(t *testing.T) {
+       matcher := NewMatchAllMatcher(1.5, 42)
+       matcher.Next()
+       if docID := matcher.Next(); docID != 2 {
+               t.Errorf("Unexpected return value for Next: %d", docID)
+       }
+       if docID := matcher.GetDocID(); docID != 2 {
+               t.Errorf("Unexpected return value for GetDocID: %d", docID)
+       }
+       if docID := matcher.Advance(42); docID != 42 {
+               t.Errorf("Advance returned %d", docID)
+       }
+       if score := matcher.Score(); score != 1.5 {
+               t.Errorf("Unexpected score: %f", score)
+       }
+       if matcher.Next() != 0 {
+               t.Error("Matcher should be exhausted")
+       }
+}
+
+func TestNoMatchMatcherBasics(t *testing.T) {
+       matcher := NewNoMatchMatcher()
+       if matcher.Next() != 0 {
+               t.Error("Next should return false")
+       }
+       matcher = NewNoMatchMatcher()
+       if matcher.Advance(3) != 0 {
+               t.Error("Advance should return false")
+       }
+}
+
 func TestTopDocsBasics(t *testing.T) {
        matchDocs := []MatchDoc{
                NewMatchDoc(42, 2.0, nil),

Reply via email to