2 Rem Option VBASupport 1 'unREM in .vb file
4 Dim passCount
As Integer
5 Dim failCount
As Integer
8 Function doUnitTest() As String
9 result
= verify_testCBool()
10 If failCount
<> 0 Or passCount
= 0 Then
19 Function verify_testCBool() As String
24 result
= "Test Results" & Chr
$(10) & "============" & Chr
$(10)
26 Dim testName
As String
27 Dim res2
, res1
As Boolean
29 testName
= "Test CBool function"
30 On Error GoTo errorHandler
34 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
38 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
42 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
46 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
50 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
54 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
58 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
62 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
66 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
71 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
76 TestLog_ASSERT res1
= res2
, "the return CBool is: " & res1
78 result
= result
& Chr
$(10) & "Tests passed: " & passCount
& Chr
$(10) & "Tests failed: " & failCount
& Chr
$(10)
79 verify_testCBool
= result
83 TestLog_ASSERT (False), testName
& ": hit error handler"
86 Sub TestLog_ASSERT(assertion
As Boolean, Optional testId
As String, Optional testComment
As String)
88 If assertion
= True Then
89 passCount
= passCount
+ 1
92 If Not IsMissing(testId
) Then
93 testMsg
= testMsg
+ " : " + testId
95 If Not IsMissing(testComment
) And Not (testComment
= "") Then
96 testMsg
= testMsg
+ " (" + testComment
+ ")"
99 result
= result
& Chr
$(10) & " Failed: " & testMsg
100 failCount
= failCount
+ 1