Java Reference
In-Depth Information
a # new Activity("Zone26", 15.0, 30.0, 35.0, 45.0);
a # new Activity("Zone27", 10.0, 30.0, 35.0, 45.0);
this .addTask(task2);
Resource carrier2 # new Resource("Carrier2");
this .addResource(carrier2);
We developed the test within the JUnit automatic test framework (see
Sidebar 3.2). Accordingly, the test case is implemented in class TestScheduler .
import scheduler.*;
import java.util.*;
import junit.framework.*;
public class TestScheduler extends TestCase {
Scheduler scheduler # new Scheduler();
public TestScheduler(String name) { super (name); }
public void testPostOffice() {
Problem problem # new PostOfficeProblem();
double gain # 0.1;
// verifies the expected performance value
assertEquals(0.0, scheduler.bestValue(), 0.1);
HashMap expectedResults # new HashMap();
expectedResults.put("Zone11", new Double(8.0));
expectedResults.put("Zone12", new Double(13.0));
expectedResults.put("Zone13", new Double(18.0));
expectedResults.put("Zone14", new Double(23.0));
expectedResults.put("Zone15", new Double(28.0));
expectedResults.put("Zone16", new Double(33.0));
expectedResults.put("Zone17", new Double(38.0));
expectedResults.put("Zone21", new Double(5.0));
expectedResults.put("Zone22", new Double(14.0));
expectedResults.put("Zone23", new Double(28.0));
expectedResults.put("Zone24", new Double(43.0));
expectedResults.put("Zone25", new Double(38.0));
expectedResults.put("Zone26", new Double(33.0));
expectedResults.put("Zone27", new Double(23.0));
// verifies the expected values for the temporal
Activity activity;
Double value;
Search WWH ::

Custom Search