Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / vba_tests / vartype.vb
blob066255b2b7e33d86fa5b63ae48f8f887779f9615
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_testVarType
15 doUnitTest = TestUtil.GetResult()
16 End Function
18 Sub verify_testVarType()
19 Dim TestDateTime As Date
20 Dim TestStr As String
21 Dim TestInt As Integer
22 Dim TestLong As Long
23 Dim TestDouble As Double
24 Dim TestBoo As Boolean
25 Dim TestSingle As Single
26 Dim TestCurr As Currency
28 Dim TestIntSign%
29 Dim TestLongSign&
30 Dim TestSingleSign!
31 Dim TestDoubleSign#
32 Dim TestCurrSign@
33 Dim TestStrSign$
34 On Error GoTo errorHandler
36 TestUtil.AssertEqual(vbInteger, 2, "vbInteger")
37 TestUtil.AssertEqual(vbLong, 3, "vbLong")
38 TestUtil.AssertEqual(vbSingle, 4, "vbSingle")
39 TestUtil.AssertEqual(vbDouble, 5, "vbDouble")
40 TestUtil.AssertEqual(vbCurrency, 6, "vbCurrency")
41 TestUtil.AssertEqual(vbDate, 7, "vbDate")
42 TestUtil.AssertEqual(vbString, 8, "vbString")
43 TestUtil.AssertEqual(vbBoolean, 11, "vbBoolean")
45 TestUtil.AssertEqual(VarType(varname:=TestStr), vbString, "VarType(varname:=TestStr)")
47 TestUtil.AssertEqual(VarType(TestStr), vbString, "VarType(TestStr)")
48 TestUtil.AssertEqual(VarType(TestBoo), vbBoolean, "VarType(TestBoo)")
49 TestUtil.AssertEqual(VarType(TestDouble), vbDouble, "VarType(TestDouble)")
50 TestUtil.AssertEqual(VarType(TestLong), vbLong, "VarType(TestLong)")
51 TestUtil.AssertEqual(VarType(TestInt), vbInteger, "VarType(TestInt)")
52 TestUtil.AssertEqual(VarType(TestDateTime), vbDate, "VarType(TestDateTime)")
53 TestUtil.AssertEqual(VarType(TestSingle), vbSingle, "VarType(TestSingle)")
54 TestUtil.AssertEqual(VarType(TestCurr), vbCurrency, "VarType(TestCurr)")
56 TestUtil.AssertEqual(VarType(TestIntSign), vbInteger, "VarType(TestIntSign)")
57 TestUtil.AssertEqual(VarType(TestLongSign), vbLong, "VarType(TestLongSign)")
58 TestUtil.AssertEqual(VarType(TestSingleSign), vbSingle, "VarType(TestSingleSign)")
59 TestUtil.AssertEqual(VarType(TestDoubleSign), vbDouble, "VarType(TestDoubleSign)")
60 TestUtil.AssertEqual(VarType(TestCurrSign), vbCurrency, "VarType(TestCurrSign)")
62 Exit Sub
63 errorHandler:
64 TestUtil.ReportErrorHandler("verify_testVarType", Err, Error$, Erl)
65 End Sub