示例#1
0
        public void RegExpAaOrBbDotAaOrBb()
        {
            RegExp regExpLeft = new RegExp("aa");

            Assert.IsNull(regExpLeft.Left);
            Assert.IsNull(regExpLeft.Right);
            Assert.AreEqual(RegExp.OperatorEnum.One, regExpLeft.Operator);
            Assert.AreEqual("aa", regExpLeft.Terminals);

            RegExp regExpRight = new RegExp("bb");

            Assert.IsNull(regExpRight.Left);
            Assert.IsNull(regExpRight.Right);
            Assert.AreEqual(RegExp.OperatorEnum.One, regExpRight.Operator);
            Assert.AreEqual("bb", regExpRight.Terminals);

            RegExp regExpOr = regExpLeft.Or(regExpRight);

            Assert.AreSame(regExpLeft, regExpOr.Left);
            Assert.AreSame(regExpRight, regExpOr.Right);
            Assert.AreEqual(RegExp.OperatorEnum.Or, regExpOr.Operator);
            Assert.AreEqual("", regExpOr.Terminals);

            RegExp regExpDot = regExpOr.Dot(regExpOr);

            Assert.AreSame(regExpOr, regExpDot.Left);
            Assert.AreSame(regExpOr, regExpDot.Right);
            Assert.AreEqual(RegExp.OperatorEnum.Dot, regExpDot.Operator);
            Assert.AreEqual("", regExpDot.Terminals);
        }
示例#2
0
        public void RegExpAaDotBb()
        {
            RegExp regExpLeft = new RegExp("aa");

            Assert.IsNull(regExpLeft.Left);
            Assert.IsNull(regExpLeft.Right);
            Assert.AreEqual(RegExp.OperatorEnum.One, regExpLeft.Operator);
            Assert.AreEqual("a.a", regExpLeft.Terminals);

            RegExp regExpRight = new RegExp("bb");

            Assert.IsNull(regExpRight.Left);
            Assert.IsNull(regExpRight.Right);
            Assert.AreEqual(RegExp.OperatorEnum.One, regExpRight.Operator);
            Assert.AreEqual("bb", regExpRight.Terminals);

            RegExp regExpDot = regExpLeft.Dot(regExpRight);

            Assert.AreEqual(regExpLeft, regExpDot.Left);
            Assert.AreEqual(regExpRight, regExpDot.Right);
            Assert.AreEqual(RegExp.OperatorEnum.Dot, regExpDot.Operator);
            Assert.AreEqual("", regExpDot.Terminals);
        }