コード例 #1
0
def test_rotate_based_on(test_input, x, expected):
    scrambler = Scrambler(test_input)
    assert scrambler.rotate_based_on(x) == expected
コード例 #2
0
def test_swap_position():
    scrambler = Scrambler(list('abcde'))
    assert scrambler.swap_position(4, 0) == list('ebcda')
コード例 #3
0
def test_move(test_input, x, y, expected):
    scrambler = Scrambler(test_input)
    assert scrambler.move(x, y) == expected
コード例 #4
0
def test_rotate_right(test_input, x, expected):
    scrambler = Scrambler(test_input)
    assert scrambler.rotate_right(x) == expected
コード例 #5
0
def test_rotate_left():
    scrambler = Scrambler(list('abcde'))
    assert scrambler.rotate_left(1) == list('bcdea')
コード例 #6
0
def test_reverse():
    scrambler = Scrambler(list('edcba'))
    assert scrambler.reverse(0, 4) == list('abcde')
コード例 #7
0
def test_swap_letter():
    scrambler = Scrambler(list('ebcda'))
    assert scrambler.swap_letter('d', 'b') == list('edcba')