2019-12-12 18:43:43 +01:00
|
|
|
'
|
|
|
|
' This file is part of the LibreOffice project.
|
|
|
|
'
|
|
|
|
' This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
' License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
' file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
'
|
|
|
|
|
|
|
|
Option VBASupport 1
|
|
|
|
Option Explicit
|
|
|
|
|
|
|
|
Enum CountDown ' Values get ROUNDED to Int32
|
|
|
|
FIVE = 4.11
|
|
|
|
FOUR = -4.25
|
|
|
|
THREE = 5
|
|
|
|
TWO = -.315E1
|
|
|
|
ONE = 286.0E-2 ' equals 3
|
|
|
|
LIFT_OFF = 7
|
|
|
|
End Enum ' CountDown
|
|
|
|
|
|
|
|
Function doUnitTest()
|
|
|
|
''' test_vba.cxx main entry point '''
|
|
|
|
Call ENUM_TestCases
|
2020-12-16 22:28:02 +00:00
|
|
|
doUnitTest = TestUtilModule.GetResult()
|
2019-12-12 18:43:43 +01:00
|
|
|
End Function
|
|
|
|
|
|
|
|
Sub ENUM_TestCases()
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.TestInit
|
2019-12-12 18:43:43 +01:00
|
|
|
try:
|
|
|
|
On Error Goto catch
|
|
|
|
|
|
|
|
With CountDown
|
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
a: TestUtilModule.AssertTrue(.ONE = 3, "case a", "CountDown.ONE equals " & Str(.ONE))
|
2019-12-12 18:43:43 +01:00
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
b: TestUtilModule.AssertTrue(.TWO = -3, "case b", "CountDown.TWO equals " & Str(.TWO))
|
2019-12-12 18:43:43 +01:00
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
c: TestUtilModule.AssertTrue(TypeName(.FOUR) = "Long", "case c", "CountDown.FOUR type is: " & TypeName(.FOUR))
|
2019-12-12 18:43:43 +01:00
|
|
|
|
|
|
|
d: Dim sum As Double
|
|
|
|
sum = .FIVE + .FOUR + .THREE + .TWO + .ONE + .LIFT_OFF
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.AssertTrue(sum = 12, "case d", "SUM of CountDown values is: " & Str(sum))
|
2019-12-12 18:43:43 +01:00
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
End With
|
2019-12-12 18:43:43 +01:00
|
|
|
|
|
|
|
finally:
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.TestEnd
|
2019-12-12 18:43:43 +01:00
|
|
|
Exit Sub
|
|
|
|
|
|
|
|
catch:
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.AssertTrue(False, "ERROR", "#"& Str(Err.Number) &" in 'ENUM_TestCases' at line"& Str(Erl) &" - "& Error$)
|
2019-12-12 18:43:43 +01:00
|
|
|
Resume Next
|
|
|
|
End Sub
|