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/.
12 Function doUnitTest() As String
14 DSD
' double = string + double
15 SSD
' string = string + double
16 DSS
' double = string + string
17 doUnitTest
= TestUtil
.GetResult()
25 On Error GoTo ErrorHandler
28 TestUtil
.AssertEqual(r
, -1, "s = null, d = null, r = s + d")
31 TestUtil
.AssertEqual(r
, 0, "s = null, d = null, r = s & d")
35 TestUtil
.AssertEqual(r
, -1, "s = null, d = 20, r = s + d")
39 TestUtil
.AssertEqual(r
, 20, "s = null, d = 20, r = s & d")
45 TestUtil
.AssertEqual(r
, 10, "s = '10', d = null, r = s + d")
48 TestUtil
.AssertEqual(r
, 100, "s = '10', d = null, r = s & d")
52 TestUtil
.AssertEqual(r
, 30, "s = '10', d = 20, r = s + d")
56 TestUtil
.AssertEqual(r
, 1020, "s = '10', d = 20, r = s & d")
62 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = null, r = s + d")
65 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = null, r = s & d")
69 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = 20, r = s + d")
73 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = 20, r = s & d")
87 On Error GoTo ErrorHandler
90 TestUtil
.AssertEqual(r
, "-1", "s = null, d = null, r = s + d")
93 TestUtil
.AssertEqual(r
, "0", "s = null, d = null, r = s & d")
97 TestUtil
.AssertEqual(r
, "-1", "s = null, d = 20, r = s + d")
101 TestUtil
.AssertEqual(r
, "20", "s = null, d = 20, r = s & d")
107 TestUtil
.AssertEqual(r
, "10", "s = '10', d = null, r = s + d")
110 TestUtil
.AssertEqual(r
, "100", "s = '10', d = null, r = s & d")
114 TestUtil
.AssertEqual(r
, "30", "s = '10', d = 20, r = s + d")
118 TestUtil
.AssertEqual(r
, "1020", "s = '10', d = 20, r = s & d")
124 TestUtil
.AssertEqual(r
, "-1", "s = 'abc', d = null, r = s + d")
127 TestUtil
.AssertEqual(r
, "abc0", "s = 'abc', d = null, r = s & d")
131 TestUtil
.AssertEqual(r
, "-1", "s = 'abc', d = 20, r = s + d")
135 TestUtil
.AssertEqual(r
, "abc20", "s = 'abc', d = 20, r = s & d")
148 On Error GoTo ErrorHandler
151 TestUtil
.AssertEqual(r
, -1, "s = null, d = null, r = s + d")
154 TestUtil
.AssertEqual(r
, -1, "s = null, d = null, r = s & d")
158 TestUtil
.AssertEqual(r
, 20, "s = null, d = 20, r = s + d")
162 TestUtil
.AssertEqual(r
, 20, "s = null, d = 20, r = s & d")
168 TestUtil
.AssertEqual(r
, 10, "s = '10', d = null, r = s + d")
171 TestUtil
.AssertEqual(r
, 10, "s = '10', d = null, r = s & d")
175 TestUtil
.AssertEqual(r
, 1020, "s = '10', d = 20, r = s + d")
179 TestUtil
.AssertEqual(r
, 1020, "s = '10', d = 20, r = s & d")
185 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = null, r = s + d")
188 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = null, r = s & d")
192 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = 20, r = s + d")
196 TestUtil
.AssertEqual(r
, -1, "s = 'abc', d = 20, r = s & d")
221 c
= a
+ b
' c = false