Bump version to 6.4.7.2.M8
[LibreOffice.git] / basic / qa / vba_tests / lbound.vb
blob34999c534349bec32deab358acae3fdf7aa623be
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_testLBound()
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_testLBound() 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 10, 5 To 15, 10 To 20) ' Declare array variables.
28 testName = "Test LBound function"
29 On Error GoTo errorHandler
31 date2 = 1
32 date1 = LBound(MyArray, 1)
33 TestLog_ASSERT date1 = date2, "the return LBound is: " & date1
35 date2 = 10
36 date1 = LBound(MyArray, 3)
37 TestLog_ASSERT date1 = date2, "the return LBound is: " & date1
40 result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
41 verify_testLBound = result
43 Exit Function
44 errorHandler:
45 TestLog_ASSERT (False), testName & ": hit error handler"
46 End Function
48 Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
50 If assertion = True Then
51 passCount = passCount + 1
52 Else
53 Dim testMsg As String
54 If Not IsMissing(testId) Then
55 testMsg = testMsg + " : " + testId
56 End If
57 If Not IsMissing(testComment) And Not (testComment = "") Then
58 testMsg = testMsg + " (" + testComment + ")"
59 End If
61 result = result & Chr$(10) & " Failed: " & testMsg
62 failCount = failCount + 1
63 End If
65 End Sub