3 Dim passCount
As Integer
4 Dim failCount
As Integer
7 Function doUnitTest() As String
8 result
= verify_testString()
9 If failCount
<> 0 or passCount
= 0 Then
18 Function verify_testString() As String
23 result
= "Test Results" & Chr
$(10) & "============" & Chr
$(10)
25 Dim testName
As String
28 testName
= "Test String function"
29 On Error GoTo errorHandler
32 date1
= String(5, "P")
33 TestLog_ASSERT date1
= date2
, "the return String is: " & date1
36 date1
= String(5, "a")
37 TestLog_ASSERT date1
= date2
, "the return String is: " & date1
40 date1
= String(0, "P")
41 TestLog_ASSERT date1
= date2
, "the return String is: " & date1
43 result
= result
& Chr
$(10) & "Tests passed: " & passCount
& Chr
$(10) & "Tests failed: " & failCount
& Chr
$(10)
44 verify_testString
= result
48 TestLog_ASSERT (False), testName
& ": hit error handler"
51 Sub TestLog_ASSERT(assertion
As Boolean, Optional testId
As String, Optional testComment
As String)
53 If assertion
= True Then
54 passCount
= passCount
+ 1
57 If Not IsMissing(testId
) Then
58 testMsg
= testMsg
+ " : " + testId
60 If Not IsMissing(testComment
) And Not (testComment
= "") Then
61 testMsg
= testMsg
+ " (" + testComment
+ ")"
64 result
= result
& Chr
$(10) & " Failed: " & testMsg
65 failCount
= failCount
+ 1