test run (partial)
This commit is contained in:
parent
8fcd6bb5a6
commit
7ca85a871d
11 changed files with 282 additions and 0 deletions
20
tests/anagram_check.py
Normal file
20
tests/anagram_check.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.anagram_check import anagram_check
|
||||||
|
|
||||||
|
|
||||||
|
class Test_anagram_check(TestCase):
|
||||||
|
def test_anagram_check_1(self):
|
||||||
|
assert anagram_check(s1='B', s2='o8') == False
|
||||||
|
|
||||||
|
def test_anagram_check_2(self):
|
||||||
|
assert anagram_check(s1=' ', s2='u') == False
|
||||||
|
|
||||||
|
def test_anagram_check_3(self):
|
||||||
|
assert anagram_check(s1='', s2='') == True
|
||||||
|
|
||||||
|
def test_anagram_check_4(self):
|
||||||
|
assert anagram_check(s1='?8H', s2='') == False
|
||||||
|
|
||||||
|
def test_anagram_check_5(self):
|
||||||
|
assert anagram_check(s1='@m', s2='Pj') == False
|
23
tests/cd_count.py
Normal file
23
tests/cd_count.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.common_divisor_count import cd_count
|
||||||
|
|
||||||
|
|
||||||
|
class Test_cd_count(TestCase):
|
||||||
|
def test_cd_count_1(self):
|
||||||
|
assert cd_count(a=-946, b=0) == 2
|
||||||
|
|
||||||
|
def test_cd_count_2(self):
|
||||||
|
assert cd_count(a=873, b=164) == 1
|
||||||
|
|
||||||
|
def test_cd_count_3(self):
|
||||||
|
assert cd_count(a=0, b=-90) == 2
|
||||||
|
|
||||||
|
def test_cd_count_4(self):
|
||||||
|
assert cd_count(a=783, b=-749) == 1
|
||||||
|
|
||||||
|
def test_cd_count_5(self):
|
||||||
|
assert cd_count(a=621, b=-23) == 2
|
||||||
|
|
||||||
|
def test_cd_count_6(self):
|
||||||
|
assert cd_count(a=-635, b=444) == 1
|
20
tests/check_armstrong.py
Normal file
20
tests/check_armstrong.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.check_armstrong import check_armstrong
|
||||||
|
|
||||||
|
|
||||||
|
class Test_check_armstrong(TestCase):
|
||||||
|
def test_check_armstrong_1(self):
|
||||||
|
assert check_armstrong(n=370) == True
|
||||||
|
|
||||||
|
def test_check_armstrong_2(self):
|
||||||
|
assert check_armstrong(n=5) == False
|
||||||
|
|
||||||
|
def test_check_armstrong_3(self):
|
||||||
|
assert check_armstrong(n=1) == True
|
||||||
|
|
||||||
|
def test_check_armstrong_4(self):
|
||||||
|
assert check_armstrong(n=0) == True
|
||||||
|
|
||||||
|
def test_check_armstrong_5(self):
|
||||||
|
assert check_armstrong(n=346) == False
|
8
tests/decrypt.py
Normal file
8
tests/decrypt.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.caesar_cipher import decrypt
|
||||||
|
|
||||||
|
|
||||||
|
class Test_decrypt(TestCase):
|
||||||
|
def test_decrypt_1(self):
|
||||||
|
assert decrypt(strng='\\nEGQ&', key=41) == '3E{}(ý'
|
11
tests/encrypt.py
Normal file
11
tests/encrypt.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.caesar_cipher import encrypt
|
||||||
|
|
||||||
|
|
||||||
|
class Test_encrypt(TestCase):
|
||||||
|
def test_encrypt_1(self):
|
||||||
|
assert encrypt(strng='ToU}[G4}', key=70) == ';V<dB.zd'
|
||||||
|
|
||||||
|
def test_encrypt_2(self):
|
||||||
|
assert encrypt(strng='Ja%b7$x?S', key=91) == 'F]!^3 t;O'
|
8
tests/exponentiation.py
Normal file
8
tests/exponentiation.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.exponentiation import exponentiation
|
||||||
|
|
||||||
|
|
||||||
|
class Test_exponentiation(TestCase):
|
||||||
|
def test_exponentiation_1(self):
|
||||||
|
assert exponentiation(baseNumber=-963, power=53) == -135579247021508037271506970896774862890401757444424074712158036994660498207857413507120369768136011010001454548485109484383268428282840962739680900835831388403
|
20
tests/gcd.py
Normal file
20
tests/gcd.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.gcd import gcd
|
||||||
|
|
||||||
|
|
||||||
|
class Test_gcd(TestCase):
|
||||||
|
def test_gcd_1(self):
|
||||||
|
assert gcd(a=531, b=338) == 1
|
||||||
|
|
||||||
|
def test_gcd_2(self):
|
||||||
|
assert gcd(a=1, b=395) == 1
|
||||||
|
|
||||||
|
def test_gcd_3(self):
|
||||||
|
assert gcd(a=71, b=496) == 1
|
||||||
|
|
||||||
|
def test_gcd_4(self):
|
||||||
|
assert gcd(a=644, b=644) == 644
|
||||||
|
|
||||||
|
def test_gcd_5(self):
|
||||||
|
assert gcd(a=581, b=1) == 1
|
8
tests/longest_sorted_substr.py
Normal file
8
tests/longest_sorted_substr.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.longest_substring import longest_sorted_substr
|
||||||
|
|
||||||
|
|
||||||
|
class Test_longest_sorted_substr(TestCase):
|
||||||
|
def test_longest_sorted_substr_1(self):
|
||||||
|
assert longest_sorted_substr(s='YW|jsXG,u') == 'W|'
|
127
tests/output.txt
Normal file
127
tests/output.txt
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
/usr/local/bin/python3.10 /Volumes/Data/git/kse/project-02-python-test-generator-maggicl/genetic.py
|
||||||
|
Instrumenting: 10it [00:00, 722.61it/s]
|
||||||
|
Generating tests: 0%| | 0/12 [00:00<?, ?it/s]
|
||||||
|
anagram_check: rep #00: Cov: 87.50% (7/8 branches): 1F 1T 2F 2T 3F 3T 4F
|
||||||
|
anagram_check: rep #01: Cov: 87.50% (7/8 branches): 1F 1T 2F 2T 3F 3T 4F
|
||||||
|
anagram_check: rep #02: Cov: 100.00% (8/8 branches): 1F 1T 2F 2T 3F 3T 4F 4T
|
||||||
|
anagram_check: rep #03: Cov: 87.50% (7/8 branches): 1F 1T 2F 2T 3F 3T 4F
|
||||||
|
anagram_check: rep #04: Cov: 87.50% (7/8 branches): 1F 1T 2F 2T 3F 3T 4F
|
||||||
|
anagram_check: rep #05: Cov: 87.50% (7/8 branches): 1F 1T 2F 2T 3F 3T 4F
|
||||||
|
anagram_check: rep #06: Cov: 100.00% (8/8 branches): 1F 1T 2F 2T 3F 3T 4F 4T
|
||||||
|
anagram_check: rep #07: Cov: 100.00% (8/8 branches): 1F 1T 2F 2T 3F 3T 4F 4T
|
||||||
|
anagram_check: rep #08: Cov: 87.50% (7/8 branches): 1F 1T 2F 2T 3F 3T 4F
|
||||||
|
anagram_check: rep #09: Cov: 100.00% (8/8 branches): 1F 1T 2F 2T 3F 3T 4F 4T
|
||||||
|
[87.5, 87.5, 100.0, 87.5, 87.5, 87.5, 100.0, 100.0, 87.5, 100.0]
|
||||||
|
Generating tests: 8%|▊ | 1/12 [01:05<12:02, 65.64s/it]
|
||||||
|
cd_count: rep #00: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #01: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #02: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #03: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #04: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #05: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #06: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #07: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #08: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
cd_count: rep #09: Cov: 100.00% (14/14 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T 6F 6T 7F 7T
|
||||||
|
[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
|
||||||
|
Generating tests: 17%|█▋ | 2/12 [02:30<12:50, 77.04s/it]
|
||||||
|
check_armstrong: rep #00: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #01: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #02: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #03: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #04: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #05: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #06: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #07: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #08: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
check_armstrong: rep #09: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
|
||||||
|
Generating tests: 25%|██▌ | 3/12 [03:36<10:45, 71.73s/it]
|
||||||
|
decrypt: rep #00: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #01: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #02: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #03: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #04: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #05: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #06: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #07: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #08: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
decrypt: rep #09: Cov: 100.00% (2/2 branches): 2F 2T
|
||||||
|
[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
|
||||||
|
Generating tests: 33%|███▎ | 4/12 [04:49<09:40, 72.50s/it]
|
||||||
|
encrypt: rep #00: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #01: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #02: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #03: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #04: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #05: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #06: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #07: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #08: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
encrypt: rep #09: Cov: 100.00% (2/2 branches): 1F 1T
|
||||||
|
[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
|
||||||
|
Generating tests: 42%|████▏ | 5/12 [06:04<08:31, 73.13s/it]
|
||||||
|
exponentiation: rep #00: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #01: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #02: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #03: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #04: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #05: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #06: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #07: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
exponentiation: rep #08: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
Generating tests: 50%|█████ | 6/12 [07:50<08:26, 84.43s/it]
|
||||||
|
exponentiation: rep #09: Cov: 62.50% (5/8 branches): 1F 1T 2F 2T 3T
|
||||||
|
[62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5]
|
||||||
|
gcd: rep #00: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #01: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #02: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #03: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #04: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #05: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #06: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #07: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #08: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
gcd: rep #09: Cov: 100.00% (10/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F 5T
|
||||||
|
[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
|
||||||
|
Generating tests: 58%|█████▊ | 7/12 [09:09<06:52, 82.57s/it]
|
||||||
|
longest_sorted_substr: rep #00: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #01: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #02: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #03: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #04: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #05: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #06: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #07: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
longest_sorted_substr: rep #08: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
Generating tests: 67%|██████▋ | 8/12 [10:19<05:15, 78.78s/it]
|
||||||
|
longest_sorted_substr: rep #09: Cov: 100.00% (4/4 branches): 1F 1T 2F 2T
|
||||||
|
[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
|
||||||
|
rabin_karp_search: rep #00: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #01: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #02: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #03: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #04: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #05: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #06: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #07: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #08: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
rabin_karp_search: rep #09: Cov: 90.00% (9/10 branches): 1F 1T 2F 2T 3F 3T 4F 4T 5F
|
||||||
|
[90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0]
|
||||||
|
Generating tests: 75%|███████▌ | 9/12 [11:32<03:50, 76.96s/it]
|
||||||
|
raildecrypt: rep #00: Cov: 87.50% (14/16 branches): 5F 5T 6F 6T 7F 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #01: Cov: 93.75% (15/16 branches): 5F 5T 6F 6T 7F 7T 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #02: Cov: 93.75% (15/16 branches): 5F 5T 6F 6T 7F 7T 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #03: Cov: 87.50% (14/16 branches): 5F 5T 6F 6T 7F 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #04: Cov: 87.50% (14/16 branches): 5F 5T 6F 6T 7F 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #05: Cov: 87.50% (14/16 branches): 5F 5T 6F 6T 7F 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #06: Cov: 93.75% (15/16 branches): 5F 5T 6F 6T 7F 7T 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #07: Cov: 93.75% (15/16 branches): 5F 5T 6F 6T 7F 7T 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #08: Cov: 93.75% (15/16 branches): 5F 5T 6F 6T 7F 7T 8F 8T 9T 10F 10T 11F 11T 12F 12T
|
||||||
|
raildecrypt: rep #09: Cov: 68.75% (11/16 branches): 5T 6F 6T 8F 8T 9T 10F 10T 11F 11T 12T
|
||||||
|
[87.5, 93.75, 93.75, 87.5, 87.5, 87.5, 93.75, 93.75, 93.75, 68.75]
|
||||||
|
Generating tests: 83%|████████▎ | 10/12 [17:25<05:24, 162.00s/it]
|
||||||
|
railencrypt: rep #00: Cov: 100.00% (8/8 branches): 1F 1T 2F 2T 3F 3T 4F 4T
|
||||||
|
railencrypt: rep #01: Cov: 100.00% (8/8 branches): 1F 1T 2F 2T 3F 3T 4F 4T
|
||||||
|
railencrypt: rep #02: Cov: 62.50% (5/8 branches): 1T 2F 2T 4F 4T
|
||||||
|
railencrypt: rep #03: Cov: 100.00% (8/8 branches): 1F 1T 2F 2T 3F 3T 4F 4T
|
20
tests/rabin_karp_search.py
Normal file
20
tests/rabin_karp_search.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.rabin_karp import rabin_karp_search
|
||||||
|
|
||||||
|
|
||||||
|
class Test_rabin_karp_search(TestCase):
|
||||||
|
def test_rabin_karp_search_1(self):
|
||||||
|
assert rabin_karp_search(pat='', txt='m 2') == []
|
||||||
|
|
||||||
|
def test_rabin_karp_search_2(self):
|
||||||
|
assert rabin_karp_search(pat='.w5', txt='55[Ax5X') == []
|
||||||
|
|
||||||
|
def test_rabin_karp_search_3(self):
|
||||||
|
assert rabin_karp_search(pat='h@=y', txt='JcEC') == []
|
||||||
|
|
||||||
|
def test_rabin_karp_search_4(self):
|
||||||
|
assert rabin_karp_search(pat='X', txt='J@X"') == [2]
|
||||||
|
|
||||||
|
def test_rabin_karp_search_5(self):
|
||||||
|
assert rabin_karp_search(pat='>0OPQ', txt='Dzxu8:(P') == []
|
17
tests/raildecrypt.py
Normal file
17
tests/raildecrypt.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from benchmark.railfence_cipher import raildecrypt
|
||||||
|
|
||||||
|
|
||||||
|
class Test_raildecrypt(TestCase):
|
||||||
|
def test_raildecrypt_1(self):
|
||||||
|
assert raildecrypt(st='q338K a{.', k=9) == 'q338K a{.'
|
||||||
|
|
||||||
|
def test_raildecrypt_2(self):
|
||||||
|
assert raildecrypt(st='q338K a{.', k=3) == 'q8{K3 .a3'
|
||||||
|
|
||||||
|
def test_raildecrypt_3(self):
|
||||||
|
assert raildecrypt(st='Hi=BC/', k=557) == 'Hi=BC/'
|
||||||
|
|
||||||
|
def test_raildecrypt_4(self):
|
||||||
|
assert raildecrypt(st='X61*8p', k=5) == 'X61*p8'
|
Reference in a new issue