tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / basic / qa / basic_coverage / test_unsigned_integers.bas
blobd7f2385ecff5efd620ead7458e2587de1f2a1e44
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 Explicit
11 Function doUnitTest() As String
12 TestUtil.TestInit
13 verify_testUnsignedIntegers
14 doUnitTest = TestUtil.GetResult()
15 End Function
17 Function convertToDouble(n)
18 Dim conv As Object
19 conv = CreateUnoService("com.sun.star.script.Converter")
20 convertToDouble = conv.convertToSimpleType(n, com.sun.star.uno.TypeClass.DOUBLE)
21 End Function
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
27 t.Seconds = 201
28 t.NanoSeconds = 202
29 Dim u8 As Byte, u16, u32
30 u8 = 200
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)")
43 Exit Sub
44 errorHandler:
45 TestUtil.ReportErrorHandler("verify_testUnsignedIntegers", Err, Error$, Erl)
46 End Sub