This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
kse-02/tests/test_railfence_cipher.py
2023-12-09 20:52:07 +01:00

25 lines
892 B
Python

from unittest import TestCase
from benchmark.railfence_cipher import railencrypt
from benchmark.railfence_cipher import raildecrypt
class Test_railencrypt(TestCase):
def test_railencrypt_1(self):
assert railencrypt(st='78l%K2', k=3) == '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
def test_railencrypt_2(self):
assert railencrypt(st='f', k=25) == '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
def test_railencrypt_3(self):
assert railencrypt(st='(la_UD^', k=2) == '\x00\x00\x00\x00\x00\x00\x00'
class Test_raildecrypt(TestCase):
def test_raildecrypt_1(self):
assert raildecrypt(st='(la_UD^', k=2) == ''
def test_raildecrypt_2(self):
assert raildecrypt(st="ZZ.B/8M'M", k=3) == ''
def test_raildecrypt_3(self):
assert raildecrypt(st='9[HS4', k=960) == ''