Exemple #1
0
 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)))
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
 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)
Exemple #5
0
 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)
Exemple #6
0
 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)
Exemple #7
0
 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)
Exemple #8
0
 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)
Exemple #9
0
 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)
Exemple #10
0
 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)
Exemple #11
0
 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)
Exemple #12
0
 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)
Exemple #13
0
 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)
Exemple #14
0
 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)))
Exemple #15
0
 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)
Exemple #16
0
 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)