42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
'''testing'''
|
|
import pytest
|
|
|
|
from main import turn_dial, check_cross_zero
|
|
|
|
@pytest.mark.parametrize('current, given, expected',
|
|
[
|
|
(50, 'L68', 82),
|
|
(82, 'L30', 52),
|
|
(52, 'R48', 0),
|
|
(0, 'L5', 95),
|
|
(95, 'R60', 55),
|
|
(55, 'L55', 0),
|
|
(0, 'L1', 99),
|
|
(99, 'L99', 0),
|
|
(0, 'R14', 14),
|
|
(14, 'L82', 32),
|
|
(50, 'R1000', 50),
|
|
(50, 'L1000', 50)
|
|
])
|
|
def test_matching_zero(current, given, expected):
|
|
assert turn_dial(current, given) == expected
|
|
|
|
|
|
@pytest.mark.parametrize('current, given, expected',
|
|
[
|
|
(50, 'L68', 1),
|
|
(82, 'L30', 0),
|
|
(52, 'R48', 1),
|
|
(0, 'L5', 0),
|
|
(95, 'R60', 1),
|
|
(55, 'L55', 1),
|
|
(0, 'L1', 0),
|
|
(99, 'L99', 1),
|
|
(0, 'R14', 0),
|
|
(14, 'L82', 1),
|
|
(50, 'R1000', 10),
|
|
(50, 'L1000', 10)
|
|
])
|
|
def test_crossing_zero(current, given, expected):
|
|
assert check_cross_zero(current, given) == expected
|