3 Dim passCount
As Integer
4 Dim failCount
As Integer
7 Function doUnitTest() As String
8 result
= verify_testConstants()
9 If failCount
<> 0 Or passCount
= 0 Then
16 Function verify_testConstants() As String
20 result
= "Test Results" & Chr
$(10) & "============" & Chr
$(10)
22 Dim testName
As String
23 testName
= "Test Constants"
24 On Error GoTo errorHandler
26 If GetGuiType() = 1 Then
27 TestLog_ASSERT vbNewline
= vbCrLf
, "vbNewLine is the same as vbCrLf on Windows"
29 TestLog_ASSERT vbNewLine
= vbLf
, "vbNewLine is the same as vbLf on others than Windows"
32 result
= result
& Chr
$(10) & "Tests passed: " & passCount
& Chr
$(10) & "Tests failed: " & failCount
& Chr
$(10)
33 verify_testConstants
= result
37 TestLog_ASSERT (False), testName
& ": hit error handler"
40 Sub TestLog_ASSERT(assertion
As Boolean, Optional testId
As String, Optional testComment
As String)
42 If assertion
= True Then
43 passCount
= passCount
+ 1
46 If Not IsMissing(testId
) Then
47 testMsg
= testMsg
+ " : " + testId
49 If Not IsMissing(testComment
) And Not (testComment
= "") Then
50 testMsg
= testMsg
+ " (" + testComment
+ ")"
53 result
= result
& Chr
$(10) & " Failed: " & testMsg
54 failCount
= failCount
+ 1