コード例 #1
0
def test_intersect_rotate_down():
    cart = Cart(0, 0, "v")
    cart.intersect_rotate()
    assert_equal(cart.get_direction(), ">",
                 "expected cart to have turned left")
    cart.intersect_rotate()
    assert_equal(cart.get_direction(), ">", "expected cart not to have turned")
    cart.intersect_rotate()
    assert_equal(cart.get_direction(), "v",
                 "expected cart to have turned right")
    cart.intersect_rotate()
    assert_equal(cart.get_direction(), ">",
                 "expected cart to have turned left")
コード例 #2
0
def test_turn_rotate_down_backward():
    cart = Cart(0, 0, "v")
    cart.turn_rotate("\\")
    assert_equal(cart.get_direction(), ">")
コード例 #3
0
def test_turn_rotate_down_forward():
    cart = Cart(0, 0, "v")
    cart.turn_rotate("/")
    assert_equal(cart.get_direction(), "<")
コード例 #4
0
def test_turn_rotate_right_forward():
    cart = Cart(0, 0, ">")
    cart.turn_rotate("/")
    assert_equal(cart.get_direction(), "^")
コード例 #5
0
def test_turn_rotate_left_backward():
    cart = Cart(0, 0, "<")
    cart.turn_rotate("\\")
    assert_equal(cart.get_direction(), "^")