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
14 doUnitTest
= TestUtil
.GetResult()
18 On Error GoTo errorHandler
21 TestUtil
.AssertEqual(CCur("100"), 100, "CCur(100)")
23 ' tdf#141050 - passing a number with + sign
24 TestUtil
.AssertEqual(CCur("+100"), 100, "CCur(100)")
25 ' tdf#141050 - passing a number with - sign
26 TestUtil
.AssertEqual(CCur("-100"), -100, "CCur(-100)")
28 ' tdf#128122 - verify en_US locale currency format behavior
29 TestUtil
.AssertEqual(CCur("$100"), 100, "CCur($100)")
30 TestUtil
.AssertEqual(CCur("$1.50"), 1.5, "CCur($1.50)")
32 ' tdf#162724 - CStr must create strings that allow CCur round-trip
33 TestUtil
.AssertEqual(CCur(CStr(CCur(75.50))), 75.5, "CCur(CStr(CCur(75.50)))")
35 verify_testCCurUnderflow
36 verify_testCCurOverflow
37 verify_testCCurInvalidFormat
41 TestUtil
.ReportErrorHandler("verify_testCCur", Err
, Error$, Erl
)
44 sub verify_testCCurUnderflow
45 On Error GoTo underflowHandler
47 ' tdf$128122 - test underflow condition
48 CCur("-9223372036854775809")
49 TestUtil
.Assert(False, "verify_testCCur", "underflow error not raised")
54 TestUtil
.Assert(False, "verify_testCCur", "underflow error incorrect type")
58 sub verify_testCCurOverflow
59 On Error GoTo overflowHandler
61 ' tdf$128122 - test overflow condition
62 CCur("9223372036854775808")
63 TestUtil
.Assert(False, "verify_testCCur", "overflow error not raised")
68 TestUtil
.Assert(False, "verify_testCCur", "overflow error incorrect type")
72 sub verify_testCCurInvalidFormat
73 On Error GoTo invalidFormatHandler
75 ' tdf$128122 - test invalid format in en_US locale
77 TestUtil
.Assert(False, "verify_testCCur", "invalid format error not raised")
82 TestUtil
.Assert(False, "verify_testCCur", "invalid format error incorrect type")