-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
40 lines (24 loc) · 916 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# test.py
from crypto import Crypto
import unittest
class TestCrypto(unittest.TestCase):
def test_encrypt_a_is_b_in_one_shift(self):
enc = Crypto(1, "a")
self.assertEqual(enc.encrypt(), "b")
def test_encrypt_z_is_b_in_two_shift(self):
enc = Crypto(2, "z")
self.assertEqual(enc.encrypt(), "b")
def test_encrypt_hello_is_jgnnq_in_two_shift(self):
enc = Crypto(2, "hello")
self.assertEqual(enc.encrypt(), "jgnnq")
def test_decrypt_b_is_a_in_one_shift(self):
enc = Crypto(1, "b")
self.assertEqual(enc.decrypt(), "a")
def test_decrypt_b_is_z_in_two_shift(self):
enc = Crypto(2, "b")
self.assertEqual(enc.decrypt(), "z")
def test_decrypt_jgnnq_is_hello_in_two_shift(self):
enc = Crypto(2, "jgnnq")
self.assertEqual(enc.decrypt(), "hello")
if __name__ == '__main__':
unittest.main()