package ut.com.atlassian.jgitflow.core;

import com.atlassian.jgitflow.core.TaggedVersion;
import org.apache.maven.shared.release.versions.VersionParseException;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

public class TaggedVersionTest {

	@Test
	public void testComparison() throws Exception {
		assertTrue(compare("1.0", "1.1") < 0);
		assertTrue(compare("1.1", "1.0") > 0);
		assertTrue(compare("1.0", "1.0") == 0);
		assertTrue(compare("1.0.1", "1.0.0") > 0);
		assertTrue(compare("1.0.1", "1.0") > 0);
		assertTrue(compare("1.0.0", "1.0") > 0);
		assertTrue(compare("2.0.14", "1.5.0") > 0);
		assertTrue(compare("2.3.4", "1.9.5") > 0);
		assertTrue(compare("2.1.3", "2.0.7") > 0);
		assertTrue(compare("2.4.8", "2.4.7") > 0);
		assertTrue(compare("2", "1.3.0") > 0);
		assertTrue(compare("2.0.0", "1.3") > 0);
	}

	private int compare(String version1, String version2) throws VersionParseException {
		return new TaggedVersion(version1, null).compareTo(new TaggedVersion(version2, null));
	}
}


@@ -833,16 +833,100 @@
 ) %3E 0);%0A
+%09%09assertTrue(compare(%220.12%22, %220.9%22) %3E 0);%0A%09%09assertTrue(compare(%2215.0%22, %223.0%22) %3E 0);%0A
 %09%7D%0A%0A%09pri

use latest tag instead of master branch - wip