From e5f2a4d8976d22276670e96622898af85f57da69 Mon Sep 17 00:00:00 2001 From: fdai7783 Date: Sun, 4 Feb 2024 13:07:04 +0100 Subject: [PATCH] Added conjunctive function and test --- src/main/py/logical_operations.py | 7 +++++++ src/test/py/test_logical_operations.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/main/py/logical_operations.py b/src/main/py/logical_operations.py index 297746f..179714b 100644 --- a/src/main/py/logical_operations.py +++ b/src/main/py/logical_operations.py @@ -3,3 +3,10 @@ def identity_disconjunctive(variable, operator, zero): return variable else: return None + + +def identity_conjunctive(variable, operator, zero): + if zero == 0 and operator == "+": + return variable + else: + return None diff --git a/src/test/py/test_logical_operations.py b/src/test/py/test_logical_operations.py index 051ad51..69a9886 100644 --- a/src/test/py/test_logical_operations.py +++ b/src/test/py/test_logical_operations.py @@ -21,6 +21,9 @@ class calculationsWithRoots(unittest.TestCase): def test_disconjunctive_identity_0_or_0_equals_0(self): self.assertEqual(identity_disconjunctive(0, "+", 0), 0) + def test_disconjunctive_identity_0_or_0_equals_01(self): + self.assertEqual(identity_conjunctive(0, ".", 0), None) + if __name__ == "__main__": unittest.main()