Test BitVecMatcher Go bindings.

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

Branch: refs/heads/master
Commit: aa8e372efb1fd1bd21d8bde40eb7bd8088f1c22b
Parents: db2c25d
Author: Marvin Humphrey <[email protected]>
Authored: Wed Aug 12 17:45:23 2015 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Wed Sep 9 18:25:24 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/lucy/blob/aa8e372e/go/lucy/search_test.go
----------------------------------------------------------------------
diff --git a/go/lucy/search_test.go b/go/lucy/search_test.go
index c5e2cc2..e822d09 100644
--- a/go/lucy/search_test.go
+++ b/go/lucy/search_test.go
@@ -268,3 +268,23 @@ func TestMockMatcherBasics(t *testing.T) {
                t.Error("Next (iteration finished): %d", got)
        }
 }
+
+func TestBitVecMatcherBasics(t *testing.T) {
+       bv := NewBitVector(0)
+       bv.Set(42)
+       bv.Set(43)
+       bv.Set(100)
+       matcher := NewBitVecMatcher(bv)
+       if got := matcher.Next(); got != 42 {
+               t.Error("Next: %d", got)
+       }
+       if got := matcher.GetDocID(); got != 42 {
+               t.Error("GetDocID: %d", got)
+       }
+       if got := matcher.Advance(50); got != 100 {
+               t.Error("Advance: %d", got)
+       }
+       if got := matcher.Next(); got != 0 {
+               t.Error("Next (iteration finished): %d", got)
+       }
+}

Reply via email to