Skip to content

Commit 94e9a5c

Browse files
committed
Add first round of unit tests
1 parent cabcd9c commit 94e9a5c

File tree

5 files changed

+392
-25
lines changed

5 files changed

+392
-25
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ minversion = "8.0"
4747
testpaths = [
4848
"tests",
4949
]
50+
python_files = ["test_*.py"]
5051

5152
[tool.mypy]
5253
files = "."

tests/pytest.ini

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/test_basic_data_handling.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/test_boolean_nodes.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import pytest
2+
3+
from src.basic_data_handling.boolean_nodes import (
4+
BooleanAnd,
5+
BooleanOr,
6+
BooleanNot,
7+
BooleanXor,
8+
BooleanNand,
9+
BooleanNor,
10+
)
11+
12+
13+
def test_boolean_and():
14+
node = BooleanAnd()
15+
assert node.and_operation(True, True) == (True,)
16+
assert node.and_operation(True, False) == (False,)
17+
assert node.and_operation(False, True) == (False,)
18+
assert node.and_operation(False, False) == (False,)
19+
20+
21+
def test_boolean_or():
22+
node = BooleanOr()
23+
assert node.or_operation(True, True) == (True,)
24+
assert node.or_operation(True, False) == (True,)
25+
assert node.or_operation(False, True) == (True,)
26+
assert node.or_operation(False, False) == (False,)
27+
28+
29+
def test_boolean_not():
30+
node = BooleanNot()
31+
assert node.not_operation(True) == (False,)
32+
assert node.not_operation(False) == (True,)
33+
34+
35+
def test_boolean_xor():
36+
node = BooleanXor()
37+
assert node.xor_operation(True, True) == (False,)
38+
assert node.xor_operation(True, False) == (True,)
39+
assert node.xor_operation(False, True) == (True,)
40+
assert node.xor_operation(False, False) == (False,)
41+
42+
43+
def test_boolean_nand():
44+
node = BooleanNand()
45+
assert node.nand_operation(True, True) == (False,)
46+
assert node.nand_operation(True, False) == (True,)
47+
assert node.nand_operation(False, True) == (True,)
48+
assert node.nand_operation(False, False) == (True,)
49+
50+
51+
def test_boolean_nor():
52+
node = BooleanNor()
53+
assert node.nor_operation(True, True) == (False,)
54+
assert node.nor_operation(True, False) == (False,)
55+
assert node.nor_operation(False, True) == (False,)
56+
assert node.nor_operation(False, False) == (True,)

0 commit comments

Comments
 (0)