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

Fix: run example from jar FIX #919 #934

Merged
merged 5 commits into from
Dec 4, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: add test-projects in dspot's resources
danglotb committed Dec 4, 2019
commit 0532342f2e08ea52e7a245e888d141060c6a5aec
20 changes: 20 additions & 0 deletions dspot/src/main/resources/test-projects/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
description = """
Test Gradle project for DSpot test cases

Project name: dspot.gradle.java.example

"""
apply plugin: 'java'

version = "0.0.1"
sourceCompatibility = 1.7

repositories {
mavenCentral()
}

dependencies {
compile 'org.apache.logging.log4j:log4j-api:2.8.2'
compile 'org.apache.logging.log4j:log4j-core:2.8.2'
testCompile 'junit:junit:4.12'
}
25 changes: 25 additions & 0 deletions dspot/src/main/resources/test-projects/originalpit/mutations.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator,<init>,27,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator,<init>,23,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator,<init>,24,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.MathMutator,<init>,24,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator,<init>,27,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator,<init>,24,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator,charAt,12,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator,charAt,15,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator,charAt,18,KILLED,example.TestSuiteExample.test4(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.MathMutator,charAt,18,KILLED,example.TestSuiteExample.test4(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator,charAt,12,KILLED,example.TestSuiteExample.test3(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator,charAt,15,KILLED,example.TestSuiteExample.test4(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator,charAt,15,KILLED,example.TestSuiteExample.test7(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator,charAt,16,KILLED,example.TestSuiteExample.test3(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator,charAt,18,KILLED,example.TestSuiteExample.test4(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator,charAt,18,KILLED,example.TestSuiteExample.test4(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_ELSE,charAt,12,SURVIVED,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_ELSE,charAt,15,KILLED,example.TestSuiteExample.test7(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_IF,charAt,12,KILLED,example.TestSuiteExample.test3(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_IF,charAt,15,KILLED,example.TestSuiteExample.test4(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator,charAt,16,KILLED,example.TestSuiteExample.test3(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator,charAt,18,KILLED,example.TestSuiteExample.test4(example.TestSuiteExample)
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator,charAt,13,NO_COVERAGE,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator,charAt,13,NO_COVERAGE,none
Example.java,example.Example,org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator,charAt,13,NO_COVERAGE,none
37 changes: 37 additions & 0 deletions dspot/src/main/resources/test-projects/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>test-projects</name>

<properties>
<default.encoding>UTF-8</default.encoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package example;

public class Example {

/*
* Return the index char of s
* or the last if index > s.length
* or the first if index < 0
*/
public char charAt(String s, int index){

if ( index <= 0 )
return s.charAt(0);

if ( index < s.length() )
return s.charAt(index);

return s.charAt(s.length()-1);
}

public Example() {
int variableInsideConstructor;
variableInsideConstructor = 15;
index = 2 * variableInsideConstructor;
}

private int index = 419382;
private static String s = "Overloading field name with parameter name";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package example;

import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

/**
* created by Benjamin DANGLOT
* [email protected]
* on 26/11/18
*/
@RunWith(Parameterized.class)
public class ParametrizedTestSuiteExample {

private String string;

public ParametrizedTestSuiteExample(String string) {
this.string = string;
}


@Parameterized.Parameters
public static Collection<Object[]> strategies() {
return Arrays.asList(
new Object[]{
"abcd"
},
new Object[]{
"abcd"
}
);
}

@org.junit.Test
public void test3() {
example.Example ex = new example.Example();
java.lang.String s = "abcd";
org.junit.Assert.assertEquals('d', ex.charAt(s, ((s.length()) - 1)));
}

@org.junit.Test
public void test4() {
example.Example ex = new example.Example();
java.lang.String s = "abcd";
org.junit.Assert.assertEquals('d', ex.charAt(s, 12));
}

@org.junit.Test
public void test7() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('c', ex.charAt("abcd", 2));
}

@org.junit.Test
public void test8() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('b', ex.charAt("abcd", 1));
}

@org.junit.Test
public void test9() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('f', ex.charAt("abcdefghijklm", 5));
}

@org.junit.Test
public void test2() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('d', ex.charAt("abcd", 3));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


package example;


public class TestResources {

public static int integer = 23;

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@


package example;


public class TestSuiteExample {

@org.junit.Test
public void test3() {
example.Example ex = new example.Example();
java.lang.String s = "abcd";
org.junit.Assert.assertEquals('d', ex.charAt(s, ((s.length()) - 1)));
}

@org.junit.Test
public void test4() {
example.Example ex = new example.Example();
java.lang.String s = "abcd";
org.junit.Assert.assertEquals('d', ex.charAt(s, 12));
}

@org.junit.Test
public void test7() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('c', ex.charAt("abcd", 2));
}

@org.junit.Test
public void test8() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('b', ex.charAt("abcd", 1));
}

@org.junit.Test
public void test9() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('f', ex.charAt("abcdefghijklm", 5));
}

@org.junit.Test
public void test2() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('d', ex.charAt("abcd", 3));
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@


package example;


public class TestSuiteExample2 {

private static int integer = example.TestResources.integer;

@org.junit.Test
public void test3() {
example.Example ex = new example.Example();
java.lang.String s = "abcd";
org.junit.Assert.assertEquals('d', ex.charAt(s, ((s.length()) - 1)));
}

@org.junit.Test
public void test4() {
example.Example ex = new example.Example();
java.lang.String s = "abcd";
org.junit.Assert.assertEquals('d', ex.charAt(s, 12));
}

@org.junit.Test
public void test7() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('c', ex.charAt("abcd", 2));
}

@org.junit.Test
public void test8() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('b', ex.charAt("abcd", 1));
}

@org.junit.Test
public void test9() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('f', ex.charAt("abcdefghijklm", 5));
}

@org.junit.Test
public void test2() {
example.Example ex = new example.Example();
org.junit.Assert.assertEquals('d', ex.charAt("abcd", 3));
}
}