Search in sources :

Example 1 with ExceptionCoverageSuiteFitness

use of org.evosuite.coverage.exception.ExceptionCoverageSuiteFitness in project evosuite by EvoSuite.

the class CompositionalFitnessSystemTest method testCompositionalGetFitnessForSeveralFunctions.

@Test
public void testCompositionalGetFitnessForSeveralFunctions() {
    Properties.TARGET_CLASS = Compositional.class.getCanonicalName();
    TestSuiteChromosome c = new TestSuiteChromosome();
    MethodTraceCoverageSuiteFitness f1 = new MethodTraceCoverageSuiteFitness();
    c.addFitness(f1);
    c.setFitness(f1, ANY_DOUBLE_1);
    MethodNoExceptionCoverageSuiteFitness f2 = new MethodNoExceptionCoverageSuiteFitness();
    c.addFitness(f2);
    c.setFitness(f2, ANY_DOUBLE_2);
    OutputCoverageSuiteFitness f3 = new OutputCoverageSuiteFitness();
    c.addFitness(f3);
    c.setFitness(f3, ANY_DOUBLE_3);
    ExceptionCoverageSuiteFitness f4 = new ExceptionCoverageSuiteFitness();
    c.addFitness(f4);
    c.setFitness(f4, ANY_DOUBLE_4);
    double sum = ANY_DOUBLE_1 + ANY_DOUBLE_2 + ANY_DOUBLE_3 + ANY_DOUBLE_4;
    assertEquals(sum, c.getFitness(), 0.001);
}
Also used : OutputCoverageSuiteFitness(org.evosuite.coverage.io.output.OutputCoverageSuiteFitness) MethodNoExceptionCoverageSuiteFitness(org.evosuite.coverage.method.MethodNoExceptionCoverageSuiteFitness) ExceptionCoverageSuiteFitness(org.evosuite.coverage.exception.ExceptionCoverageSuiteFitness) Compositional(com.examples.with.different.packagename.Compositional) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) MethodTraceCoverageSuiteFitness(org.evosuite.coverage.method.MethodTraceCoverageSuiteFitness) MethodNoExceptionCoverageSuiteFitness(org.evosuite.coverage.method.MethodNoExceptionCoverageSuiteFitness) Test(org.junit.Test)

Example 2 with ExceptionCoverageSuiteFitness

use of org.evosuite.coverage.exception.ExceptionCoverageSuiteFitness in project evosuite by EvoSuite.

the class ChromosomeTest method testCompositionalGetFitnessForSeveralFunctions.

@Test
public void testCompositionalGetFitnessForSeveralFunctions() {
    Properties.ALGORITHM = Algorithm.MONOTONIC_GA;
    TestSuiteChromosome c = new TestSuiteChromosome();
    LineCoverageSuiteFitness f1 = new LineCoverageSuiteFitness();
    c.addFitness(f1);
    c.setFitness(f1, ANY_DOUBLE_1);
    MethodNoExceptionCoverageSuiteFitness f2 = new MethodNoExceptionCoverageSuiteFitness();
    c.addFitness(f2);
    c.setFitness(f2, ANY_DOUBLE_2);
    OutputCoverageSuiteFitness f3 = new OutputCoverageSuiteFitness();
    c.addFitness(f3);
    c.setFitness(f3, ANY_DOUBLE_3);
    ExceptionCoverageSuiteFitness f4 = new ExceptionCoverageSuiteFitness();
    c.addFitness(f4);
    c.setFitness(f4, ANY_DOUBLE_4);
    double sum = ANY_DOUBLE_1 + ANY_DOUBLE_2 + ANY_DOUBLE_3 + ANY_DOUBLE_4;
    assertEquals(sum, c.getFitness(), 0.001);
}
Also used : OutputCoverageSuiteFitness(org.evosuite.coverage.io.output.OutputCoverageSuiteFitness) LineCoverageSuiteFitness(org.evosuite.coverage.line.LineCoverageSuiteFitness) MethodNoExceptionCoverageSuiteFitness(org.evosuite.coverage.method.MethodNoExceptionCoverageSuiteFitness) ExceptionCoverageSuiteFitness(org.evosuite.coverage.exception.ExceptionCoverageSuiteFitness) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) MethodNoExceptionCoverageSuiteFitness(org.evosuite.coverage.method.MethodNoExceptionCoverageSuiteFitness) Test(org.junit.Test)

Aggregations

ExceptionCoverageSuiteFitness (org.evosuite.coverage.exception.ExceptionCoverageSuiteFitness)2 OutputCoverageSuiteFitness (org.evosuite.coverage.io.output.OutputCoverageSuiteFitness)2 MethodNoExceptionCoverageSuiteFitness (org.evosuite.coverage.method.MethodNoExceptionCoverageSuiteFitness)2 TestSuiteChromosome (org.evosuite.testsuite.TestSuiteChromosome)2 Test (org.junit.Test)2 Compositional (com.examples.with.different.packagename.Compositional)1 LineCoverageSuiteFitness (org.evosuite.coverage.line.LineCoverageSuiteFitness)1 MethodTraceCoverageSuiteFitness (org.evosuite.coverage.method.MethodTraceCoverageSuiteFitness)1