示例#1
0
def test_move_head_invalid_direction():
    tape = Tape('B', ['a', 'b', 'X', 'B'], ['a', 'b'])
    with pytest.raises(ValueError):
        tape.move_head('T')
示例#2
0
def test_move_head_right_left():
    tape = Tape('B', ['a', 'b', 'X', 'B'], ['a', 'b'])
    tape.move_head('R')
    tape.move_head('L')
    assert tape.get_content() == 'a'
    assert tape.position == 0
示例#3
0
def test_move_head_stay():
    tape = Tape('B', ['a', 'b', 'X', 'B'], ['a', 'b'])
    tape.move_head('S')
    assert tape.get_content() == 'a'
    assert tape.content == ['a', 'b']
    assert tape.position == 0