From 7ca85a871d2ce1553a7d2bbb4b0999ed46d0a692 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Sat, 9 Dec 2023 14:43:29 +0100 Subject: [PATCH] test run (partial) --- tests/anagram_check.py | 20 ++++++ tests/cd_count.py | 23 ++++++ tests/check_armstrong.py | 20 ++++++ tests/decrypt.py | 8 +++ tests/encrypt.py | 11 +++ tests/exponentiation.py | 8 +++ tests/gcd.py | 20 ++++++ tests/longest_sorted_substr.py | 8 +++ tests/output.txt | 127 +++++++++++++++++++++++++++++++++ tests/rabin_karp_search.py | 20 ++++++ tests/raildecrypt.py | 17 +++++ 11 files changed, 282 insertions(+) create mode 100644 tests/anagram_check.py create mode 100644 tests/cd_count.py create mode 100644 tests/check_armstrong.py create mode 100644 tests/decrypt.py create mode 100644 tests/encrypt.py create mode 100644 tests/exponentiation.py create mode 100644 tests/gcd.py create mode 100644 tests/longest_sorted_substr.py create mode 100644 tests/output.txt create mode 100644 tests/rabin_karp_search.py create mode 100644 tests/raildecrypt.py diff --git a/tests/anagram_check.py b/tests/anagram_check.py new file mode 100644 index 0000000..f3cc27b --- /dev/null +++ b/tests/anagram_check.py @@ -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 \ No newline at end of file diff --git a/tests/cd_count.py b/tests/cd_count.py new file mode 100644 index 0000000..81b863e --- /dev/null +++ b/tests/cd_count.py @@ -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 \ No newline at end of file diff --git a/tests/check_armstrong.py b/tests/check_armstrong.py new file mode 100644 index 0000000..cc42a7a --- /dev/null +++ b/tests/check_armstrong.py @@ -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 \ No newline at end of file diff --git a/tests/decrypt.py b/tests/decrypt.py new file mode 100644 index 0000000..33135e6 --- /dev/null +++ b/tests/decrypt.py @@ -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{}(ý' \ No newline at end of file diff --git a/tests/encrypt.py b/tests/encrypt.py new file mode 100644 index 0000000..3d0bfb2 --- /dev/null +++ b/tests/encrypt.py @@ -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