25 lines
892 B
Python
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) == ''
|