Skip to content

Commit d048387

Browse files
committed
Merge pull request seiflotfy#7 from glaslos/fix_test
fixed imports and generalized test
2 parents d7e0874 + 1e38783 commit d048387

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

cuckoofilter_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,26 @@ func TestInsertion(t *testing.T) {
1111

1212
cf := NewCuckooFilter(1000000)
1313

14-
fd, err := os.Open("/usr/share/dict/web2")
14+
fd, err := os.Open("/usr/share/dict/words")
1515
if err != nil {
1616
fmt.Println(err.Error())
1717
return
1818
}
1919
scanner := bufio.NewScanner(fd)
2020

2121
var values [][]byte
22+
var lineCount uint
2223
for scanner.Scan() {
2324
s := []byte(scanner.Text())
24-
cf.InsertUnique(s)
25+
if cf.InsertUnique(s) {
26+
lineCount++
27+
}
2528
values = append(values, s)
2629
}
2730

2831
count := cf.Count()
29-
if count != 235081 {
30-
t.Errorf("Expected count = 235081, instead count = %d", count)
32+
if count != lineCount {
33+
t.Errorf("Expected count = %d, instead count = %d", lineCount, count)
3134
}
3235

3336
for _, v := range values {

util_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
"testing"
88

9-
"code.google.com/p/gofarmhash"
9+
"github.com/leemcloughlin/gofarmhash"
1010
)
1111

1212
func TestIndexAndFP(t *testing.T) {
@@ -23,7 +23,7 @@ func TestIndexAndFP(t *testing.T) {
2323
}
2424

2525
func TestFarmhash(t *testing.T) {
26-
fd, err := os.Open("/usr/share/dict/web2")
26+
fd, err := os.Open("/usr/share/dict/words")
2727
if err != nil {
2828
fmt.Println(err.Error())
2929
return

0 commit comments

Comments
 (0)