/** * <p>totalLengthOfTestCases</p> * * @return Sum of the lengths of the test cases */ public int totalLengthOfTestCases() { int length = 0; for (T test : tests) length += test.size(); return length; }
/** * <p> * getLengthSum * </p> * * @param chromosome1 * a {@link org.evosuite.testcase.ExecutableChromosome} object. * @param chromosome2 * a {@link org.evosuite.testcase.ExecutableChromosome} object. * @return a int. */ public int getLengthSum(ExecutableChromosome chromosome1, ExecutableChromosome chromosome2) { return chromosome1.size() + chromosome2.size(); }
private void removeEmptyTestCases(TestSuiteChromosome suite) { Iterator<TestChromosome> it = suite.tests.iterator(); while (it.hasNext()) { ExecutableChromosome test = it.next(); if (test.size() == 0) { logger.debug("Removing empty test case"); it.remove(); } } }
private int getMaxLength(TestSuiteChromosome chromosome) { int max = 0; for (ExecutableChromosome test : chromosome.getTestChromosomes()) { max = Math.max(max, test.size()); } return max; }
/** {@inheritDoc} */ @Override public boolean isTooLong(Chromosome chromosome) { // Always accept if fitness is better if (chromosome.getFitness() < best_fitness) return false; // logger.debug("Current - max: "+((TestSuiteChromosome)chromosome).length()+" - "+current_max); if (current_max > 0) { // if(((TestSuiteChromosome)chromosome).length() > bloat_factor * // current_max) // logger.debug("Bloat control: "+((TestSuiteChromosome)chromosome).length() // +" > "+ bloat_factor * current_max); return ((ExecutableChromosome) chromosome).size() > Properties.BLOAT_FACTOR * current_max; } else return false; // Don't know max length so can't reject! }
/** {@inheritDoc} */ @Override public void iteration(GeneticAlgorithm<?> algorithm) { current_max = ((ExecutableChromosome) algorithm.getBestIndividual()).size(); best_fitness = algorithm.getBestIndividual().getFitness(); }
while(testIterator.hasNext()) { T test = testIterator.next(); if(test.size() == 0) testIterator.remove();