Skip to content

Ghidra is a software reverse engineering (SRE) framework

Tests - fixed tests failing due to recent enum changes

dragonmacher6a68e1f2ddc9
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/DataTypesXmlMgr.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/DataTypesXmlMgr.java
index d79a4ef20c..6e158a6c16 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/DataTypesXmlMgr.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/DataTypesXmlMgr.java
@@ -546,6 +546,7 @@ public class DataTypesXmlMgr {
writeRegularComment(writer, enuum.getDescription());
String[] names = enuum.getNames();
+ Arrays.sort(names);
for (String name : names) {
attrs = new XmlAttributes();
attrs.addAttribute("NAME", name);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/xml/XmlTestHelper.java b/Ghidra/Features/Base/src/main/java/ghidra/util/xml/XmlTestHelper.java
index a45a0c1af6..b5616f41af 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/util/xml/XmlTestHelper.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/util/xml/XmlTestHelper.java
@@ -134,9 +134,6 @@ public class XmlTestHelper {
}
}
- /**
- * Return true if the given line is in the the xml list.
- */
public boolean containsXml(String line) {
boolean contains = xmlList.contains(line);
return contains;
@@ -182,33 +179,18 @@ public class XmlTestHelper {
exception.printStackTrace();
}
- /**
- * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
- */
@Override
public void fatalError(SAXParseException exception) throws SAXException {
exception.printStackTrace();
}
- /**
- * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
- */
@Override
public void warning(SAXParseException exception) throws SAXException {
exception.printStackTrace();
}
}
- /**
- * @param programName the program name
- * @return the program
- * @throws VersionException
- * @throws InvalidNameException
- * @throws DuplicateNameException
- * @throws CancelledException
- * @throws FileNotFoundException if the file is not found
- */
public Program loadResourceProgram(String programName) throws IOException, CancelledException,
DuplicateNameException, InvalidNameException, VersionException {
File file = AbstractGenericTest.getTestDataFile(programName);
@@ -218,14 +200,6 @@ public class XmlTestHelper {
return getProject().importProgramFast(file);
}
- /**
- * See {@link #assertXMLFilesEquals(XmlPullParser, XmlPullParser) assertXMLFilesEquals()}
- *
- * @param expectedXMLFile
- * @param testXMLFile
- * @throws SAXException
- * @throws IOException
- */
public static void assertXMLFilesEquals(File expectedXMLFile, File testXMLFile)
throws SAXException, IOException {
@@ -235,22 +209,18 @@ public class XmlTestHelper {
assertXMLFilesEquals(expectedXMLParser, testXMLParser);
}
- /**
+ /*
* Compares 2 xml files and fails if there is any difference between the two.
- * <p>
+ *
* Elements must be ordered in the same order. Attribute values are not order sensitive.
- * <p>
+ *
* Inter-node whitespace differences are ignored.
- * <p>
+ *
* DTD definitions are ignored.
- * <p>
- * @param expectedXMLParser
- * @param testXMLParser
- * @throws SAXException
- * @throws IOException
+ *
*/
public static void assertXMLFilesEquals(XmlPullParser expectedXMLParser,
- XmlPullParser testXMLParser) throws SAXException, IOException {
+ XmlPullParser testXMLParser) {
Deque<String> currentPath = new ArrayDeque<>();
@@ -275,7 +245,8 @@ public class XmlTestHelper {
if (expectedElement.isStart()) {
Map<String, String> testAttrs = testElement.getAttributes();
- for (Entry<String, String> expectedAttr : expectedElement.getAttributes().entrySet()) {
+ for (Entry<String, String> expectedAttr : expectedElement.getAttributes()
+ .entrySet()) {
if (!testAttrs.containsKey(expectedAttr.getKey())) {
failWithInfo("Attribute " + expectedAttr.getKey() + " missing",
expectedXMLParser, testXMLParser, expectedElement, testElement,
diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java
index 21b15053b3..f428a0fdb7 100644
--- a/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java
+++ b/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java
@@ -997,7 +997,7 @@ public class HTMLDataTypeRepresentationTest extends AbstractGenericTest {
}
private EnumDataType createEnumDataType() {
- EnumDataType enumDataType = new EnumDataType("myEnum", 10);
+ EnumDataType enumDataType = new EnumDataType("myEnum", 1);
enumDataType.add("COMDLG32", 0x1);
enumDataType.add("SHELL32", 0x3);