'--------------------------------------------------------------------
' Test case of Version Class
'--------------------------------------------------------------------

Namespace VersionTest

Sub TestMain()
	Dim v12 = New System.Version(1, 2)
	Dim v123 = New System.Version(1, 2, 3)
	Dim v1234 = New System.Version(1, 2, 3, 4)

	UnitTest("Version(major, minor)", String.Compare(v12.ToString(), "1.2") = 0)
	UnitTest("Version(major, minor, build)", String.Compare(v123.ToString(), "1.2.3") = 0)
	UnitTest("Version(major, minor, build, revision)", String.Compare(v1234.ToString(), "1.2.3.4") = 0)

	UnitTest("Version.ToString(0)", String.Compare(v1234.ToString(0), "") = 0)
	UnitTest("Version.ToString(1)", String.Compare(v1234.ToString(1), "1") = 0)
	UnitTest("Version.ToString(2)", String.Compare(v1234.ToString(2), "1.2") = 0)
	UnitTest("Version.ToString(3)", String.Compare(v1234.ToString(3), "1.2.3") = 0)
	UnitTest("Version.ToString(4)", String.Compare(v1234.ToString(4), "1.2.3.4") = 0)

	UnitTest("Version.Major", v1234.Major = 1)
	UnitTest("Version.Minor", v1234.Minor = 2)
	UnitTest("Version.Build", v1234.Build = 3)
	UnitTest("Version.Revision", v1234.Revision = 4)

	Dim v120 = New System.Version(1, 2, 0)
	Dim v1231 = New System.Version(1, 2, 3, 1)
	Dim v131 = New System.Version(1, 3, 1)
	Dim v20 = New System.Version(2, 0)

	UnitTest("Version (1.3.1).CompareTo(2.0) < 0", v131.CompareTo(v20) < 0)
	UnitTest("Version (1.3.1).CompareTo(1.3.1) = 0", v131.CompareTo(v131) = 0)
	UnitTest("Version (1.3.1).CompareTo(1.2.3.4) > 0", v131.CompareTo(v1234) > 0)

	UnitTest("Version (2.0).Equals(2.0)", v20.Equals(v20))
	UnitTest("Version Not (2.0).Equals(1.2)", Not v20.Equals(v12))

	UnitTest("Version - 1.2.3.4 = 1.2.3.4", v1234 = v1234)
	UnitTest("Version - Not 1.2.3.4 = 1.2.3", Not v1234 = v123)
	UnitTest("Version - 1.2.3.4 <> 2.0", v1234 <> v20)
	UnitTest("Version - Not 1.2.3.4 <> 1.2.3.4", v1234 <> v123)
	UnitTest("Version - 1.2.3.4 > 1.2.3", v1234 > v123)
	UnitTest("Version - 1.2.3.4 > 1.2", v1234 > v12)
	UnitTest("Version - 1.3.1 > 1.2", v131 > v12)
	UnitTest("Version - 1.2.0 > 1.2", v120 > v12)
	UnitTest("Version - 1.2.3.4 > 1.2.3.1", v1234 > v1231)
	UnitTest("Version - 1.2 < 1.2.0", v12 < v120)
	UnitTest("Version - Not 1.2 > 1.2.0", Not v12 > v120)
	UnitTest("Version - 1.2.3.4 => 1.2.3", v1234 => v123)
	UnitTest("Version - 1.2.3.4 => 1.2.3.4", v1234 => v1234)
	UnitTest("Version - Not 1.2.3.4 =< 1.2.3", Not v1234 =< v123)
	UnitTest("Version - 1.2.3.4 =< 1.2.3.4", v1234 =< v1234)
End Sub

End Namespace

VersionTest.TestMain()
