예제 #1
0
    def test_update_current_location(self):
        # arrange
        expected_location = Point(5, 5)

        # act
        test_path_finder = PathFinder(test_terrain, test_initial_point,
                                      test_final_point)

        test_path_finder.update_current_location(expected_location)

        # assert
        self.assertEqual(expected_location, test_path_finder.current_location)
예제 #2
0
    def test_is_point_in_terrain_out_east(self):
        # arrange
        test_x = len(test_terrain[0]) + 20
        test_y = 3
        test_point = Point(test_x, test_y)

        # act
        test_path_finder = PathFinder(test_terrain, test_initial_point,
                                      test_final_point)

        # assert
        self.assertFalse(test_path_finder.is_point_in_terrain(test_point))
예제 #3
0
    def test_is_on_southeast_corner(self):
        # arrange
        test_x = 9
        test_y = 15
        test_point = Point(test_x, test_y)

        # act
        test_path_finder = PathFinder(test_terrain, test_initial_point,
                                      test_final_point)

        # assert
        self.assertTrue(test_path_finder.is_on_southeast_corner(test_point))
예제 #4
0
    def test_is_on_north_edge(self):
        # arrange
        test_x = 3
        test_y = 0
        test_point = Point(test_x, test_y)

        # act
        test_path_finder = PathFinder(test_terrain, test_initial_point,
                                      test_final_point)

        # assert
        self.assertTrue(test_path_finder.is_on_north_edge(test_point))
예제 #5
0
    def test_mark_as_visited(self):
        # arrange
        test_x = 2
        test_y = 3
        test_visted_point = Point(test_x, test_y)

        # act
        test_path_finder = PathFinder(test_terrain, test_initial_point,
                                      test_final_point)
        test_path_finder.mark_as_visited(test_visted_point)

        # assert
        self.assertTrue(test_path_finder.visited_points[test_x][test_y])
예제 #6
0
    def test_no_points_visited(self):
        # arrange
        expected_visited_points = [[
            False for i in range(len(test_terrain[0]))
        ] for j in range(len(test_terrain))]

        # act
        test_path_finder = PathFinder(test_terrain, test_initial_point,
                                      test_final_point)

        # assert
        self.assertEqual(expected_visited_points,
                         test_path_finder.visited_points)
예제 #7
0
    def test_visited_points_init(self):
        # arrange
        expected_latitude = len(test_terrain)
        expected_longitude = len(test_terrain[0])

        # act
        test_path_finder = PathFinder(test_terrain, test_initial_point,
                                      test_final_point)
        actual_latitude = len(test_path_finder.visited_points)
        actual_longitude = len(test_path_finder.visited_points[0])

        # assert
        self.assertEqual(expected_latitude, actual_latitude)
        self.assertEqual(expected_longitude, actual_longitude)