mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
added junit test for previous memory block bug
This commit is contained in:
parent
8bc95794e6
commit
1dfda0d419
1 changed files with 21 additions and 0 deletions
|
@ -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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue