Example #1
0
        public void ToStringImplementation()
        {
            var segment1 = new Segment("E", false);
            var segment2 = new Segment("+", true);
            var segment3 = new Segment("Number", true);

            var production = new Production(segment1, ImmutableArray.Create(segment1, segment2, segment3));

            var item0 = new ParseItem(production, 0);
            var item1 = new ParseItem(production, 1);
            var item2 = new ParseItem(production, 2);
            var item3 = new ParseItem(production, 3);

            Assert.That(item0.ToString(), Is.EqualTo("[<E> -> \u2022 <E> + Number]"));
            Assert.That(item1.ToString(), Is.EqualTo("[<E> -> <E> \u2022 + Number]"));
            Assert.That(item2.ToString(), Is.EqualTo("[<E> -> <E> + \u2022 Number]"));
            Assert.That(item3.ToString(), Is.EqualTo("[<E> -> <E> + Number \u2022]"));
        }