Search in sources :

Example 1 with AFalsityPredicate

use of de.be4.classicalb.core.parser.node.AFalsityPredicate in project probparsers by bendisposto.

the class ASTPrologTest method testTrueFalse.

@Test
public void testTrueFalse() throws BCompoundException {
    checkPredicate("TRUE : BOOL", "member($,boolean_true($),bool_set($))");
    checkPredicate("FALSE : BOOL", "member($,boolean_false($),bool_set($))");
    final ADisjunctPredicate disjunction = new ADisjunctPredicate();
    disjunction.setLeft(new ATruthPredicate());
    disjunction.setRight(new AFalsityPredicate());
    checkAST(0, "disjunct($,truth($),falsity($))", disjunction);
}
Also used : ATruthPredicate(de.be4.classicalb.core.parser.node.ATruthPredicate) ADisjunctPredicate(de.be4.classicalb.core.parser.node.ADisjunctPredicate) AFalsityPredicate(de.be4.classicalb.core.parser.node.AFalsityPredicate) Test(org.junit.Test)

Example 2 with AFalsityPredicate

use of de.be4.classicalb.core.parser.node.AFalsityPredicate in project probparsers by bendisposto.

the class PredicatesTest method testBFalse.

@Test
public void testBFalse() throws BCompoundException {
    parser.getOptions().setRestrictProverExpressions(true);
    try {
        getPredicateAsString("bfalse");
        fail("exception expected");
    } catch (BCompoundException e) {
        assertTrue(e.getFirstException().getCause() instanceof CheckException);
    }
    parser.getOptions().setRestrictProverExpressions(false);
    final String actual = getPredicateAsString("bfalse");
    final String expected = "AFalsityPredicate()";
    assertEquals(expected, actual);
}
Also used : CheckException(de.be4.classicalb.core.parser.exceptions.CheckException) Ast2String(util.Ast2String) BCompoundException(de.be4.classicalb.core.parser.exceptions.BCompoundException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 BCompoundException (de.be4.classicalb.core.parser.exceptions.BCompoundException)1 CheckException (de.be4.classicalb.core.parser.exceptions.CheckException)1 ADisjunctPredicate (de.be4.classicalb.core.parser.node.ADisjunctPredicate)1 AFalsityPredicate (de.be4.classicalb.core.parser.node.AFalsityPredicate)1 ATruthPredicate (de.be4.classicalb.core.parser.node.ATruthPredicate)1 Ast2String (util.Ast2String)1