Browse Source

Added conjunctive function and test

remotes/origin/feature/feature-logical-operations
fdai7783 11 months ago
parent
commit
e5f2a4d897
  1. 7
      src/main/py/logical_operations.py
  2. 3
      src/test/py/test_logical_operations.py

7
src/main/py/logical_operations.py

@ -3,3 +3,10 @@ def identity_disconjunctive(variable, operator, zero):
return variable return variable
else: else:
return None return None
def identity_conjunctive(variable, operator, zero):
if zero == 0 and operator == "+":
return variable
else:
return None

3
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): def test_disconjunctive_identity_0_or_0_equals_0(self):
self.assertEqual(identity_disconjunctive(0, "+", 0), 0) 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__": if __name__ == "__main__":
unittest.main() unittest.main()
Loading…
Cancel
Save