コード例 #1
0
    def test_change_for_speed(self):
        road = self.twoLaneRoad
        car = Car(road, (50, 0))
        road.placeObject(car)

        self.assertTrue(car.willingToChangeDown())
        self.assertFalse(car.willingToChangeUp())
コード例 #2
0
    def test_avoid_obstacle(self):
        road = self.twoLaneRoad
        car = Car(road, (89, 0), self.maxSpeed)
        road.placeObject(car)

        self.assertTrue(car.willingToChangeDown())
        self.assertFalse(car.willingToChangeUp())
コード例 #3
0
    def test_change_because_car_ahead(self):
        road = self.threeLaneRoad
        car1, car2 = Car(road, (0, 1), 5), Car(road, (2, 1), 5)
        road.placeObjects( [car1, car2] )

        self.assertTrue( car1.willingToChangeUp() and car1.willingToChangeDown() )
        self.assertNotWillingToChange(car2)
コード例 #4
0
    def test_change_for_speed(self):
        road = self.twoLaneRoad
        car = Car(road, (50, 0))
        road.placeObject(car)

        self.assertTrue( car.willingToChangeDown() )
        self.assertFalse( car.willingToChangeUp() )
コード例 #5
0
    def test_avoid_obstacle(self):
        road = self.twoLaneRoad
        car = Car(road, (89, 0), self.maxSpeed)
        road.placeObject(car)

        self.assertTrue( car.willingToChangeDown() )
        self.assertFalse( car.willingToChangeUp() )
コード例 #6
0
    def test_change_because_car_ahead(self):
        road = self.threeLaneRoad
        car1, car2 = Car(road, (0, 1), 5), Car(road, (2, 1), 5)
        road.placeObjects([car1, car2])

        self.assertTrue(car1.willingToChangeUp()
                        and car1.willingToChangeDown())
        self.assertNotWillingToChange(car2)