Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Upgrade Pitest to 1.15.8 #224

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*/
public enum Mutators {
CUSTOM("Custom mutator data", "This is used for the custom settings of mutators and should not be seen by the user."),
OLD_DEFAULTS("Old defaults", "&Old default Mutators"),
DEFAULTS("Defaults", "&Default Mutators"),
STRONGER("Stronger defaults", "&Stronger Mutators"),
ALL("All", "&All Mutators"),
Expand All @@ -49,48 +48,18 @@ public enum Mutators {
NON_VOID_METHOD_CALLS("Non Void Method Call", "Removes method calls to non void methods. Their return value is replaced by the Java Default Value for that specific type"),
PRIMITIVE_RETURNS("Primite Returns", "Replaces int, short, long, char, float and double return values with 0", true),
REMOVE_CONDITIONALS("Remove Conditionals", "Removes all conditionals statements such that the guarded statements always execute"),
REMOVE_CONDITIONALS_EQ_IF("Remove Equal Conditionals If", "Remove equal conditions and replace with true, execute if part"),
REMOVE_CONDITIONALS_EQ_ELSE("Remove Equal Conditionals Else", "Remove equal conditions and replace with false, execute else part"),
REMOVE_CONDITIONALS_ORD_IF("Remove Order Checks If", "Remove order conditions and replace with true, execute if part"),
REMOVE_CONDITIONALS_ORD_ELSE("Remove Order Checks Else", "Remove order conditions and replace with false, execute else part"),
REMOVE_CONDITIONALS_EQUAL_IF("Remove Equal Conditionals If", "Remove equal conditions and replace with true, execute if part"),
REMOVE_CONDITIONALS_EQUAL_ELSE("Remove Equal Conditionals Else", "Remove equal conditions and replace with false, execute else part"),
REMOVE_CONDITIONALS_ORDER_IF("Remove Order Checks If", "Remove order conditions and replace with true, execute if part"),
REMOVE_CONDITIONALS_ORDER_ELSE("Remove Order Checks Else", "Remove order conditions and replace with false, execute else part"),
REMOVE_INCREMENTS("Remove Increments", "Removes local variable increments"),
EXPERIMENTAL_ARGUMENT_PROPAGATION("Experimentation Argument Propagation", "Replaces method call with one of its parameters of matching type"),
EXPERIMENTAL_BIG_INTEGER("Experimental Big Integer", "Swaps big integer methods"),
EXPERIMENTAL_BIG_DECIMAL("Experimental Big Decimal", "Swaps big decimal methods"),
EXPERIMENTAL_NAKED_RECEIVER("Experimental Naked Receiver", "Replaces method call with a naked receiver"),
EXPERIMENTAL_MEMBER_VARIABLE("Experimental Member Variable", "Removes assignments to member variables. Can even remove assignments to final members. The members will be initialized with their Java Default Value"),
EXPERIMENTAL_SWITCH("Experimental Switch", "Finds the first label within a switch statement that differs from the default label. Mutates the switch statement by replacing the default label (wherever it is used) with this label. All the other labels are replaced by the default one"),
ABS("Negation", "Replaces any use of a numeric variable (local variable, field, array cell) with its negation"),
AOR("Arithmetic Operator Replacement", "Like the Math mutator, replaces binary arithmetic operations for either integer or floating-point arithmetic with another operation"),
AOR_1("Arithmetic Operator Replacement 1", "+ -> -, - -> +, * -> /, / -> *, % -> *"),
AOR_2("Arithmetic Operator Replacement 2", "+ -> *, - -> *, * -> %, / -> %, % -> /"),
AOR_3("Arithmetic Operator Replacement 3", "+ -> /, - -> /, * -> +, / -> +, % -> +"),
AOR_4("Arithmetic Operator Replacement 4", "+ -> %, - -> %, * -> -, / -> -, % -> -"),
AOD("Arithmetic Operator Deletion", "Replaces an arithmetic operation with one of its members"),
AOD1("Arithmetic Operator Deletion 1", "int a = b + c; -> int a = b;"),
AOD2("Arithmetic Operator Deletion 2", "int a = b + c; -> int a = c;"),
CRCR("Constant Replacement", "Like the Inline Constant mutator, mutates inline constant"),
CRCR1("Constant Replacement 1", "Replaces the inline constant c with 1"),
CRCR2("Constant Replacement 2", "Replaces the inline constant c with 0"),
CRCR3("Constant Replacement 3", "Replaces the inline constant c with -1"),
CRCR4("Constant Replacement 4", "Replaces the inline constant c with -c"),
CRCR5("Constant Replacement 5", "Replaces the inline constant c with c+1"),
CRCR6("Constant Replacement 6", "Replaces the inline constant c with c-1"),
OBBN("Bitwise Operator", "Mutates bitwise and (&) and or (|)"),
OBBN1("Bitwise Operator 1", "a & b; -> a | b;"),
OBBN2("Bitwise Operator 2", "a & b; -> a;"),
OBBN3("Bitwise Operator 3", "a & b; -> b;"),
ROR("Relational Operator Replacement", "Replaces a relational operator with another one"),
ROR1("Relational Operator Replacement 1", "< -> <=, <= -> <, > -> <, >= -> <, == -> <, != -> <"),
ROR2("Relational Operator Replacement 2", "< -> >, <= -> >, > -> <=, >= -> <=, == -> <=, != -> <="),
ROR3("Relational Operator Replacement 3", "< -> >=, <= -> >=, > -> >=, >= -> >, == -> >, != -> >"),
ROR4("Relational Operator Replacement 4", "< -> ==, <= -> ==, > -> ==, >= -> ==, == -> >=, != -> >="),
ROR5("Relational Operator Replacement 5", "< -> !=, <= -> !=, > -> !=, >= -> !=, == -> !=, != -> =="),
// XXX REMOVE_SWITCH("",""), no data on the page of pitest
UOI1("Unary Operator Insertion 1", "Inserts a unary operator to a variable call from the variable a to a++"),
UOI2("Unary Operator Insertion 2", "Inserts a unary operator to a variable call from the variable a to a--"),
UOI3("Unary Operator Insertion 3", "Inserts a unary operator to a variable call from the variable a to ++a"),
UOI4("Unary Operator Insertion 4", "Inserts a unary operator to a variable call from the variable a to --a"),
UOI("Unary Operator Insertion", "Inserts a unary operator (increment or decrement) to a variable call. Affects local variables, array variables, fields and parameters");
REMOVE_SWITCH("Remove Switch", "Finds the first switch label that differs from the default label, then replaces the default label with this label, and all other labels are replaced with the default one");

/**
* Descriptor which is used to display the name of this mutator in a table
Expand Down Expand Up @@ -132,7 +101,6 @@ public static List<Mutators> getMainGroup() {
mainGroup.add(DEFAULTS);
mainGroup.add(STRONGER);
mainGroup.add(ALL);
mainGroup.add(OLD_DEFAULTS);
return mainGroup;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void handleMutationResult(ClassMutationResults results) {
result.getKillingTest().ifPresent(mutation::setKillingTest);
mutation.setLineNumber(BigInteger.valueOf(details.getLineNumber()));
mutation.setMutatedClass(details.getClassName().asJavaName());
mutation.setMutatedMethod(details.getMethod().name());
mutation.setMutatedMethod(details.getMethod());
mutation.setMutator(details.getMutator());
mutation.setSourceFile(details.getFilename());
mutation.setStatus(DetectionStatusCoverter.convert(result.getStatus()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Collection;
import java.util.Objects;

import org.pitest.classinfo.ClassInfo;
import org.pitest.mutationtest.ClassMutationResults;
import org.pitest.mutationtest.MutationResult;

Expand All @@ -43,13 +42,13 @@ private ClassSummary(String className, Coverage lineCoverage, Coverage mutationC
this.mutationCoverage = mutationCoverage;
}

public static ClassSummary from(ClassMutationResults results, ClassInfo classInfo, int linesCovered) {
public static ClassSummary from(ClassMutationResults results, int numberOfCodeLines, int linesCovered) {
Collection<MutationResult> mutations = results.getMutations();
int totalMutations = mutations.size();
int survivedMutations = (int) mutations.stream()
.filter(m -> !m.getStatus().isDetected())
.count();
Coverage lineCoverage = Coverage.from(linesCovered, classInfo.getNumberOfCodeLines());
Coverage lineCoverage = Coverage.from(linesCovered, numberOfCodeLines);
Coverage mutationCoverage = Coverage.from(totalMutations - survivedMutations, totalMutations);

return from(results.getMutatedClass().asJavaName(), lineCoverage, mutationCoverage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
import java.util.Collections;
import java.util.List;

import org.pitest.classinfo.ClassInfo;
import org.pitest.classinfo.ClassName;
import org.pitest.coverage.CoverageDatabase;
import org.pitest.coverage.ReportCoverage;
import org.pitest.mutationtest.ClassMutationResults;
import org.pitest.mutationtest.MutationResultListener;
import org.pitest.pitclipse.runner.results.Dispatcher;
Expand All @@ -37,7 +36,7 @@ public class SummaryResultListener implements MutationResultListener {

private SummaryResult result = SummaryResult.EMPTY;
private final Dispatcher<SummaryResult> dispatcher;
private final CoverageDatabase coverage;
private final ReportCoverage coverage;

/**
* Creates a new listener that will compute a summary of the whole PIT analysis.
Expand All @@ -47,7 +46,7 @@ public class SummaryResultListener implements MutationResultListener {
* @param coverage
* The coverage computed from the tests.
*/
public SummaryResultListener(Dispatcher<SummaryResult> dispatcher, CoverageDatabase coverage) {
public SummaryResultListener(Dispatcher<SummaryResult> dispatcher, ReportCoverage coverage) {
this.dispatcher = dispatcher;
this.coverage = coverage;
}
Expand All @@ -59,12 +58,14 @@ public void runStart() {

@Override
public void handleMutationResult(ClassMutationResults results) {
List<ClassName> classUnderTest = Collections.singletonList(results.getMutatedClass());
int coveredLines = coverage.getNumberOfCoveredLines(classUnderTest);
for (ClassInfo info : coverage.getClassInfo(classUnderTest)) {
ClassSummary classSummary = ClassSummary.from(results, info, coveredLines);
result = result.update(classSummary);
}
List<ClassName> classesUnderTest = Collections.singletonList(results.getMutatedClass());

for (ClassName classUnderTest : classesUnderTest) {
int numberOfCoveredLines = coverage.getCoveredLines(classUnderTest).size();
int numberOfLines = coverage.getCodeLinesForClass(classUnderTest).getNumberOfCodeLines();
ClassSummary classSummary = ClassSummary.from(results, numberOfLines, numberOfCoveredLines);
result = result.update(classSummary);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: pitest-junit5-plugin
Bundle-SymbolicName: org.pitest.pitest-junit5-plugin
Bundle-Version: 0.14.0.qualifier
Bundle-Version: 1.2.1.qualifier
Bundle-ClassPath: lib/pitest-junit5-plugin-sources.jar,
lib/pitest-junit5-plugin-javadoc.jar,
lib/pitest-junit5-plugin.jar,
Expand Down
4 changes: 2 additions & 2 deletions bundles/org.pitest.pitest-junit5-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
</parent>

<artifactId>org.pitest.pitest-junit5-plugin</artifactId>
<version>0.14.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<description>Wraps Pitest JUnit 5 Plugin's JAR as an Eclipse plug-in</description>

<properties>
<!-- The version of the 'pitest-junit5-plugin' deployed in Maven.
We cannot use a bare ${project.version} as in org.pitest because
Tycho packs this project with the version "0.14.0" -->
<project.maven.version>0.14</project.maven.version>
<project.maven.version>1.2.1</project.maven.version>
</properties>

<dependencies>
Expand Down
5 changes: 1 addition & 4 deletions bundles/org.pitest/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Pitest
Bundle-SymbolicName: org.pitest
Bundle-Version: 1.6.8.qualifier
Bundle-Version: 1.15.8.qualifier
Bundle-ClassPath: lib/pitest-command-line-javadoc.jar,
lib/pitest-command-line-sources.jar,
lib/pitest-command-line.jar,
Expand Down Expand Up @@ -34,7 +34,6 @@ Export-Package: joptsimple,
org.pitest.coverage.analysis,
org.pitest.coverage.execute,
org.pitest.coverage.export,
org.pitest.dependency,
org.pitest.extension.common,
org.pitest.functional,
org.pitest.functional.predicate,
Expand All @@ -60,7 +59,6 @@ Export-Package: joptsimple,
org.pitest.mutationtest.engine.gregor.config,
org.pitest.mutationtest.engine.gregor.mutators,
org.pitest.mutationtest.engine.gregor.mutators.experimental,
org.pitest.mutationtest.engine.gregor.mutators.rv,
org.pitest.mutationtest.execute,
org.pitest.mutationtest.filter,
org.pitest.mutationtest.incremental,
Expand Down Expand Up @@ -98,7 +96,6 @@ Export-Package: joptsimple,
org.pitest.testapi,
org.pitest.testapi.execute,
org.pitest.testapi.execute.containers,
org.pitest.testng,
org.pitest.util,
sun.pitest
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Expand Down
4 changes: 2 additions & 2 deletions bundles/org.pitest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
</parent>

<artifactId>org.pitest</artifactId>
<version>1.6.8-SNAPSHOT</version>
<version>1.15.8-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<description>Wraps Pitest JAR as an Eclipse plug-in</description>

<properties>
<pitclipse-version>1.6.8</pitclipse-version>
<pitclipse-version>1.15.8</pitclipse-version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,68 +41,35 @@ private String getPitMutatorsAsString() {
}

private String getExpectedMutatorsAsString() {
return "INVERT_NEGS\n"
+ "RETURN_VALS\n"
+ "INLINE_CONSTS\n"
+ "MATH\n"
+ "VOID_METHOD_CALLS\n"
+ "NEGATE_CONDITIONALS\n"
+ "CONDITIONALS_BOUNDARY\n"
+ "INCREMENTS\n"
+ "REMOVE_INCREMENTS\n"
+ "NON_VOID_METHOD_CALLS\n"
+ "CONSTRUCTOR_CALLS\n"
+ "REMOVE_CONDITIONALS_EQ_IF\n"
+ "REMOVE_CONDITIONALS_EQ_ELSE\n"
+ "REMOVE_CONDITIONALS_ORD_IF\n"
+ "REMOVE_CONDITIONALS_ORD_ELSE\n"
+ "REMOVE_CONDITIONALS\n"
+ "TRUE_RETURNS\n"
+ "FALSE_RETURNS\n"
+ "PRIMITIVE_RETURNS\n"
+ "EMPTY_RETURNS\n"
+ "NULL_RETURNS\n"
+ "RETURNS\n"
+ "EXPERIMENTAL_MEMBER_VARIABLE\n"
+ "EXPERIMENTAL_SWITCH\n"
+ "EXPERIMENTAL_ARGUMENT_PROPAGATION\n"
+ "EXPERIMENTAL_NAKED_RECEIVER\n"
+ "EXPERIMENTAL_BIG_INTEGER\n"
+ "AOR_1\n"
+ "AOR_2\n"
+ "AOR_3\n"
+ "AOR_4\n"
+ "ABS\n"
+ "AOD1\n"
+ "AOD2\n"
+ "CRCR1\n"
+ "CRCR2\n"
+ "CRCR3\n"
+ "CRCR4\n"
+ "CRCR5\n"
+ "CRCR6\n"
+ "OBBN1\n"
+ "OBBN2\n"
+ "OBBN3\n"
+ "ROR1\n"
+ "ROR2\n"
+ "ROR3\n"
+ "ROR4\n"
+ "ROR5\n"
+ "UOI1\n"
+ "UOI2\n"
+ "UOI3\n"
+ "UOI4\n"
+ "REMOVE_SWITCH\n"
+ "OLD_DEFAULTS\n"
+ "STRONGER\n"
+ "ALL\n"
+ "DEFAULTS\n"
+ "AOR\n"
+ "AOD\n"
+ "CRCR\n"
+ "OBBN\n"
+ "ROR\n"
+ "UOI\n";
return "REMOVE_CONDITIONALS_ORDER_IF\n"
+ "REMOVE_CONDITIONALS\n"
+ "REMOVE_CONDITIONALS_EQUAL_IF\n"
+ "TRUE_RETURNS\n"
+ "REMOVE_CONDITIONALS_EQUAL_ELSE\n"
+ "VOID_METHOD_CALLS\n"
+ "PRIMITIVE_RETURNS\n"
+ "FALSE_RETURNS\n"
+ "NON_VOID_METHOD_CALLS\n"
+ "INVERT_NEGS\n"
+ "CONDITIONALS_BOUNDARY\n"
+ "REMOVE_CONDITIONALS_ORDER_ELSE\n"
+ "DEFAULTS\n"
+ "EXPERIMENTAL_SWITCH\n"
+ "RETURNS\n"
+ "EXPERIMENTAL_MEMBER_VARIABLE\n"
+ "NULL_RETURNS\n"
+ "EXPERIMENTAL_BIG_DECIMAL\n"
+ "MATH\n"
+ "EXPERIMENTAL_BIG_INTEGER\n"
+ "INCREMENTS\n"
+ "EXPERIMENTAL_ARGUMENT_PROPAGATION\n"
+ "EXPERIMENTAL_NAKED_RECEIVER\n"
+ "CONSTRUCTOR_CALLS\n"
+ "REMOVE_SWITCH\n"
+ "INLINE_CONSTS\n"
+ "STRONGER\n"
+ "REMOVE_INCREMENTS\n"
+ "NEGATE_CONDITIONALS\n"
+ "EMPTY_RETURNS\n";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.pitest.mutationtest.MutationResult;
import org.pitest.mutationtest.MutationStatusTestPair;
import org.pitest.mutationtest.engine.Location;
import org.pitest.mutationtest.engine.MethodName;
import org.pitest.mutationtest.engine.MutationDetails;
import org.pitest.mutationtest.engine.MutationIdentifier;
import org.pitest.pitclipse.example.Foo;
Expand All @@ -48,7 +47,7 @@ class ListenerTestFixture {
private static final ObjectFactory JAXB_OBJECT_FACTORY = new ObjectFactory();

public static ClassMutationResults aClassMutationResult() {
Location location = new Location(ClassName.fromClass(Foo.class), MethodName.fromString("doFoo"), "doFoo");
Location location = new Location(ClassName.fromClass(Foo.class), "doFoo", "doFoo");
MutationIdentifier id = new MutationIdentifier(location, 1, "SomeMutator");
MutationDetails md = new MutationDetails(id, "org/pitest/pitclipse/example/Foo.java", TEST_FACTORY.aString(),
20, TEST_FACTORY.aRandomInt());
Expand Down
Loading
Loading