75e2cdf04fecff6afce1d2bf5a935aae5d4b231b
1 package be
.nikiroo
.utils
.test
;
3 import be
.nikiroo
.utils
.Version
;
5 class VersionTest
extends TestLauncher
{
6 public VersionTest(String
[] args
) {
7 super("Version test", args
);
9 addTest(new TestCase("String <-> int") {
11 public void test() throws Exception
{
12 assertEquals("Cannot parse version 1.2.3 from int to String",
13 "1.2.3", new Version(1, 2, 3).toString());
15 "Cannot parse major version \"1.2.3\" from String to int",
16 1, new Version("1.2.3").getMajor());
18 "Cannot parse minor version \"1.2.3\" from String to int",
19 2, new Version("1.2.3").getMinor());
21 "Cannot parse patch version \"1.2.3\" from String to int",
22 3, new Version("1.2.3").getPatch());
26 addTest(new TestCase("Bad input") {
28 public void test() throws Exception
{
30 "Bad input should return an empty version",
33 "Doors 98 SE Special Deluxe Edition Pro++ Not-Home")
37 "Bad input should return [unknown]",
40 "Doors 98 SE Special Deluxe Edition Pro++ Not-Home")
45 addTest(new TestCase("Read current version") {
47 public void test() throws Exception
{
48 assertNotNull("The version should not be NULL (in any case!)",
49 Version
.getCurrentVersion());
50 assertEquals("The current version should not be empty", false,
51 Version
.getCurrentVersion().isEmpty());