Exemplo n.º 1
0
        public void TestUnary()
        {
            var mult = new Arith(new Token('*'), new Constant(42), new Constant(3));
            var u    = new Unary(new Token('-'), mult);

            Assert.AreEqual("- 42 * 3", u.ToString());
            Assert.IsTrue(u.Gen() is Expr);
        }
Exemplo n.º 2
0
        public void UnaryToStringTest()
        {
            var token    = new Token('-');
            var variable = new Id(new Word("x", Tag.ID), VarType.INT, 0);
            var unary    = new Unary(token, variable);

            Assert.AreEqual("- x", unary.ToString());
        }