use crate::import_map; use map_model::{LaneID, TurnType}; // If this test gets fully fleshed out, there would be many more of these. This one means the // southern road, inbound to the intersection, the left lane of it. const S_IN_LEFT: LaneID = LaneID(2); #[test] fn test_left_turn_lane() { let map = import_map(four_way()); // Assert the hardcoded ID is reasonable assert_eq!("south", map.get_parent(S_IN_LEFT).get_name(None)); assert!(map.get_l(S_IN_LEFT).is_driving()); // TODO This is quite a weak assertion. I want to express that there's only the left turn from // this lane, and S_IN_RIGHT has the two straight turns and the right turn. But it'll be so // verbose. assert_eq!( TurnType::Left, map.get_turns_from_lane(S_IN_LEFT)[0].turn_type ); } // A map with 4 roads (north, south, east, west) and one intersection. The north/south roads have 4 // lanes, the east/west just 2. The south road has a left turn lane. fn four_way() -> String { format!( r#" "# ) }