/**
* Test method for {@link org.movsim.roadmappings.RoadMapping#laneOffset(int)}
*/
@Test
public void testLaneOffset() {
RoadMapping roadMapping = new RoadMappingConcrete(0);
final double laneWidth = roadMapping.laneWidth();
roadMapping = new RoadMappingConcrete(1);
assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
assertEquals(0.0, roadMapping.laneOffset(Lanes.LANE1), delta);
roadMapping = new RoadMappingConcrete(3);
assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
assertEquals(-laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
assertEquals(0.0, roadMapping.laneOffset(Lanes.LANE2), delta);
assertEquals(+laneWidth, roadMapping.laneOffset(Lanes.LANE3), delta);
roadMapping = new RoadMappingConcrete(5);
assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
assertEquals(-2 * laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
assertEquals(-laneWidth, roadMapping.laneOffset(Lanes.LANE2), delta);
assertEquals(0.0, roadMapping.laneOffset(Lanes.LANE3), delta);
assertEquals(laneWidth, roadMapping.laneOffset(Lanes.LANE4), delta);
assertEquals(2 * laneWidth, roadMapping.laneOffset(Lanes.LANE5), delta);
roadMapping = new RoadMappingConcrete(2);
assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
assertEquals(-0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
assertEquals(0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE2), delta);
roadMapping = new RoadMappingConcrete(4);
assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
assertEquals(-1.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
assertEquals(-0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE2), delta);
assertEquals(0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE3), delta);
assertEquals(1.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE4), delta);
}