Example #1
0
        public void GetMappingSegment_ReturnsConstructedMappingSegment()
        {
            var decoder = new MappingDecoder();
            var segment = decoder.GetMappingSegment(1, "llClDlHeL");

            Assert.That(segment.GeneratedLineIndex, Is.EqualTo(1));
            Assert.That(segment.GeneratedColumnIndex, Is.EqualTo(-1106));
            Assert.That(segment.SourcesIndex, Is.EqualTo(-50));
            Assert.That(segment.SourceLineIndex, Is.EqualTo(-114));
            Assert.That(segment.SourceColumnIndex, Is.EqualTo(15));
            Assert.That(segment.NamesIndex, Is.EqualTo(-5));
        }
Example #2
0
        public void FixUpGroupSetmentOffsets_TalliesNamesIndices()
        {
            var groups = new List <MappingGroup>
            {
                GetGroup(new MappingSegment {
                    NamesIndex = 1
                }, new MappingSegment {
                    NamesIndex = 4
                }),
                GetGroup(new MappingSegment {
                    NamesIndex = null
                }, new MappingSegment {
                    NamesIndex = 3
                })
            };

            MappingDecoder.FixUpGroupSegmentOffsets(groups);

            Assert.That(groups[0].Segments.ElementAt(0).NamesIndex, Is.EqualTo(1));
            Assert.That(groups[0].Segments.ElementAt(1).NamesIndex, Is.EqualTo(5));
            Assert.That(groups[1].Segments.ElementAt(0).NamesIndex, Is.EqualTo(null));
            Assert.That(groups[1].Segments.ElementAt(1).NamesIndex, Is.EqualTo(8));
        }
Example #3
0
        public void FixUpGroupSegmentOffsets_TalliesLastGeneratedColumnIndex_ResettingAtEachGroup()
        {
            var groups = new List <MappingGroup>
            {
                GetGroup(new MappingSegment {
                    GeneratedColumnIndex = 2
                }, new MappingSegment {
                    GeneratedColumnIndex = 5
                }),
                GetGroup(new MappingSegment {
                    GeneratedColumnIndex = 1
                }, new MappingSegment {
                    GeneratedColumnIndex = 3
                })
            };

            MappingDecoder.FixUpGroupSegmentOffsets(groups);

            Assert.That(groups[0].Segments.ElementAt(0).GeneratedColumnIndex, Is.EqualTo(2));
            Assert.That(groups[0].Segments.ElementAt(1).GeneratedColumnIndex, Is.EqualTo(7));
            Assert.That(groups[1].Segments.ElementAt(0).GeneratedColumnIndex, Is.EqualTo(1));
            Assert.That(groups[1].Segments.ElementAt(1).GeneratedColumnIndex, Is.EqualTo(4));
        }