def test_run_stepbystep_bottleneck_001(self): # Using new constructor sim_instance = Simulator.from_path(self.mocks_path, self.sim_path) with sim_instance as s: while s.do_next: s.run_step()
def test_vehicle_in_network_bottleneck_001(self): sim_instance = Simulator.from_path(self.mocks_path, self.sim_path) flag = False with sim_instance as s: while s.do_next: s.run_step() if s.state.vehicle_in_network("0"): flag = True self.assertTrue(flag)
def test_vehicle_in_network_bottleneck_002(self): sim_instance = Simulator.from_path(self.mocks_path, self.sim_path) flag0, flag1, flag2 = False, False, False with sim_instance as s: while s.do_next: s.run_step() if s.state.vehicle_in_network("0", "1"): flag0 = True if s.state.vehicle_in_network("1"): flag1 = True if s.state.vehicle_in_network("2"): flag2 = True self.assertTrue(flag0) self.assertTrue(flag1) self.assertTrue(flag2)
def test_create_rsu_bottleneck_002(self): sim_instance = Simulator.from_path(self.mocks_path, self.sim_path) rsu = RoadSideUnit("Zone_001", 0.0) v2i_net = V2INetwork() v2i_net.register_element(rsu) sim_instance.register_network(v2i_net) with sim_instance as s: while s.do_next: s.run_step() if s.state.vehicle_in_network("0"): s.state.update_vehicle_list() if s.state.vehicle_in_network("1"): s.state.update_vehicle_list() if s.state.vehicle_in_network("2"): s.state.update_vehicle_list() x = 2 self.assertEqual(self.mocks_path, sim_instance.casename)
def test_create_rsu_bottleneck_001(self): sim_instance = Simulator.from_path(self.mocks_path, self.sim_path) rsu = RoadSideUnit("Zone_001", 0.0) v2i_net = V2INetwork() v2i_net.register_element(rsu) sim_instance.register_network(v2i_net) with sim_instance as s: while s.do_next: s.run_step() if s.state.vehicle_in_network("0"): s.state.create_vehicle_list() x = 1 # v = Vehicle("0") # v.plug_vehicle_to_sim(s) # s.log_vehicle_in_network(v, v2i_net) ## TODO: To finish x = 2 self.assertEqual(self.mocks_path, sim_instance.casename)
def test_run_simulation_alternative_constructor_bottleneck_001(self): sim_instance = Simulator.from_path(self.mocks_path, self.sim_path) sim_instance.run_simulation()
def test_constructor_bottleneck_001(self): sim_instance = Simulator.from_path(self.mocks_path, self.sim_path) self.assertEqual(self.mocks_path, sim_instance.casename)