コード例 #1
0
        public void TestAnd()
        {
            var and = new And(Constant.True, Constant.True);

            Assert.AreEqual("true && true", and.ToString());

            and.Jumping(42, 99);
            //output:
            //        goto L42
        }
コード例 #2
0
        public void AndJumpingTest()
        {
            using (var cout = new StringWriter())
            {
                Node.Cout = cout;

                var token = new Word("and", Tag.AND);
                var exp1  = new Expr(Word.TRUE, VarType.BOOL);
                var exp2  = new Expr(Word.FALSE, VarType.BOOL);
                var and   = new And(token, exp1, exp2);
                and.Jumping(22, 33);

                var actual = cout.ToString();
                Assert.AreEqual("\tif true goto L33\r\n\tif false goto L22\r\n\tgoto L33\r\n", actual);
            }
        }