tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / basic / qa / basic_coverage / test_If.bas
blob71193108ab9f15560606e8821dc48754fc55d4c5
1 Option Explicit
3 Function doUnitTest() As String
4 TestUtil.TestInit
6 TestUtil.AssertEqual(verify_ElseIf, "OK", "verify_ElseIf", "result")
7 TestUtil.AssertEqual(verify_nested_Ifs, "OK", "verify_nested_Ifs", "result")
8 TestUtil.AssertEqual(verify_oneline, "OK", "verify_oneline", "result")
10 doUnitTest = TestUtil.GetResult()
11 End Function
13 Sub Main : MsgBox doUnitTest : End Sub
15 Function verify_ElseIf As String
16 On Error GoTo catch
18 If False Then
19 verify_ElseIf = "Fail"
20 ElseIf False Then
21 verify_ElseIf = "Fail"
22 ElseIf False Then
23 verify_ElseIf = "Fail"
24 ElseIf False Then verify_ElseIf = "Fail"
25 Else
26 verify_ElseIf = "OK"
27 End If
28 Exit Function
30 catch:
31 TestUtil.ReportErrorHandler("verify_ElseIf", Err, Error$, Erl)
32 End Function
34 Function verify_oneline As String
35 If False Then verify_oneline = "Fail" Else verify_oneline = "OK"
36 End Function
38 Function verify_nested_Ifs
40 On Error GoTo catch
42 If False Then
43 verify_nested_Ifs = "Fail"
44 ElseIf True Then
45 If True Then
46 verify_nested_Ifs = "OK"
47 End If
48 ElseIf False Then
49 verify_nested_Ifs = "Fail"
50 ElseIf False Then verify_nested_Ifs = "Fail"
51 Else
52 verify_nested_Ifs = "Fail"
53 EndIf
54 Exit Function
56 catch:
57 TestUtil.ReportErrorHandler("verify_nested_Ifs", Err, Error$, Erl)
59 End Function