3 Dim passCount
As Integer
4 Dim failCount
As Integer
7 Function doUnitTest() As String
8 result
= verify_testIsArray()
9 If failCount
<> 0 Or passCount
= 0 Then
18 Function verify_testIsArray() As String
23 result
= "Test Results" & Chr
$(10) & "============" & Chr
$(10)
25 Dim testName
As String
27 Dim MyArray(1 To 5) As Integer, YourArray
' Declare array variables.
28 testName
= "Test IsArray function"
29 On Error GoTo errorHandler
30 YourArray
= Array(1, 2, 3) ' Use Array function.
33 date1
= IsArray(MyArray
)
34 TestLog_ASSERT date1
= date2
, "the return IsArray is: " & date1
37 date1
= IsArray(YourArray
)
38 TestLog_ASSERT date1
= date2
, "the return IsArray is: " & date1
41 date1
= IsArray(date2
)
42 TestLog_ASSERT date1
= date2
, "the return IsArray is: " & date1
44 result
= result
& Chr
$(10) & "Tests passed: " & passCount
& Chr
$(10) & "Tests failed: " & failCount
& Chr
$(10)
45 verify_testIsArray
= result
49 TestLog_ASSERT (False), testName
& ": hit error handler"
52 Sub TestLog_ASSERT(assertion
As Boolean, Optional testId
As String, Optional testComment
As String)
54 If assertion
= True Then
55 passCount
= passCount
+ 1
58 If Not IsMissing(testId
) Then
59 testMsg
= testMsg
+ " : " + testId
61 If Not IsMissing(testComment
) And Not (testComment
= "") Then
62 testMsg
= testMsg
+ " (" + testComment
+ ")"
65 result
= result
& Chr
$(10) & " Failed: " & testMsg
66 failCount
= failCount
+ 1