-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_calc.py
36 lines (28 loc) · 1.11 KB
/
test_calc.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
import unittest
from binary_from_int import BinaryNumericText
class TestBinaryPyCalc(unittest.TestCase):
@classmethod
def setUp(cls):
cls.binary_first = BinaryNumericText()
cls.binary_second = BinaryNumericText()
def test_result_four(self):
self.binary_first.number = 2
self.binary_second.number = 2
sum_result = self.binary_first.add(self.binary_second)
self.assertEqual(sum_result, '0100')
def test_result_ten(self):
self.binary_first.number = 5
self.binary_second.number = 5
sum_result = self.binary_first.add(self.binary_second)
self.assertEqual(sum_result, '01010')
def test_result_twenty(self):
self.binary_first.number = 15
self.binary_second.number = 5
sum_result = self.binary_first.add(self.binary_second)
self.assertEqual(sum_result, '010100')
def test_result_thirty(self):
self.binary_first.number = 15
self.binary_second.number = 15
sum_result = self.binary_first.add(self.binary_second)
self.assertEqual(sum_result, '011110')
unittest.main()