mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
added junit test for previous memory block bug
This commit is contained in:
@@ -359,6 +359,27 @@ public class MemBlockDBTest extends AbstractGenericTest {
|
|||||||
assertEquals(10, sourceInfo.getLength());
|
assertEquals(10, sourceInfo.getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testJoinNonConsecutiveBlocks() throws Exception {
|
||||||
|
FileBytes fileBytes = createFileBytes();
|
||||||
|
MemoryBlock block1 = createFileBytesBlock(fileBytes, addr(0), 25, 10);
|
||||||
|
MemoryBlock block2 = createFileBytesBlock(fileBytes, addr(20), 70, 10);
|
||||||
|
MemoryBlock block3 = createFileBytesBlock(fileBytes, addr(10), 0, 10);
|
||||||
|
|
||||||
|
MemoryBlock block = mem.join(block1, block3);
|
||||||
|
block = mem.join(block1, block2);
|
||||||
|
assertEquals(1, mem.getBlocks().length);
|
||||||
|
assertEquals(30, block.getSize());
|
||||||
|
assertEquals(addr(0), block.getStart());
|
||||||
|
List<MemoryBlockSourceInfo> sourceInfos = block.getSourceInfos();
|
||||||
|
assertEquals(3, sourceInfos.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < block.getSize(); i++) {
|
||||||
|
mem.getByte(addr(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testJoinFileBytesBlockAndBufferBlock() throws Exception {
|
public void testJoinFileBytesBlockAndBufferBlock() throws Exception {
|
||||||
FileBytes fileBytes = createFileBytes();
|
FileBytes fileBytes = createFileBytes();
|
||||||
|
|||||||
Reference in New Issue
Block a user