public void TestDisjunctionTrueExpression() { AbstractExpression expr1 = new ConstExpression(true); AbstractExpression expr2 = new ConstExpression(false); AbstractExpression expr3 = new DisjunctionExpression(expr1, expr2); Assert.AreEqual(expr3.interpret(_context), true); }
public void TestComplexExpression() { _context.setValue("x", true); _context.setValue("y", false); // (x v y ) n true AbstractExpression xExpr = new VariableExpression("x"); AbstractExpression yExpr = new VariableExpression("y"); AbstractExpression trueExpr = new ConstExpression(true); AbstractExpression orExpr = new DisjunctionExpression(xExpr, yExpr); AbstractExpression andExpr = new ConjunctionExpression(orExpr, trueExpr); Assert.AreEqual(andExpr.interpret(_context), true); }