Skip to content

Commit

Permalink
test to confirm tfidf work differently
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Jun 11, 2020
1 parent c0fc7fc commit eb0416f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions processor/result_ranker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,29 @@ func TestRankResultsTFIDFTraditional(t *testing.T) {
}
}

func TestRankResultsTFIDFComparison(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

if score1 == score2 {
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 eb0416f

Please sign in to comment.