public object Visit(NotEquals expression) { object leftValue = expression.Left.Accept <object>(this); object rightValue = expression.Right.Accept <object>(this); return((int)leftValue != (int)rightValue); }
public void Visit(NotEquals m) { Console.WriteLine("Pop stack into a"); Console.WriteLine("Pop stack into b"); Console.WriteLine("compare a,b"); Console.WriteLine("push ! zero flag onto stack"); }
public static void ToSql(NotEquals expression, StringBuilder builder) { if (null == expression) { throw new ArgumentNullException("expression"); } if (null == builder) { throw new ArgumentNullException("builder"); } if (expression.Operands.Count > 0) { IToken operand1 = expression.Operands .First(); IToken operand2 = expression.Operands .ElementAtOrDefault(1); if (null != operand1 && null != operand2) { operand1.ToSql(builder); builder.Append(" <> "); operand2.ToSql(builder); } } }
public static string GetNotEqualsOperand(NotEquals expression, VHDLCompilerInterface compiler) { string left = GetOperand(expression.Left, compiler); string right = GetOperand(expression.Right, compiler); FunctionCallTemplate template = new FunctionCallTemplate(left, "NotEquals", right); return(template.TransformText()); }
public void conditionMeet_should_return_true_if_both_numbers_dont_have_same_value() { // Given SUT = new NotEquals(new RealNumber(1), new RealNumber(2)); // Then Assert.IsTrue(SUT.ConditionMeet); }
public void Evaluate_LeftIsNotEqualToRight_ReturnsTrue() { var left = new Integer(-1); var right = new Integer(3934); var equals = new NotEquals(left, right); var result = equals.EvaluateWithData <bool>(); Assert.True(result); }
public void constructor_should_throw_if_right_number_is_null() { // Given // When // Then var ex = Assert.Throws<ArgumentNullException>(() => SUT = new NotEquals(new RealNumber(1), null)); Assert.AreEqual("The right number can't be null\r\nParameter name: right", ex.Message); }
public void contructor_should_set_right_number() { // Given var nbr = new RealNumber(1); // When SUT = new NotEquals(new RealNumber(2), nbr); // Then Assert.AreSame(nbr, SUT.Right); }
public void TestNotEquals(String string1, String string2, bool expectedResult) { NotEquals gt = new NotEquals { LeftHand = new ARPB2Engine.Model.String(string1), RightHand = new ARPB2Engine.Model.String(string2) }; Assert.Equal(expectedResult, gt.Execute()); }
public void Visit(NotEquals bin) { var left = bin.Left; var right = bin.Right; PrepareBinaryOperation(left, right); Emit("ceq"); Emit($"ldc.{MiniType.Bool.ToPrimitive()} 0"); EmitStackDown("ceq"); }
private IExpression EqualityExpression() { var expression = RelationalExpression(); while (lookAhead.Type == ExpressionTokenType.Equal || lookAhead.Type == ExpressionTokenType.NotEqual) { var type = lookAhead.Type; NextToken(); var rightOperand = RelationalExpression(); switch (type) { case ExpressionTokenType.Equal: expression = new Equals(expression, rightOperand); break; case ExpressionTokenType.NotEqual: expression = new NotEquals(expression, rightOperand); break; } } return(expression); }
public void ToString_IntegerComparison_ReturnsExpected() { var expr = new NotEquals(new Integer(3), new Integer(9)); Assert.AreEqual("3 != 9", expr.ToString()); }
protected internal virtual void create() { int num = this.string_0.Length; Unit unit = null; int num2 = 0; while (this.int_0 < num) { char ch2 = this.string_0[this.int_0]; if (char.IsWhiteSpace(ch2)) { goto Label_041D; } unit = null; char ch = ch2; switch (ch) { case '!': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { unit = new NotEquals(); this.int_0++; } if (unit == null) { unit = new Not(); } goto Label_03B6; case '"': case '#': case '$': case '\'': case ';': goto Label_02D1; case '%': unit = new Mod(); this.int_0++; goto Label_03B6; case '&': this.int_0++; if ((this.int_0 >= num) || (this.string_0[this.int_0] != '&')) { break; } unit = new And(); this.int_0++; goto Label_03B6; case '(': goto Label_02DD; case ')': goto Label_02F4; case '*': goto Label_0312; case '+': goto Label_032B; case ',': throw new ReportError(new StringBuilder("位置").Append(this.int_0).Append("不应该出现逗号").ToString().ToString()); case '-': goto Label_0341; case '.': goto Label_0357; case '/': unit = new Divide(); this.int_0++; goto Label_03B6; case ':': unit = new Link(this.cellExt1_0); this.int_0++; goto Label_03B6; case '<': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { unit = new NotGreater(); this.int_0++; } if (unit == null) { unit = new Smaller(); } goto Label_03B6; case '=': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { this.int_0++; } unit = new Equals(); goto Label_03B6; case '>': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { unit = new NotSmaller(); this.int_0++; } if (unit == null) { unit = new Greater(); } goto Label_03B6; default: if (ch != '|') { goto Label_02D1; } this.int_0++; if ((this.int_0 >= num) || (this.string_0[this.int_0] != '|')) { throw new ReportError("不能识别标识符|"); } unit = new Or(); this.int_0++; goto Label_03B6; } unit = LoadFunction.newFunction("address", this.env_0, this.cellExt1_0, this.dataSet_0); goto Label_03B6; Label_02D1: unit = this.createNode(); goto Label_03B6; Label_02DD: num2++; this.int_0++; continue; Label_02F4: if (--num2 < 0) { throw new ReportError("括号不匹配,右括号太多!"); } this.int_0++; continue; Label_0312: unit = new Multiply(); this.int_0++; goto Label_03B6; Label_032B: unit = new Add(); this.int_0++; goto Label_03B6; Label_0341: unit = new Subtract(); this.int_0++; goto Label_03B6; Label_0357: if ((this.unit_1 != null) && !this.unit_1.Operator) { unit = LoadFunction.newFunction("dsmember", this.env_0, this.cellExt1_0, this.dataSet_0); this.int_0++; } else { unit = this.createNode(); } Label_03B6: unit.InBrackets = num2; this.unit_1 = unit; if (this.unit_0 != null) { Unit right = this.unit_0; Unit unit2 = null; while (right != null) { if (right.Priority >= unit.Priority) { break; } unit2 = right; right = right.Right; } unit.Left = right; if (unit2 == null) { this.unit_0 = unit; } else { unit2.Right = unit; } continue; } this.unit_0 = unit; continue; Label_041D: this.int_0++; } if (num2 > 0) { throw new ReportError("括号不匹配,左括号太多!"); } }
public void Teardown() { SUT = null; }
public static void ToSql(NotEquals expression, StringBuilder builder) { if (null == expression) throw new ArgumentNullException("expression"); if (null == builder) throw new ArgumentNullException("builder"); if (expression.Operands.Count > 0) { IToken operand1 = expression.Operands .First(); IToken operand2 = expression.Operands .ElementAtOrDefault(1); if (null != operand1 && null != operand2) { operand1.ToSql(builder); builder.Append(" <> "); operand2.ToSql(builder); } } }
public static string GetNotEqualsExpresstionType(NotEquals expression, VHDLCompilerInterface compiler) { return("bool"); }
public void Setup() { SUT = new NotEquals(new RealNumber(1), new RealNumber(2)); }
public AbstractValue Evaluate(NotEquals expr) { throw new NotImplementedException(); }