def test_through_the_middle_reversed(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(4, 4) p2 = Point(0, 0) result = line_crosses_obstacle(p1, p2, obstacle) self.assertTrue(result)
def test_large_obstacle(self): obstacle = Obstacle(265, 335, 265, 8000) p1 = Point(284, 221) p2 = Point(265, 265) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_through_the_middle_y_aligned(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(2, 0) p2 = Point(2, 4) result = line_crosses_obstacle(p1, p2, obstacle) self.assertTrue(result)
def test_pointing_away(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(4, 2) p2 = Point(5, 2.5) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_one_point_inside(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(0, 0) p2 = Point(2, 2) result = line_crosses_obstacle(p1, p2, obstacle) self.assertTrue(result)
def test_touching_side_perpendicular(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(0, 2) p2 = Point(1, 2) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_not_crossing_but_pointing(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(-1, 2.5) p2 = Point(0, 2) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_starting_in_tip_perpendicular(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(1, 1) p2 = Point(0, 1) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_tip(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(0, 2) p2 = Point(2, 4) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_parallel_edge_y(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(1, 0) p2 = Point(1, 4) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_no_collision(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(0, 0) p2 = Point(4, 0) result = line_crosses_obstacle(p1, p2, obstacle) self.assertFalse(result)
def test_through_the_middle_different_angle(self): obstacle = Obstacle(1, 3, 1, 3) p1 = Point(0, 2.5) p2 = Point(3, 3.99) result = line_crosses_obstacle(p1, p2, obstacle) self.assertTrue(result)