tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / basic / qa / basic_coverage / test_ccur_method.bas
blobd1c6c247a6e218f4dcd6e03988b700be891eadf5
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_testCCur
14 doUnitTest = TestUtil.GetResult()
15 End Function
17 Sub verify_testCCur
18 On Error GoTo errorHandler
20 ' CCUR
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
39 Exit Sub
40 errorHandler:
41 TestUtil.ReportErrorHandler("verify_testCCur", Err, Error$, Erl)
42 End Sub
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")
51 Exit Sub
52 underflowHandler:
53 If(Err <> 6) Then
54 TestUtil.Assert(False, "verify_testCCur", "underflow error incorrect type")
55 Endif
56 End Sub
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")
65 Exit Sub
66 overflowHandler:
67 If(Err <> 6) Then
68 TestUtil.Assert(False, "verify_testCCur", "overflow error incorrect type")
69 Endif
70 End Sub
72 sub verify_testCCurInvalidFormat
73 On Error GoTo invalidFormatHandler
75 ' tdf$128122 - test invalid format in en_US locale
76 CCur("75,50 kr")
77 TestUtil.Assert(False, "verify_testCCur", "invalid format error not raised")
79 Exit Sub
80 invalidFormatHandler:
81 If(Err <> 13) Then
82 TestUtil.Assert(False, "verify_testCCur", "invalid format error incorrect type")
83 Endif
84 End Sub