Repository: lucy
Updated Branches:
  refs/heads/master a22a44520 -> 63c45cc9a


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/07fa7b0b
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/07fa7b0b
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/07fa7b0b

Branch: refs/heads/master
Commit: 07fa7b0b9aa5d3f0087c2fdc09752b284c8885b0
Parents: 53131d1
Author: Marvin Humphrey <[email protected]>
Authored: Fri Oct 30 10:02:11 2015 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Sat Oct 31 15:31:15 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/lucy/blob/07fa7b0b/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