2018-08-30 09:00:27 +03:00
|
|
|
extern crate abstutil;
|
|
|
|
extern crate control;
|
|
|
|
extern crate map_model;
|
|
|
|
extern crate sim;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn bus_reaches_stops() {
|
2018-09-01 01:03:15 +03:00
|
|
|
let (map, _, control_map, mut sim) = sim::load(
|
2018-08-30 09:00:27 +03:00
|
|
|
"../data/small.abst".to_string(),
|
|
|
|
"bus_reaches_stops".to_string(),
|
|
|
|
Some(42),
|
|
|
|
Some(sim::Tick::from_seconds(30)),
|
|
|
|
);
|
|
|
|
|
2018-08-30 21:04:27 +03:00
|
|
|
let stop1 = map.get_l(map_model::LaneID(309)).bus_stops[0].clone();
|
|
|
|
let stop2 = map.get_l(map_model::LaneID(840)).bus_stops[0].clone();
|
2018-08-30 22:12:33 +03:00
|
|
|
let buses = sim.seed_bus_route(vec![stop1.clone(), stop2.clone()], &map);
|
|
|
|
let (bus1, bus2) = (buses[0], buses[1]);
|
2018-08-30 09:00:27 +03:00
|
|
|
|
2018-09-01 01:03:15 +03:00
|
|
|
sim.run_until_expectations_met(
|
2018-08-30 09:00:27 +03:00
|
|
|
&map,
|
|
|
|
&control_map,
|
2018-08-30 22:12:33 +03:00
|
|
|
// TODO assert stuff about bus2 as well, although the timing is a little unclear
|
2018-08-30 09:00:27 +03:00
|
|
|
vec![
|
2018-08-30 22:12:33 +03:00
|
|
|
sim::Event::BusArrivedAtStop(bus1, stop2.clone()),
|
|
|
|
sim::Event::BusDepartedFromStop(bus1, stop2),
|
|
|
|
sim::Event::BusArrivedAtStop(bus1, stop1.clone()),
|
|
|
|
sim::Event::BusDepartedFromStop(bus1, stop1),
|
2018-08-30 09:00:27 +03:00
|
|
|
],
|
2018-08-30 21:04:27 +03:00
|
|
|
sim::Tick::from_minutes(10),
|
2018-08-30 09:00:27 +03:00
|
|
|
);
|
|
|
|
}
|