Skip to content

Commit

Permalink
confirm rankers produce different scores
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Jun 11, 2020
1 parent eb0416f commit f96f37a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions processor/result_ranker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ func TestRankResultsTFIDFComparison(t *testing.T) {
}
}

func TestRankResultsRankerComparison(t *testing.T) {
ml1 := map[string][][]int{}
ml1["example"] = [][]int{{1}, {2}, {3}}

s := []*fileJob{
{
MatchLocations: ml1,
Location: "/test/other.go",
Bytes: 12,
},
}

s = rankResultsTFIDF(2, s, calculateDocumentFrequency(s), true)
score1 := s[0].Score

s = rankResultsTFIDF(2, s, calculateDocumentFrequency(s), false)
score2 := s[0].Score

s = rankResultsBM25(2, s, calculateDocumentFrequency(s))
score3 := s[0].Score

if score1 == score2 || score1 == score3 || score2 == score3 {
t.Error("expected scores to be slightly different")
}
}

func TestRankResultsLocation(t *testing.T) {
ml := map[string][][]int{}
ml["test"] = [][]int{{1}, {2}, {3}}
Expand Down

0 comments on commit f96f37a

Please sign in to comment.