-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05efb3d
commit babe200
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/fr/spoonlabs/flacoco/localization/spectrum/formulas/TarantulaFormula.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package fr.spoonlabs.flacoco.localization.spectrum.formulas; | ||
|
||
public class TarantulaFormula implements Formula { | ||
|
||
public TarantulaFormula() { | ||
} | ||
|
||
public double compute(double nPassingNotExecuting, double nFailingNotExecuting, double nPassingExecuting, | ||
double nFailingExecuting) { | ||
double passingTerm = nPassingNotExecuting + nPassingExecuting == 0 ? 0 : nPassingExecuting / (nPassingNotExecuting + nPassingExecuting); | ||
double failingTerm = nFailingNotExecuting + nFailingExecuting == 0 ? 0 : nFailingExecuting / (nFailingNotExecuting + nFailingExecuting); | ||
|
||
if (passingTerm == 0 || failingTerm == 0) { | ||
return 0; | ||
} | ||
|
||
return passingTerm / (passingTerm + failingTerm); | ||
} | ||
|
||
} |