Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: Test fixes

Ryan Kurtz883cc9c4db6b
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/CommonTestData.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/CommonTestData.java
index 279b544662..b66d3f9877 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/CommonTestData.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/CommonTestData.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,9 +32,10 @@ public class CommonTestData {
new QWordDataType()},
KeyStroke.getKeyStroke(KeyEvent.VK_B, 0));
public static CycleGroup floatCycleGroup = new CycleGroup(
- "Cycle: float,double",
+ "Cycle: float,double,longdouble",
new DataType[] {new FloatDataType(),
- new DoubleDataType()},
+ new DoubleDataType(),
+ new LongDoubleDataType() },
KeyStroke.getKeyStroke(KeyEvent.VK_F, 0));
public static CycleGroup asciiCycleGroup = new CycleGroup(
"Cycle: char, string, unicode",
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedEnablementTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedEnablementTest.java
index dd98883c7d..504e8f085f 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedEnablementTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorLockedEnablementTest.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -87,7 +87,7 @@ public class StructureEditorLockedEnablementTest extends AbstractStructureEditor
String name = cycleGroupAction.getName();
checkEnablement(action,
name.equals("Cycle: byte,word,dword,qword") ||
- name.equals("Cycle: float,double") ||
+ name.equals("Cycle: float,double,longdouble") ||
name.equals("Cycle: char,string,unicode"));
}
else {
@@ -138,7 +138,7 @@ public class StructureEditorLockedEnablementTest extends AbstractStructureEditor
String name = cycleGroupAction.getName();
checkEnablement(action,
name.equals("Cycle: byte,word,dword,qword") ||
- name.equals("Cycle: float,double") ||
+ name.equals("Cycle: float,double,longdouble") ||
name.equals("Cycle: char,string,unicode"));
}
else {
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedActions2Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedActions2Test.java
index 250241a05d..10a9c22a32 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedActions2Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedActions2Test.java
@@ -137,6 +137,12 @@ public class StructureEditorUnlockedActions2Test
assertEquals(8, getLength(0));
checkSelection(new int[] { 0 });
+ invoke(floatAction);
+ assertEquals(1, model.getNumComponents());
+ assertTrue(getDataType(0).isEquivalent(new LongDoubleDataType()));
+ assertEquals(8, getLength(0));
+ checkSelection(new int[] { 0 });
+
invoke(floatAction);
assertEquals(5, model.getNumComponents());
assertTrue(getDataType(0).isEquivalent(new FloatDataType()));
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedEnablementTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedEnablementTest.java
index 6cdcadafa7..d3604b207b 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedEnablementTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorUnlockedEnablementTest.java
@@ -133,7 +133,7 @@ public class StructureEditorUnlockedEnablementTest extends AbstractStructureEdit
String name = cycleGroupAction.getName();
checkEnablement(action,
name.equals("Cycle: byte,word,dword,qword") ||
- name.equals("Cycle: float,double") ||
+ name.equals("Cycle: float,double,longdouble") ||
name.equals("Cycle: char,string,unicode") || name.equals("char") ||
name.equals("string"));
}
@@ -173,7 +173,7 @@ public class StructureEditorUnlockedEnablementTest extends AbstractStructureEdit
String name = cycleGroupAction.getName();
checkEnablement(action,
name.equals("Cycle: byte,word,dword,qword") ||
- name.equals("Cycle: float,double") ||
+ name.equals("Cycle: float,double,longdouble") ||
name.equals("Cycle: char,string,unicode") || name.equals("char") ||
name.equals("string"));
}
@@ -218,7 +218,7 @@ public class StructureEditorUnlockedEnablementTest extends AbstractStructureEdit
String name = cycleGroupAction.getName();
checkEnablement(action,
name.equals("Cycle: byte,word,dword,qword") ||
- name.equals("Cycle: float,double") ||
+ name.equals("Cycle: float,double,longdouble") ||
name.equals("Cycle: char,string,unicode") || name.equals("char") ||
name.equals("string"));
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorActions1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorActions1Test.java
index 1d64e16d6e..7a97caee0f 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorActions1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorActions1Test.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -348,6 +348,12 @@ public class UnionEditorActions1Test extends AbstractUnionEditorTest {
assertEquals(8, getLength(0));
checkSelection(new int[] { 0 });
+ invoke(floatAction);
+ assertEquals(1, model.getNumComponents());
+ assertTrue(getDataType(0).isEquivalent(new LongDoubleDataType()));
+ assertEquals(8, getLength(0));
+ checkSelection(new int[] { 0 });
+
invoke(floatAction);
assertEquals(1, model.getNumComponents());
assertTrue(getDataType(0).isEquivalent(new FloatDataType()));
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java
index 1947e04a09..aeb77f0f54 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -593,6 +593,9 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
doCycleAction(floatCycleAction);
assertEquals("double entry(void)", function.getPrototypeString(false, false));
+ doCycleAction(floatCycleAction);
+ assertEquals("longdouble entry(void)", function.getPrototypeString(false, false));
+
doCycleAction(floatCycleAction);
assertEquals("float entry(void)", function.getPrototypeString(false, false));
}
@@ -631,6 +634,9 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
doCycleAction(floatCycleAction);
assertEquals("double", cb.getCurrentFieldText());
+ doCycleAction(floatCycleAction);
+ assertEquals("longdouble", cb.getCurrentFieldText());
+
doCycleAction(floatCycleAction);
assertEquals("float", cb.getCurrentFieldText());
@@ -699,6 +705,9 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
doCycleAction(floatCycleAction);
assertEquals("double", cb.getCurrentFieldText());
+ doCycleAction(floatCycleAction);
+ assertEquals("longdouble", cb.getCurrentFieldText());
+
doCycleAction(floatCycleAction);
assertEquals("float", cb.getCurrentFieldText());
@@ -774,6 +783,9 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
doCycleAction(floatCycleAction);
assertEquals("double", cb.getCurrentFieldText());
+ doCycleAction(floatCycleAction);
+ assertEquals("longdouble", cb.getCurrentFieldText());
+
doCycleAction(floatCycleAction);
assertEquals("float", cb.getCurrentFieldText());
@@ -873,6 +885,9 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
doCycleAction(floatCycleAction);
assertEquals("double", cb.getCurrentFieldText());
+ doCycleAction(floatCycleAction);
+ assertEquals("longdouble", cb.getCurrentFieldText());
+
doCycleAction(floatCycleAction);
assertEquals("float", cb.getCurrentFieldText());
@@ -1442,7 +1457,7 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
editComment = getAction(fp, "Edit Variable Comment");
deleteComment = getAction(fp, "Delete Function Variable Comment");
byteCycleAction = getAction(fp, "Cycle: byte,word,dword,qword");
- floatCycleAction = getAction(fp, "Cycle: float,double");
+ floatCycleAction = getAction(fp, "Cycle: float,double,longdouble");
createArray = getAction(fp, "Define Array");
createPointer = getAction(fp, "Define pointer");
clearFunctionReturnTypeAction = getAction(fp, "Clear Function Return Type");