Test TermInfo Go bindings.

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

Branch: refs/heads/LUCY-282-test-index-go-pt1
Commit: fdb228e5408fba62eff749ce6ab5d685e32e3d0d
Parents: 101c075
Author: Marvin Humphrey <[email protected]>
Authored: Fri Oct 30 10:02:11 2015 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Fri Oct 30 12:03:02 2015 -0700

----------------------------------------------------------------------
 go/lucy/index_test.go | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/fdb228e5/go/lucy/index_test.go
----------------------------------------------------------------------
diff --git a/go/lucy/index_test.go b/go/lucy/index_test.go
index a9aa279..826bd2b 100644
--- a/go/lucy/index_test.go
+++ b/go/lucy/index_test.go
@@ -247,3 +247,39 @@ func TestIndexManagerRecycle(t *testing.T) {
                t.Errorf("Recycle: (%d SegReaders) %v", len(segReaders), err)
        }
 }
+
+func TestTermInfoMisc(t *testing.T) {
+       tinfo := NewTermInfo(1000)
+       if got := tinfo.GetDocFreq(); got != 1000 {
+               t.Errorf("GetDocFreq: %d", got)
+       }
+       tinfo.SetDocFreq(1001)
+       if got := tinfo.GetDocFreq(); got != 1001 {
+               t.Errorf("Set/GetDocFreq: %d", got)
+       }
+       tinfo.SetLexFilePos(1002)
+       if got := tinfo.GetLexFilePos(); got != 1002 {
+               t.Errorf("Set/GetLexFilePos: %d", got)
+       }
+       tinfo.SetPostFilePos(1003)
+       if got := tinfo.GetPostFilePos(); got != 1003 {
+               t.Errorf("Set/GetPostFilePos: %d", got)
+       }
+       tinfo.SetSkipFilePos(1002)
+       if got := tinfo.GetSkipFilePos(); got != 1002 {
+               t.Errorf("Set/GetSkipFilePos: %d", got)
+       }
+       other := NewTermInfo(42)
+       other.Mimic(tinfo)
+       if got := other.GetDocFreq(); got != tinfo.GetDocFreq() {
+               t.Errorf("Mimic: (%d != %d)", got, tinfo.GetDocFreq())
+       }
+       other = tinfo.Clone().(TermInfo)
+       if got := other.GetDocFreq(); got != tinfo.GetDocFreq() {
+               t.Errorf("Clone: (%d != %d)", got, tinfo.GetDocFreq())
+       }
+       tinfo.Reset()
+       if got := tinfo.GetDocFreq(); got != 0 {
+               t.Errorf("Reset: expected 0, got %d", got)
+       }
+}

Reply via email to