-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
74 lines (66 loc) · 1.11 KB
/
test.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import unittest
from bigmessage import convert_phrase
import unittest
class BigMessageTestCase(unittest.TestCase):
def test_one_character(self):
output = convert_phrase('H', '0', '1', False)
expected = '''1001
1001
1111
1001
1001
'''
self.assertEqual(output, expected)
def test_one_word(self):
output = convert_phrase('HI', '0', '1', False)
expected = '''10010111
10010010
11110010
10010010
10010111
'''
self.assertEqual(output, expected)
def test_two_words(self):
output = convert_phrase('A B', '0', '1', False)
expected = '''0110
1001
1111
1001
1001
1110
1001
1110
1001
1110
'''
self.assertEqual(output, expected)
def test_one_word_border(self):
output = convert_phrase('HI', '0', '1', True)
expected = '''0000000000
0100101110
0100100100
0111100100
0100100100
0100101110
0000000000
'''
self.assertEqual(output, expected)
def test_two_words_border(self):
output = convert_phrase('A B', '0', '1', True)
expected = '''000000
001100
010010
011110
010010
010010
000000
011100
010010
011100
010010
011100
000000
'''
self.assertEqual(output, expected)
if __name__ == '__main__':
unittest.main()