-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_full_adder.py
43 lines (34 loc) · 1.05 KB
/
test_full_adder.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
from lib import adderhandler
class Tests:
def test_000(self):
adder = adderhandler.FullAdder(0, 0, 0)
assert adder.s == 0
assert adder.c == 0
def test_001(self):
adder = adderhandler.FullAdder(0, 0, 1)
assert adder.s == 1
assert adder.c == 0
def test_010(self):
adder = adderhandler.FullAdder(0, 1, 0)
assert adder.s == 1
assert adder.c == 0
def test_011(self):
adder = adderhandler.FullAdder(0, 1, 1)
assert adder.s == 0
assert adder.c == 1
def test_100(self):
adder = adderhandler.FullAdder(1, 0, 0)
assert adder.s == 1
assert adder.c == 0
def test_101(self):
adder = adderhandler.FullAdder(1, 0, 1)
assert adder.s == 0
assert adder.c == 1
def test_110(self):
adder = adderhandler.FullAdder(1, 1, 0)
assert adder.s == 0
assert adder.c == 1
def test_111(self):
adder = adderhandler.FullAdder(1, 1, 1)
assert adder.s == 1
assert adder.c == 1