Package com.spertus.jacquard.coverage
Class LinearScorer
java.lang.Object
com.spertus.jacquard.coverage.Scorer
com.spertus.jacquard.coverage.LinearScorer
- Direct Known Subclasses:
LinearBranchScorer,LinearLineScorer
A code coverage scorer that uses a linear equation to weight the branch
coverage and line coverage.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionLinearScorer(double branchWeight, double maxPoints) Creates a scorer that scales the branch percentage by the specified weight, which must be in the range [0, 1].LinearScorer(double branchWeight, double lineWeight, double maxPoints) Creates a scorer that scales the branch percentage and line percentage by the specified weights, which must both be in the range [0, 1] and add up to one. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetMessage(double branchCoverage, double lineCoverage) Gets a message summarizing information about the coverage being tested.Creates a result based on information generated by Jacoco.doublescore(double branchCoverage, double lineCoverage) Converts branch coverage and line coverage ratios into a score.
-
Constructor Details
-
LinearScorer
public LinearScorer(double branchWeight, double lineWeight, double maxPoints) Creates a scorer that scales the branch percentage and line percentage by the specified weights, which must both be in the range [0, 1] and add up to one.- Parameters:
branchWeight- how much to weight the branch coverage percentagelineWeight- how much to weight the line coverage percentagemaxPoints- the maximum number of points- Throws:
ClientException- if either weight is not in the range [0, 1] or they do not add up to 1
-
LinearScorer
public LinearScorer(double branchWeight, double maxPoints) Creates a scorer that scales the branch percentage by the specified weight, which must be in the range [0, 1]. The remainder of the score is determined by scaling the line percentage by (1-branchWeight).- Parameters:
branchWeight- how much to weight the branch coverage percentagemaxPoints- the maximum number of points- Throws:
ClientException- if either weight is not in the range [0, 1]
-
-
Method Details
-
score
public double score(double branchCoverage, double lineCoverage) Description copied from class:ScorerConverts branch coverage and line coverage ratios into a score. -
getResult
Description copied from class:ScorerCreates a result based on information generated by Jacoco. -
getMessage
Gets a message summarizing information about the coverage being tested.- Parameters:
branchCoverage- the branch coverage ratio [0, 1]lineCoverage- the line coverage ratio [0, 1]- Returns:
- a message
-