use of org.evosuite.coverage.line.LineCoverageSuiteFitness 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);
}
use of org.evosuite.coverage.line.LineCoverageSuiteFitness in project evosuite by EvoSuite.
the class SPEA2Test method testDistanceOfEqualChromosomes.
@Test
public void testDistanceOfEqualChromosomes() {
SPEA2<Chromosome> algorithm = new SPEA2<Chromosome>(null);
BranchCoverageSuiteFitness branch = new BranchCoverageSuiteFitness();
LineCoverageSuiteFitness line = new LineCoverageSuiteFitness();
TestSuiteChromosome t1 = new TestSuiteChromosome();
t1.setFitness(branch, 0.5);
t1.setFitness(line, 0.3);
TestSuiteChromosome t2 = new TestSuiteChromosome();
t2.setFitness(branch, 0.5);
t2.setFitness(line, 0.3);
assertEquals(0.0, algorithm.distanceBetweenObjectives(t1, t2), 0.0);
}
Aggregations