示例#1
0
        public void Memoize()
        {
            var a   = new Literal("a");
            var dot = new Repetition(a, 1, 1);

            var dot2 = dot.Memoize() as Repetition;

            Assert.IsNotNull(dot2);
            Assert.IsTrue(dot2.Memoized);
            Assert.AreEqual("", dot2.Name);

            var dot3 = dot2.Memoize();

            Assert.AreEqual(dot2, dot3);

            var dot4 = dot2.Memoize("Test") as Repetition;

            Assert.IsNotNull(dot4);
            Assert.IsTrue(dot4.Memoized);
            Assert.AreEqual("Test", dot4.Name);
        }