Skip to content

Commit

Permalink
added test for scenario length
Browse files Browse the repository at this point in the history
  • Loading branch information
rinde committed Aug 2, 2016
1 parent 7979509 commit 773cdc0
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.github.rinde.rinsim.ui.renderers.PDPModelRenderer;
import com.github.rinde.rinsim.ui.renderers.PlaneRoadModelRenderer;
import com.github.rinde.rinsim.ui.renderers.RoadUserRenderer;
import com.github.rinde.rinsim.util.TimeWindow;

/**
* @author Rinde van Lon
Expand Down Expand Up @@ -106,6 +107,25 @@ public void test2() {
}
}

@Test
public void testScenarioLength() {
final DatasetGenerator genDefault = DatasetGenerator.builder()
.build();
final DatasetGenerator gen2 = DatasetGenerator.builder()
.setScenarioLength(2)
.build();
final DatasetGenerator gen5 = DatasetGenerator.builder()
.setScenarioLength(5)
.build();

assertThat(genDefault.generate().next().getTimeWindow())
.isEqualTo(TimeWindow.create(0, 4 * 60 * 60 * 1000L));
assertThat(gen2.generate().next().getTimeWindow())
.isEqualTo(TimeWindow.create(0, 2 * 60 * 60 * 1000L));
assertThat(gen5.generate().next().getTimeWindow())
.isEqualTo(TimeWindow.create(0, 5 * 60 * 60 * 1000L));
}

static String toString(Dataset<GeneratedScenario> data) {
final StringBuilder sb = new StringBuilder();
for (final GeneratedScenario scen : data) {
Expand Down

0 comments on commit 773cdc0

Please sign in to comment.