3 Dim passCount
As Integer
4 Dim failCount
As Integer
7 Function doUnitTest() As String
8 result
= verify_testTimeValue()
9 If failCount
<> 0 or passCount
= 0 Then
16 Function verify_testTimeValue() As String
21 result
= "Test Results" & Chr
$(10) & "============" & Chr
$(10)
23 Dim testName
As String
25 Dim date1
, date2
As Date 'variables for test
26 testName
= "Test TimeValue function"
27 On Error GoTo errorHandler
30 date1
= TimeValue("4:35:17 PM")
31 TestLog_ASSERT date1
= date2
, "the return TimeValue is: " & date1
33 result
= result
& Chr
$(10) & "Tests passed: " & passCount
& Chr
$(10) & "Tests failed: " & failCount
& Chr
$(10)
34 verify_testTimeValue
= result
38 TestLog_ASSERT (False), testName
& ": hit error handler"
41 Sub TestLog_ASSERT(assertion
As Boolean, Optional testId
As String, Optional testComment
As String)
43 If assertion
= True Then
44 passCount
= passCount
+ 1
47 If Not IsMissing(testId
) Then
48 testMsg
= testMsg
+ " : " + testId
50 If Not IsMissing(testComment
) And Not (testComment
= "") Then
51 testMsg
= testMsg
+ " (" + testComment
+ ")"
54 result
= result
& Chr
$(10) & " Failed: " & testMsg
55 failCount
= failCount
+ 1