3 Dim passCount
As Integer
4 Dim failCount
As Integer
7 Function doUnitTest() As String
8 result
= verify_testIsMissing()
9 If failCount
<> 0 Or passCount
= 0 Then
18 Function verify_testIsMissing() As String
23 result
= "Test Results" & Chr
$(10) & "============" & Chr
$(10)
25 Dim testName
As String
26 Dim num1
, num2
As Integer
27 testName
= "Test IsMissing function"
28 On Error GoTo errorHandler
31 TestLog_ASSERT
IsNull(num1
)
35 TestLog_ASSERT num1
= num2
, "the return IsMissing is: " & num1
37 result
= result
& Chr
$(10) & "Tests passed: " & passCount
& Chr
$(10) & "Tests failed: " & failCount
& Chr
$(10)
38 verify_testIsMissing
= result
42 TestLog_ASSERT (False), testName
& ": hit error handler"
45 Sub TestLog_ASSERT(assertion
As Boolean, Optional testId
As String, Optional testComment
As String)
47 If assertion
= True Then
48 passCount
= passCount
+ 1
51 If Not IsMissing(testId
) Then
52 testMsg
= testMsg
+ " : " + testId
54 If Not IsMissing(testComment
) And Not (testComment
= "") Then
55 testMsg
= testMsg
+ " (" + testComment
+ ")"
58 result
= result
& Chr
$(10) & " Failed: " & testMsg
59 failCount
= failCount
+ 1
63 ' Function procedure definition.
64 Function ReturnTwice(Optional A
)
66 ' If argument is missing, return a Null.
69 ' If argument is present, return twice the value.