Skip to content

Commit

Permalink
fix core tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Nov 28, 2024
1 parent bcbd7db commit c69818a
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public void test_getDistributions() {
public void test_getTopComparisons() {
// given
JPlagResult jPlagResult = createJPlagResult(distribution(EXPECTED_AVG_DISTRIBUTION), distribution(EXPECTED_MAX_DISTRIBUTION),
comparison(submission("1", 22), submission("2", 30), .7, .8, .5, new int[] {9, 3, 1}),
comparison(submission("3", 202), submission("4", 134), .3, .9, .01, new int[] {1, 15, 23, 3}));
comparison(submission("1", 22), submission("2", 30), .7, .8, .5, .5, new int[] {9, 3, 1}),
comparison(submission("3", 202), submission("4", 134), .3, .9, .01, .25, new int[] {1, 15, 23, 3}));

// when
List<TopComparison> result = metricMapper.getTopComparisons(jPlagResult);
Expand Down Expand Up @@ -78,12 +78,12 @@ private CreateSubmission submission(String name) {
}

private Comparison comparison(CreateSubmission submission1, CreateSubmission submission2, double similarity, double maxSimilarity,
double minSimilarity, int[] matchLengths) {
return new Comparison(submission1, submission2, similarity, maxSimilarity, minSimilarity, matchLengths);
double minSimilarity, double symSimilarity, int[] matchLengths) {
return new Comparison(submission1, submission2, similarity, maxSimilarity, minSimilarity, symSimilarity, matchLengths);
}

private Comparison comparison(CreateSubmission submission1, CreateSubmission submission2, double similarity, double maxSimilarity) {
return comparison(submission1, submission2, similarity, maxSimilarity, 0, new int[0]);
return comparison(submission1, submission2, similarity, maxSimilarity, 0, 0, new int[0]);
}

private JPlagResult createJPlagResult(int[] avgDistribution, int[] maxDistribution, Comparison... createComparisonsDto) {
Expand All @@ -110,6 +110,7 @@ private JPlagResult createJPlagResult(int[] avgDistribution, int[] maxDistributi
doReturn(comparisonDto.similarity).when(mockedComparison).similarity();
doReturn(comparisonDto.maxSimilarity).when(mockedComparison).maximalSimilarity();
doReturn(comparisonDto.minSimilarity).when(mockedComparison).minimalSimilarity();
doReturn(comparisonDto.symSimilarity).when(mockedComparison).symmetricSimilarity();
List<Match> matches = createMockMatchList(comparisonDto.matchLengths);
doReturn(matches).when(mockedComparison).matches();
doReturn(matches.stream().mapToInt(Match::length).sum()).when(mockedComparison).getNumberOfMatchedTokens();
Expand All @@ -131,7 +132,7 @@ private List<Match> createMockMatchList(int[] matchLengths) {
}

private record Comparison(CreateSubmission submission1, CreateSubmission submission2, double similarity, double maxSimilarity,
double minSimilarity, int[] matchLengths) {
double minSimilarity, double symSimilarity, int[] matchLengths) {
}

private record CreateSubmission(String name, int tokenCount) {
Expand Down

0 comments on commit c69818a

Please sign in to comment.