예제 #1
0
def test_transform(rotor_name, ring_setting, position):
    ring_setting %= 26
    position %= 26
    rotor = get_rotor(rotor_name, ring_setting, position)
    encoding = rotor.initial_encoding

    assert transform_to_encoding(rotor.transform) == gen_data(
        encoding, position, ring_setting)
예제 #2
0
def test_transform(encoding, expected):
    reflector = Plugboard(encoding)
    result_encoding = transform_to_encoding(reflector.transform)

    assert result_encoding == expected
예제 #3
0
def test_encoding_converters(encoding):
    transform = encoding_to_transform(encoding)

    assert isinstance(transform, np.ndarray)
    assert transform_to_encoding(transform) == encoding
예제 #4
0
def test_get_reflector(reflector_type, encoding):
    reflector = get_reflector(reflector_type)
    result_encoding = transform_to_encoding(reflector.transform)

    assert result_encoding == encoding
예제 #5
0
def test_transform(encoding):
    reflector = Reflector(encoding)
    result_encoding = transform_to_encoding(reflector.transform)

    assert result_encoding == encoding