public void BinaryLessEqualTest()
        {
            LessEq op = new LessEq();

            Assert.AreEqual(f, new BinaryStatement(op, oneIntn, zeroIntn).Evaluate(varTable));
            Assert.AreEqual(t, new BinaryStatement(op, minusOneIntn, zeroIntn).Evaluate(varTable));
            Assert.AreEqual(f, new BinaryStatement(op, halfFloatn, zeroFloatn).Evaluate(varTable));
            Assert.AreEqual(t, new BinaryStatement(op, zeroFloatn, zeroFloatn).Evaluate(varTable));
        }
        public void BinaryLessEqualErrorTest()
        {
            LessEq op = new LessEq();

            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));
        }
Example #3
0
        //-----------------------------------------------------------
        public string Visit(LessEq node)
        {
            var label = GenerateLabel();

            return(String.Format(
                       "\t\tldc.i4 42\n\t\t{0}\n\t\t{1}\n\t\tble '{2}'\n\t\tpop\n\t\tldc.i4.0\n\t'{2}':\n",
                       Visit((dynamic)node[0]),
                       Visit((dynamic)node[1]),
                       label
                       ));
        }
Example #4
0
        public string Visit(LessEq node)
        {
            var result = "";

            result +=
                Visit((dynamic)node[0]) + "\n"
                + Visit((dynamic)node[1]) + "\n"
                + "\tcgt\n"
                + "\tldc.i4.0\n"
                + "\tceq\n";
            return(result);
        }
Example #5
0
 //-----------------------------------------------------------
 public void Visit(LessEq node)
 {
     VisitChildren(node);
 }
 public Type Visit(LessEq node)
 {
     VisitBinaryOperator("<=", node, Type.INT);
     return(Type.BOOL);
 }