예제 #1
0
def test_journey_history():
    lift = Lift(queues, capacity)
    lift.current_floor = 0
    lift.record_stop()
    lift.current_floor = 6
    lift.record_stop()
    lift.current_floor = 3
    lift.record_stop()
    assert lift.journey_history == [0,6,3]
예제 #2
0
def test_passengers_pickup_no_queue():
    lift = Lift(queues, 2)
    lift.direction_of_travel = 'down'
    lift.current_floor = 1
    floor_queue = lift.queues[1]
    lift.passengers_pickup()
    assert lift.occupants == []
예제 #3
0
def test_passengers_pickup_going_up():
    lift = Lift(queues, 2)
    lift.current_floor = 2
    lift.passengers_pickup()
    assert lift.number_of_occupants() == 2
    assert lift.occupants == [5,5]
    assert lift.queues == {0:(), 1:(), 2: (5,), 3:(), 4:(3,), 5:(), 6:()}
예제 #4
0
def test_passengers_pickup_going_down():
    lift = Lift(queues, 2)
    lift.direction_of_travel = 'down'
    lift.current_floor = 4
    floor_queue = lift.queues[4]
    lift.passengers_pickup()
    assert lift.occupants == [3]
    assert lift.queues == {0:(), 1:(), 2: (5,5,5), 3:(), 4:(), 5:(), 6:()}