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/.
11 Function doUnitTest() As String
13 verify_testUnsignedIntegers
14 doUnitTest
= TestUtil
.GetResult()
17 Function convertToDouble(n
)
19 conv
= CreateUnoService("com.sun.star.script.Converter")
20 convertToDouble
= conv
.convertToSimpleType(n
, com
.sun
.star
.uno
.TypeClass
.DOUBLE)
23 Sub verify_testUnsignedIntegers()
24 On Error GoTo errorHandler
26 Dim t
As New com
.sun
.star
.util
.Time
' has both unsigned long and unsigned short
29 Dim u8
As Byte, u16
, u32
31 u16
= t
.Seconds
' UShort
32 u32
= t
.NanoSeconds
' ULong
34 TestUtil
.AssertEqual(TypeName(u8
), "Byte", "TypeName(u8)")
35 TestUtil
.AssertEqual(convertToDouble(u8
), 200, "convertToDouble(u8)")
37 TestUtil
.AssertEqual(TypeName(u16
), "UShort", "TypeName(u16)")
38 TestUtil
.AssertEqual(convertToDouble(u16
), 201, "convertToDouble(u16)")
40 TestUtil
.AssertEqual(TypeName(u32
), "ULong", "TypeName(u32)")
41 TestUtil
.AssertEqual(convertToDouble(u32
), 202, "convertToDouble(u32)")
45 TestUtil
.ReportErrorHandler("verify_testUnsignedIntegers", Err
, Error$, Erl
)