public void BinaryGreaterEqualTest() { GreaterEq op = new GreaterEq(); Assert.AreEqual(t, new BinaryStatement(op, oneIntn, zeroIntn).Evaluate(varTable)); Assert.AreEqual(f, new BinaryStatement(op, minusOneIntn, zeroIntn).Evaluate(varTable)); Assert.AreEqual(t, new BinaryStatement(op, halfFloatn, zeroFloatn).Evaluate(varTable)); Assert.AreEqual(t, new BinaryStatement(op, zeroFloatn, zeroFloatn).Evaluate(varTable)); }
public void BinaryGreaterEqualErrorTest() { GreaterEq op = new GreaterEq(); Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op, oneFloatn, zeroIntn).Evaluate(varTable)); Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op, abn, an).Evaluate(varTable)); Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op, tn, fn).Evaluate(varTable)); Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op, oneFloatn, tn).Evaluate(varTable)); Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op, fn, zeroIntn).Evaluate(varTable)); }
//----------------------------------------------------------- public string Visit(GreaterEq node, Table table) { string label = GenerateLabel(); return(String.Format( "\t\tldc.i4.1\n" + "{1}{2}" + "\t\tbge {0}\n" + "\t\tpop\n" + "\t\tldc.i4.0\n" + "\t\t{0}:\n", label, Visit((dynamic)node[0], table), Visit((dynamic)node[1], table))); }
//----------------------------------------------------------- private Type Visit(GreaterEq node, Table table) { VisitBinaryOperator(">=", node, Type.INTEGER, table); return(Type.BOOLEAN); }