From f9c76fcaed89949d8c84ab73616a17eb5a3d5931 Mon Sep 17 00:00:00 2001 From: ghidra1 Date: Fri, 15 May 2020 18:54:03 -0400 Subject: [PATCH] Fixed tests - space character not permitted in block and address space names --- .../merge/memory/MemoryMergeManagerTest.java | 4 +-- .../database/module/TreeManagerTest.java | 36 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/memory/MemoryMergeManagerTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/memory/MemoryMergeManagerTest.java index 4d5df75fb8..70882624e8 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/memory/MemoryMergeManagerTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/memory/MemoryMergeManagerTest.java @@ -348,7 +348,7 @@ public class MemoryMergeManagerTest extends AbstractMergeTest { blocks[4].setExecute(false); try { - blocks[4].setName("special debug"); + blocks[4].setName("special-debug"); } catch (DuplicateNameException e) { Assert.fail(); @@ -382,7 +382,7 @@ public class MemoryMergeManagerTest extends AbstractMergeTest { blocks[4].setRead(true); blocks[4].setWrite(false); blocks[4].setExecute(true); - blocks[4].setName("not used"); + blocks[4].setName("not-used"); } catch (DuplicateNameException e) { Assert.fail(); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/module/TreeManagerTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/module/TreeManagerTest.java index f19e7f723f..6598011a7f 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/module/TreeManagerTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/module/TreeManagerTest.java @@ -125,8 +125,8 @@ public class TreeManagerTest extends AbstractGhidraHeadedIntegrationTest { assertNotNull(root); String[] names = treeManager.getTreeNames(); - for (int i = 0; i < names.length; i++) { - treeManager.removeTree(names[i]); + for (String name : names) { + treeManager.removeTree(name); } assertNull(treeManager.getRootModule("Test-One")); assertEquals(0, treeManager.getTreeNames().length); @@ -201,7 +201,7 @@ public class TreeManagerTest extends AbstractGhidraHeadedIntegrationTest { assertEquals(r1FragCount, r2FragCount); assertEquals(2, r1FragCount); - addBlock("Test Block", 0x5000, 100); + addBlock("TestBlock", 0x5000, 100); // make sure new fragment was created in all trees ProgramModule r1 = treeManager.getRootModule("Default"); @@ -222,9 +222,9 @@ public class TreeManagerTest extends AbstractGhidraHeadedIntegrationTest { ProgramModule root = treeManager.createRootModule("Test-One"); ProgramModule r2 = treeManager.createRootModule("Test-Two"); - addBlock("Test Block", 0x5000, 100); - MemoryBlock b2 = addBlock("Test Two Block", 0x6000, 200); - addBlock("Test Three Block", 0x6500, 100); + addBlock("TestBlock", 0x5000, 100); + MemoryBlock b2 = addBlock("TestTwoBlock", 0x6000, 200); + addBlock("TestThreeBlock", 0x6500, 100); int r1FragCount = root.getChildren().length; int r2FragCount = r2.getChildren().length; @@ -244,9 +244,9 @@ public class TreeManagerTest extends AbstractGhidraHeadedIntegrationTest { ProgramModule root = treeManager.createRootModule("Test-One"); ProgramModule r2 = treeManager.createRootModule("Test-Two"); - addBlock("Test Block", 0x5000, 100); - MemoryBlock b2 = addBlock("Test Two Block", 0x6000, 200); - addBlock("Test Three Block", 0x6500, 100); + addBlock("TestBlock", 0x5000, 100); + MemoryBlock b2 = addBlock("TestTwoBlock", 0x6000, 200); + addBlock("TestThreeBlock", 0x6500, 100); ProgramFragment fragB2 = treeManager.getFragment("Test-One", getAddr(0x6050)); assertEquals(getAddr(0x6000), fragB2.getMinAddress()); @@ -286,9 +286,9 @@ public class TreeManagerTest extends AbstractGhidraHeadedIntegrationTest { public void testMoveBlockOverlap() throws Exception { treeManager.createRootModule("Test-One"); - MemoryBlock b1 = addBlock("Test Block", 0x5000, 0x100); - addBlock("Test Two Block", 0x6000, 0x200); - addBlock("Test Three Block", 0x6500, 0x100); + MemoryBlock b1 = addBlock("TestBlock", 0x5000, 0x100); + addBlock("TestTwoBlock", 0x6000, 0x200); + addBlock("TestThreeBlock", 0x6500, 0x100); ProgramFragment fragB1 = treeManager.getFragment("Test-One", getAddr(0x5000)); assertEquals(getAddr(0x5000), fragB1.getMinAddress()); @@ -309,9 +309,9 @@ public class TreeManagerTest extends AbstractGhidraHeadedIntegrationTest { public void testMoveBlockOverlap2() throws Exception { treeManager.createRootModule("Test-One"); - addBlock("Test Block", 0x5000, 0x100); - MemoryBlock b2 = addBlock("Test Two Block", 0x6000, 0x200); - addBlock("Test Three Block", 0x6500, 0x100); + addBlock("TestBlock", 0x5000, 0x100); + MemoryBlock b2 = addBlock("TestTwoBlock", 0x6000, 0x200); + addBlock("TestThreeBlock", 0x6500, 0x100); ProgramFragment fragB2 = treeManager.getFragment("Test-One", getAddr(0x6000)); assertEquals(getAddr(0x6000), fragB2.getMinAddress()); @@ -331,9 +331,9 @@ public class TreeManagerTest extends AbstractGhidraHeadedIntegrationTest { public void testMoveBlockMultiFragments() throws Exception { ProgramModule root = treeManager.createRootModule("Test-One"); - MemoryBlock b1 = addBlock("Test Block", 0x5000, 0x100); - addBlock("Test Two Block", 0x6000, 0x200); - addBlock("Test Three Block", 0x6500, 0x100); + MemoryBlock b1 = addBlock("TestBlock", 0x5000, 0x100); + addBlock("TestTwoBlock", 0x6000, 0x200); + addBlock("TestThreeBlock", 0x6500, 0x100); ProgramFragment fragB1 = treeManager.getFragment("Test-One", getAddr(0x5000)); String fragB1Name = fragB1.getName();