4 Function doUnitTest() As String
7 doUnitTest
= TestUtil
.GetResult()
10 Sub verify_optionBase() As String
11 On Error GoTo errorHandler
13 ' tdf#54912 - with option base arrays should start at index 1.
14 ' Without option compatible the upper bound is changed as well (#109275).
15 Dim strArray(2) As String
16 TestUtil
.AssertEqual(LBound(strArray
), 1, "Lower bound of a string array (before assignment): " & LBound(strArray
))
17 TestUtil
.AssertEqual(UBound(strArray
), 3, "Upper bound of a string array (before assignment): " & UBound(strArray
))
18 strArray
= Array("a", "b")
19 TestUtil
.AssertEqual(LBound(strArray
), 1, "Lower bound of a string array (after assignment): " & LBound(strArray
))
20 TestUtil
.AssertEqual(UBound(strArray
), 2, "Upper bound of a string array (after assignment): " & UBound(strArray
))
22 Dim intArray(2) As Integer
23 TestUtil
.AssertEqual(LBound(intArray
), 1, "Lower bound of an integer array (before assignment): " & LBound(intArray
))
24 TestUtil
.AssertEqual(UBound(intArray
), 3, "Upper bound of an integer array (before assignment): " & UBound(intArray
))
25 intArray
= Array(1, 2)
26 TestUtil
.AssertEqual(LBound(intArray
), 1, "Lower bound of an integer array (after assignment): " & LBound(intArray
))
27 TestUtil
.AssertEqual(UBound(intArray
), 2, "Upper bound of an integer array (after assignment): " & UBound(intArray
))
29 Dim byteArray(2) As Byte
30 TestUtil
.AssertEqual(LBound(byteArray
), 1, "Lower bound of a byte array (before assignment): " & LBound(byteArray
))
31 TestUtil
.AssertEqual(UBound(byteArray
), 3, "Upper bound of a byte array (before assignment): " & UBound(byteArray
))
32 byteArray
= StrConv("ab", 128)
33 TestUtil
.AssertEqual(LBound(byteArray
), 1, "Lower bound of a byte array (StrConv): " & LBound(byteArray
))
34 TestUtil
.AssertEqual(UBound(byteArray
), 2, "Upper bound of a byte array (StrConv): " & UBound(byteArray
))
37 TestUtil
.AssertEqual(LBound(byteArray
), 1, "Lower bound of a byte array (ReDim): " & LBound(byteArray
))
38 TestUtil
.AssertEqual(UBound(byteArray
), 4, "Upper bound of a byte array (ReDim): " & UBound(byteArray
))
42 TestUtil
.ReportErrorHandler("verify_optionBase", Err
, Error$, Erl
)