-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for sim_config module
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pytest | ||
from robot_sf.sim_config import ( | ||
EnvSettings, | ||
SimulationSettings, | ||
LidarScannerSettings, | ||
DifferentialDriveSettings, | ||
BicycleDriveSettings, | ||
MapDefinitionPool, | ||
DifferentialDriveRobot, | ||
BicycleDriveRobot) | ||
|
||
def test_env_settings_initialization(): | ||
env_settings = EnvSettings() | ||
assert isinstance(env_settings.sim_config, SimulationSettings) | ||
assert isinstance(env_settings.lidar_config, LidarScannerSettings) | ||
assert isinstance(env_settings.robot_config, DifferentialDriveSettings) | ||
assert isinstance(env_settings.map_pool, MapDefinitionPool) | ||
|
||
def test_env_settings_post_init(): | ||
with pytest.raises(ValueError): | ||
env_settings = EnvSettings(sim_config=None) | ||
|
||
def test_robot_factory(): | ||
env_settings = EnvSettings() | ||
robot = env_settings.robot_factory() | ||
assert isinstance(robot, DifferentialDriveRobot) | ||
|
||
env_settings.robot_config = BicycleDriveSettings() | ||
robot = env_settings.robot_factory() | ||
assert isinstance(robot, BicycleDriveRobot) | ||
|
||
with pytest.raises(NotImplementedError): | ||
env_settings.robot_config = "unsupported type" | ||
env_settings.robot_factory() |