def test_rotor_class_notch_position(self): for num in range(0, 26): if (enigma_utility.number_to_letter(num) == 'N'): self.assertTrue( self.rotor.is_notch(enigma_utility.number_to_letter(num))) else: self.assertFalse( self.rotor.is_notch(enigma_utility.number_to_letter(num)))
def test_rotor_V_mapping(self): mapping = 'VZBRGITYUPSDNHLXAWMJQOFECK' for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual(self.V_rotor.get_left_right_mapping(input_char), output_char)
def test_rotor_IV_mapping(self): mapping = 'ESOVPZJAYQUIRHXLNFTGKDCMWB' for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual(self.IV_rotor.get_left_right_mapping(input_char), output_char)
def test_rotor_III_mapping(self): mapping = 'BDFHJLCPRTXVZNYEIWGAKMUSQO' for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual(self.III_rotor.get_left_right_mapping(input_char), output_char)
def test_rotor_II_mapping(self): mapping = 'AJDKSIRUXBLHWTMCQGZNPYFVOE' for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual(self.II_rotor.get_left_right_mapping(input_char), output_char)
def test_rotor_I_mapping(self): mapping = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ' for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual(self.I_rotor.get_left_right_mapping(input_char), output_char)
def test_reflector_C_mapping(self): mapping = 'FVPJIAOYEDRZXWGCTKUQSBNMHL' for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual( self.reflector_c.get_left_right_mapping(input_char), output_char)
def test_reflector_B_mapping(self): mapping = 'YRUHQSLDPXNGOKMIEBFZCWVJAT' for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual( self.reflector_b.get_left_right_mapping(input_char), output_char)
def test_rotor_class_notch_position(self): for num in range(0, 26): if (enigma_utility.number_to_letter(num) == 'N'): self.assertTrue(self.rotor.is_notch(enigma_utility.number_to_letter(num))) else: self.assertFalse(self.rotor.is_notch(enigma_utility.number_to_letter(num)))
def test_reflector_C_mapping(self): mapping = "FVPJIAOYEDRZXWGCTKUQSBNMHL" for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual(self.reflector_c.get_left_right_mapping(input_char), output_char)
def test_reflector_B_mapping(self): mapping = "YRUHQSLDPXNGOKMIEBFZCWVJAT" for num in range(0, 26): input_char = enigma_utility.number_to_letter(num) output_char = mapping[num] self.assertEqual(self.reflector_b.get_left_right_mapping(input_char), output_char)