-
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.
fix formula types and add tarantula (#243)
* fix formula types * add tarantula * add test for tarantula * fix tarantula formula * add math70 test for tarantula
- Loading branch information
1 parent
58d17ea
commit c9fef4f
Showing
6 changed files
with
123 additions
and
22 deletions.
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
21 changes: 3 additions & 18 deletions
21
src/main/java/fr/spoonlabs/flacoco/localization/spectrum/formulas/Formula.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 |
---|---|---|
@@ -1,23 +1,8 @@ | ||
/** | ||
* Copyright (C) 2019 GZoltar contributors. | ||
* | ||
* This file is part of GZoltar. | ||
* | ||
* GZoltar is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
* Lesser General Public License as published by the Free Software Foundation, either version 3 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* GZoltar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | ||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License along with GZoltar. If | ||
* not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package fr.spoonlabs.flacoco.localization.spectrum.formulas; | ||
|
||
public interface Formula { | ||
|
||
public double compute(int nPassingNotExecuting, int nFailingNotExecuting, int nPassingExecuting, | ||
int nFailingExecuting); | ||
public double compute(double nPassingNotExecuting, double nFailingNotExecuting, double nPassingExecuting, | ||
double nFailingExecuting); | ||
|
||
} |
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 + failingTerm == 0) { | ||
return 0; | ||
} | ||
|
||
return failingTerm / (passingTerm + failingTerm); | ||
} | ||
|
||
} |
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
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