Skip to content

Commit

Permalink
add tarantula
Browse files Browse the repository at this point in the history
  • Loading branch information
andre15silva committed May 24, 2023
1 parent 05efb3d commit babe200
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import fr.spoonlabs.flacoco.localization.spectrum.formulas.Formula;
import fr.spoonlabs.flacoco.localization.spectrum.formulas.OchiaiFormula;
import fr.spoonlabs.flacoco.localization.spectrum.formulas.TarantulaFormula;

public enum SpectrumFormula {

OCHIAI(new OchiaiFormula());
OCHIAI(new OchiaiFormula()),
TARANTULA(new TarantulaFormula());

private final Formula formula;

Expand Down
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);
}

}

0 comments on commit babe200

Please sign in to comment.