make all crates build (sim.save became mut)

This commit is contained in:
Dustin Carlino 2019-12-18 16:31:10 -08:00
parent d5312fabd4
commit d9a68332e5
7 changed files with 7 additions and 8 deletions

View File

@ -50,7 +50,6 @@ pub fn load(dir_path: &str) -> Vec<Route> {
for (key, group) in
GTFSIterator::<_, transitfeed::StopTime>::from_path(&format!("{}/stop_times.txt", dir_path))
.unwrap()
.into_iter()
.map(|rec| rec.unwrap())
.group_by(|rec| rec.trip_id.clone())
.into_iter()

View File

@ -632,7 +632,7 @@ impl Sim {
self.run_until_done(map, |_, _| {}, time_limit);
}
pub fn run_until_done<F: Fn(&Sim, &Map)>(
pub fn run_until_done<F: Fn(&mut Sim, &Map)>(
&mut self,
map: &Map,
callback: F,

View File

@ -248,7 +248,7 @@ pub struct TestHelper {
}
impl TestHelper {
pub fn setup_done(&mut self, sim: &Sim) {
pub fn setup_done(&mut self, sim: &mut Sim) {
if self.debug_with_savestate.is_some() {
panic!("Can't call setup_done twice in one test");
}

View File

@ -9,7 +9,7 @@ pub fn run(t: &mut TestRunner) {
flags.opts.savestate_every = Some(Duration::seconds(30.0));
let (map, mut sim, mut rng) = flags.load(&mut Timer::throwaway());
Scenario::small_run(&map).instantiate(&mut sim, &map, &mut rng, &mut Timer::throwaway());
h.setup_done(&sim);
h.setup_done(&mut sim);
sim.just_run_until_done(&map, Some(Duration::minutes(70)));
});
}

View File

@ -98,7 +98,7 @@ pub fn run(t: &mut TestRunner) {
}
let mut sim3: Sim =
Sim::load_savestate(sim1_save.clone(), &mut Timer::throwaway()).unwrap();
Sim::load_savestate(sim1_save.clone(), &map, &mut Timer::throwaway()).unwrap();
sim3.set_name("with_savestating_3".to_string());
if sim3 != sim2 {
panic!(

View File

@ -11,7 +11,7 @@ pub fn run(t: &mut TestRunner) {
let route = map.get_bus_route("49").unwrap();
let buses = sim.seed_bus_route(route, &map, &mut Timer::throwaway());
let bus = buses[0];
h.setup_done(&sim);
h.setup_done(&mut sim);
let mut expectations: Vec<Event> = Vec::new();
// TODO assert stuff about other buses as well, although the timing is a little unclear
@ -61,7 +61,7 @@ pub fn run(t: &mut TestRunner) {
.0
.unwrap();
sim.spawn_all_trips(&map, &mut Timer::throwaway(), false);
h.setup_done(&sim);
h.setup_done(&mut sim);
sim.run_until_expectations_met(
&map,

View File

@ -22,7 +22,7 @@ pub fn run(t: &mut TestRunner) {
&map,
);
sim.spawn_all_trips(&map, &mut Timer::throwaway(), false);
h.setup_done(&sim);
h.setup_done(&mut sim);
sim.run_until_expectations_met(
&map,