Fix tests.

This commit is contained in:
Alex Roitman 2018-11-01 15:18:55 -07:00
parent df0192f3f6
commit bf5317f040
1 changed files with 22 additions and 22 deletions

View File

@ -230,7 +230,7 @@ func TestCollectionScan(t *testing.T) {
} }
var n int var n int
var prevID string var prevID string
c.Scan(false, func(id string, obj geojson.Object, fields []float64) bool { c.Scan(false, 0, func(n uint64) {}, func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, id > prevID) expect(t, id > prevID)
} }
@ -241,7 +241,7 @@ func TestCollectionScan(t *testing.T) {
}) })
expect(t, n == c.Count()) expect(t, n == c.Count())
n = 0 n = 0
c.Scan(true, func(id string, obj geojson.Object, fields []float64) bool { c.Scan(true, 0, func(n uint64) {}, func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, id < prevID) expect(t, id < prevID)
} }
@ -253,7 +253,7 @@ func TestCollectionScan(t *testing.T) {
expect(t, n == c.Count()) expect(t, n == c.Count())
n = 0 n = 0
c.ScanRange("0060", "0070", false, c.ScanRange("0060", "0070", false, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, id > prevID) expect(t, id > prevID)
@ -266,7 +266,7 @@ func TestCollectionScan(t *testing.T) {
expect(t, n == 10) expect(t, n == 10)
n = 0 n = 0
c.ScanRange("0070", "0060", true, c.ScanRange("0070", "0060", true, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, id < prevID) expect(t, id < prevID)
@ -317,7 +317,7 @@ func TestCollectionSearch(t *testing.T) {
} }
var n int var n int
var prevValue string var prevValue string
c.SearchValues(false, func(id string, obj geojson.Object, fields []float64) bool { c.SearchValues(false, 0, func(n uint64) {}, func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, obj.String() > prevValue) expect(t, obj.String() > prevValue)
} }
@ -328,7 +328,7 @@ func TestCollectionSearch(t *testing.T) {
}) })
expect(t, n == c.Count()) expect(t, n == c.Count())
n = 0 n = 0
c.SearchValues(true, func(id string, obj geojson.Object, fields []float64) bool { c.SearchValues(true, 0, func(n uint64) {}, func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, obj.String() < prevValue) expect(t, obj.String() < prevValue)
} }
@ -340,7 +340,7 @@ func TestCollectionSearch(t *testing.T) {
expect(t, n == c.Count()) expect(t, n == c.Count())
n = 0 n = 0
c.SearchValuesRange("0060", "0070", false, c.SearchValuesRange("0060", "0070", false, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, obj.String() > prevValue) expect(t, obj.String() > prevValue)
@ -353,7 +353,7 @@ func TestCollectionSearch(t *testing.T) {
expect(t, n == 10) expect(t, n == 10)
n = 0 n = 0
c.SearchValuesRange("0070", "0060", true, c.SearchValuesRange("0070", "0060", true, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
if n > 0 { if n > 0 {
expect(t, obj.String() < prevValue) expect(t, obj.String() < prevValue)
@ -436,7 +436,7 @@ func TestSpatialSearch(t *testing.T) {
var n int var n int
n = 0 n = 0
c.Within(q1, 0, c.Within(q1, 0, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
n++ n++
return true return true
@ -445,7 +445,7 @@ func TestSpatialSearch(t *testing.T) {
expect(t, n == 3) expect(t, n == 3)
n = 0 n = 0
c.Within(q2, 0, c.Within(q2, 0, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
n++ n++
return true return true
@ -454,7 +454,7 @@ func TestSpatialSearch(t *testing.T) {
expect(t, n == 7) expect(t, n == 7)
n = 0 n = 0
c.Within(q3, 0, c.Within(q3, 0, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
n++ n++
return true return true
@ -463,7 +463,7 @@ func TestSpatialSearch(t *testing.T) {
expect(t, n == 4) expect(t, n == 4)
n = 0 n = 0
c.Intersects(q1, 0, c.Intersects(q1, 0, 0, func(n uint64) {},
func(_ string, _ geojson.Object, _ []float64) bool { func(_ string, _ geojson.Object, _ []float64) bool {
n++ n++
return true return true
@ -472,7 +472,7 @@ func TestSpatialSearch(t *testing.T) {
expect(t, n == 4) expect(t, n == 4)
n = 0 n = 0
c.Intersects(q2, 0, c.Intersects(q2, 0, 0, func(n uint64) {},
func(_ string, _ geojson.Object, _ []float64) bool { func(_ string, _ geojson.Object, _ []float64) bool {
n++ n++
return true return true
@ -481,7 +481,7 @@ func TestSpatialSearch(t *testing.T) {
expect(t, n == 7) expect(t, n == 7)
n = 0 n = 0
c.Intersects(q3, 0, c.Intersects(q3, 0, 0, func(n uint64) {},
func(_ string, _ geojson.Object, _ []float64) bool { func(_ string, _ geojson.Object, _ []float64) bool {
n++ n++
return true return true
@ -490,7 +490,7 @@ func TestSpatialSearch(t *testing.T) {
expect(t, n == 5) expect(t, n == 5)
n = 0 n = 0
c.Intersects(q3, 0, c.Intersects(q3, 0, 0, func(n uint64) {},
func(_ string, _ geojson.Object, _ []float64) bool { func(_ string, _ geojson.Object, _ []float64) bool {
n++ n++
return n <= 1 return n <= 1
@ -502,7 +502,7 @@ func TestSpatialSearch(t *testing.T) {
exitems := []geojson.Object{ exitems := []geojson.Object{
r2, p1, p4, r1, p3, r3, p2, r2, p1, p4, r1, p3, r3, p2,
} }
c.Nearby(q4, c.Nearby(q4, 0, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
items = append(items, obj) items = append(items, obj)
return true return true
@ -528,7 +528,7 @@ func TestCollectionSparse(t *testing.T) {
} }
var n int var n int
n = 0 n = 0
c.Within(rect, 1, c.Within(rect, 0,1, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
n++ n++
return true return true
@ -537,7 +537,7 @@ func TestCollectionSparse(t *testing.T) {
expect(t, n == 4) expect(t, n == 4)
n = 0 n = 0
c.Within(rect, 2, c.Within(rect, 0, 2, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
n++ n++
return true return true
@ -546,7 +546,7 @@ func TestCollectionSparse(t *testing.T) {
expect(t, n == 16) expect(t, n == 16)
n = 0 n = 0
c.Within(rect, 3, c.Within(rect, 0, 3, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
n++ n++
return true return true
@ -555,7 +555,7 @@ func TestCollectionSparse(t *testing.T) {
expect(t, n == 64) expect(t, n == 64)
n = 0 n = 0
c.Within(rect, 3, c.Within(rect, 0, 3, func(n uint64) {},
func(id string, obj geojson.Object, fields []float64) bool { func(id string, obj geojson.Object, fields []float64) bool {
n++ n++
return n <= 30 return n <= 30
@ -564,7 +564,7 @@ func TestCollectionSparse(t *testing.T) {
expect(t, n == 31) expect(t, n == 31)
n = 0 n = 0
c.Intersects(rect, 3, c.Intersects(rect, 0, 3, func(n uint64) {},
func(id string, _ geojson.Object, _ []float64) bool { func(id string, _ geojson.Object, _ []float64) bool {
n++ n++
return true return true
@ -573,7 +573,7 @@ func TestCollectionSparse(t *testing.T) {
expect(t, n == 64) expect(t, n == 64)
n = 0 n = 0
c.Intersects(rect, 3, c.Intersects(rect, 0, 3, func(n uint64) {},
func(id string, _ geojson.Object, _ []float64) bool { func(id string, _ geojson.Object, _ []float64) bool {
n++ n++
return n <= 30 return n <= 30