source: TestCase/SimpleTestCase/VersionTest.ab@ 272

Last change on this file since 272 was 257, checked in by イグトランス (egtra), 18 years ago

VersionTest追加、Log1p追加

File size: 2.6 KB
Line 
1'--------------------------------------------------------------------
2' Test case of Version Class
3'--------------------------------------------------------------------
4
5#require <Classes/System/Version.ab>
6
7Namespace VersionTest
8
9Sub TestMain()
10 Dim v12 = New System.Version(1, 2)
11 Dim v123 = New System.Version(1, 2, 3)
12 Dim v1234 = New System.Version(1, 2, 3, 4)
13
14 UnitTest("Version(major, minor)", String.Compare(v12.ToString(), "1.2") = 0)
15 UnitTest("Version(major, minor, build)", String.Compare(v123.ToString(), "1.2.3") = 0)
16 UnitTest("Version(major, minor, build, revision)", String.Compare(v1234.ToString(), "1.2.3.4") = 0)
17
18 UnitTest("Version.ToString(0)", String.Compare(v1234.ToString(0), "") = 0)
19 UnitTest("Version.ToString(1)", String.Compare(v1234.ToString(1), "1") = 0)
20 UnitTest("Version.ToString(2)", String.Compare(v1234.ToString(2), "1.2") = 0)
21 UnitTest("Version.ToString(3)", String.Compare(v1234.ToString(3), "1.2.3") = 0)
22 UnitTest("Version.ToString(4)", String.Compare(v1234.ToString(4), "1.2.3.4") = 0)
23
24 UnitTest("Version.Major", v1234.Major = 1)
25 UnitTest("Version.Minor", v1234.Minor = 2)
26 UnitTest("Version.Build", v1234.Build = 3)
27 UnitTest("Version.Revision", v1234.Revision = 4)
28
29 Dim v120 = New System.Version(1, 2, 0)
30 Dim v1231 = New System.Version(1, 2, 3, 1)
31 Dim v131 = New System.Version(1, 3, 1)
32 Dim v20 = New System.Version(2, 0)
33
34 UnitTest("Version (1.3.1).CompareTo(2.0) < 0", v131.CompareTo(v20) < 0)
35 UnitTest("Version (1.3.1).CompareTo(1.3.1) = 0", v131.CompareTo(v131) = 0)
36 UnitTest("Version (1.3.1).CompareTo(1.2.3.4) > 0", v131.CompareTo(v1234) > 0)
37
38 UnitTest("Version (2.0).Equals(2.0)", v20.Equals(v20))
39 UnitTest("Version Not (2.0).Equals(1.2)", Not v20.Equals(v12))
40
41 UnitTest("Version - 1.2.3.4 = 1.2.3.4", v1234 = v1234)
42 UnitTest("Version - Not 1.2.3.4 = 1.2.3", Not v1234 = v123)
43 UnitTest("Version - 1.2.3.4 <> 2.0", v1234 <> v20)
44 UnitTest("Version - Not 1.2.3.4 <> 1.2.3.4", v1234 <> v123)
45 UnitTest("Version - 1.2.3.4 > 1.2.3", v1234 > v123)
46 UnitTest("Version - 1.2.3.4 > 1.2", v1234 > v12)
47 UnitTest("Version - 1.3.1 > 1.2", v131 > v12)
48 UnitTest("Version - 1.2.0 > 1.2", v120 > v12)
49 UnitTest("Version - 1.2.3.4 > 1.2.3.1", v1234 > v1231)
50 UnitTest("Version - 1.2 < 1.2.0", v12 < v120)
51 UnitTest("Version - Not 1.2 > 1.2.0", Not v12 > v120)
52 UnitTest("Version - 1.2.3.4 => 1.2.3", v1234 => v123)
53 UnitTest("Version - 1.2.3.4 => 1.2.3.4", v1234 => v1234)
54 UnitTest("Version - Not 1.2.3.4 =< 1.2.3", Not v1234 =< v123)
55 UnitTest("Version - 1.2.3.4 =< 1.2.3.4", v1234 =< v1234)
56End Sub
57
58End Namespace
59
60VersionTest.TestMain()
Note: See TracBrowser for help on using the repository browser.