-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathFrmClockTests.sb
More file actions
97 lines (76 loc) · 2.36 KB
/
FrmClockTests.sb
File metadata and controls
97 lines (76 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
' Note:
' One or more of these tests can fail, because we capture the system clock time twice, and two a fraction of a millisecond can make date and time parts change bewteen the two values.
' So, yo may need to run these tests again to make sure that failed tests will pass.
'------------------------------------------------
Function Test_Date()
t = Date.Now
d = Clock.Date
Return UnitTest.AssertEqual(t.ShortDate, d, "Clock.Date")
EndFunction
'------------------------------------------------
Function Test_Day()
t = Date.Now
d = Clock.Day
Return UnitTest.AssertEqual(t.Day, d, "Clock.Day")
EndFunction
'------------------------------------------------
Function Test_ElapsedMilliseconds()
d1 = Clock.ElapsedMilliseconds
t = Date.Now
d2 = t.ElapsedMilliseconds
Return UnitTest.AssertEqual(d2, d1, "Clock.ElapsedMilliseconds")
EndFunction
'------------------------------------------------
Function Test_Hour()
t = Date.Now
d = Clock.Hour
Return UnitTest.AssertEqual(t.Hour, d, "Clock.Hour")
EndFunction
'------------------------------------------------
Function Test_Millisecond()
t = Date.Now
d = Clock.Millisecond
Return UnitTest.AssertEqual(d - t.Millisecond <= 1, True, "Clock.Millisecond")
EndFunction
'------------------------------------------------
Function Test_Minute()
t = Date.Now
d = Clock.Minute
Return UnitTest.AssertEqual(t.Minute, d, "Clock.Minute")
EndFunction
'------------------------------------------------
Function Test_Month()
t = Date.Now
d = Clock.Month
Return UnitTest.AssertEqual(t.Month, d, "Clock.Month")
EndFunction
'------------------------------------------------
Function Test_Second()
t = Date.Now
d = Clock.Second
Return UnitTest.AssertEqual(t.Second, d, "Clock.Second")
EndFunction
'------------------------------------------------
Function Test_Time()
t = Date.Now
d = Clock.Time
Return UnitTest.AssertEqual(
Date.GetTicks(t.LongTime),
d.Ticks,
"Clock.Time"
)
EndFunction
'------------------------------------------------
Function Test_WeekDay()
t = Date.Now
d = Clock.WeekDay
Return UnitTest.AssertEqual(
t.EnglishDayName, d, "Clock.WeekDay"
)
EndFunction
'------------------------------------------------
Function Test_Year()
t = Date.Now
d = Clock.Year
Return UnitTest.AssertEqual(t.Year, d, "Clock.Year")
EndFunction