use of com.examples.with.different.packagename.continuous.UsingSimpleAndTrivial in project evosuite by EvoSuite.
the class JobSchedulerTest method testSeedingAndBudget.
@Test
public void testSeedingAndBudget() {
String[] cuts = new String[] { Trivial.class.getName(), UsingSimpleAndTrivial.class.getName(), Simple.class.getName() };
ProjectAnalyzer analyzer = new ProjectAnalyzer(cuts);
ProjectStaticData data = analyzer.analyze();
int cores = 2;
int memory = 1800;
int budget = 3;
CtgConfiguration conf = new CtgConfiguration(memory, cores, budget, 1, false, AvailableSchedule.BUDGET_AND_SEEDING);
JobScheduler scheduler = new JobScheduler(data, conf);
List<JobDefinition> jobs = scheduler.createNewSchedule();
Assert.assertNotNull(jobs);
Assert.assertEquals("Wrong number of jobs: " + jobs.toString(), 3, jobs.size());
// UsingSimpleAndTrivial should be the last in the schedule, as it depends on the other 2
JobDefinition seeding = jobs.get(2);
Assert.assertNotNull(seeding);
Assert.assertEquals(UsingSimpleAndTrivial.class.getName(), seeding.cut);
Set<String> in = seeding.inputClasses;
Assert.assertNotNull(in);
System.out.println(in.toString());
Assert.assertTrue(in.contains(Simple.class.getName()));
Assert.assertTrue(in.contains(Trivial.class.getName()));
Assert.assertEquals(2, in.size());
// should be the first, as it has the highest number of branches among the jobs with no depencencies
JobDefinition simple = jobs.get(0);
Assert.assertNotNull(simple);
Assert.assertEquals(Simple.class.getName(), simple.cut);
int simpleTime = jobs.get(0).seconds;
int trivialTime = jobs.get(1).seconds;
int seedingTime = jobs.get(2).seconds;
System.out.println("Ordered times: " + simpleTime + ", " + trivialTime + ", " + seedingTime);
Assert.assertTrue(simpleTime > trivialTime);
// seeding, even if last, it should have more time, as it has most branches
Assert.assertTrue(simpleTime < seedingTime);
Assert.assertTrue(trivialTime < seedingTime);
}
use of com.examples.with.different.packagename.continuous.UsingSimpleAndTrivial in project evosuite by EvoSuite.
the class JobSchedulerTest method testSeedingOrder.
@Test
public void testSeedingOrder() {
String[] cuts = new String[] { Simple.class.getName(), UsingSimpleAndTrivial.class.getName(), Trivial.class.getName() };
ProjectAnalyzer analyzer = new ProjectAnalyzer(cuts);
ProjectStaticData data = analyzer.analyze();
int cores = 3;
int memory = 1800;
int budget = 2;
CtgConfiguration conf = new CtgConfiguration(memory, cores, budget, 1, false, AvailableSchedule.SEEDING);
JobScheduler scheduler = new JobScheduler(data, conf);
List<JobDefinition> jobs = scheduler.createNewSchedule();
Assert.assertNotNull(jobs);
Assert.assertEquals("Wrong number of jobs: " + jobs.toString(), 3, jobs.size());
// UsingSimpleAndTrivial should be the last in the schedule, as it depends on the first 2
JobDefinition seeding = jobs.get(2);
Assert.assertNotNull(seeding);
Assert.assertEquals(UsingSimpleAndTrivial.class.getName(), seeding.cut);
Set<String> in = seeding.inputClasses;
Assert.assertNotNull(in);
System.out.println(in.toString());
Assert.assertTrue(in.contains(Simple.class.getName()));
Assert.assertTrue(in.contains(Trivial.class.getName()));
Assert.assertEquals(2, in.size());
}
Aggregations