LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / basic / qa / basic_coverage / test_option_base.bas
blob11afea50d75b1a21f0fd3451ad54adc7b9dc29e6
1 Option Base 1
2 Option Explicit
4 Function doUnitTest() As String
5 TestUtil.TestInit
6 verify_optionBase
7 doUnitTest = TestUtil.GetResult()
8 End Function
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))
36 ReDim byteArray(3)
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))
40 Exit Sub
41 errorHandler:
42 TestUtil.ReportErrorHandler("verify_optionBase", Err, Error$, Erl)
43 End Sub