Ejemplo n.º 1
0
        public void BottomUpOptimizer_Simple8()
        {
            var burs = GetStrOptimizer();

            var t = new ConcatStrTree(
                new UnaryStrTree(StrKind.ToUpper,
                                 new UnaryStrTree(StrKind.ToLower,
                                                  new ConstStrTree("FoO")
                                                  )
                                 ),
                new UnaryStrTree(StrKind.ToLower,
                                 new ConcatStrTree(
                                     ConstStrTree.Empty,
                                     ConstStrTree.Empty
                                     )
                                 ),
                new UnaryStrTree(StrKind.ToLower,
                                 new UnaryStrTree(StrKind.ToUpper,
                                                  new ConstStrTree("bAr")
                                                  )
                                 )
                );

            var r = burs.Optimize(t);

            Assert.AreEqual(t.Eval(), r.Eval());
            Assert.AreEqual("Concat(ToUpper(Const(FoO)), ToLower(Const(bAr)))", r.ToString());
        }
Ejemplo n.º 2
0
        public void BottomUpOptimizer_Simple7()
        {
            var burs = GetStrOptimizer();

            var t = new ConcatStrTree();
            var r = burs.Optimize(t);

            Assert.AreEqual(t.Eval(), r.Eval());
            Assert.AreEqual("Const()", r.ToString());
        }