001: package com.ecyrd.jspwiki;
002:
003: import junit.framework.Test;
004: import junit.framework.TestCase;
005: import junit.framework.TestSuite;
006:
007: public class ReleaseTest extends TestCase {
008: public void testNewer1() {
009: assertTrue(Release.isNewerOrEqual("1.0.100"));
010: }
011:
012: public void testNewer2() {
013: assertTrue(Release.isNewerOrEqual("2.0.0-alpha"));
014: }
015:
016: public void testNewer3() {
017: assertFalse(Release.isNewerOrEqual("10.0.0"));
018: }
019:
020: public void testNewer4() {
021: assertTrue(Release.isNewerOrEqual(Release.VERSTR));
022: }
023:
024: public void testNewer5() {
025: String rel = Release.VERSION + "." + Release.REVISION + "."
026: + (Release.MINORREVISION + 1) + "-cvs";
027:
028: assertFalse(Release.isNewerOrEqual(rel));
029: }
030:
031: public void testNewer6() {
032: String rel = null;
033:
034: if (Release.MINORREVISION != 0)
035: rel = Release.VERSION + "." + Release.REVISION + "."
036: + (Release.MINORREVISION - 1) + "-cvs";
037: else
038: rel = Release.VERSION + "." + (Release.REVISION - 1)
039: + ".9999" + "-cvs";
040:
041: assertTrue(Release.isNewerOrEqual(rel));
042: }
043:
044: public void testNewer7() {
045: String rel = Release.VERSION + "." + Release.REVISION;
046:
047: assertTrue(Release.isNewerOrEqual(rel));
048: }
049:
050: public void testNewer8() {
051: String rel = Release.VERSION + "";
052:
053: assertTrue(Release.isNewerOrEqual(rel));
054: }
055:
056: public void testOlder1() {
057: assertFalse(Release.isOlderOrEqual("1.0.100"));
058: }
059:
060: public void testOlder2() {
061: assertFalse(Release.isOlderOrEqual("2.0.0-alpha"));
062: }
063:
064: public void testOlder3() {
065: assertTrue(Release.isOlderOrEqual("10.0.0"));
066: }
067:
068: public void testOlder4() {
069: assertTrue(Release.isOlderOrEqual(Release.VERSTR));
070: }
071:
072: public void testOlder5() {
073: String rel = Release.VERSION + "." + Release.REVISION + "."
074: + (Release.MINORREVISION + 1) + "-cvs";
075:
076: assertTrue(Release.isOlderOrEqual(rel));
077: }
078:
079: public void testOlder6() {
080: String rel;
081:
082: if (Release.MINORREVISION != 0)
083: rel = Release.VERSION + "." + Release.REVISION + "."
084: + (Release.MINORREVISION - 1) + "-cvs";
085: else
086: rel = Release.VERSION + "." + (Release.REVISION - 1)
087: + ".9999" + "-cvs";
088:
089: assertFalse(Release.isOlderOrEqual(rel));
090: }
091:
092: public void testOlder7() {
093: String rel = Release.VERSION + "." + Release.REVISION;
094:
095: assertTrue(Release.isOlderOrEqual(rel));
096: }
097:
098: public void testOlder8() {
099: String rel = Release.VERSION + "";
100:
101: assertTrue(Release.isOlderOrEqual(rel));
102: }
103:
104: public void testOlder9() {
105: String rel = "";
106:
107: assertTrue(Release.isOlderOrEqual(rel));
108: }
109:
110: public static Test suite() {
111: return new TestSuite(ReleaseTest.class);
112: }
113: }
|