Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / vba_tests / like.vb
blobc3be1e081b16f6d41178a067fe570daf084fb0c5
2 ' This file is part of the LibreOffice project.
4 ' This Source Code Form is subject to the terms of the Mozilla Public
5 ' License, v. 2.0. If a copy of the MPL was not distributed with this
6 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 Option VBASupport 1
10 Option Explicit
12 Function doUnitTest() As String
13 TestUtil.TestInit
14 verify_testLike
15 doUnitTest = TestUtil.GetResult()
16 End Function
18 Sub verify_testLike()
19 On Error GoTo errorHandler
20 ' Negation test
21 TestUtil.AssertEqual("!" Like "[.!?]", True, "Negation1")
22 TestUtil.AssertEqual("a" Like "[!abc]", False, "Negation2")
23 TestUtil.AssertEqual("!" Like "[!!?]", False, "Negation3")
24 TestUtil.AssertEqual("^" Like "[.!?]", False, "Negation4")
25 TestUtil.AssertEqual("^" Like "[.^?]", True, "Negation5")
26 ' Like test from microsoft vba
27 TestUtil.AssertEqual("aBBBa" Like "a*a", True, "Like1")
28 TestUtil.AssertEqual("F" Like "[A-Z]", True, "Like2")
29 TestUtil.AssertEqual("F" Like "[!A-Z]", False, "Like3")
30 TestUtil.AssertEqual("a2a" Like "a#a", True, "Like4")
31 TestUtil.AssertEqual("aM5b" Like "a[L-P]#[!c-e]", True, "Like5")
32 TestUtil.AssertEqual("BAT123khg" Like "B?T*", True, "Like6")
33 TestUtil.AssertEqual("CAT123khg" Like "B?T*", False, "Like7")
34 TestUtil.AssertEqual("ab" Like "a*b", True, "Like8")
35 TestUtil.AssertEqual("a*b" Like "a [*]b", False, "Like9")
36 TestUtil.AssertEqual("axxxxxb" Like "a [*]b", False, "Like10")
37 TestUtil.AssertEqual("a [xyz" Like "a [[]*", True, "Like11")
39 Exit Sub
40 errorHandler:
41 TestUtil.ReportErrorHandler("verify_testLike", Err, Error$, Erl)
42 End Sub