lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [05/14] lucy git commit: Test Span Go bindings.
Date Mon, 28 Sep 2015 19:52:21 GMT
Test Span Go bindings.


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

Branch: refs/heads/master
Commit: d1f3764ad447867618554af0c7e453716bfb47ee
Parents: 8c1e020
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Thu Sep 10 21:01:07 2015 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Tue Sep 15 15:54:50 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/lucy/blob/d1f3764a/go/lucy/search_test.go
----------------------------------------------------------------------
diff --git a/go/lucy/search_test.go b/go/lucy/search_test.go
index 1f34df9..b082c51 100644
--- a/go/lucy/search_test.go
+++ b/go/lucy/search_test.go
@@ -424,3 +424,29 @@ func TestHitQueueBasics(t *testing.T) {
 		t.Error("PopAll")
 	}
 }
+
+func TestSpanBasics(t *testing.T) {
+	a := NewSpan(42, 1, 0.0)
+	b := NewSpan(42, 2, 0.0)
+	if !a.Equals(a) {
+		t.Error("Equals self")
+	}
+	if a.Equals(b) {
+		t.Error("Equals should return false for non-equal spans")
+	}
+	if got := a.CompareTo(b); got >= 0 {
+		t.Errorf("CompareTo returned %d", got)
+	}
+	a.SetOffset(21)
+	if got := a.GetOffset(); got != 21 {
+		t.Errorf("Set/Get offset: %d", got)
+	}
+	a.SetLength(10)
+	if got := a.GetLength(); got != 10 {
+		t.Errorf("Set/Get length: %d", got)
+	}
+	a.SetWeight(1.5)
+	if got := a.GetWeight(); got != 1.5 {
+		t.Errorf("Set/Get weight: %f", got)
+	}
+}


Mime
View raw message