0
0
Fork 0

add validation that all locations were seen

This commit is contained in:
Marty Schoch 2017-12-05 11:58:05 -05:00
parent e08fdab54a
commit 7a6b5483f2
1 changed files with 10 additions and 0 deletions

View File

@ -253,7 +253,9 @@ func TestSingle(t *testing.T) {
if nextPosting.Norm() != 1.0 {
t.Errorf("expected norm 1.0, got %f", nextPosting.Norm())
}
var numLocs uint64
for _, loc := range nextPosting.Locations() {
numLocs++
if loc.Start() != 0 {
t.Errorf("expected loc start to be 0, got %d", loc.Start())
}
@ -267,6 +269,9 @@ func TestSingle(t *testing.T) {
t.Errorf("expect loc array pos to be nil, got %v", loc.ArrayPositions())
}
}
if numLocs != nextPosting.Frequency() {
t.Errorf("expected %d locations, got %d", nextPosting.Frequency(), numLocs)
}
nextPosting, err = postingsItr.Next()
}
@ -314,7 +319,9 @@ func TestSingle(t *testing.T) {
if nextPosting.Norm() != float64(expectedNorm) {
t.Errorf("expected norm %f, got %f", expectedNorm, nextPosting.Norm())
}
var numLocs uint64
for _, loc := range nextPosting.Locations() {
numLocs++
if loc.Start() != 0 {
t.Errorf("expected loc start to be 0, got %d", loc.Start())
}
@ -328,6 +335,9 @@ func TestSingle(t *testing.T) {
t.Errorf("expect loc array pos to be nil, got %v", loc.ArrayPositions())
}
}
if numLocs != nextPosting.Frequency() {
t.Errorf("expected %d locations, got %d", nextPosting.Frequency(), numLocs)
}
nextPosting, err = postingsItr.Next()
}