Пример #1
0
        public void NormalizeWorksWithMultipleSections()
        {
            // --- Arrange
            var mm = new MemoryMap();

            mm.Add(new MemorySection(0x0100, 0x01FF));
            mm.Add(new MemorySection(0x0300, 0x03FF));
            mm.Add(new MemorySection(0x0400, 0x04FF));
            mm.Add(new MemorySection(0x0600, 0x06FF));
            mm.Add(new MemorySection(0x0700, 0x07FF));
            mm.Add(new MemorySection(0x0800, 0x08FF));
            mm.Add(new MemorySection(0x0900, 0x09FF));
            mm.Add(new MemorySection(0x1000, 0x1FFF));

            // --- Act
            mm.Normalize();

            // --- Assert
            mm.Count.ShouldBe(4);
            mm[0].StartAddress.ShouldBe((ushort)0x0100);
            mm[0].EndAddress.ShouldBe((ushort)0x01FF);
            mm[0].SectionType.ShouldBe(MemorySectionType.Disassemble);
            mm[1].StartAddress.ShouldBe((ushort)0x0300);
            mm[1].EndAddress.ShouldBe((ushort)0x04FF);
            mm[1].SectionType.ShouldBe(MemorySectionType.Disassemble);
            mm[2].StartAddress.ShouldBe((ushort)0x0600);
            mm[2].EndAddress.ShouldBe((ushort)0x09FF);
            mm[2].SectionType.ShouldBe(MemorySectionType.Disassemble);
            mm[3].StartAddress.ShouldBe((ushort)0x1000);
            mm[3].EndAddress.ShouldBe((ushort)0x1FFF);
            mm[3].SectionType.ShouldBe(MemorySectionType.Disassemble);
        }
Пример #2
0
        public void NormalizeWorksWithThreeAdjacentSections()
        {
            // --- Arrange
            var mm = new MemoryMap();

            mm.Add(new MemorySection(0x0100, 0x01FF));
            mm.Add(new MemorySection(0x0200, 0x02FF));
            mm.Add(new MemorySection(0x0300, 0x03FF));

            // --- Act
            mm.Normalize();

            // --- Assert
            mm.Count.ShouldBe(1);
            mm[0].StartAddress.ShouldBe((ushort)0x0100);
            mm[0].EndAddress.ShouldBe((ushort)0x03FF);
            mm[0].SectionType.ShouldBe(MemorySectionType.Disassemble);
        }
Пример #3
0
        public void NormalizeDoesNotMergeDifferentTypes3()
        {
            // --- Arrange
            var mm = new MemoryMap();

            mm.Add(new MemorySection(0x0100, 0x01FF, MemorySectionType.Skip));
            mm.Add(new MemorySection(0x0200, 0x02FF));
            mm.Add(new MemorySection(0x0300, 0x03FF));

            // --- Act
            mm.Normalize();

            // --- Assert
            mm.Count.ShouldBe(2);
            mm[0].StartAddress.ShouldBe((ushort)0x0100);
            mm[0].EndAddress.ShouldBe((ushort)0x01FF);
            mm[0].SectionType.ShouldBe(MemorySectionType.Skip);
            mm[1].StartAddress.ShouldBe((ushort)0x0200);
            mm[1].EndAddress.ShouldBe((ushort)0x03FF);
            mm[1].SectionType.ShouldBe(MemorySectionType.Disassemble);
        }
Пример #4
0
        public void NormalizeDoesNotMergeSkipSections()
        {
            // --- Arrange
            var mm = new MemoryMap();

            mm.Add(new MemorySection(0x0100, 0x01FF, MemorySectionType.Skip));
            mm.Add(new MemorySection(0x0200, 0x02FF, MemorySectionType.Skip));
            mm.Add(new MemorySection(0x0500, 0x05FF, MemorySectionType.Skip));

            // --- Act
            mm.Normalize();

            // --- Assert
            mm.Count.ShouldBe(3);
            mm[0].StartAddress.ShouldBe((ushort)0x0100);
            mm[0].EndAddress.ShouldBe((ushort)0x01FF);
            mm[0].SectionType.ShouldBe(MemorySectionType.Skip);
            mm[1].StartAddress.ShouldBe((ushort)0x0200);
            mm[1].EndAddress.ShouldBe((ushort)0x02FF);
            mm[1].SectionType.ShouldBe(MemorySectionType.Skip);
            mm[2].StartAddress.ShouldBe((ushort)0x0500);
            mm[2].EndAddress.ShouldBe((ushort)0x05FF);
            mm[2].SectionType.ShouldBe(MemorySectionType.Skip);
        }