use of org.evosuite.coverage.io.output.OutputCoverageSuiteFitness 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);
}
use of org.evosuite.coverage.io.output.OutputCoverageSuiteFitness 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);
}
Aggregations