Exemple #1
0
        public void Repetition_0ToU()
        {
            var child = ReUtils.NewDummy('1');

            var element = ReFactory.NewRepetition(child, 0, null);

            Assert.That(element, Is.Not.Null);
            Assert.That(element, Is.TypeOf(typeof(ReKleeneStar)));

            var star = (ReKleeneStar)element;

            Assert.That(star.Element, Is.SameAs(child));
        }
Exemple #2
0
        public void Repetition_2()
        {
            var child = ReUtils.NewDummy('1');

            var element = ReFactory.NewRepetition(child, 2, 2);

            Assert.That(element, Is.Not.Null);
            Assert.That(element, Is.TypeOf(typeof(ReConcatenation)));

            var concat = (ReConcatenation)element;

            Assert.That(concat.Elements, Is.EquivalentTo(new ReElement[] { child, child }));
        }
Exemple #3
0
        public void Repetition_0To1()
        {
            var child = ReUtils.NewDummy('1');

            var element = ReFactory.NewRepetition(child, 0, 1);

            Assert.That(element, Is.Not.Null);
            Assert.That(element, Is.TypeOf(typeof(ReUnion)));

            var elements = new List <ReElement>(((ReUnion)element).Elements);

            Assert.That(elements.Count, Is.EqualTo(2));
            Assert.That(elements[0], Is.SameAs(child));
            Assert.That(elements[1], Is.Not.Null);
            Assert.That(elements[1], Is.TypeOf(typeof(ReEmptyString)));
        }
Exemple #4
0
        public void Repetition_1ToU()
        {
            var child = ReUtils.NewDummy('1');

            var element = ReFactory.NewRepetition(child, 1, null);

            Assert.That(element, Is.Not.Null);
            Assert.That(element, Is.TypeOf(typeof(ReConcatenation)));

            var concatElements = new List <ReElement>(((ReConcatenation)element).Elements);

            Assert.That(concatElements.Count, Is.EqualTo(2));
            Assert.That(concatElements[0], Is.SameAs(child));
            Assert.That(concatElements[1], Is.Not.Null);
            Assert.That(concatElements[1], Is.TypeOf(typeof(ReKleeneStar)));

            var star = (ReKleeneStar)concatElements[1];

            Assert.That(star.Element, Is.SameAs(child));
        }