Skip to content

Commit 1bf84c4

Browse files
Add test case
1 parent 0de53b9 commit 1bf84c4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: ciphers/running_key_cipher.py

+16
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,23 @@ def running_key_decrypt(key: str, ciphertext: str) -> str:
4242
return "".join(plaintext)
4343

4444

45+
def test_running_key_encrypt():
46+
"""
47+
>>> key = "How does the duck know that? said Victor"
48+
>>> plaintext = "DEFEND THIS"
49+
>>> ciphertext = running_key_encrypt(key, plaintext)
50+
>>> decrypted_text = running_key_decrypt(key, ciphertext)
51+
>>> decrypted_text == "DEFENDTHIS"
52+
True
53+
"""
54+
55+
4556
if __name__ == "__main__":
57+
import doctest
58+
59+
doctest.testmod()
60+
test_running_key_encrypt()
61+
4662
key = "How does the duck know that? said Victor"
4763
plaintext = input("Enter the plaintext: ").upper()
4864
encrypted_text = running_key_encrypt(key, plaintext)

0 commit comments

Comments
 (0)