-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_ransom_note.py
More file actions
30 lines (24 loc) · 1 KB
/
test_ransom_note.py
File metadata and controls
30 lines (24 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest
from parameterized import parameterized
from algorithms.hash_table.ransom_note import can_construct, can_construct_2
RANSOM_NOTE_TEST_CASES = [
("codinginterviewquestions", "aboincsdefoetingvqtniewonoregessnutins", True),
("code", "coingd", False),
("codinginterview", "vieewidingcodinter", True),
("program", "programming", True),
("me", "meme", True),
("a", "b", False),
("aa", "ab", False),
("aa", "aab", True),
]
class RansomNoteTestCase(unittest.TestCase):
@parameterized.expand(RANSOM_NOTE_TEST_CASES)
def test_can_construct(self, ransom_note: str, magazine: str, expected: bool):
actual = can_construct(ransom_note, magazine)
self.assertEqual(expected, actual)
@parameterized.expand(RANSOM_NOTE_TEST_CASES)
def test_can_construct_2(self, ransom_note: str, magazine: str, expected: bool):
actual = can_construct_2(ransom_note, magazine)
self.assertEqual(expected, actual)
if __name__ == "__main__":
unittest.main()