Bump version to 6.4.7.2.M8
[LibreOffice.git] / basic / qa / vba_tests / isarray.vb
blob3f7dc8a8c265d8eab14eae62961c079d048120f8
1 Option VBASupport 1
2 Option Explicit
3 Dim passCount As Integer
4 Dim failCount As Integer
5 Dim result As String
7 Function doUnitTest() As String
8 result = verify_testIsArray()
9 If failCount <> 0 Or passCount = 0 Then
10 doUnitTest = result
11 Else
12 doUnitTest = "OK"
13 End If
14 End Function
18 Function verify_testIsArray() As String
20 passCount = 0
21 failCount = 0
23 result = "Test Results" & Chr$(10) & "============" & Chr$(10)
25 Dim testName As String
26 Dim date1, date2
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.
32 date2 = True
33 date1 = IsArray(MyArray)
34 TestLog_ASSERT date1 = date2, "the return IsArray is: " & date1
36 date2 = True
37 date1 = IsArray(YourArray)
38 TestLog_ASSERT date1 = date2, "the return IsArray is: " & date1
40 date2 = False
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
47 Exit Function
48 errorHandler:
49 TestLog_ASSERT (False), testName & ": hit error handler"
50 End Function
52 Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
54 If assertion = True Then
55 passCount = passCount + 1
56 Else
57 Dim testMsg As String
58 If Not IsMissing(testId) Then
59 testMsg = testMsg + " : " + testId
60 End If
61 If Not IsMissing(testComment) And Not (testComment = "") Then
62 testMsg = testMsg + " (" + testComment + ")"
63 End If
65 result = result & Chr$(10) & " Failed: " & testMsg
66 failCount = failCount + 1
67 End If
69 End Sub