@Test public void testTrueFalseEvaluation() { Assert.assertEquals(true, m.isTrue(trueSentence)); Assert.assertEquals(false, m.isFalse(trueSentence)); Assert.assertEquals(false, m.isTrue(falseSentence)); Assert.assertEquals(true, m.isFalse(falseSentence)); }
@Test public void testSentenceStatusWhenPFalseAndQTrue() { String p = "P"; String q = "Q"; m = m.extend(new Symbol(p), false); m = m.extend(new Symbol(q), true); Assert.assertEquals(true, m.isFalse(andSentence)); Assert.assertEquals(true, m.isTrue(orSentence)); Assert.assertEquals(true, m.isTrue(impliedSentence)); Assert.assertEquals(true, m.isFalse(biConditionalSentence)); }
@Test public void testComplexSentence() { String p = "P"; String q = "Q"; m = m.extend(new Symbol(p), true); m = m.extend(new Symbol(q), false); Sentence sent = (Sentence) parser.parse("((P OR Q) AND (P => Q))"); Assert.assertFalse(m.isTrue(sent)); Assert.assertTrue(m.isFalse(sent)); Sentence sent2 = (Sentence) parser.parse("((P OR Q) AND (Q))"); Assert.assertFalse(m.isTrue(sent2)); Assert.assertTrue(m.isFalse(sent2)); }