8c92cf5cd4057bfd3390216e4ba958a54a0e4181
[reactos.git] / rostests / winetests / vbscript / api.vbs
1 ' Copyright 2011 Jacek Caban for CodeWeavers
2 '
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.
7 '
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.
12 '
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
16 '
17
18 Option Explicit
19
20 Dim x
21
22 Class EmptyClass
23 End Class
24
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))
39
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))
43 End Sub
44
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))
48 End Sub
49
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))
53 End Sub
54
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)
119
120 Sub TestCStr(arg, exval)
121 dim x
122 x = CStr(arg)
123 Call ok(getVT(x) = "VT_BSTR*", "getVT(x) = " & getVT(x))
124 Call ok(x = exval, "CStr(" & arg & ") = " & x)
125 End Sub
126
127 TestCStr "test", "test"
128 TestCStr 3, "3"
129 if isEnglishLang then TestCStr 3.5, "3.5"
130 if isEnglishLang then TestCStr true, "True"
131
132 Call ok(getVT(Chr(120)) = "VT_BSTR", "getVT(Chr(120)) = " & getVT(Chr(120)))
133 Call ok(getVT(Chr(255)) = "VT_BSTR", "getVT(Chr(255)) = " & getVT(Chr(255)))
134 Call ok(Chr(120) = "x", "Chr(120) = " & Chr(120))
135 Call ok(Chr(0) <> "", "Chr(0) = """"")
136 Call ok(Chr(120.5) = "x", "Chr(120.5) = " & Chr(120.5))
137 Call ok(Chr(119.5) = "x", "Chr(119.5) = " & Chr(119.5))
138 Call ok(Chr("120") = "x", "Chr(""120"") = " & Chr("120"))
139
140 sub testChrError
141 on error resume next
142
143 if isEnglishLang then
144 call Err.clear()
145 call Chr(-1)
146 call ok(Err.number = 5, "Err.number = " & Err.number)
147
148 call Err.clear()
149 call Chr(256)
150 call ok(Err.number = 5, "Err.number = " & Err.number)
151 end if
152
153 call Err.clear()
154 call Chr(65536)
155 call ok(Err.number = 5, "Err.number = " & Err.number)
156
157 call Err.clear()
158 call Chr(-32769)
159 call ok(Err.number = 5, "Err.number = " & Err.number)
160 end sub
161
162 call testChrError
163
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?")
172
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?")
176 x = empty
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?")
184
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?")
188 x = null
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?")
196
197 Call ok(isNumeric(Empty), "isNumeric(empty) is not true?")
198 Call ok(not isNumeric(Null), "isNumeric(Null) is not true?")
199 Call ok(isNumeric(32767), "isNumeric(32767) is true?")
200 Call ok(isNumeric(32768), "isNumeric(32768) is true?")
201 Call ok(isNumeric(CSng(3242.4)), "isNumeric(CSng(3242.4)) is true?")
202 Call ok(isNumeric(32768.4), "isNumeric(32768.4) is true?")
203 Call ok(isNumeric(CCur(32768.4)), "isNumeric(CCur(32768.4)) is true?")
204 Call ok(isNumeric("44"), "isNumeric(""44"") is true?")
205 Call ok(not isNumeric("rwrf"), "isNumeric(""rwrf"") is not true?")
206 Call ok(not isNumeric(Nothing), "isNumeric(Nothing) is not true?")
207 Call ok(not isNumeric(New EmptyClass), "isNumeric(New EmptyClass) is not true?")
208 Call ok(isNumeric(true), "isNumeric(true) is true?")
209 Call ok(isNumeric(CByte(32)), "isNumeric(CByte(32)) is true?")
210 Dim arr(2)
211 arr(0) = 2
212 arr(1) = 3
213 Call ok(not isNumeric(arr), "isNumeric(arr) is not true?")
214
215 Dim newObject
216 Set newObject = New ValClass
217 newObject.myval = 1
218 Call ok(isNumeric(newObject), "isNumeric(newObject) is true?")
219 newObject.myval = "test"
220 Call ok(not isNumeric(newObject), "isNumeric(newObject) is not true?")
221
222 Call ok(getVT(err) = "VT_DISPATCH", "getVT(err) = " & getVT(err))
223
224 Sub TestHex(x, ex)
225 Call ok(hex(x) = ex, "hex(" & x & ") = " & hex(x) & " expected " & ex)
226 End Sub
227
228 TestHex 0, "0"
229 TestHex 6, "6"
230 TestHex 16, "10"
231 TestHex &hdeadbeef&, "DEADBEEF"
232 TestHex -1, "FFFF"
233 TestHex -16, "FFF0"
234 TestHex -934859845, "C8472BBB"
235 TestHex empty, "0"
236
237 Call ok(getVT(hex(null)) = "VT_NULL", "getVT(hex(null)) = " & getVT(hex(null)))
238 Call ok(getVT(hex(empty)) = "VT_BSTR", "getVT(hex(empty)) = " & getVT(hex(empty)))
239
240 x = InStr(1, "abcd", "bc")
241 Call ok(x = 2, "InStr returned " & x)
242
243 x = InStr("abcd", "bc")
244 Call ok(x = 2, "InStr returned " & x)
245 Call ok(getVT(x) = "VT_I4*", "getVT(InStr) returned " & getVT(x))
246
247 x = InStr("abc", "bc")
248 Call ok(x = 2, "InStr returned " & x)
249
250 x = InStr("abcbc", "bc")
251 Call ok(x = 2, "InStr returned " & x)
252
253 x = InStr("bcabc", "bc")
254 Call ok(x = 1, "InStr returned " & x)
255
256 x = InStr(3, "abcd", "bc")
257 Call ok(x = 0, "InStr returned " & x)
258
259 x = InStr("abcd", "bcx")
260 Call ok(x = 0, "InStr returned " & x)
261
262 x = InStr(5, "abcd", "bc")
263 Call ok(x = 0, "InStr returned " & x)
264
265 x = "abcd"
266 x = InStr(x, "bc")
267 Call ok(x = 2, "InStr returned " & x)
268
269 x = InStr("abcd", null)
270 Call ok(isNull(x), "InStr returned " & x)
271 x = InStr(null, "abcd")
272 Call ok(isNull(x), "InStr returned " & x)
273 x = InStr(2, null, "abcd")
274 Call ok(isNull(x), "InStr returned " & x)
275
276 x = InStr(1.3, "abcd", "bc")
277 Call ok(x = 2, "InStr returned " & x)
278
279 x = InStr(2.3, "abcd", "bc")
280 Call ok(x = 2, "InStr returned " & x)
281
282 x = InStr(2.6, "abcd", "bc")
283 Call ok(x = 0, "InStr returned " & x)
284
285
286 x = InStrRev("bcabcd", "bc")
287 Call ok(x = 4, "InStrRev returned " & x)
288 Call ok(getVT(x) = "VT_I4*", "getVT(InStrRev) returned " & getVT(x))
289
290 x = InStrRev("bcabcd", "bc", 6)
291 Call ok(x = 4, "InStrRev returned " & x)
292
293 x = InStrRev("abcd", "bcx")
294 Call ok(x = 0, "InStrRev returned " & x)
295
296 x = InStrRev("abcd", "bc", 3)
297 Call ok(x = 2, "InStrRev returned " & x)
298
299 x = InStrRev("abcd", "bc", 2)
300 Call ok(x = 0, "InStrRev returned " & x)
301
302 x = InStrRev("abcd", "b", 2)
303 Call ok(x = 2, "InStrRev returned " & x)
304
305 x = InStrRev("abcd", "bc", 5)
306 Call ok(x = 0, "InStrRev returned " & x)
307
308 x = InStrRev("abcd", "bc", 15)
309 Call ok(x = 0, "InStrRev returned " & x)
310
311 x = "abcd"
312 x = InStrRev(x, "bc")
313 Call ok(x = 2, "InStrRev returned " & x)
314
315 x = InStrRev("abcd", "bc", 1.3)
316 Call ok(x = 0, "InStrRev returned " & x)
317
318 x = InStrRev("abcd", "bc", 2.3)
319 Call ok(x = 0, "InStrRev returned " & x)
320
321 x = InStrRev("abcd", "bc", 2.6)
322 Call ok(x = 2, "InStrRev returned " & x)
323
324 x = InStrRev("1234", 34)
325 Call ok(x = 3, "InStrRev returned " & x)
326
327 x = InStrRev(1234, 34)
328 Call ok(x = 3, "InStrRev returned " & x)
329
330 Sub testInStrRevError(arg1, arg2, arg3, error_num)
331 on error resume next
332 Dim x
333
334 Call Err.clear()
335 x = InStrRev(arg1, arg2, arg3)
336 Call ok(Err.number = error_num, "Err.number = " & Err.number)
337 End Sub
338
339 call testInStrRevError("abcd", null, 2, 94)
340 call testInStrRevError(null, "abcd", 2, 94)
341 call testInStrRevError("abcd", "abcd", null, 94)
342
343 Sub TestMid(str, start, len, ex)
344 x = Mid(str, start, len)
345 Call ok(x = ex, "Mid(" & str & ", " & start & ", " & len & ") = " & x & " expected " & ex)
346 End Sub
347
348 Sub TestMid2(str, start, ex)
349 x = Mid(str, start)
350 Call ok(x = ex, "Mid(" & str & ", " & start & ") = " & x & " expected " & ex)
351 End Sub
352
353 TestMid "test", 2, 2, "es"
354 TestMid "test", 2, 4, "est"
355 TestMid "test", 1, 2, "te"
356 TestMid "test", 1, 0, ""
357 TestMid "test", 1, 0, ""
358 TestMid "test", 5, 2, ""
359 TestMid2 "test", 1, "test"
360 TestMid2 "test", 2, "est"
361 TestMid2 "test", 4, "t"
362 TestMid2 "test", 5, ""
363
364 Sub TestUCase(str, ex)
365 x = UCase(str)
366 Call ok(x = ex, "UCase(" & str & ") = " & x & " expected " & ex)
367 End Sub
368
369 TestUCase "test", "TEST"
370 TestUCase "123aBC?", "123ABC?"
371 TestUCase "", ""
372 TestUCase 1, "1"
373 if isEnglishLang then TestUCase true, "TRUE"
374 TestUCase 0.123, doubleAsString(0.123)
375 TestUCase Empty, ""
376 Call ok(getVT(UCase(Null)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null)))
377
378 Sub TestLCase(str, ex)
379 x = LCase(str)
380 Call ok(x = ex, "LCase(" & str & ") = " & x & " expected " & ex)
381 End Sub
382
383 TestLCase "test", "test"
384 TestLCase "123aBC?", "123abc?"
385 TestLCase "", ""
386 TestLCase 1, "1"
387 if isEnglishLang then TestLCase true, "true"
388 TestLCase 0.123, doubleAsString(0.123)
389 TestLCase Empty, ""
390 Call ok(getVT(LCase(Null)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null)))
391
392 Call ok(Len("abc") = 3, "Len(abc) = " & Len("abc"))
393 Call ok(Len("") = 0, "Len() = " & Len(""))
394 Call ok(Len(1) = 1, "Len(1) = " & Len(1))
395 Call ok(isNull(Len(null)), "Len(null) = " & Len(null))
396 Call ok(Len(empty) = 0, "Len(empty) = " & Len(empty))
397 Call ok(getVT(Len("abc")) = "VT_I4", "getVT(Len(abc)) = " & getVT(Len("abc")))
398
399 Call ok(Space(1) = " ", "Space(1) = " & Space(1) & """")
400 Call ok(Space(0) = "", "Space(0) = " & Space(0) & """")
401 Call ok(Space(false) = "", "Space(false) = " & Space(false) & """")
402 Call ok(Space(5) = " ", "Space(5) = " & Space(5) & """")
403 Call ok(Space(5.2) = " ", "Space(5.2) = " & Space(5.2) & """")
404 Call ok(Space(5.8) = " ", "Space(5.8) = " & Space(5.8) & """")
405 Call ok(Space(5.5) = " ", "Space(5.5) = " & Space(5.5) & """")
406 Call ok(Space(4.5) = " ", "Space(4.5) = " & Space(4.5) & """")
407 Call ok(Space(0.5) = "", "Space(0.5) = " & Space(0.5) & """")
408 Call ok(Space(1.5) = " ", "Space(1.5) = " & Space(1.5) & """")
409 Call ok(Space("1") = " ", "Space(""1"") = " & Space("1") & """")
410
411 Sub TestStrReverse(str, ex)
412 Call ok(StrReverse(str) = ex, "StrReverse(" & str & ") = " & StrReverse(str))
413 End Sub
414
415 TestStrReverse "test", "tset"
416 TestStrReverse "", ""
417 TestStrReverse 123, "321"
418 if isEnglishLang then TestStrReverse true, "eurT"
419
420 Sub TestLeft(str, len, ex)
421 Call ok(Left(str, len) = ex, "Left(" & str & ", " & len & ") = " & Left(str, len))
422 End Sub
423
424 TestLeft "test", 2, "te"
425 TestLeft "test", 5, "test"
426 TestLeft "test", 0, ""
427 TestLeft 123, 2, "12"
428 TestLeft "123456", 1.5, "12"
429 TestLeft "123456", 2.5, "12"
430 TestLeft "test", "2", "te"
431 if isEnglishLang then TestLeft true, 2, "Tr"
432
433 Sub TestRight(str, len, ex)
434 Call ok(Right(str, len) = ex, "Right(" & str & ", " & len & ") = " & Right(str, len))
435 End Sub
436
437 TestRight "test", 2, "st"
438 TestRight "test", 5, "test"
439 TestRight "test", 0, ""
440 TestRight 123, 2, "23"
441 if isEnglishLang then TestRight true, 2, "ue"
442
443 Sub TestTrim(str, exstr)
444 Call ok(Trim(str) = exstr, "Trim(" & str & ") = " & Trim(str))
445 End Sub
446
447 TestTrim " test ", "test"
448 TestTrim "test ", "test"
449 TestTrim " test", "test"
450 TestTrim "test", "test"
451 TestTrim "", ""
452 TestTrim 123, "123"
453 if isEnglishLang then TestTrim true, "True"
454
455 Sub TestLTrim(str, exstr)
456 Call ok(LTrim(str) = exstr, "LTrim(" & str & ") = " & LTrim(str))
457 End Sub
458
459 TestLTrim " test ", "test "
460 TestLTrim "test ", "test "
461 TestLTrim " test", "test"
462 TestLTrim "test", "test"
463 TestLTrim "", ""
464 TestLTrim 123, "123"
465 if isEnglishLang then TestLTrim true, "True"
466
467 Sub TestRound(val, exval, vt)
468 Call ok(Round(val) = exval, "Round(" & val & ") = " & Round(val))
469 Call ok(getVT(Round(val)) = vt, "getVT(Round(" & val & ")) = " & getVT(Round(val)))
470 End Sub
471
472 Sub TestRTrim(str, exstr)
473 Call ok(RTrim(str) = exstr, "RTrim(" & str & ") = " & RTrim(str))
474 End Sub
475
476 TestRTrim " test ", " test"
477 TestRTrim "test ", "test"
478 TestRTrim " test", " test"
479 TestRTrim "test", "test"
480 TestRTrim "", ""
481 TestRTrim 123, "123"
482 if isEnglishLang then TestRTrim true, "True"
483
484 TestRound 3, 3, "VT_I2"
485 TestRound 3.3, 3, "VT_R8"
486 TestRound 3.8, 4, "VT_R8"
487 TestRound 3.5, 4, "VT_R8"
488 TestRound -3.3, -3, "VT_R8"
489 TestRound -3.5, -4, "VT_R8"
490 TestRound "2", 2, "VT_R8"
491 TestRound true, true, "VT_BOOL"
492 TestRound false, false, "VT_BOOL"
493
494 if isEnglishLang then
495 Call ok(WeekDayName(1) = "Sunday", "WeekDayName(1) = " & WeekDayName(1))
496 Call ok(WeekDayName(3) = "Tuesday", "WeekDayName(3) = " & WeekDayName(3))
497 Call ok(WeekDayName(7) = "Saturday", "WeekDayName(7) = " & WeekDayName(7))
498 Call ok(WeekDayName(1.1) = "Sunday", "WeekDayName(1.1) = " & WeekDayName(1.1))
499 Call ok(WeekDayName(1, false) = "Sunday", "WeekDayName(1, false) = " & WeekDayName(1, false))
500 Call ok(WeekDayName(1, true) = "Sun", "WeekDayName(1, true) = " & WeekDayName(1, true))
501 Call ok(WeekDayName(1, 10) = "Sun", "WeekDayName(1, 10) = " & WeekDayName(1, 10))
502 Call ok(WeekDayName(1, true, 0) = "Sun", "WeekDayName(1, true, 0) = " & WeekDayName(1, true, 0))
503 Call ok(WeekDayName(1, true, 2) = "Mon", "WeekDayName(1, true, 2) = " & WeekDayName(1, true, 2))
504 Call ok(WeekDayName(1, true, 2.5) = "Mon", "WeekDayName(1, true, 2.5) = " & WeekDayName(1, true, 2.5))
505 Call ok(WeekDayName(1, true, 1.5) = "Mon", "WeekDayName(1, true, 1.5) = " & WeekDayName(1, true, 1.5))
506 Call ok(WeekDayName(1, true, 7) = "Sat", "WeekDayName(1, true, 7) = " & WeekDayName(1, true, 7))
507 Call ok(WeekDayName(1, true, 7.1) = "Sat", "WeekDayName(1, true, 7.1) = " & WeekDayName(1, true, 7.1))
508
509 Call ok(MonthName(1) = "January", "MonthName(1) = " & MonthName(1))
510 Call ok(MonthName(12) = "December", "MonthName(12) = " & MonthName(12))
511 Call ok(MonthName(1, 0) = "January", "MonthName(1, 0) = " & MonthName(1, 0))
512 Call ok(MonthName(12, false) = "December", "MonthName(12, false) = " & MonthName(12, false))
513 Call ok(MonthName(1, 10) = "Jan", "MonthName(1, 10) = " & MonthName(1, 10))
514 Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true))
515 end if
516
517 Call ok(getVT(Now()) = "VT_DATE", "getVT(Now()) = " & getVT(Now()))
518
519 Call ok(vbOKOnly = 0, "vbOKOnly = " & vbOKOnly)
520 Call ok(getVT(vbOKOnly) = "VT_I2", "getVT(vbOKOnly) = " & getVT(vbOKOnly))
521 Call ok(vbOKCancel = 1, "vbOKCancel = " & vbOKCancel)
522 Call ok(getVT(vbOKCancel) = "VT_I2", "getVT(vbOKCancel) = " & getVT(vbOKCancel))
523 Call ok(vbAbortRetryIgnore = 2, "vbAbortRetryIgnore = " & vbAbortRetryIgnore)
524 Call ok(getVT(vbAbortRetryIgnore) = "VT_I2", "getVT(vbAbortRetryIgnore) = " & getVT(vbAbortRetryIgnore))
525 Call ok(vbYesNoCancel = 3, "vbYesNoCancel = " & vbYesNoCancel)
526 Call ok(getVT(vbYesNoCancel) = "VT_I2", "getVT(vbYesNoCancel) = " & getVT(vbYesNoCancel))
527 Call ok(vbYesNo = 4, "vbYesNo = " & vbYesNo)
528 Call ok(getVT(vbYesNo) = "VT_I2", "getVT(vbYesNo) = " & getVT(vbYesNo))
529 Call ok(vbRetryCancel = 5, "vbRetryCancel = " & vbRetryCancel)
530 Call ok(getVT(vbRetryCancel) = "VT_I2", "getVT(vbRetryCancel) = " & getVT(vbRetryCancel))
531
532 Call ok(vbOK = 1, "vbOK = " & vbOK)
533 Call ok(getVT(vbOK) = "VT_I2", "getVT(vbOK) = " & getVT(vbOK))
534 Call ok(vbCancel = 2, "vbCancel = " & vbCancel)
535 Call ok(getVT(vbCancel) = "VT_I2", "getVT(vbCancel) = " & getVT(vbCancel))
536 Call ok(vbAbort = 3, "vbAbort = " & vbAbort)
537 Call ok(getVT(vbAbort) = "VT_I2", "getVT(vbAbort) = " & getVT(vbAbort))
538 Call ok(vbRetry = 4, "vbRetry = " & vbRetry)
539 Call ok(getVT(vbRetry) = "VT_I2", "getVT(vbRetry) = " & getVT(vbRetry))
540 Call ok(vbIgnore = 5, "vbIgnore = " & vbIgnore)
541 Call ok(getVT(vbIgnore) = "VT_I2", "getVT(vbIgnore) = " & getVT(vbIgnore))
542 Call ok(vbYes = 6, "vbYes = " & vbYes)
543 Call ok(getVT(vbYes) = "VT_I2", "getVT(vbYes) = " & getVT(vbYes))
544 Call ok(vbNo = 7, "vbNo = " & vbNo)
545 Call ok(getVT(vbNo) = "VT_I2", "getVT(vbNo) = " & getVT(vbNo))
546
547 Call ok(CInt(-36.75) = -37, "CInt(-36.75) = " & CInt(-36.75))
548 Call ok(getVT(CInt(-36.75)) = "VT_I2", "getVT(CInt(-36.75)) = " & getVT(CInt(-36.75)))
549 Call ok(CInt(-36.50) = -36, "CInt(-36.50) = " & CInt(-36.50))
550 Call ok(getVT(CInt(-36.50)) = "VT_I2", "getVT(CInt(-36.50)) = " & getVT(CInt(-36.50)))
551 Call ok(CInt(-36.25) = -36, "CInt(-36.25) = " & CInt(-36.25))
552 Call ok(getVT(CInt(-36.25)) = "VT_I2", "getVT(CInt(-36.25)) = " & getVT(CInt(-36.25)))
553 Call ok(CInt(-36) = -36, "CInt(-36) = " & CInt(-36))
554 Call ok(getVT(CInt(-36)) = "VT_I2", "getVT(CInt(-36)) = " & getVT(CInt(-36)))
555 Call ok(CInt(0) = 0, "CInt(0) = " & CInt(0))
556 Call ok(getVT(CInt(0)) = "VT_I2", "getVT(CInt(0)) = " & getVT(CInt(0)))
557 Call ok(CInt(0.0) = 0, "CInt(0.0) = " & CInt(0))
558 Call ok(getVT(CInt(0.0)) = "VT_I2", "getVT(CInt(0.0)) = " & getVT(CInt(0.0)))
559 Call ok(CInt(0.5) = 0, "CInt(0.5) = " & CInt(0))
560 Call ok(getVT(CInt(0.5)) = "VT_I2", "getVT(CInt(0.5)) = " & getVT(CInt(0.5)))
561 Call ok(CInt(36) = 36, "CInt(36) = " & CInt(36))
562 Call ok(getVT(CInt(36)) = "VT_I2", "getVT(CInt(36)) = " & getVT(CInt(36)))
563 Call ok(CInt(36.25) = 36, "CInt(36.25) = " & CInt(36.25))
564 Call ok(getVT(CInt(36.25)) = "VT_I2", "getVT(CInt(36.25)) = " & getVT(CInt(36.25)))
565 Call ok(CInt(36.50) = 36, "CInt(36.50) = " & CInt(36.50))
566 Call ok(getVT(CInt(36.50)) = "VT_I2", "getVT(CInt(36.50)) = " & getVT(CInt(36.50)))
567 Call ok(CInt(36.75) = 37, "CInt(36.75) = " & CInt(36.75))
568 Call ok(getVT(CInt(36.75)) = "VT_I2", "getVT(CInt(36.75)) = " & getVT(CInt(36.75)))
569
570
571 Call ok(CBool(5) = true, "CBool(5) = " & CBool(5))
572 Call ok(getVT(CBool(5)) = "VT_BOOL", "getVT(CBool(5)) = " & getVT(CBool(5)))
573 Call ok(CBool(0) = false, "CBool(0) = " & CBool(0))
574 Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))
575 Call ok(CBool(-5) = true, "CBool(-5) = " & CBool(-5))
576 Call ok(getVT(CBool(-5)) = "VT_BOOL", "getVT(CBool(-5)) = " & getVT(CBool(-5)))
577
578 Sub testCBoolError(strings, error_num)
579 on error resume next
580
581 Call Err.clear()
582 Call CBool(strings)
583 Call ok(Err.number = error_num, "Err.number = " & Err.number)
584 End Sub
585
586 Class ValClass
587 Public myval
588
589 Public default Property Get defprop
590 defprop = myval
591 End Property
592 End Class
593
594 Dim MyObject
595 Set MyObject = New ValClass
596
597 Call ok(CBool(Empty) = False, "CBool(Empty) = " & CBool(Empty))
598 Call ok(getVT(CBool(Empty)) = "VT_BOOL", "getVT(CBool(Empty)) = " & getVT(CBool(Empty)))
599 Call ok(CBool(1) = True, "CBool(1) = " & CBool(1))
600 Call ok(getVT(CBool(1)) = "VT_BOOL", "getVT(CBool(1)) = " & getVT(CBool(1)))
601 Call ok(CBool(0) = False, "CBool(0) = " & CBool(0))
602 Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))
603 Call ok(CBool(-0.56) = True, "CBool(-0.56) = " & CBool(-0.56))
604 Call ok(getVT(CBool(-0.56)) = "VT_BOOL", "getVT(CBool(-0.56)) = " & getVT(CBool(-0.56)))
605 Call testCBoolError("", 13)
606 Call ok(CBool("0") = False, "CBool(""0"") = " & CBool("0"))
607 Call ok(getVT(CBool("0")) = "VT_BOOL", "getVT(CBool(""0"")) = " & getVT(CBool("0")))
608 If isEnglishLang Then
609 Call ok(CBool("0.1") = True, "CBool(""0.1"") = " & CBool("0.1"))
610 Call ok(getVT(CBool("0.1")) = "VT_BOOL", "getVT(CBool(""0.1"")) = " & getVT(CBool("0.1")))
611 End If
612 Call ok(CBool("true") = True, "CBool(""true"") = " & CBool("true"))
613 Call ok(getVT(CBool("true")) = "VT_BOOL", "getVT(CBool(""true"")) = " & getVT(CBool("true")))
614 Call ok(CBool("false") = False, "CBool(""false"") = " & CBool("false"))
615 Call ok(getVT(CBool("false")) = "VT_BOOL", "getVT(CBool(""false"")) = " & getVT(CBool("false")))
616 Call ok(CBool("TRUE") = True, "CBool(""TRUE"") = " & CBool("TRUE"))
617 Call ok(getVT(CBool("TRUE")) = "VT_BOOL", "getVT(CBool(""TRUE"")) = " & getVT(CBool("TRUE")))
618 Call ok(CBool("FALSE") = False, "CBool(""FALSE"") = " & CBool("FALSE"))
619 Call ok(getVT(CBool("FALSE")) = "VT_BOOL", "getVT(CBool(""FALSE"")) = " & getVT(CBool("FALSE")))
620 Call ok(CBool("#TRUE#") = True, "CBool(""#TRUE#"") = " & CBool("#TRUE#"))
621 Call ok(getVT(CBool("#TRUE#")) = "VT_BOOL", "getVT(CBool(""#TRUE#"")) = " & getVT(CBool("#TRUE#")))
622 Call ok(CBool("#FALSE#") = False, "CBool(""#FALSE#"") = " & CBool("#FALSE#"))
623 Call ok(getVT(CBool("#FALSE#")) = "VT_BOOL", "getVT(CBool(""#FALSE#"")) = " & getVT(CBool("#FALSE#")))
624 Call ok(CBool(MyObject) = False, "CBool(MyObject) = " & CBool(MyObject))
625 Call ok(getVT(CBool(MyObject)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject)))
626 MyObject.myval = 1
627 Call ok(CBool(MyObject) = True, "CBool(MyObject) = " & CBool(MyObject))
628 Call ok(getVT(CBool(MyObject)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject)))
629 MyObject.myval = 0
630 Call ok(CBool(MyObject) = False, "CBool(MyObject) = " & CBool(MyObject))
631 Call ok(getVT(CBool(MyObject)) = "VT_BOOL", "getVT(CBool(MyObject)) = " & getVT(CBool(MyObject)))
632
633 Sub testCByteError(strings, error_num1,error_num2)
634 on error resume next
635 Dim x
636
637 Call Err.clear()
638 x = CByte(strings)
639 Call ok(Err.number = error_num1, "Err.number = " & Err.number)
640
641 Call Err.clear()
642 Call CByte(strings)
643 Call ok(Err.number = error_num2, "Err.number = " & Err.number)
644 End Sub
645
646 Call ok(CByte(Empty) = 0, "CByte(Empty) = " & CByte(Empty))
647 Call ok(getVT(CByte(Empty)) = "VT_UI1", "getVT(CByte(Empty)) = " & getVT(CByte(Empty)))
648 Call ok(CByte(255) = 255, "CByte(255) = " & CByte(255))
649 Call ok(getVT(CByte(255)) = "VT_UI1", "getVT(CByte(255)) = " & getVT(CByte(255)))
650 Call ok(CByte(255.49) = 255, "CByte(255.49) = " & CByte(255.49))
651 Call ok(getVT(CByte(255.49)) = "VT_UI1", "getVT(CByte(255.49)) = " & getVT(CByte(255.49)))
652 Call testCByteError(1, 0, 458)
653 Call testCByteError("", 13, 13)
654 Call testCByteError("-1", 6, 6)
655 Call testCByteError("258", 6, 6)
656 Call testCByteError("TRUE", 13, 13)
657 Call testCByteError("FALSE", 13, 13)
658 Call testCByteError("#TRue#", 13, 13)
659 Call testCByteError("#fAlSE#", 13, 13)
660 If isEnglishLang Then
661 Call ok(CByte("-0.5") = 0, "CByte(""-0.5"") = " & CByte("-0.5"))
662 Call ok(getVT(CByte("-0.5")) = "VT_UI1", "getVT(CByte(""-0.5"")) = " & getVT(CByte("-0.5")))
663 End If
664 Call ok(CByte(True) = 255, "CByte(True) = " & CByte(True))
665 Call ok(getVT(CByte(True)) = "VT_UI1", "getVT(CByte(True)) = " & getVT(CByte(True)))
666 Call ok(CByte(False) = 0, "CByte(False) = " & CByte(False))
667 Call ok(getVT(CByte(False)) = "VT_UI1", "getVT(CByte(False)) = " & getVT(CByte(False)))
668 Call ok(CByte(MyObject) = 0, "CByte(MyObject) = " & CByte(MyObject))
669 Call ok(getVT(CByte(MyObject)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject)))
670 MyObject.myval = 1
671 Call ok(CByte(MyObject) = 1, "CByte(MyObject) = " & CByte(MyObject))
672 Call ok(getVT(CByte(MyObject)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject)))
673 MyObject.myval = 0
674 Call ok(CByte(MyObject) = 0, "CByte(MyObject) = " & CByte(MyObject))
675 Call ok(getVT(CByte(MyObject)) = "VT_UI1", "getVT(CByte(MyObject)) = " & getVT(CByte(MyObject)))
676
677 Sub testCCurError(strings, error_num1, error_num2)
678 on error resume next
679 Dim x
680
681 Call Err.clear()
682 x = CCur(strings)
683 Call ok(Err.number = error_num1, "Err.number = " & Err.number)
684
685 Call Err.clear()
686 Call CCur(strings)
687 Call ok(Err.number = error_num2, "Err.number = " & Err.number)
688 End Sub
689
690 Call ok(CCur(Empty) = 0, "CCur(Empty) = " & CCur(Empty))
691 Call ok(getVT(CCur(Empty)) = "VT_CY", "getVT(CCur(Empty)) = " & getVT(CCur(Empty)))
692 Call ok(CCur(-32768) = -32768, "CCur(-32768) = " & CCur(-32768))
693 Call ok(getVT(CCur(-32768)) = "VT_CY", "getVT(CCur(-32768)) = " & getVT(CCur(-32768)))
694 Call ok(CCur(32768) = 32768, "CCur(32768) = " & CCur(32768))
695 Call ok(getVT(CCur(32768)) = "VT_CY", "getVT(CCur(32768)) = " & getVT(CCur(32768)))
696 Call ok(CCur(0.000149) = 0.0001, "CCur(0.000149) = " & CCur(0.000149))
697 Call ok(getVT(CCur(0.000149)) = "VT_CY", "getVT(CCur(0.000149)) = " & getVT(CCur(0.000149)))
698 Call ok(CCur(2147483647.99) = 2147483647.99, "CCur(2147483647.99) = " & CCur(2147483647.99))
699 Call ok(getVT(CCur(2147483647.99)) = "VT_CY", "getVT(CCur(2147483647.99)) = " & getVT(CCur(2147483647.99)))
700 Call ok(CCur("-1") = -1, "CCur(""-1"") = " & CCur("-1"))
701 Call ok(getVT(CCur("-1")) = "VT_CY", "getVT(CCur(""-1"")) = " & getVT(CCur("-1")))
702 If isEnglishLang Then
703 Call ok(CCur("-0.5") = -0.5, "CCur(""-0.5"") = " & CCur("-0.5"))
704 Call ok(getVT(CCur("-0.5")) = "VT_CY", "getVT(CCur(""-0.5"")) = " & getVT(CCur("-0.5")))
705 End If
706 Call testCCurError("", 13, 13)
707 Call testCCurError("-1", 0, 458)
708 Call testCCurError("TRUE", 13, 13)
709 Call testCCurError("FALSE", 13, 13)
710 Call testCCurError("#TRue#", 13, 13)
711 Call testCCurError("#fAlSE#", 13, 13)
712 Call testCCurError(1, 0, 458)
713 Call ok(CCur(True) = -1, "CCur(True) = " & CCur(True))
714 Call ok(getVT(CCur(True)) = "VT_CY", "getVT(CCur(True)) = " & getVT(CCur(True)))
715 Call ok(CCur(False) = 0, "CCur(False) = " & CCur(False))
716 Call ok(getVT(CCur(False)) = "VT_CY", "getVT(CCur(False)) = " & getVT(CCur(False)))
717 MyObject.myval = 0.1
718 Call ok(CCur(MyObject) = 0.1, "CCur(MyObject) = " & CCur(MyObject))
719 Call ok(getVT(CCur(MyObject)) = "VT_CY", "getVT(CCur(MyObject)) = " & getVT(CCur(MyObject)))
720 MyObject.myval = 0
721 Call ok(CCur(MyObject) = 0, "CCur(MyObject) = " & CCur(MyObject))
722 Call ok(getVT(CCur(MyObject)) = "VT_CY", "getVT(CCur(MyObject)) = " & getVT(CCur(MyObject)))
723
724 Sub testCDblError(strings, error_num1, error_num2)
725 on error resume next
726 Dim x
727
728 Call Err.clear()
729 x = CDbl(strings)
730 Call ok(Err.number = error_num1, "Err.number = " & Err.number)
731
732 Call Err.clear()
733 Call CDbl(strings)
734 Call ok(Err.number = error_num2, "Err.number = " & Err.number)
735 End Sub
736
737 Call ok(CDbl(Empty) = 0, "CDbl(Empty) = " & CDbl(Empty))
738 Call ok(getVT(CDbl(Empty)) = "VT_R8", "getVT(CDbl(Empty)) = " & getVT(CDbl(Empty)))
739 Call ok(CDbl(CByte(0)) = 0, "CDbl(CByte(0)) = " & CDbl(CByte(0)))
740 Call ok(getVT(CDbl(CCur(0))) = "VT_R8", "getVT(CDbl(CCur(0))) = " & getVT(CDbl(CCur(0))))
741 Call ok(CDbl(CCur(0)) = 0, "CDbl(CCur(0)) = " & CDbl(CCur(0)))
742 Call ok(getVT(CDbl(CCur(0))) = "VT_R8", "getVT(CDbl(CCur(0))) = " & getVT(CDbl(CCur(0))))
743 Call ok(CDbl(0) = 0, "CDbl(0) = " & CDbl(0))
744 Call ok(getVT(CDbl(0)) = "VT_R8", "getVT(CDbl(0)) = " & getVT(CDbl(0)))
745 Call ok(CDbl(32768) = 32768, "CDbl(32768) = " & CDbl(32768))
746 Call ok(getVT(CDbl(32768)) = "VT_R8", "getVT(CDbl(32768)) = " & getVT(CDbl(32768)))
747 Call ok(CDbl(0.001 * 0.001) = 0.000001, "CDbl(0.001 * 0.001) = " & CDbl(0.001 * 0.001))
748 Call ok(getVT(CDbl(0.001 * 0.001)) = "VT_R8", "getVT(CDbl(0.001 * 0.001)) = " & getVT(CDbl(0.001 * 0.001)))
749 Call ok(CDbl("-1") = -1, "CDbl(""-1"") = " & CDbl("-1"))
750 Call ok(getVT(CDbl("-1")) = "VT_R8", "getVT(CDbl(""-1"")) = " & getVT(CDbl("-1")))
751 If isEnglishLang Then
752 Call ok(CDbl("-0.5") = -0.5, "CDbl(""-0.5"") = " & CDbl("-0.5"))
753 Call ok(getVT(CDbl("-0.5")) = "VT_R8", "getVT(CDbl(""-0.5"")) = " & getVT(CDbl("-0.5")))
754 End If
755 Call testCDblError("", 13, 13)
756 Call testCDblError("TRUE", 13, 13)
757 Call testCDblError("FALSE", 13, 13)
758 Call testCDblError("#TRue#", 13, 13)
759 Call testCDblError("#fAlSE#", 13, 13)
760 Call testCDblError(1, 0, 458)
761 Call ok(CDbl(True) = -1, "CDbl(True) = " & CDbl(True))
762 Call ok(getVT(CDbl(True)) = "VT_R8", "getVT(CDbl(True)) = " & getVT(CDbl(True)))
763 Call ok(CDbl(False) = 0, "CDbl(False) = " & CDbl(False))
764 Call ok(getVT(CDbl(False)) = "VT_R8", "getVT(CDbl(False)) = " & getVT(CDbl(False)))
765 MyObject.myval = 0.1
766 Call ok(CDbl(MyObject) = 0.1, "CDbl(MyObject) = " & CDbl(MyObject))
767 Call ok(getVT(CDbl(MyObject)) = "VT_R8", "getVT(CDbl(MyObject)) = " & getVT(CDbl(MyObject)))
768 MyObject.myval = 0
769 Call ok(CDbl(MyObject) = 0, "CDbl(MyObject) = " & CDbl(MyObject))
770 Call ok(getVT(CDbl(MyObject)) = "VT_R8", "getVT(CDbl(MyObject)) = " & getVT(CDbl(MyObject)))
771
772 Sub testCLngError(strings, error_num1, error_num2)
773 on error resume next
774 Dim x
775
776 Call Err.clear()
777 x = CLng(strings)
778 Call ok(Err.number = error_num1, "Err.number = " & Err.number)
779
780 Call Err.clear()
781 Call CLng(strings)
782 Call ok(Err.number = error_num2, "Err.number = " & Err.number)
783 End Sub
784
785 Call ok(CLng(Empty) = 0, "CLng(Empty) = " & CLng(Empty))
786 Call ok(getVT(CLng(Empty)) = "VT_I4", "getVT(CLng(Empty)) = " & getVT(CLng(Empty)))
787 Call ok(CLng(CByte(0)) = 0, "CLng(CByte(0)) = " & CLng(CByte(0)))
788 Call ok(getVT(CLng(CCur(0))) = "VT_I4", "getVT(CLng(CCur(0))) = " & getVT(CLng(CCur(0))))
789 Call ok(CLng(CCur(0)) = 0, "CLng(CCur(0)) = " & CLng(CCur(0)))
790 Call ok(getVT(CLng(CCur(0))) = "VT_I4", "getVT(CLng(CCur(0))) = " & getVT(CLng(CCur(0))))
791 Call ok(CLng(0) = 0, "CLng(0) = " & CLng(0))
792 Call ok(getVT(CLng(0)) = "VT_I4", "getVT(CLng(0)) = " & getVT(CLng(0)))
793 Call ok(CLng(0.49) = 0, "CLng(0.49) = " & CLng(0.49))
794 Call ok(getVT(CLng(0.49)) = "VT_I4", "getVT(CLng(0.49)) = " & getVT(CLng(0.49)))
795 Call ok(CLng(0.5) = 0, "CLng(0.5) = " & CLng(0.5))
796 Call ok(getVT(CLng(0.5)) = "VT_I4", "getVT(CLng(0.5)) = " & getVT(CLng(0.5)))
797 Call ok(CLng(0.51) = 1, "CLng(0.51) = " & CLng(0.51))
798 Call ok(getVT(CLng(0.51)) = "VT_I4", "getVT(CLng(0.51)) = " & getVT(CLng(0.51)))
799 Call ok(CLng(1.49) = 1, "CLng(1.49) = " & CLng(1.49))
800 Call ok(getVT(CLng(1.49)) = "VT_I4", "getVT(CLng(1.49)) = " & getVT(CLng(1.49)))
801 Call ok(CLng(1.5) = 2, "CLng(1.5) = " & CLng(1.5))
802 Call ok(getVT(CLng(1.5)) = "VT_I4", "getVT(CLng(1.5)) = " & getVT(CLng(1.5)))
803 Call ok(CLng(1.51) = 2, "CLng(1.51) = " & CLng(1.51))
804 Call ok(getVT(CLng(1.51)) = "VT_I4", "getVT(CLng(1.51)) = " & getVT(CLng(1.51)))
805 Call ok(CLng("-1") = -1, "CLng(""-1"") = " & CLng("-1"))
806 Call ok(getVT(CLng("-1")) = "VT_I4", "getVT(CLng(""-1"")) = " & getVT(CLng("-1")))
807 If isEnglishLang Then
808 Call ok(CLng("-0.5") = 0, "CLng(""-0.5"") = " & CLng("-0.5"))
809 Call ok(getVT(CLng("-0.5")) = "VT_I4", "getVT(CLng(""-0.5"")) = " & getVT(CLng("-0.5")))
810 End If
811 Call testCLngError("", 13, 13)
812 Call testCLngError("TRUE", 13, 13)
813 Call testCLngError("FALSE", 13, 13)
814 Call testCLngError("#TRue#", 13, 13)
815 Call testCLngError("#fAlSE#", 13, 13)
816 Call testCLngError(1, 0, 458)
817 Call ok(CLng(True) = -1, "CLng(True) = " & CLng(True))
818 Call ok(getVT(CLng(True)) = "VT_I4", "getVT(CLng(True)) = " & getVT(CLng(True)))
819 Call ok(CLng(False) = 0, "CLng(False) = " & CLng(False))
820 Call ok(getVT(CLng(False)) = "VT_I4", "getVT(CLng(False)) = " & getVT(CLng(False)))
821 MyObject.myval = 1
822 Call ok(CLng(MyObject) = 1, "CLng(MyObject) = " & CLng(MyObject))
823 Call ok(getVT(CLng(MyObject)) = "VT_I4", "getVT(CLng(MyObject)) = " & getVT(CLng(MyObject)))
824 MyObject.myval = 0
825 Call ok(CLng(MyObject) = 0, "CLng(MyObject) = " & CLng(MyObject))
826 Call ok(getVT(CLng(MyObject)) = "VT_I4", "getVT(CLng(MyObject)) = " & getVT(CLng(MyObject)))
827
828 Sub testCIntError(strings, error_num1, error_num2)
829 on error resume next
830 Dim x
831
832 Call Err.clear()
833 x = CInt(strings)
834 Call ok(Err.number = error_num1, "Err.number = " & Err.number)
835
836 Call Err.clear()
837 Call CInt(strings)
838 Call ok(Err.number = error_num2, "Err.number = " & Err.number)
839 End Sub
840
841 Call ok(CInt(Empty) = 0, "CInt(Empty) = " & CInt(Empty))
842 Call ok(getVT(CInt(Empty)) = "VT_I2", "getVT(CInt(Empty)) = " & getVT(CInt(Empty)))
843 Call ok(CInt(CByte(0)) = 0, "CInt(CByte(0)) = " & CInt(CByte(0)))
844 Call ok(getVT(CInt(CByte(0))) = "VT_I2", "getVT(CInt(CByte(0))) = " & getVT(CInt(CByte(0))))
845 Call ok(CInt(CCur(0)) = 0, "CInt(CCur(0)) = " & CInt(CCur(0)))
846 Call ok(getVT(CInt(CCur(0))) = "VT_I2", "getVT(CInt(CCur(0))) = " & getVT(CInt(CCur(0))))
847 Call ok(CInt(0.49) = 0, "CInt(0.49) = " & CInt(0.49))
848 Call ok(getVT(CInt(0.49)) = "VT_I2", "getVT(CInt(0.49)) = " & getVT(CInt(0.49)))
849 Call ok(CInt(0.5) = 0, "CInt(0.5) = " & CInt(0.5))
850 Call ok(getVT(CInt(0.5)) = "VT_I2", "getVT(CInt(0.5)) = " & getVT(CInt(0.5)))
851 Call ok(CInt(0.51) = 1, "CInt(0.51) = " & CInt(0.51))
852 Call ok(getVT(CInt(0.51)) = "VT_I2", "getVT(CInt(0.51)) = " & getVT(CInt(0.51)))
853 Call ok(CInt(1.49) = 1, "CInt(0.49) = " & CInt(0.49))
854 Call ok(getVT(CInt(0.49)) = "VT_I2", "getVT(CInt(0.49)) = " & getVT(CInt(0.49)))
855 Call ok(CInt(1.5) = 2, "CInt(1.5) = " & CInt(1.5))
856 Call ok(getVT(CInt(1.5)) = "VT_I2", "getVT(CInt(1.5)) = " & getVT(CInt(1.5)))
857 Call ok(CInt(1.51) = 2, "CInt(1.51) = " & CInt(1.51))
858 Call ok(getVT(CInt(1.51)) = "VT_I2", "getVT(CInt(1.51)) = " & getVT(CInt(1.51)))
859 Call ok(CInt("-1") = -1, "CInt(""-1"") = " & CInt("-1"))
860 Call ok(getVT(CInt("-1")) = "VT_I2", "getVT(CInt(""-1"")) = " & getVT(CInt("-1")))
861 If isEnglishLang Then
862 Call ok(CInt("-0.5") = 0, "CInt(""-0.5"") = " & CInt("-0.5"))
863 Call ok(getVT(CInt("-0.5")) = "VT_I2", "getVT(CInt(""-0.5"")) = " & getVT(CInt("-0.5")))
864 End If
865 Call testCIntError("", 13, 13)
866 Call testCIntError("-1", 0, 458)
867 Call testCIntError("TRUE", 13, 13)
868 Call testCIntError("FALSE", 13, 13)
869 Call testCIntError("#TRue#", 13, 13)
870 Call testCIntError("#fAlSE#", 13, 13)
871 Call testCIntError(1, 0, 458)
872 Call testCIntError(32767.49, 0, 458)
873 Call testCIntError(32767.5, 6, 6)
874 Call testCIntError(-32768.5, 0, 458)
875 Call testCIntError(-32768.51, 6, 6)
876 Call ok(CInt(True) = -1, "CInt(True) = " & CInt(True))
877 Call ok(getVT(CInt(True)) = "VT_I2", "getVT(CInt(True)) = " & getVT(CInt(True)))
878 Call ok(CInt(False) = 0, "CInt(False) = " & CInt(False))
879 Call ok(getVT(CInt(False)) = "VT_I2", "getVT(CInt(False)) = " & getVT(CInt(False)))
880 MyObject.myval = 2.5
881 Call ok(CInt(MyObject) = 2, "CInt(MyObject) = " & CInt(MyObject))
882 Call ok(getVT(CInt(MyObject)) = "VT_I2", "getVT(CInt(MyObject)) = " & getVT(CInt(MyObject)))
883 MyObject.myval = 1.5
884 Call ok(CInt(MyObject) = 2, "CInt(MyObject) = " & CInt(MyObject))
885 Call ok(getVT(CInt(MyObject)) = "VT_I2", "getVT(CInt(MyObject)) = " & getVT(CInt(MyObject)))
886
887 Sub testCSngError(strings, error_num1, error_num2)
888 on error resume next
889 Dim x
890
891 Call Err.clear()
892 x = CSng(strings)
893 Call ok(Err.number = error_num1, "Err.number = " & Err.number)
894
895 Call Err.clear()
896 Call CSng(strings)
897 Call ok(Err.number = error_num2, "Err.number = " & Err.number)
898 End Sub
899
900 Call ok(CSng(Empty) = 0, "CSng(Empty) = " & CSng(Empty))
901 Call ok(getVT(CSng(Empty)) = "VT_R4", "getVT(CSng(Empty)) = " & getVT(CSng(Empty)))
902 Call ok(CSng(CByte(0)) = 0, "CSng(CByte(0)) = " & CSng(CByte(0)))
903 Call ok(getVT(CSng(CCur(0))) = "VT_R4", "getVT(CSng(CCur(0))) = " & getVT(CSng(CCur(0))))
904 Call ok(CSng(CCur(0)) = 0, "CSng(CCur(0)) = " & CSng(CCur(0)))
905 Call ok(getVT(CSng(CCur(0))) = "VT_R4", "getVT(CSng(CCur(0))) = " & getVT(CSng(CCur(0))))
906 Call ok(CSng(0) = 0, "CSng(0) = " & CSng(0))
907 Call ok(getVT(CSng(0)) = "VT_R4", "getVT(CSng(0)) = " & getVT(CSng(0)))
908 Call ok(CSng(32768) = 32768, "CSng(32768) = " & CSng(32768))
909 Call ok(getVT(CSng(32768)) = "VT_R4", "getVT(CSng(32768)) = " & getVT(CSng(32768)))
910 Call ok(CSng(0.001 * 0.001) = 0.000001, "CSng(0.001 * 0.001) = " & CSng(0.001 * 0.001))
911 Call ok(getVT(CSng(0.001 * 0.001)) = "VT_R4", "getVT(CSng(0.001 * 0.001)) = " & getVT(CSng(0.001 * 0.001)))
912 Call ok(CSng("-1") = -1, "CSng(""-1"") = " & CSng("-1"))
913 Call ok(getVT(CSng("-1")) = "VT_R4", "getVT(CSng(""-1"")) = " & getVT(CSng("-1")))
914 If isEnglishLang Then
915 Call ok(CSng("-0.5") = -0.5, "CSng(""-0.5"") = " & CSng("-0.5"))
916 Call ok(getVT(CSng("-0.5")) = "VT_R4", "getVT(CSng(""-0.5"")) = " & getVT(CSng("-0.5")))
917 End If
918 Call testCSngError("", 13, 13)
919 Call testCSngError("TRUE", 13, 13)
920 Call testCSngError("FALSE", 13, 13)
921 Call testCSngError("#TRue#", 13, 13)
922 Call testCSngError("#fAlSE#", 13, 13)
923 Call testCSngError(1, 0, 458)
924 Call ok(CSng(True) = -1, "CSng(True) = " & CSng(True))
925 Call ok(getVT(CSng(True)) = "VT_R4", "getVT(CSng(True)) = " & getVT(CSng(True)))
926 Call ok(CSng(False) = 0, "CSng(False) = " & CSng(False))
927 Call ok(getVT(CSng(False)) = "VT_R4", "getVT(CSng(False)) = " & getVT(CSng(False)))
928 MyObject.myval = 0.1
929 Call ok(CSng(MyObject) = 0.1, "CSng(MyObject) = " & CSng(MyObject))
930 Call ok(getVT(CSng(MyObject)) = "VT_R4", "getVT(CSng(MyObject)) = " & getVT(CSng(MyObject)))
931 MyObject.myval = 0
932 Call ok(CSng(MyObject) = 0, "CSng(MyObject) = " & CSng(MyObject))
933 Call ok(getVT(CSng(MyObject)) = "VT_R4", "getVT(CSng(MyObject)) = " & getVT(CSng(MyObject)))
934
935 Call ok(TypeName(Empty) = "Empty", "TypeName(MyEmpty) = " & TypeName(Empty))
936 Call ok(getVT(TypeName(Empty)) = "VT_BSTR", "getVT(TypeName(Empty)) = " & getVT(TypeName(Empty)))
937 Call ok(TypeName(Null) = "Null", "TypeName(Null) = " & TypeName(Null))
938 Call ok(getVT(TypeName(Null)) = "VT_BSTR", "getVT(TypeName(Null)) = " & getVT(TypeName(Null)))
939 Call ok(TypeName(CByte(255)) = "Byte", "TypeName(CByte(255)) = " & TypeName(CByte(255)))
940 Call ok(getVT(TypeName(CByte(255))) = "VT_BSTR", "getVT(TypeName(CByte(255))) = " & getVT(TypeName(CByte(255))))
941 Call ok(TypeName(255) = "Integer", "TypeName(255) = " & TypeName(255))
942 Call ok(getVT(TypeName(255)) = "VT_BSTR", "getVT(TypeName(255)) = " & getVT(TypeName(255)))
943 Call ok(TypeName(32768) = "Long", "TypeName(32768) = " & TypeName(32768))
944 Call ok(getVT(TypeName(32768)) = "VT_BSTR", "getVT(TypeName(32768)) = " & getVT(TypeName(32768)))
945 Call ok(TypeName(CSng(0.5)) = "Single", "TypeName(CSng(0.5)) = " & TypeName(CSng(0.5)))
946 Call ok(getVT(TypeName(CSng(0.5))) = "VT_BSTR", "getVT(TypeName(CSng(0.5))) = " & getVT(TypeName(CSng(0.5))))
947 Call ok(TypeName(-0.5) = "Double", "TypeName(-0.5) = " & TypeName(-0.5))
948 Call ok(getVT(TypeName(-0.5)) = "VT_BSTR", "getVT(TypeName(-0.5)) = " & getVT(TypeName(-0.5)))
949 Call ok(TypeName(CCur(0.5)) = "Currency", "TypeName(CCur(0.5)) = " & TypeName(CCur(0.5)))
950 Call ok(getVT(TypeName(CCur(0.5))) = "VT_BSTR", "getVT(TypeName(CCur(0.5))) = " & getVT(TypeName(CCur(0.5))))
951 Call ok(TypeName(CStr(0.5)) = "String", "TypeName(CStr(0.5)) = " & TypeName(CStr(0.5)))
952 Call ok(getVT(TypeName(CStr(0.5))) = "VT_BSTR", "getVT(TypeName(CStr(0.5))) = " & getVT(TypeName(CStr(0.5))))
953 Call ok(TypeName(True) = "Boolean", "TypeName(True) = " & TypeName(True))
954 Call ok(getVT(TypeName(True)) = "VT_BSTR", "getVT(TypeName(True)) = " & getVT(TypeName(True)))
955
956 Call ok(VarType(Empty) = vbEmpty, "VarType(Empty) = " & VarType(Empty))
957 Call ok(getVT(VarType(Empty)) = "VT_I2", "getVT(VarType(Empty)) = " & getVT(VarType(Empty)))
958 Call ok(VarType(Null) = vbNull, "VarType(Null) = " & VarType(Null))
959 Call ok(getVT(VarType(Null)) = "VT_I2", "getVT(VarType(Null)) = " & getVT(VarType(Null)))
960 Call ok(VarType(255) = vbInteger, "VarType(255) = " & VarType(255))
961 Call ok(getVT(VarType(255)) = "VT_I2", "getVT(VarType(255)) = " & getVT(VarType(255)))
962 Call ok(VarType(32768) = vbLong, "VarType(32768) = " & VarType(32768))
963 Call ok(getVT(VarType(32768)) = "VT_I2", "getVT(VarType(32768)) = " & getVT(VarType(32768)))
964 Call ok(VarType(CSng(0.5)) = vbSingle, "VarType(CSng(0.5)) = " & VarType(CSng(0.5)))
965 Call ok(getVT(VarType(CSng(0.5))) = "VT_I2", "getVT(VarType(CSng(0.5))) = " & getVT(VarType(CSng(0.5))))
966 Call ok(VarType(-0.5) = vbDouble, "VarType(-0.5) = " & VarType(-0.5))
967 Call ok(getVT(VarType(-0.5)) = "VT_I2", "getVT(VarType(-0.5)) = " & getVT(VarType(-0.5)))
968 Call ok(VarType(CCur(0.5)) = vbCurrency, "VarType(CCur(0.5)) = " & VarType(CCur(0.5)))
969 Call ok(getVT(VarType(CCur(0.5))) = "VT_I2", "getVT(VarType(CCur(0.5))) = " & getVT(VarType(CCur(0.5))))
970 Call ok(VarType(CStr(0.5)) = vbString, "VarType(CStr(0.5)) = " & VarType(CStr(0.5)))
971 Call ok(getVT(VarType(CStr(0.5))) = "VT_I2", "getVT(VarType(CStr(0.5))) = " & getVT(VarType(CStr(0.5))))
972 Call ok(VarType(CBool(0.5)) = vbBoolean, "VarType(CBool(0.5)) = " & VarType(CBool(0.5)))
973 Call ok(getVT(VarType(CBool(0.5))) = "VT_I2", "getVT(VarType(CBool(0.5))) = " & getVT(VarType(CBool(0.5))))
974 Call ok(VarType(CByte(255)) = vbByte, "VarType(CByte(255)) = " & VarType(CByte(255)))
975 Call ok(getVT(VarType(CByte(255))) = "VT_I2", "getVT(VarType(CByte(255))) = " & getVT(VarType(CByte(255))))
976
977 Call ok(Sgn(Empty) = 0, "Sgn(MyEmpty) = " & Sgn(Empty))
978 Call ok(getVT(Sgn(Empty)) = "VT_I2", "getVT(Sgn(MyEmpty)) = " & getVT(Sgn(Empty)))
979 Call ok(Sgn(0) = 0, "Sgn(0) = " & Sgn(0))
980 Call ok(getVT(Sgn(0)) = "VT_I2", "getVT(Sgn(0)) = " & getVT(Sgn(0)))
981 Call ok(Sgn(-32769) = -1, "Sgn(-32769) = " & Sgn(-32769))
982 Call ok(getVT(Sgn(-32769)) = "VT_I2", "getVT(Sgn(-32769)) = " & getVT(Sgn(-32769)))
983 Call ok(Sgn(CSng(-0.5)) = -1, "Sgn(CSng(-0.5)) = " & Sgn(CSng(-0.5)))
984 Call ok(getVT(Sgn(CSng(-0.5))) = "VT_I2", "getVT(Sgn(CSng(-0.5))) = " & getVT(Sgn(CSng(-0.5))))
985 Call ok(Sgn(0.5) = 1, "Sgn(0.5) = " & Sgn(0.5))
986 Call ok(getVT(Sgn(0.5)) = "VT_I2", "getVT(Sgn(0.5)) = " & getVT(Sgn(0.5)))
987 Call ok(Sgn(CCur(-1)) = -1, "Sgn(CCur(-1)) = " & Sgn(CCur(-1)))
988 Call ok(getVT(Sgn(CCur(-1))) = "VT_I2", "getVT(Sgn(CCur(-1))) = " & getVT(Sgn(CCur(-1))))
989 Call ok(Sgn(CStr(-1)) = -1, "Sgn(CStr(-1)) = " & Sgn(CStr(-1)))
990 Call ok(getVT(Sgn(CStr(-1))) = "VT_I2", "getVT(Sgn(CStr(-1))) = " & getVT(Sgn(CStr(-1))))
991 Call ok(Sgn(False) = 0, "Sgn(False) = " & Sgn(False))
992 Call ok(getVT(Sgn(False)) = "VT_I2", "getVT(Sgn(False)) = " & getVT(Sgn(False)))
993 Call ok(Sgn(True) = -1, "Sgn(True) = " & Sgn(True))
994 Call ok(getVT(Sgn(True)) = "VT_I2", "getVT(Sgn(True)) = " & getVT(Sgn(True)))
995 Call ok(Sgn(CByte(1)) = 1, "Sgn(CByte(1)) = " & Sgn(CByte(1)))
996 Call ok(getVT(Sgn(CByte(1))) ="VT_I2", "getVT(Sgn(CByte(1))) = " & getVT(Sgn(CByte(1))))
997
998 Sub testSgnError(strings, error_num)
999 on error resume next
1000
1001 Call Err.clear()
1002 Call Sgn(strings)
1003 Call ok(Err.number = error_num, "Err.number = " & Err.number)
1004 End Sub
1005
1006 Call testSgnError(Null, 94)
1007
1008 Call ok(Abs(Empty) = 0, "Abs(Empty) = " & Abs(Empty))
1009 Call ok(getVT(Abs(Empty)) = "VT_I2", "getVT(Abs(Empty)) = " & getVT(Abs(Empty)))
1010 Call ok(IsNull(Abs(Null)), "Is Abs(Null) not Null?")
1011 Call ok(getVT(Abs(Null)) = "VT_NULL", "getVT(Abs(Null)) = " & getVT(Abs(Null)))
1012 Call ok(Abs(0) = 0, "Abs(0) = " & Abs(0))
1013 Call ok(getVT(Abs(0)) = "VT_I2", "getVT(Abs(0)) = " & getVT(Abs(0)))
1014 Call ok(Abs(-32769) = 32769, "Abs(-32769) = " & Abs(-32769))
1015 Call ok(getVT(Abs(-32769)) = "VT_I4", "getVT(Abs(-32769)) = " & getVT(Abs(-32769)))
1016 Call ok(Abs(CSng(-0.5)) = 0.5, "Abs(CSng(-0.5)) = " & Abs(CSng(-0.5)))
1017 Call ok(getVT(Abs(CSng(-0.5))) = "VT_R4", "getVT(Abs(CSng(-0.5))) = " & getVT(Abs(CSng(-0.5))))
1018 Call ok(Abs(0.5) = 0.5, "Abs(0.5) = " & Abs(0.5))
1019 Call ok(getVT(Abs(0.5)) = "VT_R8", "getVT(Abs(0.5)) = " & getVT(Abs(0.5)))
1020 Call ok(Abs(CCur(-1)) = 1, "Abs(CCur(-1)) = " & Abs(CCur(-1)))
1021 Call ok(getVT(Abs(CCur(-1))) = "VT_CY", "getVT(Abs(CCur(-1))) = " & getVT(Abs(CCur(-1))))
1022 Call ok(Abs("-1") = 1, "Abs(""-1"") = " & Abs("-1"))
1023 Call ok(getVT(Abs("-1")) = "VT_R8", "getVT(Abs(""-1"")) = " & getVT(Abs("-1")))
1024 Call ok(Abs(False) = 0, "Abs(False) = " & Abs(False))
1025 Call ok(getVT(Abs(False)) = "VT_I2", "getVT(Abs(False)) = " & getVT(Abs(False)))
1026 Call ok(Abs(True) = 1, "Abs(True) = " & Abs(True))
1027 Call ok(getVT(Abs(True)) = "VT_I2", "getVT(Abs(True)) = " & getVT(Abs(True)))
1028 Call ok(Abs(CByte(1)) = 1, "Abs(CByte(1)) = " & Abs(CByte(1)))
1029 Call ok(getVT(Abs(CByte(1))) = "VT_UI1", "getVT(Abs(CByte(1))) = " & getVT(Abs(CByte(1))))
1030
1031 Sub testAbsError(strings, error_num1, error_num2)
1032 on error resume next
1033 Dim x
1034
1035 Call Err.clear()
1036 x = Abs(strings)
1037 Call ok(Err.number = error_num1, "Err.number1 = " & Err.number)
1038
1039 Call Err.clear()
1040 Call Abs(strings)
1041 Call ok(Err.number = error_num2, "Err.number2 = " & Err.number)
1042 End Sub
1043
1044 Call testAbsError("strings", 13, 13)
1045 Call testAbsError(-4, 0, 0)
1046
1047 Call ok(ScriptEngine = "VBScript", "Is scriptengine not VBScript?")
1048 Call ok(getVT(ScriptEngine) = "VT_BSTR", "getVT(ScriptEngine) = " & getVT(ScriptEngine))
1049
1050 Call ok(getVT(ScriptEngineBuildVersion) = "VT_I4", "getVT(ScriptEngineBuildVersion) = " & getVT(ScriptEngineBuildVersion))
1051
1052 Call ok(getVT(ScriptEngineMajorVersion) = "VT_I4", "getVT(ScriptEngineMajorVersion) = " & getVT(ScriptEngineMajorVersion))
1053
1054 Call ok(getVT(ScriptEngineMinorVersion) = "VT_I4", "getVT(ScriptEngineMinorVersion) = " & getVT(ScriptEngineMinorVersion))
1055
1056 Call ok(Fix(Empty) = 0, "Fix(Empty) = " & Fix(Empty))
1057 Call ok(getVT(Fix(Empty)) = "VT_I2", "getVT(Fix(Empty)) = " & getVT(Fix(Empty)))
1058 Call ok(Fix(CCur(-0.99)) = 0, "Fix(CCur(-0.99)) = " & Fix(CCur(-0.99)))
1059 Call ok(getVT(Fix(CCur(-0.99))) = "VT_CY", "getVT(Fix(CCur(-0.99))) = " & getVT(Fix(CCur(-0.99))))
1060 Call ok(Fix(1.99) = 1, "Fix(1.99) = " & Fix(1.99))
1061 Call ok(getVT(Fix(1.99)) = "VT_R8", "getVT(Fix(1.99)) = " & getVT(Fix(1.99)))
1062 Call ok(Fix(-1.99) = -1, "Fix(-1.99) = " & Fix(-1.99))
1063 Call ok(getVT(Fix(-1.99)) = "VT_R8", "getVT(Fix(-1.99)) = " & getVT(Fix(-1.99)))
1064 If isEnglishLang Then
1065 Call ok(Fix("1.99") = 1, "Fix(""1.99"") = " & Fix("1.99"))
1066 Call ok(getVT(Fix("1.99")) = "VT_R8", "getVT(Fix(""1.99"")) = " & getVT(Fix("1.99")))
1067 Call ok(Fix("-1.99") = -1, "Fix(""-1.99"") = " & Fix("-1.99"))
1068 Call ok(getVT(Fix("-1.99")) = "VT_R8", "getVT(Fix(""-1.99"")) = " & getVT(Fix("-1.99")))
1069 End If
1070 Call ok(Fix(True) = -1, "Fix(True) = " & Fix(True))
1071 Call ok(getVT(Fix(True)) = "VT_I2", "getVT(Fix(True)) = " & getVT(Fix(True)))
1072 Call ok(Fix(False) = 0, "Fix(False) = " & Fix(False))
1073 Call ok(getVT(Fix(False)) = "VT_I2", "getVT(Fix(False)) = " & getVT(Fix(False)))
1074 MyObject.myval = 2.5
1075 Call ok(Fix(MyObject) = 2, "Fix(MyObject) = " & Fix(MyObject))
1076 Call ok(getVT(Fix(MyObject)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject)))
1077 MyObject.myval = -2.5
1078 Call ok(Fix(MyObject) = -2, "Fix(MyObject) = " & Fix(MyObject))
1079 Call ok(getVT(Fix(MyObject)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject)))
1080
1081 Call ok(Int(Empty) = 0, "Int(Empty) = " & Int(Empty))
1082 Call ok(getVT(Int(Empty)) = "VT_I2", "getVT(Int(Empty)) = " & getVT(Int(Empty)))
1083 Call ok(Int(CCur(-0.99)) = -1, "Int(CCur(-0.99)) = " & Int(CCur(-0.99)))
1084 Call ok(getVT(Int(CCur(-0.99))) = "VT_CY", "getVT(Int(CCur(-0.99))) = " & getVT(Int(CCur(-0.99))))
1085 Call ok(Int(1.99) = 1, "Int(1.99) = " & Int(1.99))
1086 Call ok(getVT(Int(1.99)) = "VT_R8", "getVT(Int(1.99)) = " & getVT(Int(1.99)))
1087 Call ok(Int(-1.99) = -2, "Int(-1.99) = " & Int(-1.99))
1088 Call ok(getVT(Int(-1.99)) = "VT_R8", "getVT(Int(-1.99)) = " & getVT(Int(-1.99)))
1089 If isEnglishLang Then
1090 Call ok(Int("1.99") = 1, "Int(""1.99"") = " & Int("1.99"))
1091 Call ok(getVT(Int("1.99")) = "VT_R8", "getVT(Int(""1.99"")) = " & getVT(Int("1.99")))
1092 Call ok(Int("-1.99") = -2, "Int(""-1.99"") = " & Int("-1.99"))
1093 Call ok(getVT(Int("-1.99")) = "VT_R8", "getVT(Int(""-1.99"")) = " & getVT(Int("-1.99")))
1094 End If
1095 Call ok(Int(True) = -1, "Int(True) = " & Int(True))
1096 Call ok(getVT(Int(True)) = "VT_I2", "getVT(Int(True)) = " & getVT(Int(True)))
1097 Call ok(Int(False) = 0, "Int(False) = " & Int(False))
1098 Call ok(getVT(Int(False)) = "VT_I2", "getVT(Int(False)) = " & getVT(Int(False)))
1099 MyObject.myval = 2.5
1100 Call ok(Int(MyObject) = 2, "Int(MyObject) = " & Int(MyObject))
1101 Call ok(getVT(Int(MyObject)) = "VT_R8", "getVT(Int(MyObject)) = " & getVT(Int(MyObject)))
1102 MyObject.myval = -2.5
1103 Call ok(Int(MyObject) = -3, "Int(MyObject) = " & Int(MyObject))
1104 Call ok(getVT(Int(MyObject)) = "VT_R8", "getVT(Int(MyObject)) = " & getVT(Int(MyObject)))
1105
1106 Sub testSqrError(strings, error_num1, error_num2)
1107 on error resume next
1108 Dim x
1109
1110 Call Err.clear()
1111 x = Sqr(strings)
1112 Call ok(Err.number = error_num1, "Err.number1 = " & Err.number)
1113
1114 Call Err.clear()
1115 Call Sqr(strings)
1116 Call ok(Err.number = error_num2, "Err.number2 = " & Err.number)
1117 End Sub
1118
1119 Call testSqrError(-2, 5, 5)
1120 Call testSqrError(True, 5, 5)
1121
1122 Call ok(Sqr(Empty) = 0, "Sqr(Empty) = " & Sqr(Empty))
1123 Call ok(getVT(Sqr(Empty)) = "VT_R8", "getVT(Sqr(Empty)) = " & getVT(Sqr(Empty)))
1124 Call ok(Sqr(0) = 0, "Sqr(0) = " & Sqr(0))
1125 Call ok(getVT(Sqr(0)) = "VT_R8", "getVT(Sqr(0)) = " & getVT(Sqr(0)))
1126 Call ok(Sqr(1) = 1, "Sqr(1) = " & Sqr(1))
1127 Call ok(getVT(Sqr(1)) = "VT_R8", "getVT(Sqr(1)) = " & getVT(Sqr(1)))
1128 Call ok(Sqr(CSng(121)) = 11, "Sqr(CSng(121)) = " & Sqr(CSng(121)))
1129 Call ok(getVT(Sqr(CSng(121))) = "VT_R8", "getVT(Sqr(CSng(121))) = " & getVT(Sqr(CSng(121))))
1130 Call ok(Sqr(36100) = 190, "Sqr(36100) = " & Sqr(36100))
1131 Call ok(getVT(Sqr(36100)) = "VT_R8", "getVT(Sqr(36100)) = " & getVT(Sqr(36100)))
1132 Call ok(Sqr(CCur(0.0625)) = 0.25, "Sqr(CCur(0.0625)) = " & Sqr(CCur(0.0625)))
1133 Call ok(getVT(Sqr(CCur(0.0625))) = "VT_R8", "getVT(Sqr(CCur(0.0625))) = " & getVT(Sqr(CCur(0.0625))))
1134 Call ok(Sqr("100000000") = 10000, "Sqr(""100000000"") = " & Sqr("100000000"))
1135 Call ok(getVT(Sqr("100000000")) = "VT_R8", "getVT(Sqr(""100000000"")) = " & getVT(Sqr("100000000")))
1136 Call ok(Sqr(False) = 0, "Sqr(False) = " & Sqr(False))
1137 Call ok(getVT(Sqr(False)) = "VT_R8", "getVT(Sqr(False)) = " & getVT(Sqr(False)))
1138 Call ok(Sqr(CByte(225)) = 15, "Sqr(CByte(225)) = " & Sqr(CByte(225)))
1139 Call ok(getVT(Sqr(CByte(225))) = "VT_R8", "getVT(Sqr(CByte(225))) = " & getVT(Sqr(CByte(225))))
1140
1141 Function Approch(func, res)
1142 If Abs(func - res) < 0.001 Then
1143 Approch = True
1144 Else
1145 Approch = False
1146 End If
1147 End Function
1148
1149 Const PI = 3.1415926
1150
1151 Call ok(Approch(Cos(Empty), 1), "Cos(Empty) = " & Cos(Empty))
1152 Call ok(getVT(Cos(Empty)) = "VT_R8", "getVT(Cos(Empty)) = " & getVT(Cos(Empty)))
1153 Call ok(Approch(Cos(PI / 6), Sqr(3) / 2), "Cos(PI / 6) = " & Cos(PI / 6))
1154 Call ok(getVT(Cos(PI / 6)) = "VT_R8", "getVT(Cos(PI / 6)) = " & getVT(Cos(PI / 6)))
1155 Call ok(Approch(Cos(CCur(PI / 4)), Sqr(2) / 2), "Cos(CCur(PI / 4)) = " & Cos(CCur(PI / 4)))
1156 Call ok(getVT(Cos(CCur(PI / 4))) = "VT_R8", "getVT(Cos(CCur(PI / 4))) = " & getVT(Cos(CCur(PI / 4))))
1157 Call ok(Approch(Cos(CSng(PI / 3)), 1 / 2), "Cos(CSng(PI / 3)) = " & Cos(CSng(PI / 3)))
1158 Call ok(getVT(Cos(CSng(PI / 3))) = "VT_R8", "getVT(Cos(CSng(PI))) = " & getVT(Cos(CSng(PI))))
1159 Call ok(Approch(Cos(PI / 2), 0), "Cos(0) = " & Cos(PI / 2))
1160 Call ok(getVT(Cos(PI / 2)) = "VT_R8", "getVT(Cos(PI / 2)) = " & getVT(Cos(PI / 2)))
1161 Call ok(Approch(Cos(PI), -1), "Cos(PI) = " & Cos(PI))
1162 Call ok(getVT(Cos(PI)) = "VT_R8", "getVT(Cos(PI)) = " & getVT(Cos(PI)))
1163 Call ok(Approch(Cos(5 * PI / 4), -Sqr(2) / 2), "Cos(5 * PI / 4) = " & Cos(5 * PI / 4))
1164 Call ok(getVT(Cos(5 * PI / 4)) = "VT_R8", "getVT(Cos(5 * PI / 4)) = " & getVT(Cos(5 * PI / 4)))
1165 Call ok(Approch(Cos(3 * PI / 2), 0), "Cos(3 * PI / 2) = " & Cos(3 * PI / 2))
1166 Call ok(getVT(Cos(3 * PI / 2)) = "VT_R8", "getVT(Cos(3 * PI / 2)) = " & getVT(Cos(3 * PI / 2)))
1167 Call ok(Approch(Cos(2 * PI), 1), "Cos(2 * PI) = " & Cos(2 * PI))
1168 Call ok(getVT(Cos(2 * PI)) = "VT_R8", "getVT(Cos(2 * PI)) = " & getVT(Cos(2 * PI)))
1169 Call ok(Approch(Cos("-32768"), 0.3729), "Cos(""-32768"") = " & Cos("-32768"))
1170 Call ok(getVT(Cos("-32768")) = "VT_R8", "getVT(Cos(""-32768"")) = " & getVT(Cos("-32768")))
1171 Call ok(Approch(Cos(False), 1), "Cos(False) = " & Cos(False))
1172 Call ok(getVT(Cos(False)) = "VT_R8", "getVT(Cos(False)) = " & getVT(Cos(False)))
1173 Call ok(Approch(Cos(True), 0.5403), "Cos(True) = " & Cos(True))
1174 Call ok(getVT(Cos(True)) = "VT_R8", "getVT(Cos(True)) = " & getVT(Cos(True)))
1175 Call ok(Approch(Cos(CByte(255)), -0.8623), "Cos(CByte(255)) = " & Cos(CByte(255)))
1176 Call ok(getVT(Cos(CByte(255))) = "VT_R8", "getVT(Cos(CByte(255))) = " & getVT(Cos(CByte(255))))
1177
1178 Call ok(Approch(Sin(Empty), 0), "Sin(Empty) = " & Sin(Empty))
1179 Call ok(getVT(Sin(Empty)) = "VT_R8", "getVT(Sin(Empty)) = " & getVT(Sin(Empty)))
1180 Call ok(Approch(Sin(PI / 6), 1 / 2), "Sin(PI / 6) = " & Sin(PI / 6))
1181 Call ok(getVT(Sin(PI / 6)) = "VT_R8", "getVT(Sin(PI / 6)) = " & getVT(Sin(PI / 6)))
1182 Call ok(Approch(Sin(CCur(PI / 4)), Sqr(2) / 2), "Sin(CCur(PI / 4)) = " & Sin(CCur(PI / 4)))
1183 Call ok(getVT(Sin(CCur(PI / 4))) = "VT_R8", "getVT(Sin(CCur(PI / 4))) = " & getVT(Sin(CCur(PI / 4))))
1184 Call ok(Approch(Sin(CSng(PI / 3)), Sqr(3) / 2), "Sin(CSng(PI / 3)) = " & Sin(CSng(PI / 3)))
1185 Call ok(getVT(Sin(CSng(PI / 3))) = "VT_R8", "getVT(Sin(CSng(PI))) = " & getVT(Sin(CSng(PI))))
1186 Call ok(Approch(Sin(PI / 2), 1), "Sin(0) = " & Sin(PI / 2))
1187 Call ok(getVT(Sin(PI / 2)) = "VT_R8", "getVT(Sin(PI / 2)) = " & getVT(Sin(PI / 2)))
1188 Call ok(Approch(Sin(PI), 0), "Sin(PI) = " & Sin(PI))
1189 Call ok(getVT(Sin(PI)) = "VT_R8", "getVT(Sin(PI)) = " & getVT(Sin(PI)))
1190 Call ok(Approch(Sin(5 * PI / 4), -Sqr(2) / 2), "Sin(5 * PI / 4) = " & Sin(5 * PI / 4))
1191 Call ok(getVT(Sin(5 * PI / 4)) = "VT_R8", "getVT(Sin(5 * PI / 4)) = " & getVT(Sin(5 * PI / 4)))
1192 Call ok(Approch(Sin(3 * PI / 2), -1), "Sin(3 * PI / 2) = " & Sin(3 * PI / 2))
1193 Call ok(getVT(Sin(3 * PI / 2)) = "VT_R8", "getVT(Sin(3 * PI / 2)) = " & getVT(Sin(3 * PI / 2)))
1194 Call ok(Approch(Sin(2 * PI), 0), "Sin(2 * PI) = " & Sin(2 * PI))
1195 Call ok(getVT(Sin(2 * PI)) = "VT_R8", "getVT(Sin(2 * PI)) = " & getVT(Sin(2 * PI)))
1196 Call ok(Approch(Sin("-32768"), -0.9278), "Sin(""-32768"") = " & Sin("-32768"))
1197 Call ok(getVT(Sin("-32768")) = "VT_R8", "getVT(Sin(""-32768"")) = " & getVT(Sin("-32768")))
1198 Call ok(Approch(Sin(False), 0), "Sin(False) = " & Sin(False))
1199 Call ok(getVT(Sin(False)) = "VT_R8", "getVT(Sin(False)) = " & getVT(Sin(False)))
1200 Call ok(Approch(Sin(True), -0.84147), "Sin(True) = " & Sin(True))
1201 Call ok(getVT(Sin(True)) = "VT_R8", "getVT(Sin(True)) = " & getVT(Sin(True)))
1202 Call ok(Approch(Sin(CByte(255)), -0.5063), "Sin(CByte(255)) = " & Sin(CByte(255)))
1203 Call ok(getVT(Sin(CByte(255))) = "VT_R8", "getVT(Sin(CByte(255))) = " & getVT(Sin(CByte(255))))
1204
1205 Call ok(Approch(Tan(Empty), 0), "Tan(Empty) = " & Tan(Empty))
1206 Call ok(getVT(Tan(Empty)) = "VT_R8", "getVT(Tan(Empty)) = " & getVT(Tan(Empty)))
1207 Call ok(Approch(Tan(PI / 6), Sqr(3) / 3), "Tan(PI / 6) = " & Tan(PI / 6))
1208 Call ok(getVT(Tan(PI / 6)) = "VT_R8", "getVT(Tan(PI / 6)) = " & getVT(Tan(PI / 6)))
1209 Call ok(Approch(Tan(CCur(PI / 4)), 1), "Tan(CCur(PI / 4)) = " & Tan(CCur(PI / 4)))
1210 Call ok(getVT(Tan(CCur(PI / 4))) = "VT_R8", "getVT(Tan(CCur(PI / 4))) = " & getVT(Tan(CCur(PI / 4))))
1211 Call ok(Approch(Tan(CSng(PI / 3)), Sqr(3)), "Tan(CSng(PI / 3)) = " & Tan(CSng(PI / 3)))
1212 Call ok(getVT(Tan(CSng(PI / 3))) = "VT_R8", "getVT(Tan(CSng(PI))) = " & getVT(Tan(CSng(PI))))
1213 Call ok(Approch(Tan(PI), 0), "Tan(PI) = " & Tan(PI))
1214 Call ok(getVT(Tan(PI)) = "VT_R8", "getVT(Tan(PI)) = " & getVT(Tan(PI)))
1215 Call ok(Approch(Tan(3 * PI / 4), -1), "Tan(3 * PI / 4) = " & Tan(3 * PI / 4))
1216 Call ok(getVT(Tan(3 * PI / 4)) = "VT_R8", "getVT(Tan(3 * PI / 4)) = " & getVT(Tan(3 * PI / 4)))
1217 Call ok(Approch(Tan(5 * PI / 4), 1), "Tan(5 * PI / 4) = " & Tan(5 * PI / 4))
1218 Call ok(getVT(Tan(5 * PI / 4)) = "VT_R8", "getVT(Tan(5 * PI / 4)) = " & getVT(Tan(5 * PI / 4)))
1219 Call ok(Approch(Tan(2 * PI), 0), "Tan(2 * PI) = " & Tan(2 * PI))
1220 Call ok(getVT(Tan(2 * PI)) = "VT_R8", "getVT(Tan(2 * PI)) = " & getVT(Tan(2 * PI)))
1221 Call ok(Approch(Tan("-32768"), -2.4879), "Tan(""-32768"") = " & Tan("-32768"))
1222 Call ok(getVT(Tan("-32768")) = "VT_R8", "getVT(Tan(""-32768"")) = " & getVT(Tan("-32768")))
1223 Call ok(Approch(Tan(False), 0), "Tan(False) = " & Tan(False))
1224 Call ok(getVT(Tan(False)) = "VT_R8", "getVT(Tan(False)) = " & getVT(Tan(False)))
1225 Call ok(Approch(Tan(True), -1.5574), "Tan(True) = " & Tan(True))
1226 Call ok(getVT(Tan(True)) = "VT_R8", "getVT(Tan(True)) = " & getVT(Tan(True)))
1227 Call ok(Approch(Tan(CByte(255)), 0.5872), "Tan(CByte(255)) = " & Tan(CByte(255)))
1228 Call ok(getVT(Tan(CByte(255))) = "VT_R8", "getVT(Tan(CByte(255))) = " & getVT(Tan(CByte(255))))
1229
1230 Call ok(Approch(Atn(Empty), 0), "Atn(Empty) = " & Atn(Empty))
1231 Call ok(getVT(Atn(Empty)) = "VT_R8", "getVT(Atn(Empty)) = " & getVT(Atn(Empty)))
1232 Call ok(Approch(Atn(Sqr(3) / 3), PI / 6), "Atn(Sqr(3) / 3) = " & Atn(Sqr(3) / 3))
1233 Call ok(getVT(Atn(Sqr(3) / 3)) = "VT_R8", "getVT(Atn(Sqr(3) / 3)) = " & getVT(Atn(Sqr(3) / 3)))
1234 Call ok(Approch(Atn(CCur(1)), PI / 4), "Atn(CCur(1)) = " & Atn(CCur(1)))
1235 Call ok(getVT(Atn(CCur(1))) = "VT_R8", "getVT(Atn(CCur(1))) = " & getVT(Atn(CCur(1))))
1236 Call ok(Approch(Atn(CSng(Sqr(3))), PI / 3), "Atn(CSng(Sqr(3))) = " & Atn(CSng(Sqr(3))))
1237 Call ok(getVT(Atn(CSng(Sqr(3)))) = "VT_R8", "getVT(Atn(CSng(PI))) = " & getVT(Atn(CSng(PI))))
1238 Call ok(Approch(Atn(0), 0), "Atn(0) = " & Atn(0))
1239 Call ok(getVT(Atn(0)) = "VT_R8", "getVT(Atn(0)) = " & getVT(Atn(0)))
1240 Call ok(Approch(Atn(-1), -PI / 4), "Atn(-1) = " & Atn(-1))
1241 Call ok(getVT(Atn(-1)) = "VT_R8", "getVT(Atn(-1)) = " & getVT(Atn(-1)))
1242 Call ok(Approch(Atn("-32768"), -1.5707), "Atn(""-32768"") = " & Atn("-32768"))
1243 Call ok(getVT(Atn("-32768")) = "VT_R8", "getVT(Atn(""-32768"")) = " & getVT(Atn("-32768")))
1244 Call ok(Approch(Atn(False), 0), "Atn(False) = " & Atn(False))
1245 Call ok(getVT(Atn(False)) = "VT_R8", "getVT(Atn(False)) = " & getVT(Atn(False)))
1246 Call ok(Approch(Atn(True), -0.7853), "Atn(True) = " & Atn(True))
1247 Call ok(getVT(Atn(True)) = "VT_R8", "getVT(Atn(True)) = " & getVT(Atn(True)))
1248 Call ok(Approch(Atn(CByte(255)), 1.5668), "Atn(CByte(255)) = " & Atn(CByte(255)))
1249 Call ok(getVT(Atn(CByte(255))) = "VT_R8", "getVT(Atn(CByte(255))) = " & getVT(Atn(CByte(255))))
1250
1251 Call ok(Approch(Exp(Empty), 1), "Exp(Empty) = " & Exp(Empty))
1252 Call ok(getVT(Exp(Empty)) = "VT_R8", "getVT(Exp(Empty)) = " & getVT(Exp(Empty)))
1253 Call ok(Approch(Exp(1), 2.7182), "Exp(1) = " & Exp(1))
1254 Call ok(getVT(Exp(1)) = "VT_R8", "getVT(Exp(1)) = " & getVT(Exp(1)))
1255 Call ok(Approch(Exp(CCur(-1)), 0.3678), "Exp(CCur(-1)) = " & Exp(CCur(-1)))
1256 Call ok(getVT(Exp(CCur(-1))) = "VT_R8", "getVT(Exp(CCur(-1))) = " & getVT(Exp(CCur(-1))))
1257 Call ok(Approch(Exp(CSng(0.5)), 1.6487), "Exp(CSng(0.5)) = " & Exp(CSng(0.5)))
1258 Call ok(getVT(Exp(CSng(0.5))) = "VT_R8", "getVT(Exp(CSng(PI))) = " & getVT(Exp(CSng(PI))))
1259 Call ok(Approch(Exp(-0.5), 0.6065), "Exp(-0.5) = " & Exp(-0.5))
1260 Call ok(getVT(Exp(-0.5)) = "VT_R8", "getVT(Exp(-0.5)) = " & getVT(Exp(-0.5)))
1261 Call ok(Approch(Exp("-2"), 0.1353), "Exp(""-2"") = " & Exp("-2"))
1262 Call ok(getVT(Exp("-2")) = "VT_R8", "getVT(Exp(""-2"")) = " & getVT(Exp("-2")))
1263 Call ok(Approch(Exp(False), 1), "Exp(False) = " & Exp(False))
1264 Call ok(getVT(Exp(False)) = "VT_R8", "getVT(Exp(False)) = " & getVT(Exp(False)))
1265 Call ok(Approch(Exp(True), 0.3678), "Exp(True) = " & Exp(True))
1266 Call ok(getVT(Exp(True)) = "VT_R8", "getVT(Exp(True)) = " & getVT(Exp(True)))
1267 Call ok(Approch(Exp(CByte(2)), 7.389), "Exp(CByte(2)) = " & Exp(CByte(2)))
1268 Call ok(getVT(Exp(CByte(2))) = "VT_R8", "getVT(Exp(CByte(2))) = " & getVT(Exp(CByte(2))))
1269
1270 Sub testLogError(strings, error_num1, error_num2)
1271 on error resume next
1272 Dim x
1273
1274 Call Err.clear()
1275 x = Log(strings)
1276 Call ok(Err.number = error_num1, "Err.number1 = " & Err.number)
1277
1278 Call Err.clear()
1279 Call Log(strings)
1280 Call ok(Err.number = error_num2, "Err.number2 = " & Err.number)
1281 End Sub
1282
1283 Call testLogError(0, 5, 5)
1284 Call testLogError(-2, 5, 5)
1285 Call testLogError(False, 5, 5)
1286 Call testLogError(True, 5, 5)
1287 Call ok(Approch(Log(1), 0), "Log(1) = " & Log(1))
1288 Call ok(getVT(Log(1)) = "VT_R8", "getVT(Log(1)) = " & getVT(Log(1)))
1289 Call ok(Approch(Log(CCur(0.5)), -0.6931), "Log(CCur(0.5)) = " & Log(CCur(0.5)))
1290 Call ok(getVT(Log(CCur(0.5))) = "VT_R8", "getVT(Log(CCur(0.5))) = " & getVT(Log(CCur(0.5))))
1291 Call ok(Approch(Log(CSng(2.7182)), 1), "Log(CSng(2.7182)) = " & Log(CSng(2.7182)))
1292 Call ok(getVT(Log(CSng(2.7182))) = "VT_R8", "getVT(Log(CSng(PI))) = " & getVT(Log(CSng(PI))))
1293 Call ok(Approch(Log(32768), 10.3972), "Log(32768) = " & Log(32768))
1294 Call ok(getVT(Log(32768)) = "VT_R8", "getVT(Log(32768)) = " & getVT(Log(32768)))
1295 Call ok(Approch(Log("10"), 2.3025), "Log(""10"") = " & Log("10"))
1296 Call ok(getVT(Log("10")) = "VT_R8", "getVT(Log(""10"")) = " & getVT(Log("10")))
1297 Call ok(Approch(Log(CByte(2)), 0.6931), "Log(CByte(2)) = " & Log(CByte(2)))
1298 Call ok(getVT(Log(CByte(2))) = "VT_R8", "getVT(Log(CByte(2))) = " & getVT(Log(CByte(2))))
1299
1300 Call ok(getVT(Date) = "VT_DATE", "getVT(Date) = " & getVT(Date))
1301 Call ok(getVT(Time) = "VT_DATE", "getVT(Time) = " & getVT(Time))
1302
1303 Sub testRGBError(arg1, arg2, arg3, error_num)
1304 on error resume next
1305 Dim x
1306
1307 Call Err.clear()
1308 x = RGB(arg1, arg2, arg3)
1309 Call ok(Err.number = error_num, "Err.number1 = " & Err.number)
1310
1311 Call Err.clear()
1312 Call RGB(arg1, arg2, arg3)
1313 Call ok(Err.number = error_num, "Err.number2 = " & Err.number)
1314 End Sub
1315
1316 Call ok(RGB(0, &h1f&, &hf1&) = &hf11f00&, "RGB(0, &h1f&, &hf1&) = " & RGB(0, &h1f&, &hf1&))
1317 Call ok(getVT(RGB(0, &h1f&, &hf1&)) = "VT_I4", "getVT(RGB(&hf1&, &h1f&, &hf1&)) = " & getVT(RGB(&hf1&, &h1f&, &hf1&)))
1318 Call ok(RGB(&hef&, &hab&, &hcd&) = &hcdabef&, "RGB(&hef&, &hab&, &hcd&) = " & RGB(&hef&, &hab&, &hcd&))
1319 Call ok(getVT(RGB(&hef&, &hab&, &hcd&)) = "VT_I4", "getVT(RGB(&hef&, &hab&, &hcd&)) = " & getVT(RGB(&hef&, &hab&, &hcd&)))
1320 Call ok(RGB(&h1&, &h100&, &h111&) = &hffff01&, "RGB(&h1&, &h100&, &h111&) = " & RGB(&h1&, &h100&, &h111&))
1321 Call ok(getVT(RGB(&h1&, &h100&, &h111&)) = "VT_I4", "getVT(RGB(&h1&, &h100&, &h111&)) = " & getVT(RGB(&h1&, &h100&, &h111&)))
1322 Call testRGBError(-1, &h1e&, &h3b&, 5)
1323 Call testRGBError(&h4d&, -2, &h2f&, 5)
1324
1325 Call ok(getVT(Timer) = "VT_R4", "getVT(Timer) = " & getVT(Timer))
1326
1327 Call reportSuccess()