Skip to content

Commit

Permalink
add tarantula
Browse files Browse the repository at this point in the history
  • Loading branch information
andre15silva committed Feb 21, 2024
1 parent adadaac commit 7ccd693
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;

Check warning on line 14 in src/main/java/fr/spoonlabs/flacoco/localization/spectrum/formulas/TarantulaFormula.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/fr/spoonlabs/flacoco/localization/spectrum/formulas/TarantulaFormula.java#L14

Added line #L14 was not covered by tests
}

return failingTerm / (passingTerm + failingTerm);

Check warning on line 17 in src/main/java/fr/spoonlabs/flacoco/localization/spectrum/formulas/TarantulaFormula.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/fr/spoonlabs/flacoco/localization/spectrum/formulas/TarantulaFormula.java#L17

Added line #L17 was not covered by tests
}

}

0 comments on commit 7ccd693

Please sign in to comment.