public void TestNegation() { var op = new NegationOperator(); var result = op.Apply(1); Assert.AreEqual(-1, result); }
public void TestPrecedence() { var addition = new AdditionOperator(); var subtraction = new SubtractionOperator(); var multiplication = new MultiplicationOperator(); var division = new DivisionOperator(); var negation = new NegationOperator(); Assert.IsTrue(addition.Precedence < multiplication.Precedence); Assert.IsTrue(addition.Precedence < division.Precedence); Assert.IsTrue(subtraction.Precedence < multiplication.Precedence); Assert.IsTrue(subtraction.Precedence < division.Precedence); Assert.IsTrue(multiplication.Precedence < negation.Precedence); Assert.IsTrue(division.Precedence < negation.Precedence); }
public void Evaluate() { ParserContext pc = new ParserContext(ParserContext.DefaultBufferSize); FormatterContext fc = new FormatterContext(FormatterContext.DefaultBufferSize); NegationOperator op = new NegationOperator(new MockBooleanExpression(true)); Assert.IsFalse(op.EvaluateParse(ref pc)); Assert.IsFalse(op.EvaluateFormat(new StringField(3, "000000"), ref fc)); op = new NegationOperator(new MockBooleanExpression(false)); Assert.IsTrue(op.EvaluateParse(ref pc)); Assert.IsTrue(op.EvaluateFormat(new StringField(3, "000000"), ref fc)); }
public void InstantiationAndProperties() { NegationOperator op = new NegationOperator(); Assert.IsNull(op.Expression); MockBooleanExpression expression = new MockBooleanExpression(true); op = new NegationOperator(expression); Assert.IsTrue(op.Expression == expression); op.Expression = null; Assert.IsNull(op.Expression); }
public virtual void Visit(NegationOperator unaryOperator) { Visit(unaryOperator.Operand); }
public virtual T VisitNegationOperator(NegationOperator negationOperator) { throw new NotImplementedException(); }
protected Condition(NegationOperator negationOperator) { _negationOperator = negationOperator; SetResult(false); }
public override void Visit(NegationOperator unaryOperator) { Write("-"); Visit(unaryOperator.Operand); }
public string VisitNegationOperator(NegationOperator negationOperator) { throw new NotImplementedException(); }
public AddressNode VisitNegationOperator(NegationOperator negationOperator) { throw new System.NotImplementedException(); }