public void TestNegationExpression() { AbstractExpression expr1 = new ConstExpression(true); AbstractExpression expr2 = new NegationExpression(expr1); Assert.AreEqual(expr2.interpret(_context), false); }
public void TestDisjunctionFalseExpression() { AbstractExpression expr1 = new ConstExpression(false); AbstractExpression expr2 = new ConstExpression(false); AbstractExpression expr3 = new ConjunctionExpression(expr1, expr2); Assert.AreEqual(expr3.interpret(_context), false); }
public void TestConjunctionTrueExpression() { AbstractExpression expr1 = new ConstExpression(true); AbstractExpression expr2 = new ConstExpression(true); AbstractExpression expr3 = new ConjunctionExpression(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); }
public void TestConstExpression() { AbstractExpression expr = new ConstExpression(true); Assert.AreEqual(expr.interpret(_context), true); }