|
| 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