2 ' Copyright 2011 Jacek Caban for CodeWeavers
4 ' This library is free software; you can redistribute it and/or
5 ' modify it under the terms of the GNU Lesser General Public
6 ' License as published by the Free Software Foundation; either
7 ' version 2.1 of the License, or (at your option) any later version.
9 ' This library is distributed in the hope that it will be useful,
10 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ' Lesser General Public License for more details.
14 ' You should have received a copy of the GNU Lesser General Public
15 ' License along with this library; if not, write to the Free Software
16 ' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 Call ok(vbSunday
= 1, "vbSunday = " & vbSunday
)
27 Call ok(getVT(vbSunday
) = "VT_I2", "getVT(vbSunday) = " & getVT(vbSunday
))
28 Call ok(vbMonday
= 2, "vbMonday = " & vbMonday
)
29 Call ok(getVT(vbMonday
) = "VT_I2", "getVT(vbMonday) = " & getVT(vbMonday
))
30 Call ok(vbTuesday
= 3, "vbTuesday = " & vbTuesday
)
31 Call ok(getVT(vbTuesday
) = "VT_I2", "getVT(vbTuesday) = " & getVT(vbTuesday
))
32 Call ok(vbWednesday
= 4, "vbWednesday = " & vbWednesday
)
33 Call ok(getVT(vbWednesday
) = "VT_I2", "getVT(vbWednesday) = " & getVT(vbWednesday
))
34 Call ok(vbThursday
= 5, "vbThursday = " & vbThursday
)
35 Call ok(getVT(vbThursday
) = "VT_I2", "getVT(vbThursday) = " & getVT(vbThursday
))
36 Call ok(vbFriday
= 6, "vbFriday = " & vbFriday
)
37 Call ok(getVT(vbFriday
) = "VT_I2", "getVT(vbFriday) = " & getVT(vbFriday
))
38 Call ok(vbSaturday
= 7, "vbSaturday = " & vbSaturday
)
39 Call ok(getVT(vbSaturday
) = "VT_I2", "getVT(vbSaturday) = " & getVT(vbSaturday
))
41 Sub TestConstant(name
, val
, exval
)
42 Call ok(val
= exval
, name
& " = " & val
& " expected " & exval
)
43 Call ok(getVT(val
) = "VT_I2*", "getVT(" & name
& ") = " & getVT(val
))
46 Sub TestConstantI4(name
, val
, exval
)
47 Call ok(val
= exval
, name
& " = " & val
& " expected " & exval
)
48 Call ok(getVT(val
) = "VT_I4*", "getVT(" & name
& ") = " & getVT(val
))
51 Sub TestConstantBSTR(name
, val
, exval
)
52 Call ok(val
= exval
, name
& " = " & val
& " expected " & exval
)
53 Call ok(getVT(val
) = "VT_BSTR*", "getVT(" & name
& ") = " & getVT(val
))
56 TestConstant
"vbEmpty", vbEmpty
, 0
57 TestConstant
"vbNull", vbNull
, 1
58 TestConstant
"vbLong", vbLong
, 3
59 TestConstant
"vbSingle", vbSingle
, 4
60 TestConstant
"vbDouble", vbDouble
, 5
61 TestConstant
"vbCurrency", vbCurrency
, 6
62 TestConstant
"vbDate", vbDate
, 7
63 TestConstant
"vbString", vbString
, 8
64 TestConstant
"vbObject", vbObject
, 9
65 TestConstant
"vbError", vbError
, 10
66 TestConstant
"vbBoolean", vbBoolean
, 11
67 TestConstant
"vbVariant", vbVariant
, 12
68 TestConstant
"vbDataObject", vbDataObject
, 13
69 TestConstant
"vbDecimal", vbDecimal
, 14
70 TestConstant
"vbByte", vbByte
, 17
71 TestConstant
"vbArray", vbArray
, 8192
72 TestConstant
"vbCritical", vbCritical
, 16
73 TestConstant
"vbQuestion", vbQuestion
, 32
74 TestConstant
"vbExclamation", vbExclamation
, 48
75 TestConstant
"vbInformation", vbInformation
, 64
76 TestConstant
"vbDefaultButton1", vbDefaultButton1
, 0
77 TestConstant
"vbDefaultButton2", vbDefaultButton2
, 256
78 TestConstant
"vbDefaultButton3", vbDefaultButton3
, 512
79 TestConstant
"vbDefaultButton4", vbDefaultButton4
, 768
80 TestConstant
"vbApplicationModal", vbApplicationModal
, 0
81 TestConstant
"vbSystemModal", vbSystemModal
, 4096
82 TestConstant
"vbUseSystem", vbUseSystem
, 0
83 TestConstant
"vbUseSystemDayOfWeek", vbUseSystemDayOfWeek
, 0
84 TestConstant
"vbFirstJan1", vbFirstJan1
, 1
85 TestConstant
"vbFirstFourDays", vbFirstFourDays
, 2
86 TestConstant
"vbFirstFullWeek", vbFirstFullWeek
, 3
87 TestConstant
"vbTrue", vbTrue
, -1
88 TestConstant
"vbFalse", vbFalse
, 0
89 TestConstantI4
"vbMsgBoxHelpButton", vbMsgBoxHelpButton
, 16384
90 TestConstantI4
"vbMsgBoxSetForeground", vbMsgBoxSetForeground
, 65536
91 TestConstantI4
"vbMsgBoxRight", vbMsgBoxRight
, 524288
92 TestConstantI4
"vbMsgBoxRtlReading", vbMsgBoxRtlReading
, 1048576
93 TestConstant
"vbUseDefault", vbUseDefault
, -2
94 TestConstant
"vbBinaryCompare", vbBinaryCompare
, 0
95 TestConstant
"vbTextCompare", vbTextCompare
, 1
96 TestConstant
"vbDatabaseCompare", vbDatabaseCompare
, 2
97 TestConstant
"vbGeneralDate", vbGeneralDate
, 0
98 TestConstant
"vbLongDate", vbLongDate
, 1
99 TestConstant
"vbShortDate", vbShortDate
, 2
100 TestConstant
"vbLongTime", vbLongTime
, 3
101 TestConstant
"vbShortTime", vbShortTime
, 4
102 TestConstantI4
"vbObjectError", vbObjectError
, &h80040000
&
103 TestConstantI4
"vbBlack", vbBlack
, 0
104 TestConstantI4
"vbBlue", vbBlue
, &hff0000
&
105 TestConstantI4
"vbCyan", vbCyan
, &hffff00
&
106 TestConstantI4
"vbGreen", vbGreen
, &h00ff00
&
107 TestConstantI4
"vbMagenta", vbMagenta
, &hff00ff
&
108 TestConstantI4
"vbRed", vbRed
, &h0000ff
&
109 TestConstantI4
"vbWhite", vbWhite
, &hffffff
&
110 TestConstantI4
"vbYellow", vbYellow
, &h00ffff
&
111 TestConstantBSTR
"vbCr", vbCr
, Chr(13)
112 TestConstantBSTR
"vbCrLf", vbCrLf
, Chr(13)&Chr(10)
113 TestConstantBSTR
"vbNewLine", vbNewLine
, Chr(13)&Chr(10)
114 TestConstantBSTR
"vbFormFeed", vbFormFeed
, Chr(12)
115 TestConstantBSTR
"vbLf", vbLf
, Chr(10)
116 TestConstantBSTR
"vbNullChar", vbNullChar
, Chr(0)
117 TestConstantBSTR
"vbNullString", vbNullString
, ""
118 TestConstantBSTR
"vbTab", vbTab
, chr(9)
119 TestConstantBSTR
"vbVerticalTab", vbVerticalTab
, chr(11)
121 Sub TestCStr(arg
, exval
)
124 Call ok(getVT(x
) = "VT_BSTR*", "getVT(x) = " & getVT(x
))
125 Call ok(x
= exval
, "CStr(" & arg
& ") = " & x
)
128 TestCStr
"test", "test"
130 if isEnglishLang
then TestCStr
3.5, "3.5"
131 if isEnglishLang
then TestCStr
true, "True"
133 Call ok(getVT(Chr(120)) = "VT_BSTR", "getVT(Chr(120)) = " & getVT(Chr(120)))
134 Call ok(getVT(Chr(255)) = "VT_BSTR", "getVT(Chr(255)) = " & getVT(Chr(255)))
135 Call ok(Chr(120) = "x", "Chr(120) = " & Chr(120))
136 Call ok(Chr(0) <> "", "Chr(0) = """"")
137 Call ok(Chr(120.5) = "x", "Chr(120.5) = " & Chr(120.5))
138 Call ok(Chr(119.5) = "x", "Chr(119.5) = " & Chr(119.5))
143 if isEnglishLang
then
146 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
150 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
155 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
159 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
164 Call ok(isObject(new EmptyClass
), "isObject(new EmptyClass) is not true?")
165 Set x
= new EmptyClass
166 Call ok(isObject(x
), "isObject(x) is not true?")
167 Call ok(isObject(Nothing), "isObject(Nothing) is not true?")
168 Call ok(not isObject(true), "isObject(true) is true?")
169 Call ok(not isObject(4), "isObject(4) is true?")
170 Call ok(not isObject("x"), "isObject(""x"") is true?")
171 Call ok(not isObject(Null
), "isObject(Null) is true?")
173 Call ok(not isEmpty(new EmptyClass
), "isEmpty(new EmptyClass) is true?")
174 Set x
= new EmptyClass
175 Call ok(not isEmpty(x
), "isEmpty(x) is true?")
177 Call ok(isEmpty(x
), "isEmpty(x) is not true?")
178 Call ok(isEmpty(empty
), "isEmpty(empty) is not true?")
179 Call ok(not isEmpty(Nothing), "isEmpty(Nothing) is not true?")
180 Call ok(not isEmpty(true), "isEmpty(true) is true?")
181 Call ok(not isEmpty(4), "isEmpty(4) is true?")
182 Call ok(not isEmpty("x"), "isEmpty(""x"") is true?")
183 Call ok(not isEmpty(Null
), "isEmpty(Null) is true?")
185 Call ok(not isNull(new EmptyClass
), "isNull(new EmptyClass) is true?")
186 Set x
= new EmptyClass
187 Call ok(not isNull(x
), "isNull(x) is true?")
189 Call ok(isNull(x
), "isNull(x) is not true?")
190 Call ok(not isNull(empty
), "isNull(empty) is true?")
191 Call ok(not isNull(Nothing), "isNull(Nothing) is true?")
192 Call ok(not isNull(true), "isNull(true) is true?")
193 Call ok(not isNull(4), "isNull(4) is true?")
194 Call ok(not isNull("x"), "isNull(""x"") is true?")
195 Call ok(isNull(Null
), "isNull(Null) is not true?")
197 Call ok(getVT(err
) = "VT_DISPATCH", "getVT(err) = " & getVT(err
))
200 Call ok(hex(x
) = ex
, "hex(" & x
& ") = " & hex(x
) & " expected " & ex
)
206 TestHex
&hdeadbeef
&, "DEADBEEF"
209 TestHex
-934859845, "C8472BBB"
212 Call ok(getVT(hex(null
)) = "VT_NULL", "getVT(hex(null)) = " & getVT(hex(null
)))
213 Call ok(getVT(hex(empty
)) = "VT_BSTR", "getVT(hex(empty)) = " & getVT(hex(empty
)))
215 x
= InStr(1, "abcd", "bc")
216 Call ok(x
= 2, "InStr returned " & x
)
218 x
= InStr("abcd", "bc")
219 Call ok(x
= 2, "InStr returned " & x
)
221 x
= InStr("abc", "bc")
222 Call ok(x
= 2, "InStr returned " & x
)
224 x
= InStr("abcbc", "bc")
225 Call ok(x
= 2, "InStr returned " & x
)
227 x
= InStr("bcabc", "bc")
228 Call ok(x
= 1, "InStr returned " & x
)
230 x
= InStr(3, "abcd", "bc")
231 Call ok(x
= 0, "InStr returned " & x
)
233 x
= InStr("abcd", "bcx")
234 Call ok(x
= 0, "InStr returned " & x
)
236 x
= InStr(5, "abcd", "bc")
237 Call ok(x
= 0, "InStr returned " & x
)
241 Call ok(x
= 2, "InStr returned " & x
)
243 x
= InStr("abcd", null
)
244 Call ok(isNull(x
), "InStr returned " & x
)
245 x
= InStr(null
, "abcd")
246 Call ok(isNull(x
), "InStr returned " & x
)
247 x
= InStr(2, null
, "abcd")
248 Call ok(isNull(x
), "InStr returned " & x
)
250 x
= InStr(1.3, "abcd", "bc")
251 Call ok(x
= 2, "InStr returned " & x
)
253 x
= InStr(2.3, "abcd", "bc")
254 Call ok(x
= 2, "InStr returned " & x
)
256 x
= InStr(2.6, "abcd", "bc")
257 Call ok(x
= 0, "InStr returned " & x
)
259 Sub TestMid(str
, start
, len
, ex
)
260 x
= Mid(str
, start
, len
)
261 Call ok(x
= ex
, "Mid(" & str
& ", " & start
& ", " & len
& ") = " & x
& " expected " & ex
)
264 Sub TestMid2(str
, start
, ex
)
266 Call ok(x
= ex
, "Mid(" & str
& ", " & start
& ") = " & x
& " expected " & ex
)
269 TestMid
"test", 2, 2, "es"
270 TestMid
"test", 2, 4, "est"
271 TestMid
"test", 1, 2, "te"
272 TestMid
"test", 1, 0, ""
273 TestMid
"test", 1, 0, ""
274 TestMid
"test", 5, 2, ""
275 TestMid2
"test", 1, "test"
276 TestMid2
"test", 2, "est"
277 TestMid2
"test", 4, "t"
278 TestMid2
"test", 5, ""
280 Sub TestUCase(str
, ex
)
282 Call ok(x
= ex
, "UCase(" & str
& ") = " & x
& " expected " & ex
)
285 TestUCase
"test", "TEST"
286 TestUCase
"123aBC?", "123ABC?"
289 if isEnglishLang
then TestUCase
true, "TRUE"
290 TestUCase
0.123, doubleAsString(0.123)
292 Call ok(getVT(UCase(Null
)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null
)))
294 Sub TestLCase(str
, ex
)
296 Call ok(x
= ex
, "LCase(" & str
& ") = " & x
& " expected " & ex
)
299 TestLCase
"test", "test"
300 TestLCase
"123aBC?", "123abc?"
303 if isEnglishLang
then TestLCase
true, "true"
304 TestLCase
0.123, doubleAsString(0.123)
306 Call ok(getVT(LCase(Null
)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null
)))
308 Call ok(Len("abc") = 3, "Len(abc) = " & Len("abc"))
309 Call ok(Len("") = 0, "Len() = " & Len(""))
310 Call ok(Len(1) = 1, "Len(1) = " & Len(1))
311 Call ok(isNull(Len(null
)), "Len(null) = " & Len(null
))
312 Call ok(Len(empty
) = 0, "Len(empty) = " & Len(empty
))
314 Call ok(Space(1) = " ", "Space(1) = " & Space(1) & """")
315 Call ok(Space(0) = "", "Space(0) = " & Space(0) & """")
316 Call ok(Space(false) = "", "Space(false) = " & Space(false) & """")
317 Call ok(Space(5) = " ", "Space(5) = " & Space(5) & """")
318 Call ok(Space(5.2) = " ", "Space(5.2) = " & Space(5.2) & """")
319 Call ok(Space(5.8) = " ", "Space(5.8) = " & Space(5.8) & """")
320 Call ok(Space(5.5) = " ", "Space(5.5) = " & Space(5.5) & """")
321 Call ok(Space(4.5) = " ", "Space(4.5) = " & Space(4.5) & """")
322 Call ok(Space(0.5) = "", "Space(0.5) = " & Space(0.5) & """")
323 Call ok(Space(1.5) = " ", "Space(1.5) = " & Space(1.5) & """")
325 Sub TestStrReverse(str
, ex
)
326 Call ok(StrReverse(str
) = ex
, "StrReverse(" & str
& ") = " & StrReverse(str
))
329 TestStrReverse
"test", "tset"
330 TestStrReverse
"", ""
331 TestStrReverse
123, "321"
332 if isEnglishLang
then TestStrReverse
true, "eurT"
334 Sub TestLeft(str
, len
, ex
)
335 Call ok(Left(str
, len
) = ex
, "Left(" & str
& ", " & len
& ") = " & Left(str
, len
))
338 TestLeft
"test", 2, "te"
339 TestLeft
"test", 5, "test"
340 TestLeft
"test", 0, ""
341 TestLeft
123, 2, "12"
342 TestLeft
"123456", 1.5, "12"
343 TestLeft
"123456", 2.5, "12"
344 if isEnglishLang
then TestLeft
true, 2, "Tr"
346 Sub TestRight(str
, len
, ex
)
347 Call ok(Right(str
, len
) = ex
, "Right(" & str
& ", " & len
& ") = " & Right(str
, len
))
350 TestRight
"test", 2, "st"
351 TestRight
"test", 5, "test"
352 TestRight
"test", 0, ""
353 TestRight
123, 2, "23"
354 if isEnglishLang
then TestRight
true, 2, "ue"
356 Sub TestTrim(str
, exstr
)
357 Call ok(Trim(str
) = exstr
, "Trim(" & str
& ") = " & Trim(str
))
360 TestTrim
" test ", "test"
361 TestTrim
"test ", "test"
362 TestTrim
" test", "test"
363 TestTrim
"test", "test"
366 if isEnglishLang
then TestTrim
true, "True"
368 Sub TestLTrim(str
, exstr
)
369 Call ok(LTrim(str
) = exstr
, "LTrim(" & str
& ") = " & LTrim(str
))
372 TestLTrim
" test ", "test "
373 TestLTrim
"test ", "test "
374 TestLTrim
" test", "test"
375 TestLTrim
"test", "test"
378 if isEnglishLang
then TestLTrim
true, "True"
380 Sub TestRound(val
, exval
, vt
)
381 Call ok(Round(val
) = exval
, "Round(" & val
& ") = " & Round(val
))
382 Call ok(getVT(Round(val
)) = vt
, "getVT(Round(" & val
& ")) = " & getVT(Round(val
)))
385 Sub TestRTrim(str
, exstr
)
386 Call ok(RTrim(str
) = exstr
, "RTrim(" & str
& ") = " & RTrim(str
))
389 TestRTrim
" test ", " test"
390 TestRTrim
"test ", "test"
391 TestRTrim
" test", " test"
392 TestRTrim
"test", "test"
395 if isEnglishLang
then TestRTrim
true, "True"
397 TestRound
3, 3, "VT_I2"
398 TestRound
3.3, 3, "VT_R8"
399 TestRound
3.8, 4, "VT_R8"
400 TestRound
3.5, 4, "VT_R8"
401 TestRound
-3.3, -3, "VT_R8"
402 TestRound
-3.5, -4, "VT_R8"
403 TestRound
"2", 2, "VT_R8"
404 TestRound
true, true, "VT_BOOL"
405 TestRound
false, false, "VT_BOOL"
407 if isEnglishLang
then
408 Call ok(WeekDayName(1) = "Sunday", "WeekDayName(1) = " & WeekDayName(1))
409 Call ok(WeekDayName(3) = "Tuesday", "WeekDayName(3) = " & WeekDayName(3))
410 Call ok(WeekDayName(7) = "Saturday", "WeekDayName(7) = " & WeekDayName(7))
411 Call ok(WeekDayName(1.1) = "Sunday", "WeekDayName(1.1) = " & WeekDayName(1.1))
412 Call ok(WeekDayName(1, false) = "Sunday", "WeekDayName(1, false) = " & WeekDayName(1, false))
413 Call ok(WeekDayName(1, true) = "Sun", "WeekDayName(1, true) = " & WeekDayName(1, true))
414 Call ok(WeekDayName(1, 10) = "Sun", "WeekDayName(1, 10) = " & WeekDayName(1, 10))
415 Call ok(WeekDayName(1, true, 0) = "Sun", "WeekDayName(1, true, 0) = " & WeekDayName(1, true, 0))
416 Call ok(WeekDayName(1, true, 2) = "Mon", "WeekDayName(1, true, 2) = " & WeekDayName(1, true, 2))
417 Call ok(WeekDayName(1, true, 2.5) = "Mon", "WeekDayName(1, true, 2.5) = " & WeekDayName(1, true, 2.5))
418 Call ok(WeekDayName(1, true, 1.5) = "Mon", "WeekDayName(1, true, 1.5) = " & WeekDayName(1, true, 1.5))
419 Call ok(WeekDayName(1, true, 7) = "Sat", "WeekDayName(1, true, 7) = " & WeekDayName(1, true, 7))
420 Call ok(WeekDayName(1, true, 7.1) = "Sat", "WeekDayName(1, true, 7.1) = " & WeekDayName(1, true, 7.1))
422 Call ok(MonthName(1) = "January", "MonthName(1) = " & MonthName(1))
423 Call ok(MonthName(12) = "December", "MonthName(12) = " & MonthName(12))
424 Call ok(MonthName(1, 0) = "January", "MonthName(1, 0) = " & MonthName(1, 0))
425 Call ok(MonthName(12, false) = "December", "MonthName(12, false) = " & MonthName(12, false))
426 Call ok(MonthName(1, 10) = "Jan", "MonthName(1, 10) = " & MonthName(1, 10))
427 Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true))
430 Call ok(getVT(Now()) = "VT_DATE", "getVT(Now()) = " & getVT(Now()))
432 Call ok(vbOKOnly
= 0, "vbOKOnly = " & vbOKOnly
)
433 Call ok(getVT(vbOKOnly
) = "VT_I2", "getVT(vbOKOnly) = " & getVT(vbOKOnly
))
434 Call ok(vbOKCancel
= 1, "vbOKCancel = " & vbOKCancel
)
435 Call ok(getVT(vbOKCancel
) = "VT_I2", "getVT(vbOKCancel) = " & getVT(vbOKCancel
))
436 Call ok(vbAbortRetryIgnore
= 2, "vbAbortRetryIgnore = " & vbAbortRetryIgnore
)
437 Call ok(getVT(vbAbortRetryIgnore
) = "VT_I2", "getVT(vbAbortRetryIgnore) = " & getVT(vbAbortRetryIgnore
))
438 Call ok(vbYesNoCancel
= 3, "vbYesNoCancel = " & vbYesNoCancel
)
439 Call ok(getVT(vbYesNoCancel
) = "VT_I2", "getVT(vbYesNoCancel) = " & getVT(vbYesNoCancel
))
440 Call ok(vbYesNo
= 4, "vbYesNo = " & vbYesNo
)
441 Call ok(getVT(vbYesNo
) = "VT_I2", "getVT(vbYesNo) = " & getVT(vbYesNo
))
442 Call ok(vbRetryCancel
= 5, "vbRetryCancel = " & vbRetryCancel
)
443 Call ok(getVT(vbRetryCancel
) = "VT_I2", "getVT(vbRetryCancel) = " & getVT(vbRetryCancel
))
445 Call ok(vbOK
= 1, "vbOK = " & vbOK
)
446 Call ok(getVT(vbOK
) = "VT_I2", "getVT(vbOK) = " & getVT(vbOK
))
447 Call ok(vbCancel
= 2, "vbCancel = " & vbCancel
)
448 Call ok(getVT(vbCancel
) = "VT_I2", "getVT(vbCancel) = " & getVT(vbCancel
))
449 Call ok(vbAbort
= 3, "vbAbort = " & vbAbort
)
450 Call ok(getVT(vbAbort
) = "VT_I2", "getVT(vbAbort) = " & getVT(vbAbort
))
451 Call ok(vbRetry
= 4, "vbRetry = " & vbRetry
)
452 Call ok(getVT(vbRetry
) = "VT_I2", "getVT(vbRetry) = " & getVT(vbRetry
))
453 Call ok(vbIgnore
= 5, "vbIgnore = " & vbIgnore
)
454 Call ok(getVT(vbIgnore
) = "VT_I2", "getVT(vbIgnore) = " & getVT(vbIgnore
))
455 Call ok(vbYes
= 6, "vbYes = " & vbYes
)
456 Call ok(getVT(vbYes
) = "VT_I2", "getVT(vbYes) = " & getVT(vbYes
))
457 Call ok(vbNo
= 7, "vbNo = " & vbNo
)
458 Call ok(getVT(vbNo
) = "VT_I2", "getVT(vbNo) = " & getVT(vbNo
))
460 Call ok(CInt(-36.75) = -37, "CInt(-36.75) = " & CInt(-36.75))
461 Call ok(getVT(CInt(-36.75)) = "VT_I2", "getVT(CInt(-36.75)) = " & getVT(CInt(-36.75)))
462 Call ok(CInt(-36.50) = -36, "CInt(-36.50) = " & CInt(-36.50))
463 Call ok(getVT(CInt(-36.50)) = "VT_I2", "getVT(CInt(-36.50)) = " & getVT(CInt(-36.50)))
464 Call ok(CInt(-36.25) = -36, "CInt(-36.25) = " & CInt(-36.25))
465 Call ok(getVT(CInt(-36.25)) = "VT_I2", "getVT(CInt(-36.25)) = " & getVT(CInt(-36.25)))
466 Call ok(CInt(-36) = -36, "CInt(-36) = " & CInt(-36))
467 Call ok(getVT(CInt(-36)) = "VT_I2", "getVT(CInt(-36)) = " & getVT(CInt(-36)))
468 Call ok(CInt(0) = 0, "CInt(0) = " & CInt(0))
469 Call ok(getVT(CInt(0)) = "VT_I2", "getVT(CInt(0)) = " & getVT(CInt(0)))
470 Call ok(CInt(0.0) = 0, "CInt(0.0) = " & CInt(0))
471 Call ok(getVT(CInt(0.0)) = "VT_I2", "getVT(CInt(0.0)) = " & getVT(CInt(0.0)))
472 Call ok(CInt(0.5) = 0, "CInt(0.5) = " & CInt(0))
473 Call ok(getVT(CInt(0.5)) = "VT_I2", "getVT(CInt(0.5)) = " & getVT(CInt(0.5)))
474 Call ok(CInt(36) = 36, "CInt(36) = " & CInt(36))
475 Call ok(getVT(CInt(36)) = "VT_I2", "getVT(CInt(36)) = " & getVT(CInt(36)))
476 Call ok(CInt(36.25) = 36, "CInt(36.25) = " & CInt(36.25))
477 Call ok(getVT(CInt(36.25)) = "VT_I2", "getVT(CInt(36.25)) = " & getVT(CInt(36.25)))
478 Call ok(CInt(36.50) = 36, "CInt(36.50) = " & CInt(36.50))
479 Call ok(getVT(CInt(36.50)) = "VT_I2", "getVT(CInt(36.50)) = " & getVT(CInt(36.50)))
480 Call ok(CInt(36.75) = 37, "CInt(36.75) = " & CInt(36.75))
481 Call ok(getVT(CInt(36.75)) = "VT_I2", "getVT(CInt(36.75)) = " & getVT(CInt(36.75)))
484 Call ok(CBool(5) = true, "CBool(5) = " & CBool(5))
485 Call ok(getVT(CBool(5)) = "VT_BOOL", "getVT(CBool(5)) = " & getVT(CBool(5)))
486 Call ok(CBool(0) = false, "CBool(0) = " & CBool(0))
487 Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))
488 Call ok(CBool(-5) = true, "CBool(-5) = " & CBool(-5))
489 Call ok(getVT(CBool(-5)) = "VT_BOOL", "getVT(CBool(-5)) = " & getVT(CBool(-5)))
491 Sub testCBoolError(strings
, error_num
)
496 Call ok(Err
.number
= error_num
, "Err.number = " & Err
.number
)
502 Public default
Property Get defprop
508 Set MyObject
= New ValClass
510 Call ok(CBool(Empty
) = False, "CBool(Empty) = " & CBool(Empty
))
511 Call ok(getVT(CBool(Empty
)) = "VT_BOOL", "getVT(CBool(Empty)) = " & getVT(CBool(Empty
)))
512 Call ok(CBool(1) = True, "CBool(1) = " & CBool(1))
513 Call ok(getVT(CBool(1)) = "VT_BOOL", "getVT(CBool(1)) = " & getVT(CBool(1)))
514 Call ok(CBool(0) = False, "CBool(0) = " & CBool(0))
515 Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))
516 Call ok(CBool(-0.56) = True, "CBool(-0.56) = " & CBool(-0.56))
517 Call ok(getVT(CBool(-0.56)) = "VT_BOOL", "getVT(CBool(-0.56)) = " & getVT(CBool(-0.56)))
518 Call testCBoolError("", 13)
519 Call ok(CBool("0") = False, "CBool(""0"") = " & CBool("0"))
520 Call ok(getVT(CBool("0")) = "VT_BOOL", "getVT(CBool(""0"")) = " & getVT(CBool("0")))
521 If isEnglishLang
Then
522 Call ok(CBool("0.1") = True, "CBool(""0.1"") = " & CBool("0.1"))
523 Call ok(getVT(CBool("0.1")) = "VT_BOOL", "getVT(CBool(""0.1"")) = " & getVT(CBool("0.1")))
525 Call ok(CBool("true") = True, "CBool(""true"") = " & CBool("true"))
526 Call ok(getVT(CBool("true")) = "VT_BOOL", "getVT(CBool(""true"")) = " & getVT(CBool("true")))
527 Call ok(CBool("false") = False, "CBool(""false"") = " & CBool("false"))
528 Call ok(getVT(CBool("false")) = "VT_BOOL", "getVT(CBool(""false"")) = " & getVT(CBool("false")))
529 Call ok(CBool("TRUE") = True, "CBool(""TRUE"") = " & CBool("TRUE"))
530 Call ok(getVT(CBool("TRUE")) = "VT_BOOL", "getVT(CBool(""TRUE"")) = " & getVT(CBool("TRUE")))
531 Call ok(CBool("FALSE") = False, "CBool(""FALSE"") = " & CBool("FALSE"))
532 Call ok(getVT(CBool("FALSE")) = "VT_BOOL", "getVT(CBool(""FALSE"")) = " & getVT(CBool("FALSE")))
533 Call ok(CBool("#TRUE#") = True, "CBool(""#TRUE#"") = " & CBool("#TRUE#"))
534 Call ok(getVT(CBool("#TRUE#")) = "VT_BOOL", "getVT(CBool(""#TRUE#"")) = " & getVT(CBool("#TRUE#")))
535 Call ok(CBool("#FALSE#") = False, "CBool(""#FALSE#"") = " & CBool("#FALSE#"))
536 Call ok(getVT(CBool("#FALSE#")) = "VT_BOOL", "getVT(CBool(""#FALSE#"")) = " & getVT(CBool("#FALSE#")))
537 Call ok(CBool(MyObject
) = False, "CBool(MyObject) = " & CBool(MyObject
))
538 Call ok(getVT(CBool(MyObject
)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject
)))
540 Call ok(CBool(MyObject
) = True, "CBool(MyObject) = " & CBool(MyObject
))
541 Call ok(getVT(CBool(MyObject
)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject
)))
543 Call ok(CBool(MyObject
) = False, "CBool(MyObject) = " & CBool(MyObject
))
544 Call ok(getVT(CBool(MyObject
)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject
)))
546 Sub testCByteError(strings
, error_num1
,error_num2
)
552 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
556 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
559 Call ok(CByte(Empty
) = 0, "CByte(Empty) = " & CByte(Empty
))
560 Call ok(getVT(CByte(Empty
)) = "VT_UI1", "getVT(CByte(Empty)) = " & getVT(CByte(Empty
)))
561 Call ok(CByte(255) = 255, "CByte(255) = " & CByte(255))
562 Call ok(getVT(CByte(255)) = "VT_UI1", "getVT(CByte(255)) = " & getVT(CByte(255)))
563 Call ok(CByte(255.49) = 255, "CByte(255.49) = " & CByte(255.49))
564 Call ok(getVT(CByte(255.49)) = "VT_UI1", "getVT(CByte(255.49)) = " & getVT(CByte(255.49)))
565 Call testCByteError(1, 0, 458)
566 Call testCByteError("", 13, 13)
567 Call testCByteError("-1", 6, 6)
568 Call testCByteError("258", 6, 6)
569 Call testCByteError("TRUE", 13, 13)
570 Call testCByteError("FALSE", 13, 13)
571 Call testCByteError("#TRue#", 13, 13)
572 Call testCByteError("#fAlSE#", 13, 13)
573 If isEnglishLang
Then
574 Call ok(CByte("-0.5") = 0, "CByte(""-0.5"") = " & CByte("-0.5"))
575 Call ok(getVT(CByte("-0.5")) = "VT_UI1", "getVT(CByte(""-0.5"")) = " & getVT(CByte("-0.5")))
577 Call ok(CByte(True) = 255, "CByte(True) = " & CByte(True))
578 Call ok(getVT(CByte(True)) = "VT_UI1", "getVT(CByte(True)) = " & getVT(CByte(True)))
579 Call ok(CByte(False) = 0, "CByte(False) = " & CByte(False))
580 Call ok(getVT(CByte(False)) = "VT_UI1", "getVT(CByte(False)) = " & getVT(CByte(False)))
581 Call ok(CByte(MyObject
) = 0, "CByte(MyObject) = " & CByte(MyObject
))
582 Call ok(getVT(CByte(MyObject
)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject
)))
584 Call ok(CByte(MyObject
) = 1, "CByte(MyObject) = " & CByte(MyObject
))
585 Call ok(getVT(CByte(MyObject
)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject
)))
587 Call ok(CByte(MyObject
) = 0, "CByte(MyObject) = " & CByte(MyObject
))
588 Call ok(getVT(CByte(MyObject
)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject
)))
590 Sub testCCurError(strings
, error_num1
, error_num2
)
596 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
600 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
603 Call ok(CCur(Empty
) = 0, "CCur(Empty) = " & CCur(Empty
))
604 Call ok(getVT(CCur(Empty
)) = "VT_CY", "getVT(CCur(Empty)) = " & getVT(CCur(Empty
)))
605 Call ok(CCur(-32768) = -32768, "CCur(-32768) = " & CCur(-32768))
606 Call ok(getVT(CCur(-32768)) = "VT_CY", "getVT(CCur(-32768)) = " & getVT(CCur(-32768)))
607 Call ok(CCur(32768) = 32768, "CCur(32768) = " & CCur(32768))
608 Call ok(getVT(CCur(32768)) = "VT_CY", "getVT(CCur(32768)) = " & getVT(CCur(32768)))
609 Call ok(CCur(0.000149) = 0.0001, "CCur(0.000149) = " & CCur(0.000149))
610 Call ok(getVT(CCur(0.000149)) = "VT_CY", "getVT(CCur(0.000149)) = " & getVT(CCur(0.000149)))
611 Call ok(CCur(2147483647.99) = 2147483647.99, "CCur(2147483647.99) = " & CCur(2147483647.99))
612 Call ok(getVT(CCur(2147483647.99)) = "VT_CY", "getVT(CCur(2147483647.99)) = " & getVT(CCur(2147483647.99)))
613 Call ok(CCur("-1") = -1, "CCur(""-1"") = " & CCur("-1"))
614 Call ok(getVT(CCur("-1")) = "VT_CY", "getVT(CCur(""-1"")) = " & getVT(CCur("-1")))
615 If isEnglishLang
Then
616 Call ok(CCur("-0.5") = -0.5, "CCur(""-0.5"") = " & CCur("-0.5"))
617 Call ok(getVT(CCur("-0.5")) = "VT_CY", "getVT(CCur(""-0.5"")) = " & getVT(CCur("-0.5")))
619 Call testCCurError("", 13, 13)
620 Call testCCurError("-1", 0, 458)
621 Call testCCurError("TRUE", 13, 13)
622 Call testCCurError("FALSE", 13, 13)
623 Call testCCurError("#TRue#", 13, 13)
624 Call testCCurError("#fAlSE#", 13, 13)
625 Call testCCurError(1, 0, 458)
626 Call ok(CCur(True) = -1, "CCur(True) = " & CCur(True))
627 Call ok(getVT(CCur(True)) = "VT_CY", "getVT(CCur(True)) = " & getVT(CCur(True)))
628 Call ok(CCur(False) = 0, "CCur(False) = " & CCur(False))
629 Call ok(getVT(CCur(False)) = "VT_CY", "getVT(CCur(False)) = " & getVT(CCur(False)))
631 Call ok(CCur(MyObject
) = 0.1, "CCur(MyObject) = " & CCur(MyObject
))
632 Call ok(getVT(CCur(MyObject
)) = "VT_CY", "getVT(CCur(MyObject)) = " & getVT(CCur(MyObject
)))
634 Call ok(CCur(MyObject
) = 0, "CCur(MyObject) = " & CCur(MyObject
))
635 Call ok(getVT(CCur(MyObject
)) = "VT_CY", "getVT(CCur(MyObject)) = " & getVT(CCur(MyObject
)))
637 Sub testCDblError(strings
, error_num1
, error_num2
)
643 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
647 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
650 Call ok(CDbl(Empty
) = 0, "CDbl(Empty) = " & CDbl(Empty
))
651 Call ok(getVT(CDbl(Empty
)) = "VT_R8", "getVT(CDbl(Empty)) = " & getVT(CDbl(Empty
)))
652 Call ok(CDbl(CByte(0)) = 0, "CDbl(CByte(0)) = " & CDbl(CByte(0)))
653 Call ok(getVT(CDbl(CCur(0))) = "VT_R8", "getVT(CDbl(CCur(0))) = " & getVT(CDbl(CCur(0))))
654 Call ok(CDbl(CCur(0)) = 0, "CDbl(CCur(0)) = " & CDbl(CCur(0)))
655 Call ok(getVT(CDbl(CCur(0))) = "VT_R8", "getVT(CDbl(CCur(0))) = " & getVT(CDbl(CCur(0))))
656 Call ok(CDbl(0) = 0, "CDbl(0) = " & CDbl(0))
657 Call ok(getVT(CDbl(0)) = "VT_R8", "getVT(CDbl(0)) = " & getVT(CDbl(0)))
658 Call ok(CDbl(32768) = 32768, "CDbl(32768) = " & CDbl(32768))
659 Call ok(getVT(CDbl(32768)) = "VT_R8", "getVT(CDbl(32768)) = " & getVT(CDbl(32768)))
660 Call ok(CDbl(0.001 * 0.001) = 0.000001, "CDbl(0.001 * 0.001) = " & CDbl(0.001 * 0.001))
661 Call ok(getVT(CDbl(0.001 * 0.001)) = "VT_R8", "getVT(CDbl(0.001 * 0.001)) = " & getVT(CDbl(0.001 * 0.001)))
662 Call ok(CDbl("-1") = -1, "CDbl(""-1"") = " & CDbl("-1"))
663 Call ok(getVT(CDbl("-1")) = "VT_R8", "getVT(CDbl(""-1"")) = " & getVT(CDbl("-1")))
664 If isEnglishLang
Then
665 Call ok(CDbl("-0.5") = -0.5, "CDbl(""-0.5"") = " & CDbl("-0.5"))
666 Call ok(getVT(CDbl("-0.5")) = "VT_R8", "getVT(CDbl(""-0.5"")) = " & getVT(CDbl("-0.5")))
668 Call testCDblError("", 13, 13)
669 Call testCDblError("TRUE", 13, 13)
670 Call testCDblError("FALSE", 13, 13)
671 Call testCDblError("#TRue#", 13, 13)
672 Call testCDblError("#fAlSE#", 13, 13)
673 Call testCDblError(1, 0, 458)
674 Call ok(CDbl(True) = -1, "CDbl(True) = " & CDbl(True))
675 Call ok(getVT(CDbl(True)) = "VT_R8", "getVT(CDbl(True)) = " & getVT(CDbl(True)))
676 Call ok(CDbl(False) = 0, "CDbl(False) = " & CDbl(False))
677 Call ok(getVT(CDbl(False)) = "VT_R8", "getVT(CDbl(False)) = " & getVT(CDbl(False)))
679 Call ok(CDbl(MyObject
) = 0.1, "CDbl(MyObject) = " & CDbl(MyObject
))
680 Call ok(getVT(CDbl(MyObject
)) = "VT_R8", "getVT(CDbl(MyObject)) = " & getVT(CDbl(MyObject
)))
682 Call ok(CDbl(MyObject
) = 0, "CDbl(MyObject) = " & CDbl(MyObject
))
683 Call ok(getVT(CDbl(MyObject
)) = "VT_R8", "getVT(CDbl(MyObject)) = " & getVT(CDbl(MyObject
)))