From 95ca95376d53b56ddcb34a2f25a0171baacb1891 Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Fri, 17 May 2019 12:13:09 -0400 Subject: [PATCH 1/2] Setting version to 9.0.5-DEV. --- Ghidra/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ghidra/application.properties b/Ghidra/application.properties index 839d8b17e4..94bf0f5a11 100644 --- a/Ghidra/application.properties +++ b/Ghidra/application.properties @@ -1,5 +1,5 @@ application.name=Ghidra -application.version=9.0.x-DEV +application.version=9.0.5-DEV application.release.name=PUBLIC application.layout.version=1 application.gradle.version=5.0 From 67062ca74c0c5706ddd87613d6055bee1094b4f8 Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Fri, 17 May 2019 12:13:34 -0400 Subject: [PATCH 2/2] Test for ApplicationVersion class. --- .../framework/ApplicationVersionTest.java | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Ghidra/Framework/Generic/src/test/java/ghidra/framework/ApplicationVersionTest.java diff --git a/Ghidra/Framework/Generic/src/test/java/ghidra/framework/ApplicationVersionTest.java b/Ghidra/Framework/Generic/src/test/java/ghidra/framework/ApplicationVersionTest.java new file mode 100644 index 0000000000..f5666929aa --- /dev/null +++ b/Ghidra/Framework/Generic/src/test/java/ghidra/framework/ApplicationVersionTest.java @@ -0,0 +1,83 @@ +/* ### + * IP: GHIDRA + * + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.framework; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import generic.test.AbstractGenericTest; + +public class ApplicationVersionTest extends AbstractGenericTest { + + @Test + public void testApplicationPropertiesVersion() { + // We should be able to create an ApplicationVersion object from the application version + // defined in the application properties file without an exception being thrown. + new ApplicationVersion( + Application.getApplicationLayout().getApplicationProperties().getApplicationVersion()); + } + + @Test + public void testApplicationVersionParsing() { + assertEquals(new ApplicationVersion("9.0").toString(), "9.0"); + assertEquals(new ApplicationVersion("9.0.0").toString(), "9.0"); + assertEquals(new ApplicationVersion("9.0.0-DEV").toString(), "9.0"); + + assertEquals(new ApplicationVersion("9.1").toString(), "9.1"); + assertEquals(new ApplicationVersion("9.1.1").toString(), "9.1.1"); + assertEquals(new ApplicationVersion("9.1.1-DEV").toString(), "9.1.1"); + + try { + new ApplicationVersion("9"); + fail("Should not be able to parse only a major version...a minor version is required."); + } + catch (IllegalArgumentException e) { + // Getting here indicates success + } + } + + @Test + public void testApplicationVersionGetters() { + ApplicationVersion applicationVersion = new ApplicationVersion("9.0.1-DEV"); + assertEquals(applicationVersion.getMajor(), 9); + assertEquals(applicationVersion.getMinor(), 0); + assertEquals(applicationVersion.getPatch(), 1); + } + + @Test + public void testApplicationVersionCompare() { + ApplicationVersion applicationVersion1 = new ApplicationVersion("9.0"); + ApplicationVersion applicationVersion2 = new ApplicationVersion("9.0.0-DEV"); + assertTrue(applicationVersion1.compareTo(applicationVersion2) == 0); + + applicationVersion1 = new ApplicationVersion("9.0"); + applicationVersion2 = new ApplicationVersion("10.0"); + assertTrue(applicationVersion1.compareTo(applicationVersion2) < 0); + + applicationVersion1 = new ApplicationVersion("9.0"); + applicationVersion2 = new ApplicationVersion("9.1"); + assertTrue(applicationVersion1.compareTo(applicationVersion2) < 0); + + applicationVersion1 = new ApplicationVersion("9.0"); + applicationVersion2 = new ApplicationVersion("9.0.1"); + assertTrue(applicationVersion1.compareTo(applicationVersion2) < 0); + + applicationVersion1 = new ApplicationVersion("9.0.1"); + applicationVersion2 = new ApplicationVersion("9.0.2"); + assertTrue(applicationVersion1.compareTo(applicationVersion2) < 0); + } +}