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/.
12 Function doUnitTest() As String
15 doUnitTest
= TestUtil
.GetResult()
18 Sub verify_testTypeName()
19 On Error GoTo errorHandler
35 TestUtil
.AssertEqual(TypeName(varname
:=s1
), "String", "TypeName(varname:=s1")
37 TestUtil
.AssertEqual(TypeName(s1
), "String", "TypeName(s1)")
38 TestUtil
.AssertEqual(TypeName(b1
), "Boolean", "TypeName(b1)")
39 TestUtil
.AssertEqual(TypeName(c1
), "Byte", "TypeName(c1)")
40 TestUtil
.AssertEqual(TypeName(d1
), "Date", "TypeName(d1)")
41 TestUtil
.AssertEqual(TypeName(d2
), "Double", "TypeName(d2)")
42 TestUtil
.AssertEqual(TypeName(i1
), "Integer", "TypeName(i1)")
43 TestUtil
.AssertEqual(TypeName(l1
), "Long", "TypeName(l1)")
45 ' tdf#129596 - Types of constant values
46 TestUtil
.AssertEqual(TypeName(32767), "Integer", "TypeName(32767)")
47 TestUtil
.AssertEqual(TypeName(-32767), "Integer", "TypeName(-32767)")
48 TestUtil
.AssertEqual(TypeName(1048575), "Long", "TypeName(1048575)")
49 TestUtil
.AssertEqual(TypeName(-1048575), "Long", "TypeName(-1048575)")
51 TestUtil
.AssertEqual(TypeName(TestIntSign
), "Integer", "TypeName(TestIntSign)")
52 TestUtil
.AssertEqual(TypeName(TestLongSign
), "Long", "TypeName(TestLongSign)")
53 TestUtil
.AssertEqual(TypeName(TestSingleSign
), "Single", "TypeName(TestSingleSign)")
54 TestUtil
.AssertEqual(TypeName(TestDoubleSign
), "Double", "TypeName(TestDoubleSign)")
55 TestUtil
.AssertEqual(TypeName(TestCurrSign
), "Currency", "TypeName(TestCurrSign)")
56 TestUtil
.AssertEqual(TypeName(TestStrSign
), "String", "TypeName(TestStrSign)")
58 ' tdf#143707 - check correct initialization of default value for optionals
59 ' Without the fix in place, this test would have failed with
62 TestUtil
.AssertEqual(TestOptVariantInit(), "Integer", "TestOptVariantInit()")
66 TestUtil
.ReportErrorHandler("verify_testTypeName", Err
, Error$, Erl
)
69 Function TestOptVariantInit(Optional A
As Variant = 123)
70 TestOptVariantInit
= TypeName(A
)