def test_do_calculate_reward_if_goal_reached(): env = NavigationGoal() env._ranges = np.array([2, 1, 10, 4, 5]) env._distance_from_goal = 0.01 reward = env._do_calculate_reward(env._FORWARD) assert reward == 200
def test_do_calculate_reward_if_collision(): env = NavigationGoal() env._ranges = np.array([0.5, 1, 0.01, 4, 5]) env._distance_from_goal = 10 reward = env._do_calculate_reward(env._FORWARD) assert reward == -200
def test_do_check_if_done_false(): env = NavigationGoal() env._ranges = np.array([2, 1, 10, 4, 5]) env._distance_from_goal = 10 done = env._do_check_if_done() assert not done
def test_do_check_if_done_true_goal_reached(): env = NavigationGoal() env._ranges = np.array([2, 1, 10, 4, 5]) env._distance_from_goal = 0.01 done = env._do_check_if_done() assert done
def test_do_check_if_done_true_collision(): env = NavigationGoal() env._ranges = np.array([0.5, 1, 0.01, 4, 5]) env._distance_from_goal = 10 done = env._do_check_if_done() assert done
def test_do_calculate_reward_if_action(): env = NavigationGoal() env._ranges = np.array([2, 1, 10, 4, 5]) env._distance_from_goal = 1 env._observation = np.array([2, 1, 10, 4, 5, 3, 0.5]) reward = env._do_calculate_reward(env._FORWARD) assert reward == 20