Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / vba_tests / booltypename.vb
blob202c2370e712c5c66909a095a2d04dac6f7f43ad
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_testTypeNameBoolean
15 doUnitTest = TestUtil.GetResult()
16 End Function
18 Sub verify_testTypeNameBoolean()
19 On Error GoTo errorHandler
21 TestUtil.AssertEqual(TypeName(1>2), "Boolean", "TypeName(1>2)")
22 TestUtil.AssertEqual(TypeName(2.0>1.0), "Boolean", "TypeName(2.0>1.0)")
23 TestUtil.AssertEqual(TypeName("A">"B"), "Boolean", "TypeName(""A"">""B"")")
25 TestUtil.AssertEqual(Str(2>1), "True", "Str(2>1)")
26 TestUtil.AssertEqual(Str(1>2), "False", "Str(1>2)")
28 TestUtil.AssertEqual(Str(2.0>1.0), "True", "Str(2.0>1.0)")
29 TestUtil.AssertEqual(Str(1.0>2.0), "False", "Str(1.0>2.0)")
31 TestUtil.AssertEqual(Str("B">"A"), "True", "Str(""B"">""A"")")
32 TestUtil.AssertEqual(Str("A">"B"), "False", "Str(""A"">""B"")")
34 ' tdf#145960 - return type of boolean operators should be of type boolean
35 TestUtil.AssertEqual(TypeName(True Mod True), "Long", "TypeName(True Mod True)")
36 TestUtil.AssertEqual(TypeName(True \ True), "Long", "TypeName(True \ True)")
37 TestUtil.AssertEqual(TypeName(True And True), "Boolean", "TypeName(True And True)")
38 TestUtil.AssertEqual(TypeName(True Or True), "Boolean", "TypeName(True Or True)")
39 TestUtil.AssertEqual(TypeName(True Xor True), "Boolean", "TypeName(True Xor True)")
40 TestUtil.AssertEqual(TypeName(True Eqv True), "Boolean", "TypeName(True Eqv True)")
41 TestUtil.AssertEqual(TypeName(True Imp True), "Boolean", "TypeName(True Imp True)")
42 TestUtil.AssertEqual(TypeName(Not True), "Boolean", "TypeName(Not True)")
44 Exit Sub
45 errorHandler:
46 TestUtil.ReportErrorHandler("verify_testTypeNameBoolean", Err, Error$, Erl)
47 End Sub