8dc3ba32ad1e6d0c2fb3b880bd1cbf2d03d66c13
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")
38 addTest(new TestCase("Read current version") {
40 public void test() throws Exception
{
41 assertNotNull("The version should not be NULL (in any case!)",
42 Version
.getCurrentVersion());
43 assertEquals("The current version should not be empty", false,
44 Version
.getCurrentVersion().isEmpty());