-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_main.py
49 lines (38 loc) · 1.26 KB
/
test_main.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
import unittest
import main
class TestBinaryClock(unittest.TestCase):
#convertinttobinlist
def test_default(self):
in_value = "Verify"
result = in_value
self.assertEqual(result, in_value)
def test_0(self):
in_value = 0
result = main.convertinttobinlist(in_value)
self.assertEqual(result, [0])
def test_0_4long(self):
in_value = 0
result = main.convertinttobinlist(in_value, 4)
self.assertEqual(result, [0, 0, 0, 0])
def test_1(self):
in_value = 1
result = main.convertinttobinlist(in_value)
self.assertEqual(result, [1])
def test_2(self):
in_value = 2
result = main.convertinttobinlist(in_value)
self.assertEqual(result, [1, 0])
def test_2_4long(self):
in_value = 2
result = main.convertinttobinlist(in_value, 4)
self.assertEqual(result, [0, 0, 1, 0])
def test_24(self):
in_value = 24
result = main.convertinttobinlist(in_value)
self.assertEqual(result, [1, 1, 0, 0, 0])
def test_255(self):
in_value = 255
result = main.convertinttobinlist(in_value)
self.assertEqual(result, [1, 1, 1, 1, 1, 1, 1, 1])
if __name__ == "__main__":
unittest.main()