Beispiel #1
0
    def test_biconditional(self):
        expression = "A <=> B"
        parser = PLParser()
        root_term = parser.parse(expression)

        m = Model()
        m = m.extend("A", True).extend("B", True)

        self.assertTrue(m.is_true(root_term))
        m.clear()

        m = m.extend("A", True).extend("B", False)

        self.assertFalse(m.is_true(root_term))
        m.clear()

        m = m.extend("A", False).extend("B", True)

        self.assertFalse(m.is_true(root_term))
        m.clear()

        m = m.extend("A", False).extend("B", False)

        self.assertTrue(m.is_true(root_term))
        m.clear()
Beispiel #2
0
    def test_biconditional(self):
        expression = "A <=> B"
        parser = PLParser()
        root_term = parser.parse(expression)

        m = Model()
        m = m.extend("A", True).extend("B", True)

        self.assertTrue(m.is_true(root_term))
        m.clear()

        m = m.extend("A", True).extend("B", False)

        self.assertFalse(m.is_true(root_term))
        m.clear()

        m = m.extend("A", False).extend("B", True)

        self.assertFalse(m.is_true(root_term))
        m.clear()

        m = m.extend("A", False).extend("B", False)

        self.assertTrue(m.is_true(root_term))
        m.clear()
Beispiel #3
0
    def test_not(self):
        expression = "NOT A"
        parser = PLParser()
        root_term = parser.parse(expression)

        m = Model()
        m = m.extend("A", False)

        self.assertTrue(m.is_true(root_term))
        m.clear()

        m = m.extend("A", True)

        self.assertFalse(m.is_true(root_term))
Beispiel #4
0
    def test_not(self):
        expression = "NOT A"
        parser = PLParser()
        root_term = parser.parse(expression)

        m = Model()
        m = m.extend("A", False)

        self.assertTrue(m.is_true(root_term))
        m.clear()

        m = m.extend("A", True)

        self.assertFalse(m.is_true(root_term))