1 ' Copyright 2011 Jacek Caban for CodeWeavers
3 ' This library is free software; you can redistribute it and/or
4 ' modify it under the terms of the GNU Lesser General Public
5 ' License as published by the Free Software Foundation; either
6 ' version 2.1 of the License, or (at your option) any later version.
8 ' This library is distributed in the hope that it will be useful,
9 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ' Lesser General Public License for more details.
13 ' You should have received a copy of the GNU Lesser General Public
14 ' License along with this library; if not, write to the Free Software
15 ' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 Call ok(vbSunday
= 1, "vbSunday = " & vbSunday
)
26 Call ok(getVT(vbSunday
) = "VT_I2", "getVT(vbSunday) = " & getVT(vbSunday
))
27 Call ok(vbMonday
= 2, "vbMonday = " & vbMonday
)
28 Call ok(getVT(vbMonday
) = "VT_I2", "getVT(vbMonday) = " & getVT(vbMonday
))
29 Call ok(vbTuesday
= 3, "vbTuesday = " & vbTuesday
)
30 Call ok(getVT(vbTuesday
) = "VT_I2", "getVT(vbTuesday) = " & getVT(vbTuesday
))
31 Call ok(vbWednesday
= 4, "vbWednesday = " & vbWednesday
)
32 Call ok(getVT(vbWednesday
) = "VT_I2", "getVT(vbWednesday) = " & getVT(vbWednesday
))
33 Call ok(vbThursday
= 5, "vbThursday = " & vbThursday
)
34 Call ok(getVT(vbThursday
) = "VT_I2", "getVT(vbThursday) = " & getVT(vbThursday
))
35 Call ok(vbFriday
= 6, "vbFriday = " & vbFriday
)
36 Call ok(getVT(vbFriday
) = "VT_I2", "getVT(vbFriday) = " & getVT(vbFriday
))
37 Call ok(vbSaturday
= 7, "vbSaturday = " & vbSaturday
)
38 Call ok(getVT(vbSaturday
) = "VT_I2", "getVT(vbSaturday) = " & getVT(vbSaturday
))
40 Sub TestConstant(name
, val
, exval
)
41 Call ok(val
= exval
, name
& " = " & val
& " expected " & exval
)
42 Call ok(getVT(val
) = "VT_I2*", "getVT(" & name
& ") = " & getVT(val
))
45 Sub TestConstantI4(name
, val
, exval
)
46 Call ok(val
= exval
, name
& " = " & val
& " expected " & exval
)
47 Call ok(getVT(val
) = "VT_I4*", "getVT(" & name
& ") = " & getVT(val
))
50 Sub TestConstantBSTR(name
, val
, exval
)
51 Call ok(val
= exval
, name
& " = " & val
& " expected " & exval
)
52 Call ok(getVT(val
) = "VT_BSTR*", "getVT(" & name
& ") = " & getVT(val
))
55 TestConstant
"vbEmpty", vbEmpty
, 0
56 TestConstant
"vbNull", vbNull
, 1
57 TestConstant
"vbLong", vbLong
, 3
58 TestConstant
"vbSingle", vbSingle
, 4
59 TestConstant
"vbDouble", vbDouble
, 5
60 TestConstant
"vbCurrency", vbCurrency
, 6
61 TestConstant
"vbDate", vbDate
, 7
62 TestConstant
"vbString", vbString
, 8
63 TestConstant
"vbObject", vbObject
, 9
64 TestConstant
"vbError", vbError
, 10
65 TestConstant
"vbBoolean", vbBoolean
, 11
66 TestConstant
"vbVariant", vbVariant
, 12
67 TestConstant
"vbDataObject", vbDataObject
, 13
68 TestConstant
"vbDecimal", vbDecimal
, 14
69 TestConstant
"vbByte", vbByte
, 17
70 TestConstant
"vbArray", vbArray
, 8192
71 TestConstant
"vbCritical", vbCritical
, 16
72 TestConstant
"vbQuestion", vbQuestion
, 32
73 TestConstant
"vbExclamation", vbExclamation
, 48
74 TestConstant
"vbInformation", vbInformation
, 64
75 TestConstant
"vbDefaultButton1", vbDefaultButton1
, 0
76 TestConstant
"vbDefaultButton2", vbDefaultButton2
, 256
77 TestConstant
"vbDefaultButton3", vbDefaultButton3
, 512
78 TestConstant
"vbDefaultButton4", vbDefaultButton4
, 768
79 TestConstant
"vbApplicationModal", vbApplicationModal
, 0
80 TestConstant
"vbSystemModal", vbSystemModal
, 4096
81 TestConstant
"vbUseSystem", vbUseSystem
, 0
82 TestConstant
"vbUseSystemDayOfWeek", vbUseSystemDayOfWeek
, 0
83 TestConstant
"vbFirstJan1", vbFirstJan1
, 1
84 TestConstant
"vbFirstFourDays", vbFirstFourDays
, 2
85 TestConstant
"vbFirstFullWeek", vbFirstFullWeek
, 3
86 TestConstant
"vbTrue", vbTrue
, -1
87 TestConstant
"vbFalse", vbFalse
, 0
88 TestConstantI4
"vbMsgBoxHelpButton", vbMsgBoxHelpButton
, 16384
89 TestConstantI4
"vbMsgBoxSetForeground", vbMsgBoxSetForeground
, 65536
90 TestConstantI4
"vbMsgBoxRight", vbMsgBoxRight
, 524288
91 TestConstantI4
"vbMsgBoxRtlReading", vbMsgBoxRtlReading
, 1048576
92 TestConstant
"vbUseDefault", vbUseDefault
, -2
93 TestConstant
"vbBinaryCompare", vbBinaryCompare
, 0
94 TestConstant
"vbTextCompare", vbTextCompare
, 1
95 TestConstant
"vbDatabaseCompare", vbDatabaseCompare
, 2
96 TestConstant
"vbGeneralDate", vbGeneralDate
, 0
97 TestConstant
"vbLongDate", vbLongDate
, 1
98 TestConstant
"vbShortDate", vbShortDate
, 2
99 TestConstant
"vbLongTime", vbLongTime
, 3
100 TestConstant
"vbShortTime", vbShortTime
, 4
101 TestConstantI4
"vbObjectError", vbObjectError
, &h80040000
&
102 TestConstantI4
"vbBlack", vbBlack
, 0
103 TestConstantI4
"vbBlue", vbBlue
, &hff0000
&
104 TestConstantI4
"vbCyan", vbCyan
, &hffff00
&
105 TestConstantI4
"vbGreen", vbGreen
, &h00ff00
&
106 TestConstantI4
"vbMagenta", vbMagenta
, &hff00ff
&
107 TestConstantI4
"vbRed", vbRed
, &h0000ff
&
108 TestConstantI4
"vbWhite", vbWhite
, &hffffff
&
109 TestConstantI4
"vbYellow", vbYellow
, &h00ffff
&
110 TestConstantBSTR
"vbCr", vbCr
, Chr(13)
111 TestConstantBSTR
"vbCrLf", vbCrLf
, Chr(13)&Chr(10)
112 TestConstantBSTR
"vbNewLine", vbNewLine
, Chr(13)&Chr(10)
113 TestConstantBSTR
"vbFormFeed", vbFormFeed
, Chr(12)
114 TestConstantBSTR
"vbLf", vbLf
, Chr(10)
115 TestConstantBSTR
"vbNullChar", vbNullChar
, Chr(0)
116 TestConstantBSTR
"vbNullString", vbNullString
, ""
117 TestConstantBSTR
"vbTab", vbTab
, chr(9)
118 TestConstantBSTR
"vbVerticalTab", vbVerticalTab
, chr(11)
120 Sub TestCStr(arg
, exval
)
123 Call ok(getVT(x
) = "VT_BSTR*", "getVT(x) = " & getVT(x
))
124 Call ok(x
= exval
, "CStr(" & arg
& ") = " & x
)
127 TestCStr
"test", "test"
129 if isEnglishLang
then TestCStr
3.5, "3.5"
130 if isEnglishLang
then TestCStr
true, "True"
136 call ok(Err
.number
= 94, "Err.number = " & Err
.number
)
137 if isEnglishLang
then call ok(Err
.source
= "Microsoft VBScript runtime error", "Err.source = " & Err
.source
)
138 if isEnglishLang
then call ok(Err
.description
= "Invalid use of Null", "Err.description = " & Err
.description
)
142 Call ok(getVT(Chr(120)) = "VT_BSTR", "getVT(Chr(120)) = " & getVT(Chr(120)))
143 Call ok(getVT(Chr(255)) = "VT_BSTR", "getVT(Chr(255)) = " & getVT(Chr(255)))
144 Call ok(Chr(120) = "x", "Chr(120) = " & Chr(120))
145 Call ok(Chr(0) <> "", "Chr(0) = """"")
146 Call ok(Chr(120.5) = "x", "Chr(120.5) = " & Chr(120.5))
147 Call ok(Chr(119.5) = "x", "Chr(119.5) = " & Chr(119.5))
148 Call ok(Chr("120") = "x", "Chr(""120"") = " & Chr("120"))
153 if isEnglishLang
then
156 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
157 if isEnglishLang
then call ok(Err
.description
= "Invalid procedure call or argument", "Err.description = " & Err
.description
)
161 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
166 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
170 call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
175 Call ok(isObject(new EmptyClass
), "isObject(new EmptyClass) is not true?")
176 Set x
= new EmptyClass
177 Call ok(isObject(x
), "isObject(x) is not true?")
178 Call ok(isObject(Nothing), "isObject(Nothing) is not true?")
179 Call ok(not isObject(true), "isObject(true) is true?")
180 Call ok(not isObject(4), "isObject(4) is true?")
181 Call ok(not isObject("x"), "isObject(""x"") is true?")
182 Call ok(not isObject(Null
), "isObject(Null) is true?")
184 Call ok(not isEmpty(new EmptyClass
), "isEmpty(new EmptyClass) is true?")
185 Set x
= new EmptyClass
186 Call ok(not isEmpty(x
), "isEmpty(x) is true?")
188 Call ok(isEmpty(x
), "isEmpty(x) is not true?")
189 Call ok(isEmpty(empty
), "isEmpty(empty) is not true?")
190 Call ok(not isEmpty(Nothing), "isEmpty(Nothing) is not true?")
191 Call ok(not isEmpty(true), "isEmpty(true) is true?")
192 Call ok(not isEmpty(4), "isEmpty(4) is true?")
193 Call ok(not isEmpty("x"), "isEmpty(""x"") is true?")
194 Call ok(not isEmpty(Null
), "isEmpty(Null) is true?")
196 Call ok(not isNull(new EmptyClass
), "isNull(new EmptyClass) is true?")
197 Set x
= new EmptyClass
198 Call ok(not isNull(x
), "isNull(x) is true?")
200 Call ok(isNull(x
), "isNull(x) is not true?")
201 Call ok(not isNull(empty
), "isNull(empty) is true?")
202 Call ok(not isNull(Nothing), "isNull(Nothing) is true?")
203 Call ok(not isNull(true), "isNull(true) is true?")
204 Call ok(not isNull(4), "isNull(4) is true?")
205 Call ok(not isNull("x"), "isNull(""x"") is true?")
206 Call ok(isNull(Null
), "isNull(Null) is not true?")
208 Call ok(isNumeric(Empty
), "isNumeric(empty) is not true?")
209 Call ok(not isNumeric(Null
), "isNumeric(Null) is not true?")
210 Call ok(isNumeric(32767), "isNumeric(32767) is true?")
211 Call ok(isNumeric(32768), "isNumeric(32768) is true?")
212 Call ok(isNumeric(CSng(3242.4)), "isNumeric(CSng(3242.4)) is true?")
213 Call ok(isNumeric(32768.4), "isNumeric(32768.4) is true?")
214 Call ok(isNumeric(CCur(32768.4)), "isNumeric(CCur(32768.4)) is true?")
215 Call ok(isNumeric("44"), "isNumeric(""44"") is true?")
216 Call ok(not isNumeric("rwrf"), "isNumeric(""rwrf"") is not true?")
217 Call ok(not isNumeric(Nothing), "isNumeric(Nothing) is not true?")
218 Call ok(not isNumeric(New EmptyClass
), "isNumeric(New EmptyClass) is not true?")
219 Call ok(isNumeric(true), "isNumeric(true) is true?")
220 Call ok(isNumeric(CByte(32)), "isNumeric(CByte(32)) is true?")
224 Call ok(not isNumeric(arr
), "isNumeric(arr) is not true?")
226 Call ok(isArray(arr
), "isArray(arr) is not true?")
228 Call ok(isArray(arr
), "isArray(Array()) is not true?")
229 Call ok(not isArray(Empty
), "isArray(empty) is true?")
230 Call ok(not isArray(Null
), "isArray(Null) is true?")
231 Call ok(not isArray(42), "isArray(42) is true?")
232 Call ok(not isArray(CSng(3242.4)), "isArray(CSng(3242.4)) is true?")
233 Call ok(not isArray(CCur(32768.4)), "isArray(CCur(32768.4)) is true?")
234 Call ok(not isArray("44"), "isArray(""44"") is true?")
235 Call ok(not isArray("rwrf"), "isArray(""rwrf"") is true?")
236 Call ok(not isArray(Nothing), "isArray(Nothing) is true?")
237 Call ok(not isArray(New EmptyClass
), "isArray(New EmptyClass) is true?")
238 Call ok(not isArray(true), "isArray(true) is true?")
239 Call ok(not isArray(CByte(32)), "isArray(CByte(32)) is true?")
241 Call ok(getVT(Array()) = "VT_ARRAY|VT_VARIANT", "getVT(Array()) = " & getVT(Array()))
242 x
= Array("a1", 2, "a3")
243 Call ok(getVT(x
) = "VT_ARRAY|VT_VARIANT*", "getVT(array) = " & getVT(x
))
244 Call ok(getVT(x(0)) = "VT_BSTR*", "getVT(array(0)) = " & getVT(x(0)))
245 Call ok(x(0) = "a1", "array(0) = " & x(0))
246 Call ok(getVT(x(1)) = "VT_I2*", "getVT(array(1)) = " & getVT(x(1)))
247 Call ok(x(1) = 2, "array(1) = " & x(1))
248 Call ok(getVT(x(2)) = "VT_BSTR*", "getVT(array(2)) = " & getVT(x(2)))
249 Call ok(x(2) = "a3", "array(2) = " & x(2))
254 Call ok(new_array(0) = "a1", "new_array(0) = " & new_array(0))
256 Call ok(getVT(UBound(x
)) = "VT_I4", "getVT(UBound(x)) = " & getVT(UBound(x
)))
257 Call ok(UBound(x
) = 2, "UBound(x) = " & UBound(x
))
258 Call ok(getVT(UBound(x
, 1)) = "VT_I4", "getVT(UBound(x, 1)) = " & getVT(UBound(x
, 1)))
259 Call ok(UBound(x
, 1) = 2, "UBound(x) = " & UBound(x
, 1))
261 x
= Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33)
262 ok
x(1) = 2, "x(1) = " & x(1)
263 ok
x(32) = 33, "x(32) = " & x(32)
264 ok
ubound(x
) = 32, "ubound(x) = " & ubound(x
)
267 Call ok(UBound(arr2
) = 2, "UBound(x) = " & UBound(x
))
268 Call ok(UBound(arr2
, 1) = 2, "UBound(x) = " & UBound(x
))
269 Call ok(UBound(arr2
, 2) = 4, "UBound(x) = " & UBound(x
))
270 Call ok(Lbound(arr2
) = 0, "Lbound(x) = " & Lbound(x
))
271 Call ok(Lbound(arr2
, 1) = 0, "Lbound(x) = " & Lbound(x
))
272 Call ok(Lbound(arr2
, 2) = 0, "Lbound(x) = " & Lbound(x
))
274 sub testUBoundError()
278 call ok(Err
.number
= 450, "Err.number = " & Err
.number
)
280 call UBound(arr
, 1, 2)
281 call ok(Err
.number
= 450, "Err.number = " & Err
.number
)
282 if isEnglishLang
then call ok(Err
.description
= "Wrong number of arguments or invalid property assignment", _
283 "Err.description = " & Err
.description
)
285 call testUBoundError()
288 Set newObject
= New ValClass
290 Call ok(isNumeric(newObject
), "isNumeric(newObject) is true?")
291 newObject
.myval
= "test"
292 Call ok(not isNumeric(newObject
), "isNumeric(newObject) is not true?")
294 Call ok(getVT(err
) = "VT_DISPATCH", "getVT(err) = " & getVT(err
))
297 Call ok(hex(x
) = ex
, "hex(" & x
& ") = " & hex(x
) & " expected " & ex
)
303 TestHex
&hdeadbeef
&, "DEADBEEF"
306 TestHex
-934859845, "C8472BBB"
310 TestHex
-32767, "8001"
311 TestHex
-32768, "FFFF8000"
312 TestHex
2147483647.49, "7FFFFFFF"
313 TestHex
-2147483647.5, "80000000"
314 newObject
.myval
= 30.5
315 TestHex newObject
, "1E"
316 newObject
.myval
= "27"
317 TestHex newObject
, "1B"
320 Call ok(getVT(hex(null
)) = "VT_NULL", "getVT(hex(null)) = " & getVT(hex(null
)))
321 Call ok(getVT(hex(empty
)) = "VT_BSTR", "getVT(hex(empty)) = " & getVT(hex(empty
)))
323 Sub TestHexError(num
, err_num
)
326 Call ok(Err
.number
= err_num
, "Hex(" & num
& ") returns error number " & Err
.number
& " expected " & err_num
)
329 TestHexError
2147483647.5, 6
330 TestHexError
2147483648.51, 6
331 TestHexError
"test", 13
333 Sub TestOct(x
, ex
, res_type
)
334 Call ok(Oct(x
) = ex
, "Oct(" & x
& ") = " & Oct(x
) & " expected " & ex
)
335 Call ok(getVT(Oct(x
)) = res_type
, "getVT(Oct(" &x
& ")) = " & getVT(Oct(x
)) & "expected " & res_type
)
338 Sub TestOctError(num
, err_num
)
341 Call ok(Err
.number
= err_num
, "Oct(" & num
& ") error number is " & Err
.number
& " expected " & err_num
)
344 TestOct empty
, "0", "VT_BSTR"
345 TestOct
0, "0", "VT_BSTR"
346 TestOct
9, "11", "VT_BSTR"
347 TestOct
"9", "11", "VT_BSTR"
348 TestOct
8.5, "10", "VT_BSTR"
349 TestOct
9.5, "12", "VT_BSTR"
350 TestOct
-1, "177777", "VT_BSTR"
351 TestOct
-32767, "100001", "VT_BSTR"
352 TestOct
-32768, "37777700000", "VT_BSTR"
353 TestOct
2147483647.49, "17777777777", "VT_BSTR"
354 TestOct
-2147483648.5, "20000000000", "VT_BSTR"
355 Call ok(getVT(Oct(null
)) = "VT_NULL", "getVT(Oct(null)) = " & getVT(Oct(null
)))
357 TestOct newObject
, "5", "VT_BSTR"
359 TestOctError
2147483647.5, 6
360 TestOctError
-2147483648.51, 6
361 TestOctError
"test", 13
363 x
= InStr(1, "abcd", "bc")
364 Call ok(x
= 2, "InStr returned " & x
)
366 x
= InStr("abcd", "bc")
367 Call ok(x
= 2, "InStr returned " & x
)
368 Call ok(getVT(x
) = "VT_I4*", "getVT(InStr) returned " & getVT(x
))
370 x
= InStr("abc", "bc")
371 Call ok(x
= 2, "InStr returned " & x
)
373 x
= InStr("abcbc", "bc")
374 Call ok(x
= 2, "InStr returned " & x
)
376 x
= InStr("bcabc", "bc")
377 Call ok(x
= 1, "InStr returned " & x
)
379 x
= InStr(3, "abcd", "bc")
380 Call ok(x
= 0, "InStr returned " & x
)
382 x
= InStr("abcd", "bcx")
383 Call ok(x
= 0, "InStr returned " & x
)
385 x
= InStr(5, "abcd", "bc")
386 Call ok(x
= 0, "InStr returned " & x
)
390 Call ok(x
= 2, "InStr returned " & x
)
392 x
= InStr("abcd", null
)
393 Call ok(isNull(x
), "InStr returned " & x
)
394 x
= InStr(null
, "abcd")
395 Call ok(isNull(x
), "InStr returned " & x
)
396 x
= InStr(2, null
, "abcd")
397 Call ok(isNull(x
), "InStr returned " & x
)
399 x
= InStr(1.3, "abcd", "bc")
400 Call ok(x
= 2, "InStr returned " & x
)
402 x
= InStr(2.3, "abcd", "bc")
403 Call ok(x
= 2, "InStr returned " & x
)
405 x
= InStr(2.6, "abcd", "bc")
406 Call ok(x
= 0, "InStr returned " & x
)
408 x
= InStr(3, "abcdefgh", "fg", 0)
409 Call ok(x
= 6, "InStr returned " & x
)
411 x
= InStr(3, "abcdefgh", "FG", 0)
412 Call ok(x
= 0, "InStr returned " & x
)
414 x
= InStr(3, "abcdefgh", "FG", 1)
415 Call ok(x
= 6, "InStr returned " & x
)
417 x
= InStr(3, "abcdefgh", "FG", 1.4)
418 Call ok(x
= 6, "InStr returned " & x
)
420 x
= InStr(3, "abcdefgh", "FG", -0.3)
421 Call ok(x
= 0, "InStr returned " & x
)
423 x
= InStr(1, "abcABC", "aB", 0)
424 Call ok(x
= 0, "InStr returned " & x
)
426 x
= InStr(1, "abcABC", "aB", 1)
427 Call ok(x
= 1, "InStr returned " & x
)
429 x
= InStr(2, "abcABC", "aB", 1)
430 Call ok(x
= 4, "InStr returned " & x
)
432 x
= InStr(5, "abcABC", "aB", 1)
433 Call ok(x
= 0, "InStr returned " & x
)
435 x
= InStr(2, "abcABC", "ab", 1)
436 Call ok(x
= 4, "InStr returned " & x
)
438 x
= InStr(6, "abcABC", "c", 1)
439 Call ok(x
= 6, "InStr returned " & x
)
441 x
= InStr(2, "abc" & Chr(0) & "A" & Chr(0) & "BC", "C", 0)
442 Call ok(x
= 8, "InStr returned " & x
)
444 x
= InStr(1, "abc" & Chr(0) & "ABC", Chr(0) & "a", 1)
445 Call ok(x
= 4, "InStr returned " & x
)
447 x
= InStr(1, 23456, 45, 0)
448 Call ok(x
= 3, "InStr returned " & x
)
450 x
= InStr(1, "23456", 34, 1)
451 Call ok(x
= 2, "InStr returned " & x
)
453 x
= InStr(2, "", "abcd", 0)
454 Call ok(x
= 0, "InStr returned " & x
)
456 x
= InStr(4, "abcdef", "", 0)
457 Call ok(x
= 4, "InStr returned " & x
)
459 x
= InStr(20, "abcdef", "", 0)
460 Call ok(x
= 0, "InStr returned " & x
)
462 x
= InStr(4, "", "", 0)
463 Call ok(x
= 0, "InStr returned " & x
)
465 Sub testInStrError(arg1
, arg2
, arg3
, arg4
, error_num
)
470 x
= InStr(arg1
, arg2
, arg3
, arg4
)
471 Call ok(Err
.number
= error_num
, "Err.number = " & Err
.number
)
474 call testInStrError(2, "abcd", null
, 0, 0)
475 call testInStrError(2, Null
, "abcd", 0, 0)
476 call testInStrError(Null
, "abcd", "abcd", 0, 94)
477 call testInStrError(2, "abcd", "abcd", null
, 94)
478 call testInStrError(-20, "abcd", "abcd", 1, 5)
479 Call testInStrError(2, "abcd", "abcd", 10, 5)
482 x
= InStrRev("bcabcd", "bc")
483 Call ok(x
= 4, "InStrRev returned " & x
)
484 Call ok(getVT(x
) = "VT_I4*", "getVT(InStrRev) returned " & getVT(x
))
486 x
= InStrRev("bcabcd", "bc", 6)
487 Call ok(x
= 4, "InStrRev returned " & x
)
489 x
= InStrRev("abcd", "bcx")
490 Call ok(x
= 0, "InStrRev returned " & x
)
492 x
= InStrRev("abcd", "bc", 3)
493 Call ok(x
= 2, "InStrRev returned " & x
)
495 x
= InStrRev("abcd", "bc", 2)
496 Call ok(x
= 0, "InStrRev returned " & x
)
498 x
= InStrRev("abcd", "b", 2)
499 Call ok(x
= 2, "InStrRev returned " & x
)
501 x
= InStrRev("abcd", "bc", 5)
502 Call ok(x
= 0, "InStrRev returned " & x
)
504 x
= InStrRev("abcd", "bc", 15)
505 Call ok(x
= 0, "InStrRev returned " & x
)
508 x
= InStrRev(x
, "bc")
509 Call ok(x
= 2, "InStrRev returned " & x
)
511 x
= InStrRev("abcd", "bc", 1.3)
512 Call ok(x
= 0, "InStrRev returned " & x
)
514 x
= InStrRev("abcd", "bc", 2.3)
515 Call ok(x
= 0, "InStrRev returned " & x
)
517 x
= InStrRev("abcd", "bc", 2.6)
518 Call ok(x
= 2, "InStrRev returned " & x
)
520 x
= InStrRev("1234", 34)
521 Call ok(x
= 3, "InStrRev returned " & x
)
523 x
= InStrRev(1234, 34)
524 Call ok(x
= 3, "InStrRev returned " & x
)
526 x
= InStrRev("abcd", "A", 1, 0)
527 Call ok(x
= 0, "InStrRev returned " & x
)
529 x
= InStrRev("abcd", "A", 1, 1)
530 Call ok(x
= 1, "InStrRev returned " & x
)
532 x
= InStrRev("abcd", "Ab", 1, 1)
533 Call ok(x
= 0, "InStrRev returned " & x
)
535 x
= InStrRev("abcd", "Ab", -1, 1)
536 Call ok(x
= 1, "InStrRev returned " & x
)
538 x
= InStrRev("abcd", "cd", 3, 1)
539 Call ok(x
= 0, "InStrRev returned " & x
)
541 x
= InStrRev("abcd", "cd", 4, 1)
542 Call ok(x
= 3, "InStrRev returned " & x
)
544 x
= InStrRev("abcd", "cd", 5, 1)
545 Call ok(x
= 0, "InStrRev returned " & x
)
547 x
= InStrRev("abc" & Chr(0) & "A" & Chr(0) & "BC", "c", 8, 0)
548 Call ok(x
= 3, "InStrRev returned " & x
)
550 x
= InStrRev("abc" & Chr(0) & "ABC", Chr(0) & "a", 6, 1)
551 Call ok(x
= 4, "InStrRev returned " & x
)
553 x
= InStrRev("", "hi", 1, 0)
554 Call ok(x
= 0, "InStrRev returned " & x
)
556 x
= InStrRev("abcd", "", 3, 1)
557 Call ok(x
= 3, "InStrRev returned " & x
)
559 x
= InStrRev("", "", 3, 0)
560 Call ok(x
= 0, "InStrRev returned " & x
)
562 Sub testInStrRevError(arg1
, arg2
, arg3
, arg4
, error_num
)
567 x
= InStrRev(arg1
, arg2
, arg3
, arg4
)
568 Call ok(Err
.number
= error_num
, "Err.number = " & Err
.number
)
571 call testInStrRevError("abcd", null
, 2, 0, 94)
572 call testInStrRevError(null
, "abcd", 2, 0, 94)
573 call testInStrRevError("abcd", "abcd", null
, 0, 94)
574 call testInStrRevError("abcd", "abcd", 2, null
, 94)
575 call testInStrRevError("abcd", "abcd", -20, 1, 5)
576 Call testInStrRevError("abcd", "abcd", 2, 10, 5)
578 Sub TestMid(str
, start
, len
, ex
)
579 x
= Mid(str
, start
, len
)
580 Call ok(x
= ex
, "Mid(" & str
& ", " & start
& ", " & len
& ") = " & x
& " expected " & ex
)
583 Sub TestMid2(str
, start
, ex
)
585 Call ok(x
= ex
, "Mid(" & str
& ", " & start
& ") = " & x
& " expected " & ex
)
588 TestMid
"test", 2, 2, "es"
589 TestMid
"test", 2, 4, "est"
590 TestMid
"test", 1, 2, "te"
591 TestMid
"test", 1, 0, ""
592 TestMid
"test", 1, 0, ""
593 TestMid
"test", 5, 2, ""
594 TestMid2
"test", 1, "test"
595 TestMid2
"test", 2, "est"
596 TestMid2
"test", 4, "t"
597 TestMid2
"test", 5, ""
599 Sub TestUCase(str
, ex
)
601 Call ok(x
= ex
, "UCase(" & str
& ") = " & x
& " expected " & ex
)
604 TestUCase
"test", "TEST"
605 TestUCase
"123aBC?", "123ABC?"
608 if isEnglishLang
then TestUCase
true, "TRUE"
609 TestUCase
0.123, doubleAsString(0.123)
611 Call ok(getVT(UCase(Null
)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null
)))
613 Sub TestLCase(str
, ex
)
615 Call ok(x
= ex
, "LCase(" & str
& ") = " & x
& " expected " & ex
)
618 TestLCase
"test", "test"
619 TestLCase
"123aBC?", "123abc?"
622 if isEnglishLang
then TestLCase
true, "true"
623 TestLCase
0.123, doubleAsString(0.123)
625 Call ok(getVT(LCase(Null
)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null
)))
628 Call ok(x(0) = "abc", "Split(""abc"")(0)=" & x(0))
630 Call ok(x(0) = "abc", "Split(""abc def"")(0)=" & x(0))
631 Call ok(x(1) = "def", "Split(""abc def"")(1)=" & x(1))
632 x
= Split("abc def ghi")
633 Call ok(x(0) = "abc", "Split(""abc def ghi"")(0)=" & x(0))
634 Call ok(x(1) = "def", "Split(""abc def ghi"")(1)=" & x(1))
635 Call ok(x(2) = "ghi", "Split(""abc def ghi"")(2)=" & x(2))
636 x
= Split("abc def","")
637 Call ok(x(0) = "abc def", "Split(""abc def"","""")(0)=" & x(0))
638 x
= Split("abc-def","-")
639 Call ok(x(0) = "abc", "Split(""abc-def"",""-"")(0)=" & x(0))
640 Call ok(x(1) = "def", "Split(""abc-def"",""-"")(1)=" & x(1))
641 x
= Split("abc--def","-")
642 Call ok(x(0) = "abc", "Split(""abc--def"",""-"")(0)=" & x(0))
643 Call ok(x(1) = "", "Split(""abc--def"",""-"")(1)=" & x(1))
644 Call ok(x(2) = "def", "Split(""abc--def"",""-"")(2)=" & x(2))
645 x
= Split("abcdefghi","def")
646 Call ok(x(0) = "abc", "Split(""abcdefghi"",""def"")(0)=" & x(0))
647 Call ok(x(1) = "ghi", "Split(""abcdefghi"",""def"")(1)=" & x(1))
649 Call ok(x(0) = "12", "Split(""12345"",3)(0)=" & x(0))
650 Call ok(x(1) = "45", "Split(""12345"",3)(1)=" & x(1))
652 Call ok(x(0) = "1234", "Split(""12345"",5)(0)=" & x(0))
653 Call ok(x(1) = "", "Split(""12345"",5)(1)=" & x(1))
654 x
= Split("12345",12)
655 Call ok(x(0) = "", "Split(""12345"",12)(0)=" & x(0))
656 Call ok(x(1) = "345", "Split(""12345"",12)(1)=" & x(1))
657 x
= Split("abc-def-ghi","-")
658 Call ok(UBound(x
) = 2, "UBound(Split(""abc-def-ghi"",""-""))=" & UBound(x
))
659 x
= Split("a b c d e f g h i j k l m n o p q")
660 Call ok(UBound(x
) = 16, "UBound(Split(""a b c d e f g h i j k l m n o p q""))=" & UBound(x
))
661 x
= Split("abc-def-ghi","-",2)
662 Call ok(UBound(x
) = 1, "UBound(Split(""abc-def-ghi"",""-"",2))=" & UBound(x
))
663 x
= Split("abc-def-ghi","-",4)
664 Call ok(UBound(x
) = 2, "UBound(Split(""abc-def-ghi"",""-"",4))=" & UBound(x
))
665 x
= Split("abc-def-ghi","-",-1)
666 Call ok(UBound(x
) = 2, "UBound(Split(""abc-def-ghi"",""-"",-1))=" & UBound(x
))
667 x
= Split("abc-def-ghi","-",-1)
668 Call ok(UBound(x
) = 2, "UBound(Split(""abc-def-ghi"",""-"",-42))=" & UBound(x
))
669 x
= Split("abcZdefZghi","Z",3,0)
670 Call ok(UBound(x
) = 2, "UBound(Split(""abcZdefZghi"",""Z"",3,0))=" & UBound(x
))
671 x
= Split("abcZdefZghi","z",3,0)
672 Call ok(UBound(x
) = 0, "UBound(Split(""abcZdefZghi"",""z"",3,0))=" & UBound(x
))
673 x
= Split("abcZdefZghi","z",3,1)
674 Call ok(UBound(x
) = 2, "UBound(Split(""abcZdefZghi"",""z"",3,1))=" & UBound(x
))
676 Sub testSplitError(arg1
, arg2
, arg3
, arg4
, error_num
)
681 x
= Split(arg1
, arg2
, arg3
, arg4
)
682 Call ok(Err
.number
= error_num
, "Err.number = " & Err
.number
)
685 call testSplitError("abc-def-ghi", "-", -1, 2, 5)
686 call testSplitError("abc-def-ghi", "-", -42, 0, 5)
687 call testSplitError(null
, "-", -1, 0, 94)
688 call testSplitError("abc-def-ghi", null
, -1, 0, 94)
689 call testSplitError("abc-def-ghi", "-", null
, 0, 94)
690 call testSplitError("abc-def-ghi", "-", -1, null
, 94)
692 Sub TestStrComp(str_left
, str_right
, mode
, ex
)
693 x
= StrComp(str_left
, str_right
, mode
)
694 Call ok(x
= ex
, "StrComp(" & str_left
& ", " & str_right
& ", " & mode
& ") = " & x
& " expected " & ex
)
697 TestStrComp
"ABC", "abc", 0, -1
698 TestStrComp
"abc", "ABC", 0, 1
699 TestStrComp
"ABC", "ABC", 0, 0
700 TestStrComp
"ABC", "abc", 0, -1
701 TestStrComp
"abc", "ABC", 0, 1
702 TestStrComp
"ABC", "ABC", 0, 0
703 TestStrComp
"ABCD", "ABC", 0, 1
704 TestStrComp
"ABC", "ABCD", 0, -1
705 TestStrComp
"ABC", "abc", 1, 0
706 TestStrComp
"ABC", "ABC", 1, 0
707 TestStrComp
"ABCD", "ABC", 1, 1
708 TestStrComp
"ABC", "ABCD", 1, -1
709 TestStrComp
"ABC", "ABCD", "0", -1
710 TestStrComp
"ABC", "ABCD", "1", -1
711 TestStrComp
1, 1, 1, 0
712 TestStrComp
"1", 1, 1, 0
713 TestStrComp
"1", 1.0, 1, 0
714 TestStrComp Empty
, Empty
, 1, 0
715 TestStrComp Empty
, "", 1, 0
716 TestStrComp Empty
, "ABC", 1, -1
717 TestStrComp
"ABC", Empty
, 1, 1
718 TestStrComp vbNull
, vbNull
, 1, 0
719 TestStrComp
"", vbNull
, 1, -1
721 sub testStrCompError()
725 call ok(Err
.number
= 450, "Err.number = " & Err
.number
)
727 call StrComp("a", "a", 0, 1)
728 call ok(Err
.number
= 450, "Err.number = " & Err
.number
)
730 call testStrCompError()
732 Call ok(Len("abc") = 3, "Len(abc) = " & Len("abc"))
733 Call ok(Len("") = 0, "Len() = " & Len(""))
734 Call ok(Len(1) = 1, "Len(1) = " & Len(1))
735 Call ok(isNull(Len(null
)), "Len(null) = " & Len(null
))
736 Call ok(Len(empty
) = 0, "Len(empty) = " & Len(empty
))
737 Call ok(getVT(Len("abc")) = "VT_I4", "getVT(Len(abc)) = " & getVT(Len("abc")))
739 Call ok(Space(1) = " ", "Space(1) = " & Space(1) & """")
740 Call ok(Space(0) = "", "Space(0) = " & Space(0) & """")
741 Call ok(Space(false) = "", "Space(false) = " & Space(false) & """")
742 Call ok(Space(5) = " ", "Space(5) = " & Space(5) & """")
743 Call ok(Space(5.2) = " ", "Space(5.2) = " & Space(5.2) & """")
744 Call ok(Space(5.8) = " ", "Space(5.8) = " & Space(5.8) & """")
745 Call ok(Space(5.5) = " ", "Space(5.5) = " & Space(5.5) & """")
746 Call ok(Space(4.5) = " ", "Space(4.5) = " & Space(4.5) & """")
747 Call ok(Space(0.5) = "", "Space(0.5) = " & Space(0.5) & """")
748 Call ok(Space(1.5) = " ", "Space(1.5) = " & Space(1.5) & """")
749 Call ok(Space("1") = " ", "Space(""1"") = " & Space("1") & """")
751 sub test_string(cnt
, char
, exp
)
752 call ok(String(cnt
, char
) = exp
, "String(" & cnt
& ", """ & char
& """ = """ & _
753 String(cnt
, char
) & """ expected """ & exp
& """")
756 test_string
3, "x", "xxx"
757 test_string
3, "xy", "xxx"
758 test_string
1, "z", "z"
759 test_string
0, "z", ""
760 test_string
"3", "xy", "xxx"
761 test_string
3, Chr(3), Chr(3)&Chr(3)&Chr(3)
763 call ok(getVT(String(0, "z")) = "VT_BSTR", "getVT(String(0,z)) = " & getVT(String(0, "z")))
765 sub test_string_error()
769 call ok(err
.number
= 5, "err.number = " & err
.number
)
772 call ok(err
.number
= 5, "err.number = " & err
.number
)
775 call ok(err
.number
= 5, "err.number = " & err
.number
)
777 call test_string_error
779 Sub TestStrReverse(str
, ex
)
780 Call ok(StrReverse(str
) = ex
, "StrReverse(" & str
& ") = " & StrReverse(str
))
783 TestStrReverse
"test", "tset"
784 TestStrReverse
"", ""
785 TestStrReverse
123, "321"
786 if isEnglishLang
then TestStrReverse
true, "eurT"
788 Sub TestLeft(str
, len
, ex
)
789 Call ok(Left(str
, len
) = ex
, "Left(" & str
& ", " & len
& ") = " & Left(str
, len
))
792 TestLeft
"test", 2, "te"
793 TestLeft
"test", 5, "test"
794 TestLeft
"test", 0, ""
795 TestLeft
123, 2, "12"
796 TestLeft
"123456", 1.5, "12"
797 TestLeft
"123456", 2.5, "12"
798 TestLeft
"test", "2", "te"
799 if isEnglishLang
then TestLeft
true, 2, "Tr"
801 Sub TestRight(str
, len
, ex
)
802 Call ok(Right(str
, len
) = ex
, "Right(" & str
& ", " & len
& ") = " & Right(str
, len
))
805 TestRight
"test", 2, "st"
806 TestRight
"test", 5, "test"
807 TestRight
"test", 0, ""
808 TestRight
123, 2, "23"
809 if isEnglishLang
then TestRight
true, 2, "ue"
811 Sub TestTrim(str
, exstr
)
812 Call ok(Trim(str
) = exstr
, "Trim(" & str
& ") = " & Trim(str
))
815 TestTrim
" test ", "test"
816 TestTrim
"test ", "test"
817 TestTrim
" test", "test"
818 TestTrim
"test", "test"
821 if isEnglishLang
then TestTrim
true, "True"
823 Sub TestLTrim(str
, exstr
)
824 Call ok(LTrim(str
) = exstr
, "LTrim(" & str
& ") = " & LTrim(str
))
827 TestLTrim
" test ", "test "
828 TestLTrim
"test ", "test "
829 TestLTrim
" test", "test"
830 TestLTrim
"test", "test"
833 if isEnglishLang
then TestLTrim
true, "True"
835 Sub TestRTrim(str
, exstr
)
836 Call ok(RTrim(str
) = exstr
, "RTrim(" & str
& ") = " & RTrim(str
))
839 TestRTrim
" test ", " test"
840 TestRTrim
"test ", "test"
841 TestRTrim
" test", " test"
842 TestRTrim
"test", "test"
845 if isEnglishLang
then TestRTrim
true, "True"
848 sub test_replace(str
, find
, rep
, exp
)
850 r
= Replace(str
, find
, rep
)
851 ok r
= exp
, "Replace(""" & str
& """, """ & find
& """, """ & rep
& """) = """ & _
852 r
& """ expected """ & exp
& """"
855 sub test_replace_from(str
, find
, rep
, from
, exp
)
857 r
= Replace(str
, find
, rep
, from
)
858 ok r
= exp
, "Replace(""" & str
& """, """ & find
& """, """ & rep
& """, " & from
& ") = """ & _
859 r
& """ expected """ & exp
& """"
862 sub test_replace_cnt(str
, find
, rep
, from
, cnt
, exp
)
864 r
= Replace(str
, find
, rep
, from
, cnt
)
865 ok r
= exp
, "Replace(""" & str
& """, """ & find
& """, """ & rep
& """, " & from
& ", " & cnt
& ") = """ & _
866 r
& """ expected """ & exp
& """"
869 sub test_replace_mode(str
, find
, rep
, from
, cnt
, mode
, exp
)
871 r
= Replace(str
, find
, rep
, from
, cnt
, mode
)
872 ok r
= exp
, "Replace(""" & str
& """, """ & find
& """, """ & rep
& """, " & from
& ", " & cnt
& ", " & mode _
873 & ") = """ & r
& """ expected """ & exp
& """"
876 test_replace
"xx testxx(xx)", "xx", "!", "! test!(!)"
877 test_replace
"", "x", "y", ""
878 test_replace
"xxx", "", "y", "xxx"
879 test_replace
"yxxy", "x", "", "yy"
880 test_replace
"xxxxx", "xx", "y", "yyx"
881 test_replace
123, 2, 6, "163"
882 test_replace
"xyz" & Chr(0) & "xyz", "y", "Y", "xYz" & Chr(0) & "xYz"
883 test_replace
"xyz" & Chr(0) & "xyz", Chr(0) & "x", "Y" & Chr(0) & Chr(0), "xyzY" & Chr(0) & Chr(0) & "yz"
885 test_replace_from
"xx testxx(xx)", "xx", "!", 1, "! test!(!)"
886 test_replace_from
"xx testxx(xx)", "xx", "!", 1, "! test!(!)"
887 test_replace_from
"xx testxx(xx)", "xx", "!", 2, "x test!(!)"
888 test_replace_from
"xx testxx(xx)", "xx", "!", 2000, ""
889 test_replace_from
"xxx", "", "y", 2, "xx"
891 test_replace_cnt
"xx testxx(xx)", "xx", "!", 1, 2, "! test!(xx)"
892 test_replace_cnt
"xx testxx(xx)", "xx", "!", 1, 1, "! testxx(xx)"
893 test_replace_cnt
"xx testxx(xx)", "xx", "!", 2, 1, "x test!(xx)"
894 test_replace_cnt
"xx testxx(xx)", "xx", "!", 1, -1, "! test!(!)"
895 test_replace_cnt
"xx testxx(xx)", "xx", "!", 1, 0, "xx testxx(xx)"
897 test_replace_mode
"Aa testAAa(aa)", "aa", "!", 1, 2, 1, "! test!a(aa)"
898 test_replace_mode
"aA testaa(aa)", "AA", "!", 1, 1, 1, "! testaa(aa)"
899 test_replace_mode
"aa testAa(aa)", "aa", "!", 2, 2, 0, "a testAa(!)"
900 test_replace_mode
"aa testAA(aA)", "Aa", "!", 1, -1, 1, "! test!(!)"
901 test_replace_mode
"aa testaa(aa)", "A", "!", 1, -1, 1, "!! test!!(!!)"
904 Replace
"xx", "x", "y", -1
907 ok x
= 5, "err = " & x
910 Replace
"xx", "x", "y", 0
913 ok x
= 5, "err = " & x
916 Replace
"xx", "x", "y", 1, -2
919 ok x
= 5, "err = " & x
921 Sub testReplaceError(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, error_num
)
926 x
= Replace(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
)
927 Call ok(Err
.number
= error_num
, "Err.number = " & Err
.number
)
930 Call testReplaceError(Null
, "x", "y", 1, 1, 0, 94)
931 Call testReplaceError("xx", null
, "y", 1, 1, 0, 94)
932 Call testReplaceError("xx", "x", null
, 1, 1, 0, 94)
933 Call testReplaceError("xx", "x", "y", null
, 1, 0, 94)
934 Call testReplaceError("xx", "x", "y", 1, null
, 0, 94)
935 Call testReplaceError("xx", "x", "y", 1, 1, null
, 94)
936 Call testReplaceError("xx", "x", "y", 1, 1, 8, 5)
939 Sub TestRound(val
, exval
, vt
)
940 Call ok(Round(val
) = exval
, "Round(" & val
& ") = " & Round(val
))
941 Call ok(getVT(Round(val
)) = vt
, "getVT(Round(" & val
& ")) = " & getVT(Round(val
)))
944 TestRound
3, 3, "VT_I2"
945 TestRound
3.3, 3, "VT_R8"
946 TestRound
3.8, 4, "VT_R8"
947 TestRound
3.5, 4, "VT_R8"
948 TestRound
-3.3, -3, "VT_R8"
949 TestRound
-3.5, -4, "VT_R8"
950 TestRound
"2", 2, "VT_R8"
951 TestRound
true, true, "VT_BOOL"
952 TestRound
false, false, "VT_BOOL"
954 if isEnglishLang
then
955 Call ok(WeekDayName(1) = "Sunday", "WeekDayName(1) = " & WeekDayName(1))
956 Call ok(WeekDayName(3) = "Tuesday", "WeekDayName(3) = " & WeekDayName(3))
957 Call ok(WeekDayName(7) = "Saturday", "WeekDayName(7) = " & WeekDayName(7))
958 Call ok(WeekDayName(1.1) = "Sunday", "WeekDayName(1.1) = " & WeekDayName(1.1))
959 Call ok(WeekDayName(1, false) = "Sunday", "WeekDayName(1, false) = " & WeekDayName(1, false))
960 Call ok(WeekDayName(1, true) = "Sun", "WeekDayName(1, true) = " & WeekDayName(1, true))
961 Call ok(WeekDayName(1, 10) = "Sun", "WeekDayName(1, 10) = " & WeekDayName(1, 10))
962 Call ok(WeekDayName(1, true, 2) = "Mon", "WeekDayName(1, true, 2) = " & WeekDayName(1, true, 2))
963 Call ok(WeekDayName(1, true, 2.5) = "Mon", "WeekDayName(1, true, 2.5) = " & WeekDayName(1, true, 2.5))
964 Call ok(WeekDayName(1, true, 1.5) = "Mon", "WeekDayName(1, true, 1.5) = " & WeekDayName(1, true, 1.5))
965 Call ok(WeekDayName(1, true, 7) = "Sat", "WeekDayName(1, true, 7) = " & WeekDayName(1, true, 7))
966 Call ok(WeekDayName(1, true, 7.1) = "Sat", "WeekDayName(1, true, 7.1) = " & WeekDayName(1, true, 7.1))
968 Call ok(MonthName(1) = "January", "MonthName(1) = " & MonthName(1))
969 Call ok(MonthName(12) = "December", "MonthName(12) = " & MonthName(12))
970 Call ok(MonthName(1, 0) = "January", "MonthName(1, 0) = " & MonthName(1, 0))
971 Call ok(MonthName(12, false) = "December", "MonthName(12, false) = " & MonthName(12, false))
972 Call ok(MonthName(1, 10) = "Jan", "MonthName(1, 10) = " & MonthName(1, 10))
973 Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true))
976 Call ok(WeekDayName(1, true, 0) = WeekDayName(1, true, firstDayOfWeek
), _
977 "WeekDayName(1, true, 0) = " & WeekDayName(1, true, 0))
979 Call ok(getVT(Now()) = "VT_DATE", "getVT(Now()) = " & getVT(Now()))
981 Call ok(vbOKOnly
= 0, "vbOKOnly = " & vbOKOnly
)
982 Call ok(getVT(vbOKOnly
) = "VT_I2", "getVT(vbOKOnly) = " & getVT(vbOKOnly
))
983 Call ok(vbOKCancel
= 1, "vbOKCancel = " & vbOKCancel
)
984 Call ok(getVT(vbOKCancel
) = "VT_I2", "getVT(vbOKCancel) = " & getVT(vbOKCancel
))
985 Call ok(vbAbortRetryIgnore
= 2, "vbAbortRetryIgnore = " & vbAbortRetryIgnore
)
986 Call ok(getVT(vbAbortRetryIgnore
) = "VT_I2", "getVT(vbAbortRetryIgnore) = " & getVT(vbAbortRetryIgnore
))
987 Call ok(vbYesNoCancel
= 3, "vbYesNoCancel = " & vbYesNoCancel
)
988 Call ok(getVT(vbYesNoCancel
) = "VT_I2", "getVT(vbYesNoCancel) = " & getVT(vbYesNoCancel
))
989 Call ok(vbYesNo
= 4, "vbYesNo = " & vbYesNo
)
990 Call ok(getVT(vbYesNo
) = "VT_I2", "getVT(vbYesNo) = " & getVT(vbYesNo
))
991 Call ok(vbRetryCancel
= 5, "vbRetryCancel = " & vbRetryCancel
)
992 Call ok(getVT(vbRetryCancel
) = "VT_I2", "getVT(vbRetryCancel) = " & getVT(vbRetryCancel
))
994 Call ok(vbOK
= 1, "vbOK = " & vbOK
)
995 Call ok(getVT(vbOK
) = "VT_I2", "getVT(vbOK) = " & getVT(vbOK
))
996 Call ok(vbCancel
= 2, "vbCancel = " & vbCancel
)
997 Call ok(getVT(vbCancel
) = "VT_I2", "getVT(vbCancel) = " & getVT(vbCancel
))
998 Call ok(vbAbort
= 3, "vbAbort = " & vbAbort
)
999 Call ok(getVT(vbAbort
) = "VT_I2", "getVT(vbAbort) = " & getVT(vbAbort
))
1000 Call ok(vbRetry
= 4, "vbRetry = " & vbRetry
)
1001 Call ok(getVT(vbRetry
) = "VT_I2", "getVT(vbRetry) = " & getVT(vbRetry
))
1002 Call ok(vbIgnore
= 5, "vbIgnore = " & vbIgnore
)
1003 Call ok(getVT(vbIgnore
) = "VT_I2", "getVT(vbIgnore) = " & getVT(vbIgnore
))
1004 Call ok(vbYes
= 6, "vbYes = " & vbYes
)
1005 Call ok(getVT(vbYes
) = "VT_I2", "getVT(vbYes) = " & getVT(vbYes
))
1006 Call ok(vbNo
= 7, "vbNo = " & vbNo
)
1007 Call ok(getVT(vbNo
) = "VT_I2", "getVT(vbNo) = " & getVT(vbNo
))
1009 Call ok(CInt(-36.75) = -37, "CInt(-36.75) = " & CInt(-36.75))
1010 Call ok(getVT(CInt(-36.75)) = "VT_I2", "getVT(CInt(-36.75)) = " & getVT(CInt(-36.75)))
1011 Call ok(CInt(-36.50) = -36, "CInt(-36.50) = " & CInt(-36.50))
1012 Call ok(getVT(CInt(-36.50)) = "VT_I2", "getVT(CInt(-36.50)) = " & getVT(CInt(-36.50)))
1013 Call ok(CInt(-36.25) = -36, "CInt(-36.25) = " & CInt(-36.25))
1014 Call ok(getVT(CInt(-36.25)) = "VT_I2", "getVT(CInt(-36.25)) = " & getVT(CInt(-36.25)))
1015 Call ok(CInt(-36) = -36, "CInt(-36) = " & CInt(-36))
1016 Call ok(getVT(CInt(-36)) = "VT_I2", "getVT(CInt(-36)) = " & getVT(CInt(-36)))
1017 Call ok(CInt(0) = 0, "CInt(0) = " & CInt(0))
1018 Call ok(getVT(CInt(0)) = "VT_I2", "getVT(CInt(0)) = " & getVT(CInt(0)))
1019 Call ok(CInt(0.0) = 0, "CInt(0.0) = " & CInt(0))
1020 Call ok(getVT(CInt(0.0)) = "VT_I2", "getVT(CInt(0.0)) = " & getVT(CInt(0.0)))
1021 Call ok(CInt(0.5) = 0, "CInt(0.5) = " & CInt(0))
1022 Call ok(getVT(CInt(0.5)) = "VT_I2", "getVT(CInt(0.5)) = " & getVT(CInt(0.5)))
1023 Call ok(CInt(36) = 36, "CInt(36) = " & CInt(36))
1024 Call ok(getVT(CInt(36)) = "VT_I2", "getVT(CInt(36)) = " & getVT(CInt(36)))
1025 Call ok(CInt(36.25) = 36, "CInt(36.25) = " & CInt(36.25))
1026 Call ok(getVT(CInt(36.25)) = "VT_I2", "getVT(CInt(36.25)) = " & getVT(CInt(36.25)))
1027 Call ok(CInt(36.50) = 36, "CInt(36.50) = " & CInt(36.50))
1028 Call ok(getVT(CInt(36.50)) = "VT_I2", "getVT(CInt(36.50)) = " & getVT(CInt(36.50)))
1029 Call ok(CInt(36.75) = 37, "CInt(36.75) = " & CInt(36.75))
1030 Call ok(getVT(CInt(36.75)) = "VT_I2", "getVT(CInt(36.75)) = " & getVT(CInt(36.75)))
1033 Call ok(CBool(5) = true, "CBool(5) = " & CBool(5))
1034 Call ok(getVT(CBool(5)) = "VT_BOOL", "getVT(CBool(5)) = " & getVT(CBool(5)))
1035 Call ok(CBool(0) = false, "CBool(0) = " & CBool(0))
1036 Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))
1037 Call ok(CBool(-5) = true, "CBool(-5) = " & CBool(-5))
1038 Call ok(getVT(CBool(-5)) = "VT_BOOL", "getVT(CBool(-5)) = " & getVT(CBool(-5)))
1040 Sub testCBoolError(strings
, error_num
)
1041 on error resume next
1045 Call ok(Err
.number
= error_num
, "Err.number = " & Err
.number
)
1051 Public default
Property Get defprop
1057 Set MyObject
= New ValClass
1059 Call ok(CBool(Empty
) = False, "CBool(Empty) = " & CBool(Empty
))
1060 Call ok(getVT(CBool(Empty
)) = "VT_BOOL", "getVT(CBool(Empty)) = " & getVT(CBool(Empty
)))
1061 Call ok(CBool(1) = True, "CBool(1) = " & CBool(1))
1062 Call ok(getVT(CBool(1)) = "VT_BOOL", "getVT(CBool(1)) = " & getVT(CBool(1)))
1063 Call ok(CBool(0) = False, "CBool(0) = " & CBool(0))
1064 Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))
1065 Call ok(CBool(-0.56) = True, "CBool(-0.56) = " & CBool(-0.56))
1066 Call ok(getVT(CBool(-0.56)) = "VT_BOOL", "getVT(CBool(-0.56)) = " & getVT(CBool(-0.56)))
1067 Call testCBoolError("", 13)
1068 Call ok(CBool("0") = False, "CBool(""0"") = " & CBool("0"))
1069 Call ok(getVT(CBool("0")) = "VT_BOOL", "getVT(CBool(""0"")) = " & getVT(CBool("0")))
1070 If isEnglishLang
Then
1071 Call ok(CBool("0.1") = True, "CBool(""0.1"") = " & CBool("0.1"))
1072 Call ok(getVT(CBool("0.1")) = "VT_BOOL", "getVT(CBool(""0.1"")) = " & getVT(CBool("0.1")))
1074 Call ok(CBool("true") = True, "CBool(""true"") = " & CBool("true"))
1075 Call ok(getVT(CBool("true")) = "VT_BOOL", "getVT(CBool(""true"")) = " & getVT(CBool("true")))
1076 Call ok(CBool("false") = False, "CBool(""false"") = " & CBool("false"))
1077 Call ok(getVT(CBool("false")) = "VT_BOOL", "getVT(CBool(""false"")) = " & getVT(CBool("false")))
1078 Call ok(CBool("TRUE") = True, "CBool(""TRUE"") = " & CBool("TRUE"))
1079 Call ok(getVT(CBool("TRUE")) = "VT_BOOL", "getVT(CBool(""TRUE"")) = " & getVT(CBool("TRUE")))
1080 Call ok(CBool("FALSE") = False, "CBool(""FALSE"") = " & CBool("FALSE"))
1081 Call ok(getVT(CBool("FALSE")) = "VT_BOOL", "getVT(CBool(""FALSE"")) = " & getVT(CBool("FALSE")))
1082 Call ok(CBool("#TRUE#") = True, "CBool(""#TRUE#"") = " & CBool("#TRUE#"))
1083 Call ok(getVT(CBool("#TRUE#")) = "VT_BOOL", "getVT(CBool(""#TRUE#"")) = " & getVT(CBool("#TRUE#")))
1084 Call ok(CBool("#FALSE#") = False, "CBool(""#FALSE#"") = " & CBool("#FALSE#"))
1085 Call ok(getVT(CBool("#FALSE#")) = "VT_BOOL", "getVT(CBool(""#FALSE#"")) = " & getVT(CBool("#FALSE#")))
1086 Call ok(CBool(MyObject
) = False, "CBool(MyObject) = " & CBool(MyObject
))
1087 Call ok(getVT(CBool(MyObject
)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject
)))
1089 Call ok(CBool(MyObject
) = True, "CBool(MyObject) = " & CBool(MyObject
))
1090 Call ok(getVT(CBool(MyObject
)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject
)))
1092 Call ok(CBool(MyObject
) = False, "CBool(MyObject) = " & CBool(MyObject
))
1093 Call ok(getVT(CBool(MyObject
)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject
)))
1095 Sub testCByteError(strings
, error_num1
,error_num2
)
1096 on error resume next
1101 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
1105 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
1108 Call ok(CByte(Empty
) = 0, "CByte(Empty) = " & CByte(Empty
))
1109 Call ok(getVT(CByte(Empty
)) = "VT_UI1", "getVT(CByte(Empty)) = " & getVT(CByte(Empty
)))
1110 Call ok(CByte(255) = 255, "CByte(255) = " & CByte(255))
1111 Call ok(getVT(CByte(255)) = "VT_UI1", "getVT(CByte(255)) = " & getVT(CByte(255)))
1112 Call ok(CByte(255.49) = 255, "CByte(255.49) = " & CByte(255.49))
1113 Call ok(getVT(CByte(255.49)) = "VT_UI1", "getVT(CByte(255.49)) = " & getVT(CByte(255.49)))
1114 Call testCByteError(1, 0, 458)
1115 Call testCByteError("", 13, 13)
1116 Call testCByteError("-1", 6, 6)
1117 Call testCByteError("258", 6, 6)
1118 Call testCByteError("TRUE", 13, 13)
1119 Call testCByteError("FALSE", 13, 13)
1120 Call testCByteError("#TRue#", 13, 13)
1121 Call testCByteError("#fAlSE#", 13, 13)
1122 If isEnglishLang
Then
1123 Call ok(CByte("-0.5") = 0, "CByte(""-0.5"") = " & CByte("-0.5"))
1124 Call ok(getVT(CByte("-0.5")) = "VT_UI1", "getVT(CByte(""-0.5"")) = " & getVT(CByte("-0.5")))
1126 Call ok(CByte(True) = 255, "CByte(True) = " & CByte(True))
1127 Call ok(getVT(CByte(True)) = "VT_UI1", "getVT(CByte(True)) = " & getVT(CByte(True)))
1128 Call ok(CByte(False) = 0, "CByte(False) = " & CByte(False))
1129 Call ok(getVT(CByte(False)) = "VT_UI1", "getVT(CByte(False)) = " & getVT(CByte(False)))
1130 Call ok(CByte(MyObject
) = 0, "CByte(MyObject) = " & CByte(MyObject
))
1131 Call ok(getVT(CByte(MyObject
)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject
)))
1133 Call ok(CByte(MyObject
) = 1, "CByte(MyObject) = " & CByte(MyObject
))
1134 Call ok(getVT(CByte(MyObject
)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject
)))
1136 Call ok(CByte(MyObject
) = 0, "CByte(MyObject) = " & CByte(MyObject
))
1137 Call ok(getVT(CByte(MyObject
)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject
)))
1139 Sub testCCurError(strings
, error_num1
, error_num2
)
1140 on error resume next
1145 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
1149 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
1152 Call ok(CCur(Empty
) = 0, "CCur(Empty) = " & CCur(Empty
))
1153 Call ok(getVT(CCur(Empty
)) = "VT_CY", "getVT(CCur(Empty)) = " & getVT(CCur(Empty
)))
1154 Call ok(CCur(-32768) = -32768, "CCur(-32768) = " & CCur(-32768))
1155 Call ok(getVT(CCur(-32768)) = "VT_CY", "getVT(CCur(-32768)) = " & getVT(CCur(-32768)))
1156 Call ok(CCur(32768) = 32768, "CCur(32768) = " & CCur(32768))
1157 Call ok(getVT(CCur(32768)) = "VT_CY", "getVT(CCur(32768)) = " & getVT(CCur(32768)))
1158 Call ok(CCur(0.000149) = 0.0001, "CCur(0.000149) = " & CCur(0.000149))
1159 Call ok(getVT(CCur(0.000149)) = "VT_CY", "getVT(CCur(0.000149)) = " & getVT(CCur(0.000149)))
1160 Call ok(CCur(2147483647.99) = 2147483647.99, "CCur(2147483647.99) = " & CCur(2147483647.99))
1161 Call ok(getVT(CCur(2147483647.99)) = "VT_CY", "getVT(CCur(2147483647.99)) = " & getVT(CCur(2147483647.99)))
1162 Call ok(CCur("-1") = -1, "CCur(""-1"") = " & CCur("-1"))
1163 Call ok(getVT(CCur("-1")) = "VT_CY", "getVT(CCur(""-1"")) = " & getVT(CCur("-1")))
1164 If isEnglishLang
Then
1165 Call ok(CCur("-0.5") = -0.5, "CCur(""-0.5"") = " & CCur("-0.5"))
1166 Call ok(getVT(CCur("-0.5")) = "VT_CY", "getVT(CCur(""-0.5"")) = " & getVT(CCur("-0.5")))
1168 Call testCCurError("", 13, 13)
1169 Call testCCurError("-1", 0, 458)
1170 Call testCCurError("TRUE", 13, 13)
1171 Call testCCurError("FALSE", 13, 13)
1172 Call testCCurError("#TRue#", 13, 13)
1173 Call testCCurError("#fAlSE#", 13, 13)
1174 Call testCCurError(1, 0, 458)
1175 Call ok(CCur(True) = -1, "CCur(True) = " & CCur(True))
1176 Call ok(getVT(CCur(True)) = "VT_CY", "getVT(CCur(True)) = " & getVT(CCur(True)))
1177 Call ok(CCur(False) = 0, "CCur(False) = " & CCur(False))
1178 Call ok(getVT(CCur(False)) = "VT_CY", "getVT(CCur(False)) = " & getVT(CCur(False)))
1179 MyObject
.myval
= 0.1
1180 Call ok(CCur(MyObject
) = 0.1, "CCur(MyObject) = " & CCur(MyObject
))
1181 Call ok(getVT(CCur(MyObject
)) = "VT_CY", "getVT(CCur(MyObject)) = " & getVT(CCur(MyObject
)))
1183 Call ok(CCur(MyObject
) = 0, "CCur(MyObject) = " & CCur(MyObject
))
1184 Call ok(getVT(CCur(MyObject
)) = "VT_CY", "getVT(CCur(MyObject)) = " & getVT(CCur(MyObject
)))
1186 Sub testCDblError(strings
, error_num1
, error_num2
)
1187 on error resume next
1192 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
1196 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
1199 Call ok(CDbl(Empty
) = 0, "CDbl(Empty) = " & CDbl(Empty
))
1200 Call ok(getVT(CDbl(Empty
)) = "VT_R8", "getVT(CDbl(Empty)) = " & getVT(CDbl(Empty
)))
1201 Call ok(CDbl(CByte(0)) = 0, "CDbl(CByte(0)) = " & CDbl(CByte(0)))
1202 Call ok(getVT(CDbl(CCur(0))) = "VT_R8", "getVT(CDbl(CCur(0))) = " & getVT(CDbl(CCur(0))))
1203 Call ok(CDbl(CCur(0)) = 0, "CDbl(CCur(0)) = " & CDbl(CCur(0)))
1204 Call ok(getVT(CDbl(CCur(0))) = "VT_R8", "getVT(CDbl(CCur(0))) = " & getVT(CDbl(CCur(0))))
1205 Call ok(CDbl(0) = 0, "CDbl(0) = " & CDbl(0))
1206 Call ok(getVT(CDbl(0)) = "VT_R8", "getVT(CDbl(0)) = " & getVT(CDbl(0)))
1207 Call ok(CDbl(32768) = 32768, "CDbl(32768) = " & CDbl(32768))
1208 Call ok(getVT(CDbl(32768)) = "VT_R8", "getVT(CDbl(32768)) = " & getVT(CDbl(32768)))
1209 Call ok(CDbl(0.001 * 0.001) = 0.000001, "CDbl(0.001 * 0.001) = " & CDbl(0.001 * 0.001))
1210 Call ok(getVT(CDbl(0.001 * 0.001)) = "VT_R8", "getVT(CDbl(0.001 * 0.001)) = " & getVT(CDbl(0.001 * 0.001)))
1211 Call ok(CDbl("-1") = -1, "CDbl(""-1"") = " & CDbl("-1"))
1212 Call ok(getVT(CDbl("-1")) = "VT_R8", "getVT(CDbl(""-1"")) = " & getVT(CDbl("-1")))
1213 If isEnglishLang
Then
1214 Call ok(CDbl("-0.5") = -0.5, "CDbl(""-0.5"") = " & CDbl("-0.5"))
1215 Call ok(getVT(CDbl("-0.5")) = "VT_R8", "getVT(CDbl(""-0.5"")) = " & getVT(CDbl("-0.5")))
1217 Call testCDblError("", 13, 13)
1218 Call testCDblError("TRUE", 13, 13)
1219 Call testCDblError("FALSE", 13, 13)
1220 Call testCDblError("#TRue#", 13, 13)
1221 Call testCDblError("#fAlSE#", 13, 13)
1222 Call testCDblError(1, 0, 458)
1223 Call ok(CDbl(True) = -1, "CDbl(True) = " & CDbl(True))
1224 Call ok(getVT(CDbl(True)) = "VT_R8", "getVT(CDbl(True)) = " & getVT(CDbl(True)))
1225 Call ok(CDbl(False) = 0, "CDbl(False) = " & CDbl(False))
1226 Call ok(getVT(CDbl(False)) = "VT_R8", "getVT(CDbl(False)) = " & getVT(CDbl(False)))
1227 MyObject
.myval
= 0.1
1228 Call ok(CDbl(MyObject
) = 0.1, "CDbl(MyObject) = " & CDbl(MyObject
))
1229 Call ok(getVT(CDbl(MyObject
)) = "VT_R8", "getVT(CDbl(MyObject)) = " & getVT(CDbl(MyObject
)))
1231 Call ok(CDbl(MyObject
) = 0, "CDbl(MyObject) = " & CDbl(MyObject
))
1232 Call ok(getVT(CDbl(MyObject
)) = "VT_R8", "getVT(CDbl(MyObject)) = " & getVT(CDbl(MyObject
)))
1234 Sub testCLngError(strings
, error_num1
, error_num2
)
1235 on error resume next
1240 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
1244 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
1247 Call ok(CLng(Empty
) = 0, "CLng(Empty) = " & CLng(Empty
))
1248 Call ok(getVT(CLng(Empty
)) = "VT_I4", "getVT(CLng(Empty)) = " & getVT(CLng(Empty
)))
1249 Call ok(CLng(CByte(0)) = 0, "CLng(CByte(0)) = " & CLng(CByte(0)))
1250 Call ok(getVT(CLng(CCur(0))) = "VT_I4", "getVT(CLng(CCur(0))) = " & getVT(CLng(CCur(0))))
1251 Call ok(CLng(CCur(0)) = 0, "CLng(CCur(0)) = " & CLng(CCur(0)))
1252 Call ok(getVT(CLng(CCur(0))) = "VT_I4", "getVT(CLng(CCur(0))) = " & getVT(CLng(CCur(0))))
1253 Call ok(CLng(0) = 0, "CLng(0) = " & CLng(0))
1254 Call ok(getVT(CLng(0)) = "VT_I4", "getVT(CLng(0)) = " & getVT(CLng(0)))
1255 Call ok(CLng(0.49) = 0, "CLng(0.49) = " & CLng(0.49))
1256 Call ok(getVT(CLng(0.49)) = "VT_I4", "getVT(CLng(0.49)) = " & getVT(CLng(0.49)))
1257 Call ok(CLng(0.5) = 0, "CLng(0.5) = " & CLng(0.5))
1258 Call ok(getVT(CLng(0.5)) = "VT_I4", "getVT(CLng(0.5)) = " & getVT(CLng(0.5)))
1259 Call ok(CLng(0.51) = 1, "CLng(0.51) = " & CLng(0.51))
1260 Call ok(getVT(CLng(0.51)) = "VT_I4", "getVT(CLng(0.51)) = " & getVT(CLng(0.51)))
1261 Call ok(CLng(1.49) = 1, "CLng(1.49) = " & CLng(1.49))
1262 Call ok(getVT(CLng(1.49)) = "VT_I4", "getVT(CLng(1.49)) = " & getVT(CLng(1.49)))
1263 Call ok(CLng(1.5) = 2, "CLng(1.5) = " & CLng(1.5))
1264 Call ok(getVT(CLng(1.5)) = "VT_I4", "getVT(CLng(1.5)) = " & getVT(CLng(1.5)))
1265 Call ok(CLng(1.51) = 2, "CLng(1.51) = " & CLng(1.51))
1266 Call ok(getVT(CLng(1.51)) = "VT_I4", "getVT(CLng(1.51)) = " & getVT(CLng(1.51)))
1267 Call ok(CLng("-1") = -1, "CLng(""-1"") = " & CLng("-1"))
1268 Call ok(getVT(CLng("-1")) = "VT_I4", "getVT(CLng(""-1"")) = " & getVT(CLng("-1")))
1269 If isEnglishLang
Then
1270 Call ok(CLng("-0.5") = 0, "CLng(""-0.5"") = " & CLng("-0.5"))
1271 Call ok(getVT(CLng("-0.5")) = "VT_I4", "getVT(CLng(""-0.5"")) = " & getVT(CLng("-0.5")))
1273 Call testCLngError("", 13, 13)
1274 Call testCLngError("TRUE", 13, 13)
1275 Call testCLngError("FALSE", 13, 13)
1276 Call testCLngError("#TRue#", 13, 13)
1277 Call testCLngError("#fAlSE#", 13, 13)
1278 Call testCLngError(1, 0, 458)
1279 Call ok(CLng(True) = -1, "CLng(True) = " & CLng(True))
1280 Call ok(getVT(CLng(True)) = "VT_I4", "getVT(CLng(True)) = " & getVT(CLng(True)))
1281 Call ok(CLng(False) = 0, "CLng(False) = " & CLng(False))
1282 Call ok(getVT(CLng(False)) = "VT_I4", "getVT(CLng(False)) = " & getVT(CLng(False)))
1284 Call ok(CLng(MyObject
) = 1, "CLng(MyObject) = " & CLng(MyObject
))
1285 Call ok(getVT(CLng(MyObject
)) = "VT_I4", "getVT(CLng(MyObject)) = " & getVT(CLng(MyObject
)))
1287 Call ok(CLng(MyObject
) = 0, "CLng(MyObject) = " & CLng(MyObject
))
1288 Call ok(getVT(CLng(MyObject
)) = "VT_I4", "getVT(CLng(MyObject)) = " & getVT(CLng(MyObject
)))
1290 Sub testCIntError(strings
, error_num1
, error_num2
)
1291 on error resume next
1296 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
1300 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
1303 Call ok(CInt(Empty
) = 0, "CInt(Empty) = " & CInt(Empty
))
1304 Call ok(getVT(CInt(Empty
)) = "VT_I2", "getVT(CInt(Empty)) = " & getVT(CInt(Empty
)))
1305 Call ok(CInt(CByte(0)) = 0, "CInt(CByte(0)) = " & CInt(CByte(0)))
1306 Call ok(getVT(CInt(CByte(0))) = "VT_I2", "getVT(CInt(CByte(0))) = " & getVT(CInt(CByte(0))))
1307 Call ok(CInt(CCur(0)) = 0, "CInt(CCur(0)) = " & CInt(CCur(0)))
1308 Call ok(getVT(CInt(CCur(0))) = "VT_I2", "getVT(CInt(CCur(0))) = " & getVT(CInt(CCur(0))))
1309 Call ok(CInt(0.49) = 0, "CInt(0.49) = " & CInt(0.49))
1310 Call ok(getVT(CInt(0.49)) = "VT_I2", "getVT(CInt(0.49)) = " & getVT(CInt(0.49)))
1311 Call ok(CInt(0.5) = 0, "CInt(0.5) = " & CInt(0.5))
1312 Call ok(getVT(CInt(0.5)) = "VT_I2", "getVT(CInt(0.5)) = " & getVT(CInt(0.5)))
1313 Call ok(CInt(0.51) = 1, "CInt(0.51) = " & CInt(0.51))
1314 Call ok(getVT(CInt(0.51)) = "VT_I2", "getVT(CInt(0.51)) = " & getVT(CInt(0.51)))
1315 Call ok(CInt(1.49) = 1, "CInt(0.49) = " & CInt(0.49))
1316 Call ok(getVT(CInt(0.49)) = "VT_I2", "getVT(CInt(0.49)) = " & getVT(CInt(0.49)))
1317 Call ok(CInt(1.5) = 2, "CInt(1.5) = " & CInt(1.5))
1318 Call ok(getVT(CInt(1.5)) = "VT_I2", "getVT(CInt(1.5)) = " & getVT(CInt(1.5)))
1319 Call ok(CInt(1.51) = 2, "CInt(1.51) = " & CInt(1.51))
1320 Call ok(getVT(CInt(1.51)) = "VT_I2", "getVT(CInt(1.51)) = " & getVT(CInt(1.51)))
1321 Call ok(CInt("-1") = -1, "CInt(""-1"") = " & CInt("-1"))
1322 Call ok(getVT(CInt("-1")) = "VT_I2", "getVT(CInt(""-1"")) = " & getVT(CInt("-1")))
1323 If isEnglishLang
Then
1324 Call ok(CInt("-0.5") = 0, "CInt(""-0.5"") = " & CInt("-0.5"))
1325 Call ok(getVT(CInt("-0.5")) = "VT_I2", "getVT(CInt(""-0.5"")) = " & getVT(CInt("-0.5")))
1327 Call testCIntError("", 13, 13)
1328 Call testCIntError("-1", 0, 458)
1329 Call testCIntError("TRUE", 13, 13)
1330 Call testCIntError("FALSE", 13, 13)
1331 Call testCIntError("#TRue#", 13, 13)
1332 Call testCIntError("#fAlSE#", 13, 13)
1333 Call testCIntError(1, 0, 458)
1334 Call testCIntError(32767.49, 0, 458)
1335 Call testCIntError(32767.5, 6, 6)
1336 Call testCIntError(-32768.5, 0, 458)
1337 Call testCIntError(-32768.51, 6, 6)
1338 Call ok(CInt(True) = -1, "CInt(True) = " & CInt(True))
1339 Call ok(getVT(CInt(True)) = "VT_I2", "getVT(CInt(True)) = " & getVT(CInt(True)))
1340 Call ok(CInt(False) = 0, "CInt(False) = " & CInt(False))
1341 Call ok(getVT(CInt(False)) = "VT_I2", "getVT(CInt(False)) = " & getVT(CInt(False)))
1342 MyObject
.myval
= 2.5
1343 Call ok(CInt(MyObject
) = 2, "CInt(MyObject) = " & CInt(MyObject
))
1344 Call ok(getVT(CInt(MyObject
)) = "VT_I2", "getVT(CInt(MyObject)) = " & getVT(CInt(MyObject
)))
1345 MyObject
.myval
= 1.5
1346 Call ok(CInt(MyObject
) = 2, "CInt(MyObject) = " & CInt(MyObject
))
1347 Call ok(getVT(CInt(MyObject
)) = "VT_I2", "getVT(CInt(MyObject)) = " & getVT(CInt(MyObject
)))
1349 Sub testCSngError(strings
, error_num1
, error_num2
)
1350 on error resume next
1355 Call ok(Err
.number
= error_num1
, "Err.number = " & Err
.number
)
1359 Call ok(Err
.number
= error_num2
, "Err.number = " & Err
.number
)
1362 Call ok(CSng(Empty
) = 0, "CSng(Empty) = " & CSng(Empty
))
1363 Call ok(getVT(CSng(Empty
)) = "VT_R4", "getVT(CSng(Empty)) = " & getVT(CSng(Empty
)))
1364 Call ok(CSng(CByte(0)) = 0, "CSng(CByte(0)) = " & CSng(CByte(0)))
1365 Call ok(getVT(CSng(CCur(0))) = "VT_R4", "getVT(CSng(CCur(0))) = " & getVT(CSng(CCur(0))))
1366 Call ok(CSng(CCur(0)) = 0, "CSng(CCur(0)) = " & CSng(CCur(0)))
1367 Call ok(getVT(CSng(CCur(0))) = "VT_R4", "getVT(CSng(CCur(0))) = " & getVT(CSng(CCur(0))))
1368 Call ok(CSng(0) = 0, "CSng(0) = " & CSng(0))
1369 Call ok(getVT(CSng(0)) = "VT_R4", "getVT(CSng(0)) = " & getVT(CSng(0)))
1370 Call ok(CSng(32768) = 32768, "CSng(32768) = " & CSng(32768))
1371 Call ok(getVT(CSng(32768)) = "VT_R4", "getVT(CSng(32768)) = " & getVT(CSng(32768)))
1372 Call ok(CSng(0.001 * 0.001) = 0.000001, "CSng(0.001 * 0.001) = " & CSng(0.001 * 0.001))
1373 Call ok(getVT(CSng(0.001 * 0.001)) = "VT_R4", "getVT(CSng(0.001 * 0.001)) = " & getVT(CSng(0.001 * 0.001)))
1374 Call ok(CSng("-1") = -1, "CSng(""-1"") = " & CSng("-1"))
1375 Call ok(getVT(CSng("-1")) = "VT_R4", "getVT(CSng(""-1"")) = " & getVT(CSng("-1")))
1376 If isEnglishLang
Then
1377 Call ok(CSng("-0.5") = -0.5, "CSng(""-0.5"") = " & CSng("-0.5"))
1378 Call ok(getVT(CSng("-0.5")) = "VT_R4", "getVT(CSng(""-0.5"")) = " & getVT(CSng("-0.5")))
1380 Call testCSngError("", 13, 13)
1381 Call testCSngError("TRUE", 13, 13)
1382 Call testCSngError("FALSE", 13, 13)
1383 Call testCSngError("#TRue#", 13, 13)
1384 Call testCSngError("#fAlSE#", 13, 13)
1385 Call testCSngError(1, 0, 458)
1386 Call ok(CSng(True) = -1, "CSng(True) = " & CSng(True))
1387 Call ok(getVT(CSng(True)) = "VT_R4", "getVT(CSng(True)) = " & getVT(CSng(True)))
1388 Call ok(CSng(False) = 0, "CSng(False) = " & CSng(False))
1389 Call ok(getVT(CSng(False)) = "VT_R4", "getVT(CSng(False)) = " & getVT(CSng(False)))
1390 MyObject
.myval
= 0.1
1391 Call ok(CSng(MyObject
) = 0.1, "CSng(MyObject) = " & CSng(MyObject
))
1392 Call ok(getVT(CSng(MyObject
)) = "VT_R4", "getVT(CSng(MyObject)) = " & getVT(CSng(MyObject
)))
1394 Call ok(CSng(MyObject
) = 0, "CSng(MyObject) = " & CSng(MyObject
))
1395 Call ok(getVT(CSng(MyObject
)) = "VT_R4", "getVT(CSng(MyObject)) = " & getVT(CSng(MyObject
)))
1397 Call ok(TypeName(Empty
) = "Empty", "TypeName(MyEmpty) = " & TypeName(Empty
))
1398 Call ok(getVT(TypeName(Empty
)) = "VT_BSTR", "getVT(TypeName(Empty)) = " & getVT(TypeName(Empty
)))
1399 Call ok(TypeName(Null
) = "Null", "TypeName(Null) = " & TypeName(Null
))
1400 Call ok(getVT(TypeName(Null
)) = "VT_BSTR", "getVT(TypeName(Null)) = " & getVT(TypeName(Null
)))
1401 Call ok(TypeName(CByte(255)) = "Byte", "TypeName(CByte(255)) = " & TypeName(CByte(255)))
1402 Call ok(getVT(TypeName(CByte(255))) = "VT_BSTR", "getVT(TypeName(CByte(255))) = " & getVT(TypeName(CByte(255))))
1403 Call ok(TypeName(255) = "Integer", "TypeName(255) = " & TypeName(255))
1404 Call ok(getVT(TypeName(255)) = "VT_BSTR", "getVT(TypeName(255)) = " & getVT(TypeName(255)))
1405 Call ok(TypeName(32768) = "Long", "TypeName(32768) = " & TypeName(32768))
1406 Call ok(getVT(TypeName(32768)) = "VT_BSTR", "getVT(TypeName(32768)) = " & getVT(TypeName(32768)))
1407 Call ok(TypeName(CSng(0.5)) = "Single", "TypeName(CSng(0.5)) = " & TypeName(CSng(0.5)))
1408 Call ok(getVT(TypeName(CSng(0.5))) = "VT_BSTR", "getVT(TypeName(CSng(0.5))) = " & getVT(TypeName(CSng(0.5))))
1409 Call ok(TypeName(-0.5) = "Double", "TypeName(-0.5) = " & TypeName(-0.5))
1410 Call ok(getVT(TypeName(-0.5)) = "VT_BSTR", "getVT(TypeName(-0.5)) = " & getVT(TypeName(-0.5)))
1411 Call ok(TypeName(CCur(0.5)) = "Currency", "TypeName(CCur(0.5)) = " & TypeName(CCur(0.5)))
1412 Call ok(getVT(TypeName(CCur(0.5))) = "VT_BSTR", "getVT(TypeName(CCur(0.5))) = " & getVT(TypeName(CCur(0.5))))
1413 Call ok(TypeName(CStr(0.5)) = "String", "TypeName(CStr(0.5)) = " & TypeName(CStr(0.5)))
1414 Call ok(getVT(TypeName(CStr(0.5))) = "VT_BSTR", "getVT(TypeName(CStr(0.5))) = " & getVT(TypeName(CStr(0.5))))
1415 Call ok(TypeName(True) = "Boolean", "TypeName(True) = " & TypeName(True))
1416 Call ok(getVT(TypeName(True)) = "VT_BSTR", "getVT(TypeName(True)) = " & getVT(TypeName(True)))
1417 Call ok(TypeName(arr
) = "Variant()", "TypeName(arr) = " & TypeName(arr
))
1418 Call ok(getVT(TypeName(arr
)) = "VT_BSTR", "getVT(TypeName(arr)) = " & getVT(TypeName(arr
)))
1420 Call ok(VarType(Empty
) = vbEmpty
, "VarType(Empty) = " & VarType(Empty
))
1421 Call ok(getVT(VarType(Empty
)) = "VT_I2", "getVT(VarType(Empty)) = " & getVT(VarType(Empty
)))
1422 Call ok(VarType(Null
) = vbNull
, "VarType(Null) = " & VarType(Null
))
1423 Call ok(getVT(VarType(Null
)) = "VT_I2", "getVT(VarType(Null)) = " & getVT(VarType(Null
)))
1424 Call ok(VarType(255) = vbInteger
, "VarType(255) = " & VarType(255))
1425 Call ok(getVT(VarType(255)) = "VT_I2", "getVT(VarType(255)) = " & getVT(VarType(255)))
1426 set x
= new EmptyClass
1427 Call ok(VarType(x
) = vbObject
, "VarType(x) = " & VarType(x
))
1428 Call ok(getVT(VarType(x
)) = "VT_I2", "getVT(VarType(x)) = " & getVT(VarType(x
)))
1429 Call ok(VarType(32768) = vbLong
, "VarType(32768) = " & VarType(32768))
1430 Call ok(getVT(VarType(32768)) = "VT_I2", "getVT(VarType(32768)) = " & getVT(VarType(32768)))
1431 Call ok(VarType(CSng(0.5)) = vbSingle
, "VarType(CSng(0.5)) = " & VarType(CSng(0.5)))
1432 Call ok(getVT(VarType(CSng(0.5))) = "VT_I2", "getVT(VarType(CSng(0.5))) = " & getVT(VarType(CSng(0.5))))
1433 Call ok(VarType(-0.5) = vbDouble
, "VarType(-0.5) = " & VarType(-0.5))
1434 Call ok(getVT(VarType(-0.5)) = "VT_I2", "getVT(VarType(-0.5)) = " & getVT(VarType(-0.5)))
1435 Call ok(VarType(CCur(0.5)) = vbCurrency
, "VarType(CCur(0.5)) = " & VarType(CCur(0.5)))
1436 Call ok(getVT(VarType(CCur(0.5))) = "VT_I2", "getVT(VarType(CCur(0.5))) = " & getVT(VarType(CCur(0.5))))
1437 Call ok(VarType(CStr(0.5)) = vbString
, "VarType(CStr(0.5)) = " & VarType(CStr(0.5)))
1438 Call ok(getVT(VarType(CStr(0.5))) = "VT_I2", "getVT(VarType(CStr(0.5))) = " & getVT(VarType(CStr(0.5))))
1439 Call ok(VarType(CBool(0.5)) = vbBoolean
, "VarType(CBool(0.5)) = " & VarType(CBool(0.5)))
1440 Call ok(getVT(VarType(CBool(0.5))) = "VT_I2", "getVT(VarType(CBool(0.5))) = " & getVT(VarType(CBool(0.5))))
1441 Call ok(VarType(CByte(255)) = vbByte
, "VarType(CByte(255)) = " & VarType(CByte(255)))
1442 Call ok(getVT(VarType(CByte(255))) = "VT_I2", "getVT(VarType(CByte(255))) = " & getVT(VarType(CByte(255))))
1443 Call ok(VarType(arr
) = (vbArray
or vbVariant
), "VarType(arr) = " & VarType(arr
))
1444 Call ok(getVT(VarType(arr
)) = "VT_I2", "getVT(VarType(arr)) = " & getVT(VarType(arr
)))
1446 Call ok(Sgn(Empty
) = 0, "Sgn(MyEmpty) = " & Sgn(Empty
))
1447 Call ok(getVT(Sgn(Empty
)) = "VT_I2", "getVT(Sgn(MyEmpty)) = " & getVT(Sgn(Empty
)))
1448 Call ok(Sgn(0) = 0, "Sgn(0) = " & Sgn(0))
1449 Call ok(getVT(Sgn(0)) = "VT_I2", "getVT(Sgn(0)) = " & getVT(Sgn(0)))
1450 Call ok(Sgn(-32769) = -1, "Sgn(-32769) = " & Sgn(-32769))
1451 Call ok(getVT(Sgn(-32769)) = "VT_I2", "getVT(Sgn(-32769)) = " & getVT(Sgn(-32769)))
1452 Call ok(Sgn(CSng(-0.5)) = -1, "Sgn(CSng(-0.5)) = " & Sgn(CSng(-0.5)))
1453 Call ok(getVT(Sgn(CSng(-0.5))) = "VT_I2", "getVT(Sgn(CSng(-0.5))) = " & getVT(Sgn(CSng(-0.5))))
1454 Call ok(Sgn(0.5) = 1, "Sgn(0.5) = " & Sgn(0.5))
1455 Call ok(getVT(Sgn(0.5)) = "VT_I2", "getVT(Sgn(0.5)) = " & getVT(Sgn(0.5)))
1456 Call ok(Sgn(CCur(-1)) = -1, "Sgn(CCur(-1)) = " & Sgn(CCur(-1)))
1457 Call ok(getVT(Sgn(CCur(-1))) = "VT_I2", "getVT(Sgn(CCur(-1))) = " & getVT(Sgn(CCur(-1))))
1458 Call ok(Sgn(CStr(-1)) = -1, "Sgn(CStr(-1)) = " & Sgn(CStr(-1)))
1459 Call ok(getVT(Sgn(CStr(-1))) = "VT_I2", "getVT(Sgn(CStr(-1))) = " & getVT(Sgn(CStr(-1))))
1460 Call ok(Sgn(False) = 0, "Sgn(False) = " & Sgn(False))
1461 Call ok(getVT(Sgn(False)) = "VT_I2", "getVT(Sgn(False)) = " & getVT(Sgn(False)))
1462 Call ok(Sgn(True) = -1, "Sgn(True) = " & Sgn(True))
1463 Call ok(getVT(Sgn(True)) = "VT_I2", "getVT(Sgn(True)) = " & getVT(Sgn(True)))
1464 Call ok(Sgn(CByte(1)) = 1, "Sgn(CByte(1)) = " & Sgn(CByte(1)))
1465 Call ok(getVT(Sgn(CByte(1))) ="VT_I2", "getVT(Sgn(CByte(1))) = " & getVT(Sgn(CByte(1))))
1467 Sub testSgnError(strings
, error_num
)
1468 on error resume next
1472 Call ok(Err
.number
= error_num
, "Err.number = " & Err
.number
)
1475 Call testSgnError(Null
, 94)
1477 Call ok(Abs(Empty
) = 0, "Abs(Empty) = " & Abs(Empty
))
1478 Call ok(getVT(Abs(Empty
)) = "VT_I2", "getVT(Abs(Empty)) = " & getVT(Abs(Empty
)))
1479 Call ok(IsNull(Abs(Null
)), "Is Abs(Null) not Null?")
1480 Call ok(getVT(Abs(Null
)) = "VT_NULL", "getVT(Abs(Null)) = " & getVT(Abs(Null
)))
1481 Call ok(Abs(0) = 0, "Abs(0) = " & Abs(0))
1482 Call ok(getVT(Abs(0)) = "VT_I2", "getVT(Abs(0)) = " & getVT(Abs(0)))
1483 Call ok(Abs(-32769) = 32769, "Abs(-32769) = " & Abs(-32769))
1484 Call ok(getVT(Abs(-32769)) = "VT_I4", "getVT(Abs(-32769)) = " & getVT(Abs(-32769)))
1485 Call ok(Abs(CSng(-0.5)) = 0.5, "Abs(CSng(-0.5)) = " & Abs(CSng(-0.5)))
1486 Call ok(getVT(Abs(CSng(-0.5))) = "VT_R4", "getVT(Abs(CSng(-0.5))) = " & getVT(Abs(CSng(-0.5))))
1487 Call ok(Abs(0.5) = 0.5, "Abs(0.5) = " & Abs(0.5))
1488 Call ok(getVT(Abs(0.5)) = "VT_R8", "getVT(Abs(0.5)) = " & getVT(Abs(0.5)))
1489 Call ok(Abs(CCur(-1)) = 1, "Abs(CCur(-1)) = " & Abs(CCur(-1)))
1490 Call ok(getVT(Abs(CCur(-1))) = "VT_CY", "getVT(Abs(CCur(-1))) = " & getVT(Abs(CCur(-1))))
1491 Call ok(Abs("-1") = 1, "Abs(""-1"") = " & Abs("-1"))
1492 Call ok(getVT(Abs("-1")) = "VT_R8", "getVT(Abs(""-1"")) = " & getVT(Abs("-1")))
1493 Call ok(Abs(False) = 0, "Abs(False) = " & Abs(False))
1494 Call ok(getVT(Abs(False)) = "VT_I2", "getVT(Abs(False)) = " & getVT(Abs(False)))
1495 Call ok(Abs(True) = 1, "Abs(True) = " & Abs(True))
1496 Call ok(getVT(Abs(True)) = "VT_I2", "getVT(Abs(True)) = " & getVT(Abs(True)))
1497 Call ok(Abs(CByte(1)) = 1, "Abs(CByte(1)) = " & Abs(CByte(1)))
1498 Call ok(getVT(Abs(CByte(1))) = "VT_UI1", "getVT(Abs(CByte(1))) = " & getVT(Abs(CByte(1))))
1500 Sub testAbsError(strings
, error_num1
, error_num2
)
1501 on error resume next
1506 Call ok(Err
.number
= error_num1
, "Err.number1 = " & Err
.number
)
1510 Call ok(Err
.number
= error_num2
, "Err.number2 = " & Err
.number
)
1513 Call testAbsError("strings", 13, 13)
1514 Call testAbsError(-4, 0, 0)
1516 Call ok(ScriptEngine
= "VBScript", "Is scriptengine not VBScript?")
1517 Call ok(getVT(ScriptEngine
) = "VT_BSTR", "getVT(ScriptEngine) = " & getVT(ScriptEngine
))
1519 Call ok(getVT(ScriptEngineBuildVersion
) = "VT_I4", "getVT(ScriptEngineBuildVersion) = " & getVT(ScriptEngineBuildVersion
))
1521 Call ok(getVT(ScriptEngineMajorVersion
) = "VT_I4", "getVT(ScriptEngineMajorVersion) = " & getVT(ScriptEngineMajorVersion
))
1523 Call ok(getVT(ScriptEngineMinorVersion
) = "VT_I4", "getVT(ScriptEngineMinorVersion) = " & getVT(ScriptEngineMinorVersion
))
1525 Call ok(Fix(Empty
) = 0, "Fix(Empty) = " & Fix(Empty
))
1526 Call ok(getVT(Fix(Empty
)) = "VT_I2", "getVT(Fix(Empty)) = " & getVT(Fix(Empty
)))
1527 Call ok(Fix(CCur(-0.99)) = 0, "Fix(CCur(-0.99)) = " & Fix(CCur(-0.99)))
1528 Call ok(getVT(Fix(CCur(-0.99))) = "VT_CY", "getVT(Fix(CCur(-0.99))) = " & getVT(Fix(CCur(-0.99))))
1529 Call ok(Fix(1.99) = 1, "Fix(1.99) = " & Fix(1.99))
1530 Call ok(getVT(Fix(1.99)) = "VT_R8", "getVT(Fix(1.99)) = " & getVT(Fix(1.99)))
1531 Call ok(Fix(-1.99) = -1, "Fix(-1.99) = " & Fix(-1.99))
1532 Call ok(getVT(Fix(-1.99)) = "VT_R8", "getVT(Fix(-1.99)) = " & getVT(Fix(-1.99)))
1533 If isEnglishLang
Then
1534 Call ok(Fix("1.99") = 1, "Fix(""1.99"") = " & Fix("1.99"))
1535 Call ok(getVT(Fix("1.99")) = "VT_R8", "getVT(Fix(""1.99"")) = " & getVT(Fix("1.99")))
1536 Call ok(Fix("-1.99") = -1, "Fix(""-1.99"") = " & Fix("-1.99"))
1537 Call ok(getVT(Fix("-1.99")) = "VT_R8", "getVT(Fix(""-1.99"")) = " & getVT(Fix("-1.99")))
1539 Call ok(Fix(True) = -1, "Fix(True) = " & Fix(True))
1540 Call ok(getVT(Fix(True)) = "VT_I2", "getVT(Fix(True)) = " & getVT(Fix(True)))
1541 Call ok(Fix(False) = 0, "Fix(False) = " & Fix(False))
1542 Call ok(getVT(Fix(False)) = "VT_I2", "getVT(Fix(False)) = " & getVT(Fix(False)))
1543 MyObject
.myval
= 2.5
1544 Call ok(Fix(MyObject
) = 2, "Fix(MyObject) = " & Fix(MyObject
))
1545 Call ok(getVT(Fix(MyObject
)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject
)))
1546 MyObject
.myval
= -2.5
1547 Call ok(Fix(MyObject
) = -2, "Fix(MyObject) = " & Fix(MyObject
))
1548 Call ok(getVT(Fix(MyObject
)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject
)))
1550 Call ok(Int(Empty
) = 0, "Int(Empty) = " & Int(Empty
))
1551 Call ok(getVT(Int(Empty
)) = "VT_I2", "getVT(Int(Empty)) = " & getVT(Int(Empty
)))
1552 Call ok(Int(CCur(-0.99)) = -1, "Int(CCur(-0.99)) = " & Int(CCur(-0.99)))
1553 Call ok(getVT(Int(CCur(-0.99))) = "VT_CY", "getVT(Int(CCur(-0.99))) = " & getVT(Int(CCur(-0.99))))
1554 Call ok(Int(1.99) = 1, "Int(1.99) = " & Int(1.99))
1555 Call ok(getVT(Int(1.99)) = "VT_R8", "getVT(Int(1.99)) = " & getVT(Int(1.99)))
1556 Call ok(Int(-1.99) = -2, "Int(-1.99) = " & Int(-1.99))
1557 Call ok(getVT(Int(-1.99)) = "VT_R8", "getVT(Int(-1.99)) = " & getVT(Int(-1.99)))
1558 If isEnglishLang
Then
1559 Call ok(Int("1.99") = 1, "Int(""1.99"") = " & Int("1.99"))
1560 Call ok(getVT(Int("1.99")) = "VT_R8", "getVT(Int(""1.99"")) = " & getVT(Int("1.99")))
1561 Call ok(Int("-1.99") = -2, "Int(""-1.99"") = " & Int("-1.99"))
1562 Call ok(getVT(Int("-1.99")) = "VT_R8", "getVT(Int(""-1.99"")) = " & getVT(Int("-1.99")))
1564 Call ok(Int(True) = -1, "Int(True) = " & Int(True))
1565 Call ok(getVT(Int(True)) = "VT_I2", "getVT(Int(True)) = " & getVT(Int(True)))
1566 Call ok(Int(False) = 0, "Int(False) = " & Int(False))
1567 Call ok(getVT(Int(False)) = "VT_I2", "getVT(Int(False)) = " & getVT(Int(False)))
1568 MyObject
.myval
= 2.5
1569 Call ok(Int(MyObject
) = 2, "Int(MyObject) = " & Int(MyObject
))
1570 Call ok(getVT(Int(MyObject
)) = "VT_R8", "getVT(Int(MyObject)) = " & getVT(Int(MyObject
)))
1571 MyObject
.myval
= -2.5
1572 Call ok(Int(MyObject
) = -3, "Int(MyObject) = " & Int(MyObject
))
1573 Call ok(getVT(Int(MyObject
)) = "VT_R8", "getVT(Int(MyObject)) = " & getVT(Int(MyObject
)))
1575 Sub testSqrError(strings
, error_num1
, error_num2
)
1576 on error resume next
1581 Call ok(Err
.number
= error_num1
, "Err.number1 = " & Err
.number
)
1585 Call ok(Err
.number
= error_num2
, "Err.number2 = " & Err
.number
)
1588 Call testSqrError(-2, 5, 5)
1589 Call testSqrError(True, 5, 5)
1591 Call ok(Sqr(Empty
) = 0, "Sqr(Empty) = " & Sqr(Empty
))
1592 Call ok(getVT(Sqr(Empty
)) = "VT_R8", "getVT(Sqr(Empty)) = " & getVT(Sqr(Empty
)))
1593 Call ok(Sqr(0) = 0, "Sqr(0) = " & Sqr(0))
1594 Call ok(getVT(Sqr(0)) = "VT_R8", "getVT(Sqr(0)) = " & getVT(Sqr(0)))
1595 Call ok(Sqr(1) = 1, "Sqr(1) = " & Sqr(1))
1596 Call ok(getVT(Sqr(1)) = "VT_R8", "getVT(Sqr(1)) = " & getVT(Sqr(1)))
1597 Call ok(Sqr(CSng(121)) = 11, "Sqr(CSng(121)) = " & Sqr(CSng(121)))
1598 Call ok(getVT(Sqr(CSng(121))) = "VT_R8", "getVT(Sqr(CSng(121))) = " & getVT(Sqr(CSng(121))))
1599 Call ok(Sqr(36100) = 190, "Sqr(36100) = " & Sqr(36100))
1600 Call ok(getVT(Sqr(36100)) = "VT_R8", "getVT(Sqr(36100)) = " & getVT(Sqr(36100)))
1601 Call ok(Sqr(CCur(0.0625)) = 0.25, "Sqr(CCur(0.0625)) = " & Sqr(CCur(0.0625)))
1602 Call ok(getVT(Sqr(CCur(0.0625))) = "VT_R8", "getVT(Sqr(CCur(0.0625))) = " & getVT(Sqr(CCur(0.0625))))
1603 Call ok(Sqr("100000000") = 10000, "Sqr(""100000000"") = " & Sqr("100000000"))
1604 Call ok(getVT(Sqr("100000000")) = "VT_R8", "getVT(Sqr(""100000000"")) = " & getVT(Sqr("100000000")))
1605 Call ok(Sqr(False) = 0, "Sqr(False) = " & Sqr(False))
1606 Call ok(getVT(Sqr(False)) = "VT_R8", "getVT(Sqr(False)) = " & getVT(Sqr(False)))
1607 Call ok(Sqr(CByte(225)) = 15, "Sqr(CByte(225)) = " & Sqr(CByte(225)))
1608 Call ok(getVT(Sqr(CByte(225))) = "VT_R8", "getVT(Sqr(CByte(225))) = " & getVT(Sqr(CByte(225))))
1610 Function Approch(func
, res
)
1611 If Abs(func
- res
) < 0.001 Then
1618 Const PI
= 3.1415926
1620 Call ok(Approch(Cos(Empty
), 1), "Cos(Empty) = " & Cos(Empty
))
1621 Call ok(getVT(Cos(Empty
)) = "VT_R8", "getVT(Cos(Empty)) = " & getVT(Cos(Empty
)))
1622 Call ok(Approch(Cos(PI
/ 6), Sqr(3) / 2), "Cos(PI / 6) = " & Cos(PI
/ 6))
1623 Call ok(getVT(Cos(PI
/ 6)) = "VT_R8", "getVT(Cos(PI / 6)) = " & getVT(Cos(PI
/ 6)))
1624 Call ok(Approch(Cos(CCur(PI
/ 4)), Sqr(2) / 2), "Cos(CCur(PI / 4)) = " & Cos(CCur(PI
/ 4)))
1625 Call ok(getVT(Cos(CCur(PI
/ 4))) = "VT_R8", "getVT(Cos(CCur(PI / 4))) = " & getVT(Cos(CCur(PI
/ 4))))
1626 Call ok(Approch(Cos(CSng(PI
/ 3)), 1 / 2), "Cos(CSng(PI / 3)) = " & Cos(CSng(PI
/ 3)))
1627 Call ok(getVT(Cos(CSng(PI
/ 3))) = "VT_R8", "getVT(Cos(CSng(PI))) = " & getVT(Cos(CSng(PI
))))
1628 Call ok(Approch(Cos(PI
/ 2), 0), "Cos(0) = " & Cos(PI
/ 2))
1629 Call ok(getVT(Cos(PI
/ 2)) = "VT_R8", "getVT(Cos(PI / 2)) = " & getVT(Cos(PI
/ 2)))
1630 Call ok(Approch(Cos(PI
), -1), "Cos(PI) = " & Cos(PI
))
1631 Call ok(getVT(Cos(PI
)) = "VT_R8", "getVT(Cos(PI)) = " & getVT(Cos(PI
)))
1632 Call ok(Approch(Cos(5 * PI
/ 4), -Sqr(2) / 2), "Cos(5 * PI / 4) = " & Cos(5 * PI
/ 4))
1633 Call ok(getVT(Cos(5 * PI
/ 4)) = "VT_R8", "getVT(Cos(5 * PI / 4)) = " & getVT(Cos(5 * PI
/ 4)))
1634 Call ok(Approch(Cos(3 * PI
/ 2), 0), "Cos(3 * PI / 2) = " & Cos(3 * PI
/ 2))
1635 Call ok(getVT(Cos(3 * PI
/ 2)) = "VT_R8", "getVT(Cos(3 * PI / 2)) = " & getVT(Cos(3 * PI
/ 2)))
1636 Call ok(Approch(Cos(2 * PI
), 1), "Cos(2 * PI) = " & Cos(2 * PI
))
1637 Call ok(getVT(Cos(2 * PI
)) = "VT_R8", "getVT(Cos(2 * PI)) = " & getVT(Cos(2 * PI
)))
1638 Call ok(Approch(Cos("-32768"), 0.3729), "Cos(""-32768"") = " & Cos("-32768"))
1639 Call ok(getVT(Cos("-32768")) = "VT_R8", "getVT(Cos(""-32768"")) = " & getVT(Cos("-32768")))
1640 Call ok(Approch(Cos(False), 1), "Cos(False) = " & Cos(False))
1641 Call ok(getVT(Cos(False)) = "VT_R8", "getVT(Cos(False)) = " & getVT(Cos(False)))
1642 Call ok(Approch(Cos(True), 0.5403), "Cos(True) = " & Cos(True))
1643 Call ok(getVT(Cos(True)) = "VT_R8", "getVT(Cos(True)) = " & getVT(Cos(True)))
1644 Call ok(Approch(Cos(CByte(255)), -0.8623), "Cos(CByte(255)) = " & Cos(CByte(255)))
1645 Call ok(getVT(Cos(CByte(255))) = "VT_R8", "getVT(Cos(CByte(255))) = " & getVT(Cos(CByte(255))))
1647 Call ok(Approch(Sin(Empty
), 0), "Sin(Empty) = " & Sin(Empty
))
1648 Call ok(getVT(Sin(Empty
)) = "VT_R8", "getVT(Sin(Empty)) = " & getVT(Sin(Empty
)))
1649 Call ok(Approch(Sin(PI
/ 6), 1 / 2), "Sin(PI / 6) = " & Sin(PI
/ 6))
1650 Call ok(getVT(Sin(PI
/ 6)) = "VT_R8", "getVT(Sin(PI / 6)) = " & getVT(Sin(PI
/ 6)))
1651 Call ok(Approch(Sin(CCur(PI
/ 4)), Sqr(2) / 2), "Sin(CCur(PI / 4)) = " & Sin(CCur(PI
/ 4)))
1652 Call ok(getVT(Sin(CCur(PI
/ 4))) = "VT_R8", "getVT(Sin(CCur(PI / 4))) = " & getVT(Sin(CCur(PI
/ 4))))
1653 Call ok(Approch(Sin(CSng(PI
/ 3)), Sqr(3) / 2), "Sin(CSng(PI / 3)) = " & Sin(CSng(PI
/ 3)))
1654 Call ok(getVT(Sin(CSng(PI
/ 3))) = "VT_R8", "getVT(Sin(CSng(PI))) = " & getVT(Sin(CSng(PI
))))
1655 Call ok(Approch(Sin(PI
/ 2), 1), "Sin(0) = " & Sin(PI
/ 2))
1656 Call ok(getVT(Sin(PI
/ 2)) = "VT_R8", "getVT(Sin(PI / 2)) = " & getVT(Sin(PI
/ 2)))
1657 Call ok(Approch(Sin(PI
), 0), "Sin(PI) = " & Sin(PI
))
1658 Call ok(getVT(Sin(PI
)) = "VT_R8", "getVT(Sin(PI)) = " & getVT(Sin(PI
)))
1659 Call ok(Approch(Sin(5 * PI
/ 4), -Sqr(2) / 2), "Sin(5 * PI / 4) = " & Sin(5 * PI
/ 4))
1660 Call ok(getVT(Sin(5 * PI
/ 4)) = "VT_R8", "getVT(Sin(5 * PI / 4)) = " & getVT(Sin(5 * PI
/ 4)))
1661 Call ok(Approch(Sin(3 * PI
/ 2), -1), "Sin(3 * PI / 2) = " & Sin(3 * PI
/ 2))
1662 Call ok(getVT(Sin(3 * PI
/ 2)) = "VT_R8", "getVT(Sin(3 * PI / 2)) = " & getVT(Sin(3 * PI
/ 2)))
1663 Call ok(Approch(Sin(2 * PI
), 0), "Sin(2 * PI) = " & Sin(2 * PI
))
1664 Call ok(getVT(Sin(2 * PI
)) = "VT_R8", "getVT(Sin(2 * PI)) = " & getVT(Sin(2 * PI
)))
1665 Call ok(Approch(Sin("-32768"), -0.9278), "Sin(""-32768"") = " & Sin("-32768"))
1666 Call ok(getVT(Sin("-32768")) = "VT_R8", "getVT(Sin(""-32768"")) = " & getVT(Sin("-32768")))
1667 Call ok(Approch(Sin(False), 0), "Sin(False) = " & Sin(False))
1668 Call ok(getVT(Sin(False)) = "VT_R8", "getVT(Sin(False)) = " & getVT(Sin(False)))
1669 Call ok(Approch(Sin(True), -0.84147), "Sin(True) = " & Sin(True))
1670 Call ok(getVT(Sin(True)) = "VT_R8", "getVT(Sin(True)) = " & getVT(Sin(True)))
1671 Call ok(Approch(Sin(CByte(255)), -0.5063), "Sin(CByte(255)) = " & Sin(CByte(255)))
1672 Call ok(getVT(Sin(CByte(255))) = "VT_R8", "getVT(Sin(CByte(255))) = " & getVT(Sin(CByte(255))))
1674 Call ok(Approch(Tan(Empty
), 0), "Tan(Empty) = " & Tan(Empty
))
1675 Call ok(getVT(Tan(Empty
)) = "VT_R8", "getVT(Tan(Empty)) = " & getVT(Tan(Empty
)))
1676 Call ok(Approch(Tan(PI
/ 6), Sqr(3) / 3), "Tan(PI / 6) = " & Tan(PI
/ 6))
1677 Call ok(getVT(Tan(PI
/ 6)) = "VT_R8", "getVT(Tan(PI / 6)) = " & getVT(Tan(PI
/ 6)))
1678 Call ok(Approch(Tan(CCur(PI
/ 4)), 1), "Tan(CCur(PI / 4)) = " & Tan(CCur(PI
/ 4)))
1679 Call ok(getVT(Tan(CCur(PI
/ 4))) = "VT_R8", "getVT(Tan(CCur(PI / 4))) = " & getVT(Tan(CCur(PI
/ 4))))
1680 Call ok(Approch(Tan(CSng(PI
/ 3)), Sqr(3)), "Tan(CSng(PI / 3)) = " & Tan(CSng(PI
/ 3)))
1681 Call ok(getVT(Tan(CSng(PI
/ 3))) = "VT_R8", "getVT(Tan(CSng(PI))) = " & getVT(Tan(CSng(PI
))))
1682 Call ok(Approch(Tan(PI
), 0), "Tan(PI) = " & Tan(PI
))
1683 Call ok(getVT(Tan(PI
)) = "VT_R8", "getVT(Tan(PI)) = " & getVT(Tan(PI
)))
1684 Call ok(Approch(Tan(3 * PI
/ 4), -1), "Tan(3 * PI / 4) = " & Tan(3 * PI
/ 4))
1685 Call ok(getVT(Tan(3 * PI
/ 4)) = "VT_R8", "getVT(Tan(3 * PI / 4)) = " & getVT(Tan(3 * PI
/ 4)))
1686 Call ok(Approch(Tan(5 * PI
/ 4), 1), "Tan(5 * PI / 4) = " & Tan(5 * PI
/ 4))
1687 Call ok(getVT(Tan(5 * PI
/ 4)) = "VT_R8", "getVT(Tan(5 * PI / 4)) = " & getVT(Tan(5 * PI
/ 4)))
1688 Call ok(Approch(Tan(2 * PI
), 0), "Tan(2 * PI) = " & Tan(2 * PI
))
1689 Call ok(getVT(Tan(2 * PI
)) = "VT_R8", "getVT(Tan(2 * PI)) = " & getVT(Tan(2 * PI
)))
1690 Call ok(Approch(Tan("-32768"), -2.4879), "Tan(""-32768"") = " & Tan("-32768"))
1691 Call ok(getVT(Tan("-32768")) = "VT_R8", "getVT(Tan(""-32768"")) = " & getVT(Tan("-32768")))
1692 Call ok(Approch(Tan(False), 0), "Tan(False) = " & Tan(False))
1693 Call ok(getVT(Tan(False)) = "VT_R8", "getVT(Tan(False)) = " & getVT(Tan(False)))
1694 Call ok(Approch(Tan(True), -1.5574), "Tan(True) = " & Tan(True))
1695 Call ok(getVT(Tan(True)) = "VT_R8", "getVT(Tan(True)) = " & getVT(Tan(True)))
1696 Call ok(Approch(Tan(CByte(255)), 0.5872), "Tan(CByte(255)) = " & Tan(CByte(255)))
1697 Call ok(getVT(Tan(CByte(255))) = "VT_R8", "getVT(Tan(CByte(255))) = " & getVT(Tan(CByte(255))))
1699 Call ok(Approch(Atn(Empty
), 0), "Atn(Empty) = " & Atn(Empty
))
1700 Call ok(getVT(Atn(Empty
)) = "VT_R8", "getVT(Atn(Empty)) = " & getVT(Atn(Empty
)))
1701 Call ok(Approch(Atn(Sqr(3) / 3), PI
/ 6), "Atn(Sqr(3) / 3) = " & Atn(Sqr(3) / 3))
1702 Call ok(getVT(Atn(Sqr(3) / 3)) = "VT_R8", "getVT(Atn(Sqr(3) / 3)) = " & getVT(Atn(Sqr(3) / 3)))
1703 Call ok(Approch(Atn(CCur(1)), PI
/ 4), "Atn(CCur(1)) = " & Atn(CCur(1)))
1704 Call ok(getVT(Atn(CCur(1))) = "VT_R8", "getVT(Atn(CCur(1))) = " & getVT(Atn(CCur(1))))
1705 Call ok(Approch(Atn(CSng(Sqr(3))), PI
/ 3), "Atn(CSng(Sqr(3))) = " & Atn(CSng(Sqr(3))))
1706 Call ok(getVT(Atn(CSng(Sqr(3)))) = "VT_R8", "getVT(Atn(CSng(PI))) = " & getVT(Atn(CSng(PI
))))
1707 Call ok(Approch(Atn(0), 0), "Atn(0) = " & Atn(0))
1708 Call ok(getVT(Atn(0)) = "VT_R8", "getVT(Atn(0)) = " & getVT(Atn(0)))
1709 Call ok(Approch(Atn(-1), -PI
/ 4), "Atn(-1) = " & Atn(-1))
1710 Call ok(getVT(Atn(-1)) = "VT_R8", "getVT(Atn(-1)) = " & getVT(Atn(-1)))
1711 Call ok(Approch(Atn("-32768"), -1.5707), "Atn(""-32768"") = " & Atn("-32768"))
1712 Call ok(getVT(Atn("-32768")) = "VT_R8", "getVT(Atn(""-32768"")) = " & getVT(Atn("-32768")))
1713 Call ok(Approch(Atn(False), 0), "Atn(False) = " & Atn(False))
1714 Call ok(getVT(Atn(False)) = "VT_R8", "getVT(Atn(False)) = " & getVT(Atn(False)))
1715 Call ok(Approch(Atn(True), -0.7853), "Atn(True) = " & Atn(True))
1716 Call ok(getVT(Atn(True)) = "VT_R8", "getVT(Atn(True)) = " & getVT(Atn(True)))
1717 Call ok(Approch(Atn(CByte(255)), 1.5668), "Atn(CByte(255)) = " & Atn(CByte(255)))
1718 Call ok(getVT(Atn(CByte(255))) = "VT_R8", "getVT(Atn(CByte(255))) = " & getVT(Atn(CByte(255))))
1720 Call ok(Approch(Exp(Empty
), 1), "Exp(Empty) = " & Exp(Empty
))
1721 Call ok(getVT(Exp(Empty
)) = "VT_R8", "getVT(Exp(Empty)) = " & getVT(Exp(Empty
)))
1722 Call ok(Approch(Exp(1), 2.7182), "Exp(1) = " & Exp(1))
1723 Call ok(getVT(Exp(1)) = "VT_R8", "getVT(Exp(1)) = " & getVT(Exp(1)))
1724 Call ok(Approch(Exp(CCur(-1)), 0.3678), "Exp(CCur(-1)) = " & Exp(CCur(-1)))
1725 Call ok(getVT(Exp(CCur(-1))) = "VT_R8", "getVT(Exp(CCur(-1))) = " & getVT(Exp(CCur(-1))))
1726 Call ok(Approch(Exp(CSng(0.5)), 1.6487), "Exp(CSng(0.5)) = " & Exp(CSng(0.5)))
1727 Call ok(getVT(Exp(CSng(0.5))) = "VT_R8", "getVT(Exp(CSng(PI))) = " & getVT(Exp(CSng(PI
))))
1728 Call ok(Approch(Exp(-0.5), 0.6065), "Exp(-0.5) = " & Exp(-0.5))
1729 Call ok(getVT(Exp(-0.5)) = "VT_R8", "getVT(Exp(-0.5)) = " & getVT(Exp(-0.5)))
1730 Call ok(Approch(Exp("-2"), 0.1353), "Exp(""-2"") = " & Exp("-2"))
1731 Call ok(getVT(Exp("-2")) = "VT_R8", "getVT(Exp(""-2"")) = " & getVT(Exp("-2")))
1732 Call ok(Approch(Exp(False), 1), "Exp(False) = " & Exp(False))
1733 Call ok(getVT(Exp(False)) = "VT_R8", "getVT(Exp(False)) = " & getVT(Exp(False)))
1734 Call ok(Approch(Exp(True), 0.3678), "Exp(True) = " & Exp(True))
1735 Call ok(getVT(Exp(True)) = "VT_R8", "getVT(Exp(True)) = " & getVT(Exp(True)))
1736 Call ok(Approch(Exp(CByte(2)), 7.389), "Exp(CByte(2)) = " & Exp(CByte(2)))
1737 Call ok(getVT(Exp(CByte(2))) = "VT_R8", "getVT(Exp(CByte(2))) = " & getVT(Exp(CByte(2))))
1739 Sub testLogError(strings
, error_num1
, error_num2
)
1740 on error resume next
1745 Call ok(Err
.number
= error_num1
, "Err.number1 = " & Err
.number
)
1749 Call ok(Err
.number
= error_num2
, "Err.number2 = " & Err
.number
)
1752 Call testLogError(0, 5, 5)
1753 Call testLogError(-2, 5, 5)
1754 Call testLogError(False, 5, 5)
1755 Call testLogError(True, 5, 5)
1756 Call ok(Approch(Log(1), 0), "Log(1) = " & Log(1))
1757 Call ok(getVT(Log(1)) = "VT_R8", "getVT(Log(1)) = " & getVT(Log(1)))
1758 Call ok(Approch(Log(CCur(0.5)), -0.6931), "Log(CCur(0.5)) = " & Log(CCur(0.5)))
1759 Call ok(getVT(Log(CCur(0.5))) = "VT_R8", "getVT(Log(CCur(0.5))) = " & getVT(Log(CCur(0.5))))
1760 Call ok(Approch(Log(CSng(2.7182)), 1), "Log(CSng(2.7182)) = " & Log(CSng(2.7182)))
1761 Call ok(getVT(Log(CSng(2.7182))) = "VT_R8", "getVT(Log(CSng(PI))) = " & getVT(Log(CSng(PI
))))
1762 Call ok(Approch(Log(32768), 10.3972), "Log(32768) = " & Log(32768))
1763 Call ok(getVT(Log(32768)) = "VT_R8", "getVT(Log(32768)) = " & getVT(Log(32768)))
1764 Call ok(Approch(Log("10"), 2.3025), "Log(""10"") = " & Log("10"))
1765 Call ok(getVT(Log("10")) = "VT_R8", "getVT(Log(""10"")) = " & getVT(Log("10")))
1766 Call ok(Approch(Log(CByte(2)), 0.6931), "Log(CByte(2)) = " & Log(CByte(2)))
1767 Call ok(getVT(Log(CByte(2))) = "VT_R8", "getVT(Log(CByte(2))) = " & getVT(Log(CByte(2))))
1769 Call ok(getVT(Date) = "VT_DATE", "getVT(Date) = " & getVT(Date))
1770 Call ok(getVT(Time
) = "VT_DATE", "getVT(Time) = " & getVT(Time
))
1772 Call ok(getVT(Day(now
)) = "VT_I2", "getVT(Day(now)) = " & getVT(Day(now
)))
1773 Call ok(Day(2) = 1, "Day(2) = " & Day(2))
1774 Call ok(getVT(Month(now
)) = "VT_I2", "getVT(Month(now)) = " & getVT(Month(now
)))
1775 Call ok(Month(2) = 1, "Month(2) = " & Month(2))
1776 Call ok(getVT(Year(now
)) = "VT_I2", "getVT(Year(now)) = " & getVT(Year(now
)))
1777 Call ok(Year(2) = 1900, "Year(2) = " & Year(2))
1778 Call ok(getVT(Hour(now
)) = "VT_I2", "getVT(Hour(now)) = " & getVT(Hour(now
)))
1779 Call ok(Hour(2) = 0, "Hour(2) = " & Hour(2))
1780 Call ok(Hour(2.75) = 18, "Hour(2) = " & Hour(2.75))
1781 Call ok(getVT(Minute(now
)) = "VT_I2", "getVT(Minute(now)) = " & getVT(Minute(now
)))
1782 Call ok(Minute(2) = 0, "Minute(2) = " & Minute(2))
1783 Call ok(Minute(2.02083) = 30, "Minute(2.02083) = " & Minute(2.02083))
1784 Call ok(getVT(Second(now
)) = "VT_I2", "getVT(Second(now)) = " & getVT(Second(now
)))
1785 Call ok(Second(2) = 0, "Second(2) = " & Second(2))
1787 Sub testRGBError(arg1
, arg2
, arg3
, error_num
)
1788 on error resume next
1792 x
= RGB(arg1
, arg2
, arg3
)
1793 Call ok(Err
.number
= error_num
, "Err.number1 = " & Err
.number
)
1796 Call RGB(arg1
, arg2
, arg3
)
1797 Call ok(Err
.number
= error_num
, "Err.number2 = " & Err
.number
)
1800 Call ok(RGB(0, &h1f
&, &hf1
&) = &hf11f00
&, "RGB(0, &h1f&, &hf1&) = " & RGB(0, &h1f
&, &hf1
&))
1801 Call ok(getVT(RGB(0, &h1f
&, &hf1
&)) = "VT_I4", "getVT(RGB(&hf1&, &h1f&, &hf1&)) = " & getVT(RGB(&hf1
&, &h1f
&, &hf1
&)))
1802 Call ok(RGB(&hef
&, &hab
&, &hcd
&) = &hcdabef
&, "RGB(&hef&, &hab&, &hcd&) = " & RGB(&hef
&, &hab
&, &hcd
&))
1803 Call ok(getVT(RGB(&hef
&, &hab
&, &hcd
&)) = "VT_I4", "getVT(RGB(&hef&, &hab&, &hcd&)) = " & getVT(RGB(&hef
&, &hab
&, &hcd
&)))
1804 Call ok(RGB(&h1
&, &h100
&, &h111
&) = &hffff01
&, "RGB(&h1&, &h100&, &h111&) = " & RGB(&h1
&, &h100
&, &h111
&))
1805 Call ok(getVT(RGB(&h1
&, &h100
&, &h111
&)) = "VT_I4", "getVT(RGB(&h1&, &h100&, &h111&)) = " & getVT(RGB(&h1
&, &h100
&, &h111
&)))
1806 Call testRGBError(-1, &h1e
&, &h3b
&, 5)
1807 Call testRGBError(&h4d
&, -2, &h2f
&, 5)
1809 Call ok(getVT(Timer
) = "VT_R4", "getVT(Timer) = " & getVT(Timer
))
1811 sub testAsc(arg
, expected
)
1814 call ok(x
= expected
, "x = " & x
& " expected " & expected
)
1815 call ok(getVT(x
) = "VT_I2*", "getVT = " & getVT(x
))
1819 on error resume next
1822 Call ok(Err
.number
= 94, "Err.number = " & Err
.number
)
1825 Call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
1828 Call ok(Err
.number
= 450, "Err.number = " & Err
.number
)
1830 call Asc(Chr(260)) ' some versions of vista allow it
1831 Call ok(Err
.number
= 5 or Err
.number
= 0, "asc4 Err.number = " & Err
.number
)
1834 Call ok(Err
.number
= 5, "Err.number = " & Err
.number
)
1837 call testAsc("T", 84)
1838 call testAsc("test", 116)
1839 call testAsc("3", 51)
1841 call testAsc(" ", 32)
1842 call testAsc(Chr(255), 255)
1843 call testAsc(Chr(0), 0)
1844 if isEnglishLang
then testAsc
true, 84
1845 if Asc(Chr(&h81
)) = &h8145
then
1847 call testAsc(Chr(&h8e8e
), -29042)
1848 call testAsc(Chr(220), 220)
1852 sub testErrNumber(n
)
1853 call ok(err
.number
= n
, "err.number = " & err
.number
& " expected " & n
)
1857 on error resume next
1858 call ok(err
.number
= 0, "err.number = " & err
.number
)
1860 call ok(err
.number
= 5, "err.number = " & err
.number
)
1862 call ok(err
.number
= 1, "err.number = " & err
.number
)
1864 call ok(err
.number
= 450, "err.number = " & err
.number
)
1865 call testErrNumber(450)
1867 call ok(err
.number
= -32768, "err.number = " & err
.number
)
1869 call ok(err
.number
= -1, "err.number = " & err
.number
)
1871 call ok(err
.number
= 5, "err.number = " & err
.number
)
1872 err
.raise
-3000000000
1873 call ok(err
.number
= 6, "err.number = " & err
.number
)
1875 call ok(err
.number
= -1, "err.number = " & err
.number
)
1877 call ok(err
.number
= -20, "err.number = " & err
.number
)
1879 call ok(err
.number
= 16, "err.number = " & err
.number
)
1881 call ok(err
.number
= 32768, "err.number = " & err
.number
)
1884 call ok(getVT(err
.source
) = "VT_BSTR", "err.source = " & err
.source
)
1885 call ok(getVT(err
.description
) = "VT_BSTR", "err.description = " & err
.description
)
1886 call ok(getVT(err
.helpfile
) = "VT_BSTR", "err.helpfile = " & err
.helpfile
)
1887 call ok(getVT(err
.helpcontext
) = "VT_I4", "err.helpcontext = " & err
.helpcontext
)
1888 call ok(err
.source
= "", "err.source = " & err
.source
)
1889 call ok(err
.description
= "", "err.description = " & err
.description
)
1890 call ok(err
.helpfile
= "", "err.helpfile = " & err
.helpfile
)
1891 call ok(err
.helpcontext
= 0, "err.helpcontext = " & err
.helpcontext
)
1894 call ok(err
.number
= 1, "err.number = " & err
.number
)
1895 call ok(err
.source
= "abc", "err.source = " & err
.source
)
1896 if isEnglishLang
then call ok(err
.description
= "Unknown runtime error", "err.description = " & err
.description
)
1897 call ok(err
.helpfile
= "", "err.helpfile = " & err
.helpfile
)
1899 err
.raise
1, 2, "desc", "hf", 1
1900 call ok(err
.number
= 1, "err.number = " & err
.number
)
1901 call ok(getVT(err
.source
) = "VT_BSTR", "err.source = " & err
.source
)
1902 call ok(err
.source
= "2", "err.source = " & err
.source
)
1903 call ok(err
.description
= "desc", "err.description = " & err
.description
)
1904 call ok(err
.helpfile
= "hf", "err.helpfile = " & err
.helpfile
)
1905 call ok(getVT(err
.helpcontext
) = "VT_I4", "err.helpcontext = " & err
.helpcontext
)
1906 call ok(err
.helpcontext
= 1, "err.helpcontext = " & err
.helpcontext
)
1909 call ok(err
.number
= 5, "err.number = " & err
.number
)
1910 call ok(err
.source
= "2", "err.source = " & err
.source
)
1911 call ok(err
.description
= "desc", "err.description = " & err
.description
)
1912 call ok(err
.helpfile
= "hf", "err.helpfile = " & err
.helpfile
)
1913 call ok(getVT(err
.helpcontext
) = "VT_I4", "err.helpcontext = " & err
.helpcontext
)
1914 call ok(err
.helpcontext
= 1, "err.helpcontext = " & err
.helpcontext
)
1917 err
.raise
&h8007000E
&
1918 call ok(err
.number
= 7, "err.number = " & err
.number
)
1919 if isEnglishLang
then call ok(err
.source
= "Microsoft VBScript runtime error", "err.source = " & err
.source
)
1920 if isEnglishLang
then call ok(err
.description
= "Out of memory", "err.description = " & err
.description
)
1921 call ok(err
.helpfile
= "", "err.helpfile = " & err
.helpfile
)
1922 call ok(err
.helpcontext
= 0, "err.helpcontext = " & err
.helpcontext
)
1926 err
.raise
&h8007000E
&
1927 call ok(err
.number
= 7, "err.number = " & err
.number
)
1928 call ok(err
.source
= "test", "err.source = " & err
.source
)
1929 if isEnglishLang
then call ok(err
.description
= "Unknown runtime error", "err.description = " & err
.description
)
1930 call ok(err
.helpfile
= "", "err.helpfile = " & err
.helpfile
)
1931 call ok(err
.helpcontext
= 0, "err.helpcontext = " & err
.helpcontext
)
1933 err
.raise
1, 2, "desc", "hf", 1
1935 call ok(err
.number
= 438, "err.number = " & err
.number
)
1936 if isEnglishLang
then call ok(err
.source
= "Microsoft VBScript runtime error", "err.source = " & err
.source
)
1937 if isEnglishLang
then call ok(err
.description
= "Object doesn't support this property or method", _
1938 "err.description = " & err
.description
)
1939 call ok(err
.helpfile
= "", "err.helpfile = " & err
.helpfile
)
1940 call ok(err
.helpcontext
= 0, "err.helpcontext = " & err
.helpcontext
)
1943 call ok(getVT(e
) = "VT_I4*", "getVT(e) = " & getVT(e
))
1944 call ok(e
= 438, "e = " & e
)
1946 err
.raise
1, 2, "desc", "hf", 1
1948 call ok(err
.number
= 0, "err.number = " & err
.number
)
1949 call ok(err
.source
= "", "err.source = " & err
.source
)
1950 call ok(err
.description
= "", "err.description = " & err
.description
)
1951 call ok(err
.helpfile
= "", "err.helpfile = " & err
.helpfile
)
1952 call ok(err
.helpcontext
= 0, "err.helpcontext = " & err
.helpcontext
)
1956 call ok(getVT(e
) = "VT_I4*", "getVT(e) = " & getVT(e
))
1957 call ok(e
= 0, "e = " & e
)
1961 Call reportSuccess()