def test_handle_with_default_configs(self):
     path = os.path.join(os.path.curdir, 'tests/test_config.json')
     config_handler = ConfigHandler(json.load(open(path)))
     user_configs = config_handler.handle()
     self.assertEqual(
         user_configs,
         {
             u'Simulation': {
                 u'debugGraphicAlpha': 0,
                 u'doorSize': 50,
                 u'vehicleAmount': 20
             },
             u'Vehicle': {
                 u'diameter': 15,
                 u'mass': 50,
                 u'maxForce': 14,
                 u'maxSpeed': 8
             }
         }
     )
 def test_clip_to_max(self):
     config_handler = ConfigHandler(
         {
             u'Simulation': {
                 u'debugGraphicAlpha': 0,
                 u'doorSize': 1000,
                 u'vehicleAmount': 20
             },
             u'Vehicle': {
                 u'diameter': 15,
                 u'mass': 50,
                 u'maxForce': 14,
                 u'maxSpeed': 8
             }
         }
     )
     user_configs = config_handler.handle()
     self.assertEqual(
         user_configs['Simulation']['doorSize'], 80
     )
 def setUp(self):
     path = os.path.join(os.path.curdir, "tests/test_config.json")
     config_handler = ConfigHandler(json.load(open(path)))
     user_configs = config_handler.handle()
     self.simulation = RushSimulation(user_configs=user_configs)
 def test_initializing(self):
     path = os.path.join(os.path.curdir, "tests/test_config.json")
     config_handler = ConfigHandler(json.load(open(path)))
     user_configs = config_handler.handle()
     simulation = RushSimulation(user_configs=user_configs)
     self.assertEqual(len(simulation.children), 2)
Example #5
0
if __name__ == '__main__':
    import os
    import json
    from rushsimulation.simulation import RushApp
    from rushsimulation.config_handler import ConfigHandler
    path = os.path.join(os.path.dirname(__file__), 'config.json')
    config_handler = ConfigHandler(json.load(open(path)))
    user_configs = config_handler.handle()
    RushApp(user_configs=user_configs).run()