Ejemplo n.º 1
0
 def test_encode_decode(self):
     for i in range(0, 100):
         plaintext = ""
         for j in range(0, random.randint(20, 50)):
             plaintext += chr(random.randint(65, 90))
         key = chr(random.randint(65, 90))
         self.assertEqual(shift_cipher.decode(shift_cipher.encode(plaintext, key), key), plaintext)
Ejemplo n.º 2
0
 def test_string_decode(self):
     self.assertEqual(shift_cipher.decode("HELLO WORLD", "C"), "FCJJM UMPJB")
Ejemplo n.º 3
0
 def test_single_character_decode(self):
     self.assertEqual(shift_cipher.decode("M", "C"), "K")