mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
added tests
This commit is contained in:
parent
1423c90407
commit
b6a235bf92
2 changed files with 37 additions and 10 deletions
|
|
@ -25,6 +25,8 @@ public final class Start implements TourActivity {
|
||||||
|
|
||||||
public static int creation;
|
public static int creation;
|
||||||
|
|
||||||
|
private static Capacity capacity = Capacity.Builder.newInstance().build();
|
||||||
|
|
||||||
public static Start newInstance(String locationId, double theoreticalStart, double theoreticalEnd){
|
public static Start newInstance(String locationId, double theoreticalStart, double theoreticalEnd){
|
||||||
creation++;
|
creation++;
|
||||||
return new Start(locationId,theoreticalStart,theoreticalEnd);
|
return new Start(locationId,theoreticalStart,theoreticalEnd);
|
||||||
|
|
@ -36,8 +38,6 @@ public final class Start implements TourActivity {
|
||||||
|
|
||||||
private String locationId;
|
private String locationId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Coordinate coordinate;
|
private Coordinate coordinate;
|
||||||
|
|
||||||
private double theoretical_earliestOperationStartTime;
|
private double theoretical_earliestOperationStartTime;
|
||||||
|
|
@ -46,7 +46,7 @@ public final class Start implements TourActivity {
|
||||||
|
|
||||||
private double endTime;
|
private double endTime;
|
||||||
|
|
||||||
private double arrTime;
|
private double arrTime;
|
||||||
|
|
||||||
public Start(String locationId, double theoreticalStart, double theoreticalEnd) {
|
public Start(String locationId, double theoreticalStart, double theoreticalEnd) {
|
||||||
super();
|
super();
|
||||||
|
|
@ -63,13 +63,13 @@ public final class Start implements TourActivity {
|
||||||
theoretical_latestOperationStartTime = start.getTheoreticalLatestOperationStartTime();
|
theoretical_latestOperationStartTime = start.getTheoreticalLatestOperationStartTime();
|
||||||
endTime = start.getEndTime();
|
endTime = start.getEndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
Coordinate getCoordinate() {
|
Coordinate getCoordinate() {
|
||||||
return coordinate;
|
return coordinate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
void setCoordinate(Coordinate coordinate) {
|
void setCoordinate(Coordinate coordinate) {
|
||||||
this.coordinate = coordinate;
|
this.coordinate = coordinate;
|
||||||
}
|
}
|
||||||
|
|
@ -156,10 +156,7 @@ public final class Start implements TourActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Capacity getCapacity() {
|
public Capacity getCapacity() {
|
||||||
// TODO Auto-generated method stub
|
return capacity;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,35 @@
|
||||||
package jsprit.core.problem.solution.route.activity;
|
package jsprit.core.problem.solution.route.activity;
|
||||||
|
|
||||||
public class StartTest {
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class StartTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCallingCapacity_itShouldReturnEmptyCapacity(){
|
||||||
|
Start start = Start.newInstance("loc", 0., 0.);
|
||||||
|
assertEquals(0,start.getCapacity().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCallingCapacityDemand_itShouldReturnEmptyCapacity(){
|
||||||
|
Start start = Start.newInstance("loc", 0., 0.);
|
||||||
|
assertEquals(0,start.getCapacityDemand());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
|
||||||
|
Start start = Start.newInstance("loc", 1., 2.);
|
||||||
|
assertEquals(1.,start.getTheoreticalEarliestOperationStartTime(),0.01);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenStartIsIniWithLatestStart_itShouldBeSetCorrectly(){
|
||||||
|
Start start = Start.newInstance("loc", 1., 2.);
|
||||||
|
|
||||||
|
assertEquals(2.,start.getTheoreticalLatestOperationStartTime(),0.01);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue