예제 #1
0
 def incorrect_char_encode_test(self):
     actual = CaesarCipher(10)
     self.assertTrue(actual.encode("!") == "!")
예제 #2
0
 def upper_message_with_incorrect_letters_encode_test(self):
     actual = CaesarCipher(7)
     self.assertTrue(
         actual.encode("This is a 'simple' Message!") ==
         "Aopz pz h 'zptwsl' Tlzzhnl!")
예제 #3
0
 def simple_offset_constructor_test(self):
     actual = CaesarCipher(5)
     self.assertTrue(actual.offset == 5)
예제 #4
0
 def upper_message_encode_test(self):
     actual = CaesarCipher(7)
     self.assertTrue(
         actual.encode("This is a simple Message") ==
         "Aopz pz h zptwsl Tlzzhnl")
예제 #5
0
 def reverse_offset_constructor_test(self):
     actual = CaesarCipher(-5)
     self.assertTrue(actual.offset == 21)
예제 #6
0
 def simple_upeer_char_encode_test(self):
     actual = CaesarCipher(10)
     self.assertTrue(actual.encode("A") == "K")
예제 #7
0
 def message_encode_test_offset_15(self):
     actual = CaesarCipher(15)
     self.assertTrue(
         actual.encode("this is a simple message") ==
         "iwxh xh p hxbeat bthhpvt")
 def decipher(self):
     self.logger.log('Decipher')
     cipher = CaesarCipher(self.offset)
     self.output_text = cipher.decode(self.input_text)
     self.logger.log('Decipher text: %s' % self.output_text)
예제 #9
0
 def simple_char_with_reverse_encode_test(self):
     actual = CaesarCipher(-16)
     self.assertTrue(actual.encode("a") == "k")
예제 #10
0
 def simple_message_reverse_encode_test(self):
     actual = CaesarCipher(-1)
     self.assertTrue(actual.encode("bcde") == "abcd")
예제 #11
0
 def simple_char_with_overflow_encode_test(self):
     actual = CaesarCipher(36)
     self.assertTrue(actual.encode("a") == "k")
예제 #12
0
 def simple_char_encode_test(self):
     actual = CaesarCipher(10)
     self.assertTrue(actual.encode("a") == "k")
예제 #13
0
 def none_offset_constructor_test(self):
     actual = CaesarCipher(0)
     self.assertTrue(actual.offset == 0)
예제 #14
0
 def complex_message_decode_after_encode_test(self):
     message = "whHU6DnQhGD8STBpua5!t0BVnE51EqCORsRqKCFSINSH44?GsGZ2Pgo7imir0Z"
     actual = CaesarCipher(63)
     self.assertTrue(actual.decode(actual.encode(message)) == message)
예제 #15
0
 def message_encode_test_offset_7(self):
     actual = CaesarCipher(7)
     self.assertTrue(
         actual.encode("this is a simple message") ==
         "aopz pz h zptwsl tlzzhnl")
 def encipher(self):
     self.logger.log('Encipher')
     cipher = CaesarCipher(self.offset)
     self.output_text = cipher.encode(self.input_text)
     self.logger.log('Encipher text: %s' % self.output_text)
예제 #17
0
 def message_decode_after_encode_test(self):
     message = "this is a simple message"
     actual = CaesarCipher(63)
     self.assertTrue(actual.decode(actual.encode(message)) == message)
 def decipher(self):
     cipher = CaesarCipher(self.offset)
     self.output_text = cipher.decode(self.input_text)
예제 #19
0
 def overflow_offset_constructor_test(self):
     actual = CaesarCipher(31)
     self.assertTrue(actual.offset == 5)