Example #1
0
        public void interpNumber()
        {
            numC n1 = new numC(5);
            numC n2 = new numC(4);

            Assert.AreEqual(Program.interp(n1).toString(), "5");
            Assert.AreEqual(Program.interp(n2).toString(), "4");
        }
Example #2
0
        public void testNumC()
        {
            numC n1 = new numC(5);

            Assert.AreEqual(n1.number, 5);

            Assert.AreEqual(Program.interp(n1).toString(), "5");
        }
Example #3
0
        public void interpIfC()
        {
            boolC b1     = new boolC(true);
            numC  n1     = new numC(5);
            numC  n2     = new numC(6);
            ifC   anifc  = new ifC(b1, n1, n2);
            Value rvalue = Program.interp(anifc);

            Assert.AreEqual(rvalue.toString(), "5");
        }
Example #4
0
        public void testBinopC()
        {
            binopC abinop = new binopC("+", (new numC(5)), (new numC(6)));

            Assert.AreEqual(abinop.op, "+");
            numC left  = abinop.left as numC;
            numC right = abinop.right as numC;

            Assert.AreEqual(left.number, 5);
            Assert.AreEqual(right.number, 6);
        }