import org.junit.Assert; import org.junit.Test; import java.util.Arrays; import java.util.List; public class SimpleTest { @Test public void perfectSchedule(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(3.0,2.0,3.0,2.0,2.0); Assert.assertEquals(6.0, scheduling.minimalScheduleTime(jobs, 2), 0.0001); } @Test public void imperfectSchedule(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(2.0,3.0,6.0,2.0,4.0, 2.0); Assert.assertEquals(10.0, scheduling.minimalScheduleTime(jobs, 2), 0.0001); } @Test public void test3Drones(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(1.5, 2.0, 1.0, 2.0, 1.75, 1.0); Assert.assertEquals(3.25, scheduling.minimalScheduleTime(jobs, 3), 0.0001); } @Test public void test3Drones2(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(4.5, 3.5, 2.5, 1.85, 1.4, 1.05, 0.8); Assert.assertEquals(5.35, scheduling.minimalScheduleTime(jobs, 3), 0.0001); } @Test(timeout = 1500) public void testMultiple(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(3.657, 0.268, 3.226, 0.372, 0.030, 3.111, 1.677, 1.498, 2.015, 4.852, 2.097, 2.992, 0.572, 3.202, 2.810, 1.610, 1.083, 4.519, 3.194, 1.160); Assert.assertEquals(21.973, scheduling.minimalScheduleTime(jobs, 2), 0.0001); Assert.assertEquals(14.649, scheduling.minimalScheduleTime(jobs, 3), 0.0001); Assert.assertEquals(10.988, scheduling.minimalScheduleTime(jobs, 4), 0.0001); Assert.assertEquals(8.794, scheduling.minimalScheduleTime(jobs, 5), 0.0001); } //Deze tests zijn de moeilijkere testgevallen, waar nog-niet-geoptimaliseerde algoritmes het moeilijk mee zullen hebben. //Je kan ze gebruiken als benchmark: minder dan 10s is aanvaardbaar. 150ms is echter ook haalbaar. /* @Test(timeout = 10000) public void testHard(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(3.652, 0.441, 2.444, 2.309, 2.242, 3.488, 1.388, 3.799, 1.096, 4.602, 4.430, 1.110, 4.419, 2.197, 1.964, 4.973, 4.407, 1.415, 1.239, 2.967); Assert.assertEquals(13.649, scheduling.minimalScheduleTime(jobs, 4), 0.0001); } @Test(timeout = 10000) public void test10Drones(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(2.0,3.0,0.5,1.3,2.0,0.3,0.7,1.2,1.0,0.8,2.0,1.0,3.6,2.6,2.0,3.6,3.3,2.9,3.0,3.2); Assert.assertEquals(4.1, scheduling.minimalScheduleTime(jobs, 10), 0.0001); } @Test(timeout = 15000) public void testHard2(){ DroneScheduling scheduling = new MyDroneScheduling(); List jobs = Arrays.asList(3.652, 2.315,6.314, 2.222,0.441, 2.444, 2.309, 2.242, 3.488, 1.388, 3.799, 1.096, 4.602,1.1, 4.430, 1.110, 4.419, 2.197, 1.964, 4.973, 4.407, 1.415, 1.239, 2.967); Assert.assertEquals(16.634, scheduling.minimalScheduleTime(jobs, 4), 0.0001); } */ }