Exemple #1
0
def test_set_states_south_to_west():
    car = Car(5, 5, 'v')
    assert car.orientation == Car.Orientation.SOUTH
    assert car.count == 0
    assert car.state == 'S0'
    car.state = 'W1'
    assert car.orientation == Car.Orientation.WEST
    assert car.count == 1
Exemple #2
0
def test_set_states_west_to_north():
    car = Car(5, 5, '<')
    assert car.orientation == Car.Orientation.WEST
    assert car.count == 0
    assert car.state == 'W0'
    car.state = 'N1'
    assert car.orientation == Car.Orientation.NORTH
    assert car.count == 1
Exemple #3
0
def test_set_states_east_to_south():
    car = Car(5, 5, '>')
    assert car.orientation == Car.Orientation.EAST
    assert car.count == 0
    assert car.state == 'E0'
    car.state = 'S1'
    assert car.orientation == Car.Orientation.SOUTH
    assert car.count == 1
Exemple #4
0
def test_set_states_north_to_west():
    car = Car(5, 5, '^')
    assert car.orientation == Car.Orientation.NORTH
    assert car.count == 0
    assert car.state == 'N0'
    car.state = 'W1'
    assert car.orientation == Car.Orientation.WEST
    assert car.count == 1
    assert car.state == 'W1'
Exemple #5
0
def car_right():
    car = Car(5, 5, '>')
    state = StateMap(10, 10)
    state.cars = [car]
    state[(5, 5)] = Cell(5, 5, '-')
    state[(6, 5)] = Cell(6, 5, '+')
    return state, car
Exemple #6
0
def car_down():
    car = Car(5, 0, 'v')
    state = StateMap(10, 10)
    state.cars = [car]
    state[(5, 0)] = Cell(5, 0, '|')
    state[(5, 1)] = Cell(5, 1, '+')
    return state, car
Exemple #7
0
def car_left():
    car = Car(5, 5, '<')
    state = StateMap(10, 10)
    state.cars = [car]
    state[(5, 5)] = Cell(5, 5, '-')
    state[(4, 5)] = Cell(6, 5, '+')
    return state, car
Exemple #8
0
def test_move_car_right():
    car = Car(5, 5, '>')
    assert car.next() == (6, 5)
Exemple #9
0
def test_states_north():
    car = Car(5, 5, '^')
    assert car.state == 'N0'
Exemple #10
0
def test_move_car_down():
    car = Car(5, 5, 'v')
    assert car.next() == (5, 6)
Exemple #11
0
def test_move_car_up():
    car = Car(5, 5, '^')
    assert car.next() == (5, 4)
Exemple #12
0
def test_move_car_left():
    car = Car(5, 5, '<')
    assert car.next() == (4, 5)