2 ' Copyright 2011 Jacek Caban for CodeWeavers
4 ' This library is free software; you can redistribute it and/or
5 ' modify it under the terms of the GNU Lesser General Public
6 ' License as published by the Free Software Foundation; either
7 ' version 2.1 of the License, or (at your option) any later version.
9 ' This library is distributed in the hope that it will be useful,
10 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ' Lesser General Public License for more details.
14 ' You should have received a copy of the GNU Lesser General Public
15 ' License along with this library; if not, write to the Free Software
16 ' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 call ok(true, "true is not true?")
25 ok
true, "true is not true?"
26 call ok((true), "true is not true?")
28 ok
not false, "not false but not true?"
29 ok
not not true, "not not true but not true?"
31 Call ok(true = true, "true = true is false")
32 Call ok(false = false, "false = false is false")
33 Call ok(not (true = false), "true = false is true")
34 Call ok("x" = "x", """x"" = ""x"" is false")
35 Call ok(empty
= empty
, "empty = empty is false")
36 Call ok(empty
= "", "empty = """" is false")
37 Call ok(0 = 0.0, "0 <> 0.0")
38 Call ok(16 = &h10
&, "16 <> &h10&")
39 Call ok(010 = 10, "010 <> 10")
40 Call ok(10. = 10, "10. <> 10")
41 Call ok(&hffFFffFF
& = -1, "&hffFFffFF& <> -1")
42 Call ok(&hffFFffFF
& = -1, "&hffFFffFF& <> -1")
43 Call ok(34e5
= 3400000, "34e5 <> 3400000")
44 Call ok(56.789e5
= 5678900, "56.789e5 = 5678900")
45 Call ok(56.789e-2 = 0.56789, "56.789e-2 <> 0.56789")
46 Call ok(1e-94938484 = 0, "1e-... <> 0")
47 Call ok(34e0
= 34, "34e0 <> 34")
48 Call ok(34E1
= 340, "34E0 <> 340")
49 Call ok(--1 = 1, "--1 = " & --1)
50 Call ok(-empty
= 0, "-empty = " & (-empty
))
51 Call ok(true = -1, "! true = -1")
52 Call ok(false = 0, "false <> 0")
53 Call ok(&hff
= 255, "&hff <> 255")
54 Call ok(&Hff
= 255, "&Hff <> 255")
57 Call ok(x
= "xx", "x = " & x
& " expected ""xx""")
59 Call ok(true <> false, "true <> false is false")
60 Call ok(not (true <> true), "true <> true is true")
61 Call ok(not ("x" <> "x"), """x"" <> ""x"" is true")
62 Call ok(not (empty
<> empty
), "empty <> empty is true")
63 Call ok(x
<> "x", "x = ""x""")
64 Call ok("true" <> true, """true"" = true is true")
66 Call ok("" = true = false, """"" = true = false is false")
67 Call ok(not(false = true = ""), "false = true = """" is true")
68 Call ok(not (false = false <> false = false), "false = false <> false = false is true")
69 Call ok(not ("" <> false = false), """"" <> false = false is true")
71 Call ok(getVT(false) = "VT_BOOL", "getVT(false) is not VT_BOOL")
72 Call ok(getVT(true) = "VT_BOOL", "getVT(true) is not VT_BOOL")
73 Call ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR")
74 Call ok(getVT("test") = "VT_BSTR", "getVT(""test"") is not VT_BSTR")
75 Call ok(getVT(Empty
) = "VT_EMPTY", "getVT(Empty) is not VT_EMPTY")
76 Call ok(getVT(null
) = "VT_NULL", "getVT(null) is not VT_NULL")
77 Call ok(getVT(0) = "VT_I2", "getVT(0) is not VT_I2")
78 Call ok(getVT(1) = "VT_I2", "getVT(1) is not VT_I2")
79 Call ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8")
80 Call ok(getVT(0.0) = "VT_R8", "getVT(0.0) is not VT_R8")
81 Call ok(getVT(2147483647) = "VT_I4", "getVT(2147483647) is not VT_I4")
82 Call ok(getVT(2147483648) = "VT_R8", "getVT(2147483648) is not VT_R8")
83 Call ok(getVT(&h10
&) = "VT_I2", "getVT(&h10&) is not VT_I2")
84 Call ok(getVT(&h10000
&) = "VT_I4", "getVT(&h10000&) is not VT_I4")
85 Call ok(getVT(&H10000
&) = "VT_I4", "getVT(&H10000&) is not VT_I4")
86 Call ok(getVT(&hffFFffFF
&) = "VT_I2", "getVT(&hffFFffFF&) is not VT_I2")
87 Call ok(getVT(1e2
) = "VT_R8", "getVT(1e2) is not VT_R8")
88 Call ok(getVT(1e0
) = "VT_R8", "getVT(1e0) is not VT_R8")
89 Call ok(getVT(0.1e2
) = "VT_R8", "getVT(0.1e2) is not VT_R8")
90 Call ok(getVT(1 & 100000) = "VT_BSTR", "getVT(1 & 100000) is not VT_BSTR")
91 Call ok(getVT(-empty
) = "VT_I2", "getVT(-empty) = " & getVT(-empty
))
92 Call ok(getVT(-null
) = "VT_NULL", "getVT(-null) = " & getVT(-null
))
93 Call ok(getVT(y
) = "VT_EMPTY*", "getVT(y) = " & getVT(y
))
94 Call ok(getVT(nothing) = "VT_DISPATCH", "getVT(nothing) = " & getVT(nothing))
96 Call ok(getVT(x
) = "VT_DISPATCH*", "getVT(x=nothing) = " & getVT(x
))
98 Call ok(getVT(x
) = "VT_BOOL*", "getVT(x) = " & getVT(x
))
99 Call ok(getVT(false or true) = "VT_BOOL", "getVT(false) is not VT_BOOL")
101 Call ok(getVT(x
) = "VT_BSTR*", "getVT(x) is not VT_BSTR*")
103 Call ok(getVT(x
) = "VT_R8*", "getVT(x) = " & getVT(x
))
105 Call ok(isNullDisp(nothing), "nothing is not nulldisp?")
108 Call ok("ab" & "cd" = "abcd", """ab"" & ""cd"" <> ""abcd""")
109 Call ok("ab " & null
= "ab ", """ab"" & null = " & ("ab " & null
))
110 Call ok("ab " & empty
= "ab ", """ab"" & empty = " & ("ab " & empty
))
111 Call ok(1 & 100000 = "1100000", "1 & 100000 = " & (1 & 100000))
112 Call ok("ab" & x
= "abxx", """ab"" & x = " & ("ab"&x
))
114 if(isEnglishLang
) then
115 Call ok("" & true = "True", """"" & true = " & true)
116 Call ok(true & false = "TrueFalse", "true & false = " & (true & false))
119 call ok(true and true, "true and true is not true")
120 call ok(true and not false, "true and not false is not true")
121 call ok(not (false and true), "not (false and true) is not true")
122 call ok(getVT(null
and true) = "VT_NULL", "getVT(null and true) = " & getVT(null
and true))
124 call ok(false or true, "false or uie is false?")
125 call ok(not (false or false), "false or false is not false?")
126 call ok(false and false or true, "false and false or true is false?")
127 call ok(true or false and false, "true or false and false is false?")
128 call ok(null
or true, "null or true is false")
130 call ok(true xor
false, "true xor false is false?")
131 call ok(not (false xor
false), "false xor false is true?")
132 call ok(not (true or false xor
true), "true or false xor true is true?")
133 call ok(not (true xor
false or true), "true xor false or true is true?")
135 call ok(false eqv
false, "false does not equal false?")
136 call ok(not (false eqv
true), "false equals true?")
137 call ok(getVT(false eqv null
) = "VT_NULL", "getVT(false eqv null) = " & getVT(false eqv null
))
139 call ok(true imp
true, "true does not imp true?")
140 call ok(false imp
false, "false does not imp false?")
141 call ok(not (true imp
false), "true imp false?")
142 call ok(false imp null
, "false imp null is false?")
144 Call ok(2 >= 1, "! 2 >= 1")
145 Call ok(2 >= 2, "! 2 >= 2")
146 Call ok(not(true >= 2), "true >= 2 ?")
147 Call ok(2 > 1, "! 2 > 1")
148 Call ok(false > true, "! false < true")
149 Call ok(0 > true, "! 0 > true")
150 Call ok(not (true > 0), "true > 0")
151 Call ok(not (0 > 1 = 1), "0 > 1 = 1")
152 Call ok(1 < 2, "! 1 < 2")
153 Call ok(1 = 1 < 0, "! 1 = 1 < 0")
154 Call ok(1 <= 2, "! 1 <= 2")
155 Call ok(2 <= 2, "! 2 <= 2")
157 Call ok(isNull(0 = null
), "'(0 = null)' is not null")
158 Call ok(isNull(null
= 1), "'(null = 1)' is not null")
159 Call ok(isNull(0 > null
), "'(0 > null)' is not null")
160 Call ok(isNull(null
> 1), "'(null > 1)' is not null")
161 Call ok(isNull(0 < null
), "'(0 < null)' is not null")
162 Call ok(isNull(null
< 1), "'(null < 1)' is not null")
163 Call ok(isNull(0 <> null
), "'(0 <> null)' is not null")
164 Call ok(isNull(null
<> 1), "'(null <> 1)' is not null")
165 Call ok(isNull(0 >= null
), "'(0 >= null)' is not null")
166 Call ok(isNull(null
>= 1), "'(null >= 1)' is not null")
167 Call ok(isNull(0 <= null
), "'(0 <= null)' is not null")
168 Call ok(isNull(null
<= 1), "'(null <= 1)' is not null")
171 Call ok(2+2 = 4, "2+2 = " & (2+2))
172 Call ok(false + 6 + true = 5, "false + 6 + true <> 5")
173 Call ok(getVT(2+null
) = "VT_NULL", "getVT(2+null) = " & getVT(2+null
))
174 Call ok(2+empty
= 2, "2+empty = " & (2+empty
))
175 Call ok(x
+x
= 6, "x+x = " & (x
+x
))
177 Call ok(5-1 = 4, "5-1 = " & (5-1))
178 Call ok(3+5-true = 9, "3+5-true <> 9")
179 Call ok(getVT(2-null
) = "VT_NULL", "getVT(2-null) = " & getVT(2-null
))
180 Call ok(2-empty
= 2, "2-empty = " & (2-empty
))
181 Call ok(2-x
= -1, "2-x = " & (2-x
))
183 Call ok(9 Mod
6 = 3, "9 Mod 6 = " & (9 Mod
6))
184 Call ok(11.6 Mod
5.5 = False, "11.6 Mod 5.5 = " & (11.6 Mod
5.5 = 0.6))
185 Call ok(7 Mod
4+2 = 5, "7 Mod 4+2 <> 5")
186 Call ok(getVT(2 mod null
) = "VT_NULL", "getVT(2 mod null) = " & getVT(2 mod null
))
187 Call ok(getVT(null mod
2) = "VT_NULL", "getVT(null mod 2) = " & getVT(null mod
2))
188 'FIXME: Call ok(empty mod 2 = 0, "empty mod 2 = " & (empty mod 2))
190 Call ok(5 \
2 = 2, "5 \ 2 = " & (5\
2))
191 Call ok(4.6 \
1.5 = 2, "4.6 \ 1.5 = " & (4.6\
1.5))
192 Call ok(4.6 \
1.49 = 5, "4.6 \ 1.49 = " & (4.6\
1.49))
193 Call ok(2+3\
4 = 2, "2+3\4 = " & (2+3\
4))
195 Call ok(2*3 = 6, "2*3 = " & (2*3))
196 Call ok(3/2 = 1.5, "3/2 = " & (3/2))
197 Call ok(5\
4/2 = 2, "5\4/2 = " & (5\
2/1))
198 Call ok(12/3\
2 = 2, "12/3\2 = " & (12/3\
2))
199 Call ok(5/1000000 = 0.000005, "5/1000000 = " & (5/1000000))
201 Call ok(2^
3 = 8, "2^3 = " & (2^
3))
202 Call ok(2^
3^
2 = 64, "2^3^2 = " & (2^
3^
2))
203 Call ok(-3^
2 = 9, "-3^2 = " & (-3^
2))
204 Call ok(2*3^
2 = 18, "2*3^2 = " & (2*3^
2))
213 if true then y
= true : x
= y
216 x
= true : if false then x
= false
217 ok x
, "x is false, if false called?"
219 if not false then x
= true
220 ok x
, "x is false, if not false not called?"
222 if not false then x
= "test" : x
= true
223 ok x
, "x is false, if not false not called?"
225 if false then x
= y
: call ok(false, "if false .. : called")
227 if false then x
= y
: call ok(false, "if false .. : called") else x
= "else"
228 Call ok(x
= "else", "else not called?")
230 if true then x
= y
else y
= x
: Call ok(false, "in else?")
234 if false then x
= y
: if true then call ok(false, "embedded if called")
236 if false then x
=1 else x
=2 end if
237 if true then x
=1 end if
240 if false then x
= true : x
= true
241 Call ok(x
= false, "x <> false")
244 ok
false, "if false called"
251 Call ok(not x
, "x is false, if not evaluated?")
255 Call ok(false, "inside if false")
259 Call ok(x
, "else not called?")
263 Call ok(false, "inside if false")
265 Call ok(false, "inside elseif not true")
269 Call ok(x
, "else not called?")
273 Call ok(false, "inside if false")
276 ElseIf not False Then
279 Call ok(false, "inside else not true")
281 Call ok(x
, "elseif not called?")
285 Call ok(false, "inside if false")
286 ElseIf not False Then
289 Call ok(x
, "elseif not called?")
293 Call ok(x
, "if 1 not run?")
296 if &h10000
& then x
= true
297 Call ok(x
, "if &h10000& not run?")
307 call ok((x
and y
), "x or y is false after while")
330 do while not (x
and y
)
336 call ok((x
and y
), "x or y is false after while")
343 ok
false, "exit do didn't work"
354 call ok((x
and y
), "x or y is false after do until")
361 ok
false, "exit do didn't work"
369 call ok(x
, "x is false after do..loop?")
379 call ok((x
and y
), "x or y is false after while")
386 ok
false, "exit do didn't work"
396 loop while not (x
and y
)
397 call ok((x
and y
), "x or y is false after while")
404 ok
false, "exit do didn't work"
411 Call ok(y
= "for1: 5 6 7 8", "y = " & y
)
414 for x
= 5 to 8 step
2
417 Call ok(y
= "for2: 5 7", "y = " & y
)
424 Call ok(y
= "for3: 5 6 7 8", "y = " & y
)
430 Call ok(y
= "for4:", "y = " & y
)
433 for x
= 5 to 3 step
true
436 Call ok(y
= "for5: 5 4 3", "y = " & y
)
440 for x
= 5 to z step
3-4
444 Call ok(y
= "for6: 5 4", "y = " & y
)
448 for x
= 5 to 8 step z
452 Call ok(y
= "for7: 5 6 7 8", "y = " & y
)
459 Call ok(y
= "for8: 5 7", "y = " & y
)
462 Call ok(false, "for..to called when unexpected")
467 Call ok(false, "exit for not escaped the loop?")
476 if null
then call ok(false, "if null evaluated")
479 call ok(false, "while null evaluated")
482 Call collectionObj
.reset()
485 for each x
in collectionObj
487 Call ok(x
= y
, "x <> y")
489 Call ok(y
= 3, "y = " & y
)
490 Call ok(getVT(x
) = "VT_EMPTY*", "getVT(x) = " & getVT(x
))
492 Call collectionObj
.reset()
494 for each x
in collectionObj
495 if x
= 2 then exit for
498 Call ok(y
= 1, "y = " & y
)
499 Call ok(x
= 2, "x = " & x
)
501 Set obj
= collectionObj
507 Call ok(x
= y
, "x <> y")
509 Call ok(y
= 3, "y = " & y
)
510 Call ok(getVT(x
) = "VT_EMPTY*", "getVT(x) = " & getVT(x
))
515 Call ok(false, "unexpected case")
517 Call ok(false, "unexpected case")
519 Call ok(false, "unexpected case")
522 Call ok(false, "unexpected case")
523 case 0, false, 2+1, 10
525 case ok(false, "unexpected case")
526 Call ok(false, "unexpected case")
528 Call ok(false, "unexpected case")
530 Call ok(x
, "wrong case")
537 Call ok(x
, "wrong case")
542 Call ok(false, "unexpected case")
546 Call ok(x
, "wrong case")
554 Call ok(false, "unexpected case")
556 Call ok(x
, "wrong case")
560 Call ok(false, "unexpected case")
562 Call ok(false, "unexpected case")
570 case 3,1,2,4: x
= true
572 Call ok(false, "unexpected case")
574 Call ok(x
, "wrong case")
577 select case 2: case 5,6,7: Call ok(false, "unexpected case")
580 case else: Call ok(false, "unexpected case else")
582 Call ok(x
, "wrong case")
592 Call ok(x
, "x is false, testsub not called?")
595 Call ok(not v
, "v is not true")
601 Call ok(x
, "x was not set by SubSetTrue")
604 Call ok(not false, "false is no longer false?")
606 Sub SubSetTrue2(ByRef v
)
607 Call ok(not v
, "v is not true")
613 Call ok(x
, "x was not set by SubSetTrue")
615 Sub TestSubArgVal(ByVal v
)
616 Call ok(not v
, "v is not false")
618 Call ok(v
, "v is not true?")
622 Call TestSubArgVal(x
)
623 Call ok(not x
, "x is true after TestSubArgVal call?")
625 Sub TestSubMultiArgs(a
,b
,c
,d
,e
)
626 Call ok(a
=1, "a = " & a
)
627 Call ok(b
=2, "b = " & b
)
628 Call ok(c
=3, "c = " & c
)
629 Call ok(d
=4, "d = " & d
)
630 Call ok(e
=5, "e = " & e
)
633 Sub TestSubExit(ByRef a
)
637 Call ok(false, "Exit Sub not called?")
640 Call TestSubExit(true)
649 TestSubMultiArgs
1, 2, 3, 4, 5
650 Call TestSubMultiArgs(1, 2, 3, 4, 5)
654 Call ok(not x
, "local x is not false?")
662 Call ok(x
, "global x is not true?")
664 Public Sub TestPublicSub
668 Private Sub TestPrivateSub
680 Call ok(x
, "x is false, testfunc not called?")
682 Function FuncSetTrue(v
)
683 Call ok(not v
, "v is not true")
689 Call ok(x
, "x was not set by FuncSetTrue")
692 Call ok(not false, "false is no longer false?")
694 Function FuncSetTrue2(ByRef v
)
695 Call ok(not v
, "v is not true")
701 Call ok(x
, "x was not set by FuncSetTrue")
703 Function TestFuncArgVal(ByVal v
)
704 Call ok(not v
, "v is not false")
706 Call ok(v
, "v is not true?")
710 Call TestFuncArgVal(x
)
711 Call ok(not x
, "x is true after TestFuncArgVal call?")
713 Function TestFuncMultiArgs(a
,b
,c
,d
,e
)
714 Call ok(a
=1, "a = " & a
)
715 Call ok(b
=2, "b = " & b
)
716 Call ok(c
=3, "c = " & c
)
717 Call ok(d
=4, "d = " & d
)
718 Call ok(e
=5, "e = " & e
)
721 TestFuncMultiArgs
1, 2, 3, 4, 5
722 Call TestFuncMultiArgs(1, 2, 3, 4, 5)
724 Function TestFuncLocalVal
726 Call ok(not x
, "local x is not false?")
732 Call TestFuncLocalVal
733 Call ok(x
, "global x is not true?")
735 Function TestFuncExit(ByRef a
)
739 Call ok(false, "Exit Function not called?")
742 Call TestFuncExit(true)
744 Function TestFuncExit2(ByRef a
)
750 Call ok(false, "Exit Function not called?")
753 Call TestFuncExit2(true)
759 Function FuncParseTest
760 End Function : x
= false
767 Call ok(ReturnTrue(), "ReturnTrue returned false?")
769 Function SetVal(ByRef x
, ByVal v
)
776 ok
SetVal(x
, true), "SetVal returned false?"
777 Call ok(x
, "x is not set to true by SetVal?")
779 Public Function TestPublicFunc
783 Private Function TestPrivateFunc
787 ' Stop has an effect only in debugging mode
791 Call ok(getVT(x
) = "VT_DISPATCH*", "getVT(x=testObj) = " & getVT(x
))
793 Set obj
= New EmptyClass
794 Call ok(getVT(obj
) = "VT_DISPATCH*", "getVT(obj) = " & getVT(obj
))
800 Call ok(getVT(x
) = "VT_DISPATCH*", "getVT(x) = " & getVT(x
))
807 Public Function publicFunction()
812 Public Property Get gsProp()
814 funcCalled
= "gsProp get"
816 Call ok(false, "exit property not returned?")
819 Public Default
Property Get DefValGet
820 DefValGet
= privateProp
821 funcCalled
= "GetDefVal"
824 Public Property Let DefValGet(x
)
832 Public Property Let gsProp(val
)
834 funcCalled
= "gsProp let"
836 Call ok(false, "exit property not returned?")
839 Public Property Set gsProp(val
)
840 funcCalled
= "gsProp set"
842 Call ok(false, "exit property not returned?")
845 Public Sub setPrivateProp(x
)
849 Function getPrivateProp
850 getPrivateProp
= privateProp
853 Private Sub privateSub
856 Public Sub Class_Initialize
859 Call ok(getVT(privateProp
) = "VT_BOOL*", "getVT(privateProp) = " & getVT(privateProp
))
860 Call ok(getVT(publicProp2
) = "VT_I2*", "getVT(publicProp2) = " & getVT(publicProp2
))
861 Call ok(getVT(Me.publicProp2
) = "VT_I2", "getVT(Me.publicProp2) = " & getVT(Me.publicProp2
))
864 Property Get gsGetProp(x
)
869 Call testDisp(new testClass
)
871 Set obj
= New TestClass
873 Call ok(obj
.publicFunction
= 4, "obj.publicFunction = " & obj
.publicFunction
)
874 Call ok(obj
.publicFunction() = 4, "obj.publicFunction() = " & obj
.publicFunction())
878 Call obj
.publicFunction()
880 Call ok(getVT(obj
.publicProp
) = "VT_EMPTY", "getVT(obj.publicProp) = " & getVT(obj
.publicProp
))
882 Call ok(getVT(obj
.publicProp
) = "VT_I2", "getVT(obj.publicProp) = " & getVT(obj
.publicProp
))
883 Call ok(obj
.publicProp
= 3, "obj.publicProp = " & obj
.publicProp
)
886 Call ok(obj
.getPrivateProp() = true, "obj.getPrivateProp() = " & obj
.getPrivateProp())
887 Call obj
.setPrivateProp(6)
888 Call ok(obj
.getPrivateProp
= 6, "obj.getPrivateProp = " & obj
.getPrivateProp
)
892 Call ok(obj
.gsProp
= 6, "obj.gsProp = " & obj
.gsProp
)
893 Call ok(funcCalled
= "gsProp get", "funcCalled = " & funcCalled
)
895 Call ok(funcCalled
= "gsProp let", "funcCalled = " & funcCalled
)
896 Call ok(obj
.getPrivateProp
= 3, "obj.getPrivateProp = " & obj
.getPrivateProp
)
897 Set obj
.gsProp
= New testclass
898 Call ok(funcCalled
= "gsProp set", "funcCalled = " & funcCalled
)
901 Call ok(x
= 3, "(x = obj) = " & x
)
902 Call ok(funcCalled
= "GetDefVal", "funcCalled = " & funcCalled
)
904 Call ok(obj
= 3, "(x = obj) = " & obj
)
905 Call ok(funcCalled
= "GetDefVal", "funcCalled = " & funcCalled
)
907 Call obj
.Class_Initialize
908 Call ok(obj
.getPrivateProp() = true, "obj.getPrivateProp() = " & obj
.getPrivateProp())
910 x
= (New testclass
).publicProp
913 Public Sub Class_Terminate()
914 funcCalled
= "terminate"
918 Set obj
= New TermTest
921 Call ok(funcCalled
= "terminate", "funcCalled = " & funcCalled
)
923 Set obj
= New TermTest
925 Call obj
.Class_Terminate
926 Call ok(funcCalled
= "terminate", "funcCalled = " & funcCalled
)
929 Call ok(funcCalled
= "terminate", "funcCalled = " & funcCalled
)
931 Call (New testclass
).publicSub()
932 Call (New testclass
).publicSub
939 property get prop1(x
)
943 property get prop2(x
, y
)
948 set obj
= new PropTest
950 call ok(obj
.prop0
= 1, "obj.prop0 = " & obj
.prop0
)
951 call ok(obj
.prop1(3) = 4, "obj.prop1(3) = " & obj
.prop1(3))
952 call ok(obj
.prop2(3,4) = 7, "obj.prop2(3,4) = " & obj
.prop2(3,4))
957 x
= "following ':' is correct syntax" :
958 x
= "following ':' is correct syntax" :: :
959 :: x
= "also correct syntax"
960 rem another ugly way for comments
961 x
= "rem as simplestatement" : rem rem comment
964 Set obj
= new EmptyClass
966 Set y
= new EmptyClass
968 Call ok(obj is x
, "obj is not x")
969 Call ok(x is obj
, "x is not obj")
970 Call ok(not (obj is y
), "obj is not y")
971 Call ok(not obj is y
, "obj is not y")
972 Call ok(not (x is
Nothing), "x is 1")
973 Call ok(Nothing is
Nothing, "Nothing is not Nothing")
974 Call ok(x is obj
and true, "x is obj and true is false")
977 Public Sub Test(MyMe
)
978 Call ok(Me is MyMe
, "Me is not MyMe")
985 Call ok(getVT(test
) = "VT_DISPATCH", "getVT(test) = " & getVT(test
))
986 Call ok(Me is Test
, "Me is not Test")
988 Const c1
= 1, c2
= 2, c3
= -3
989 Call ok(c1
= 1, "c1 = " & c1
)
990 Call ok(getVT(c1
) = "VT_I2", "getVT(c1) = " & getVT(c1
))
991 Call ok(c3
= -3, "c3 = " & c3
)
992 Call ok(getVT(c3
) = "VT_I2", "getVT(c3) = " & getVT(c3
))
994 Const cb
= True, cs
= "test", cnull
= null
995 Call ok(cb
, "cb = " & cb
)
996 Call ok(getVT(cb
) = "VT_BOOL", "getVT(cb) = " & getVT(cb
))
997 Call ok(cs
= "test", "cs = " & cs
)
998 Call ok(getVT(cs
) = "VT_BSTR", "getVT(cs) = " & getVT(cs
))
999 Call ok(isNull(cnull
), "cnull = " & cnull
)
1000 Call ok(getVT(cnull
) = "VT_NULL", "getVT(cnull) = " & getVT(cnull
))
1002 if false then Const conststr
= "str"
1003 Call ok(conststr
= "str", "conststr = " & conststr
)
1004 Call ok(getVT(conststr
) = "VT_BSTR", "getVT(conststr) = " & getVT(conststr
))
1005 Call ok(conststr
= "str", "conststr = " & conststr
)
1009 Call ok(c1
= 1, "c1 = " & c1
)
1010 Call ok(funcconst
= 1, "funcconst = " & funcconst
)
1016 ' Property may be used as an identifier (although it's a keyword)
1020 Call ok(property, "property = " & property)
1022 for property = 1 to 2
1029 Public Sub Property()
1032 Sub Test(byref property)
1043 Sub Test2(byval property)
1049 Call ok(getVT(arr
) = "VT_EMPTY*", "getVT(arr) = " & getVT(arr
))
1052 Dim arr2(4,3), arr3(5,4,3), arr0(0), noarr()
1054 Call ok(getVT(arr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr) = " & getVT(arr
))
1055 Call ok(getVT(arr2
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr2) = " & getVT(arr2
))
1056 Call ok(getVT(arr0
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr0) = " & getVT(arr0
))
1057 Call ok(getVT(noarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(noarr) = " & getVT(noarr
))
1059 Call testArray(1, arr
)
1060 Call testArray(2, arr2
)
1061 Call testArray(3, arr3
)
1062 Call testArray(0, arr0
)
1063 Call testArray(-1, noarr
)
1065 Call ok(getVT(arr(1)) = "VT_EMPTY*", "getVT(arr(1)) = " & getVT(arr(1)))
1066 Call ok(getVT(arr2(1,2)) = "VT_EMPTY*", "getVT(arr2(1,2)) = " & getVT(arr2(1,2)))
1067 Call ok(getVT(arr3(1,2,2)) = "VT_EMPTY*", "getVT(arr3(1,2,3)) = " & getVT(arr3(1,2,2)))
1068 Call ok(getVT(arr(0)) = "VT_EMPTY*", "getVT(arr(0)) = " & getVT(arr(0)))
1069 Call ok(getVT(arr(3)) = "VT_EMPTY*", "getVT(arr(3)) = " & getVT(arr(3)))
1070 Call ok(getVT(arr0(0)) = "VT_EMPTY*", "getVT(arr0(0)) = " & getVT(arr0(0)))
1073 Call ok(arr(2) = 3, "arr(2) = " & arr(2))
1074 Call ok(getVT(arr(2)) = "VT_I2*", "getVT(arr(2)) = " & getVT(arr(2)))
1078 Call ok(arr3(3,2,1) = 1, "arr3(3,2,1) = " & arr3(3,2,1))
1079 Call ok(arr3(1,2,3) = 2, "arr3(1,2,3) = " & arr3(1,2,3))
1082 Call ok(x(3,2,1) = 1, "x(3,2,1) = " & x(3,2,1))
1092 Call ok(getVT(x
) = "VT_ARRAY|VT_VARIANT*", "getVT(x) = " & getVT(x
))
1093 Call ok(x(2) = 2, "x(2) = " & x(2))
1094 Call ok(getVT(x(3)) = "VT_EMPTY*", "getVT(x(3)) = " & getVT(x(3)))
1097 Call ok(x(1) = 1, "x(1) = " & x(1))
1099 Call ok(getVT(x(1)) = "VT_EMPTY*", "getVT(x(1)) = " & getVT(x(1)))
1100 Call ok(x(2) = 2, "x(2) = " & x(2))
1105 Call ok(y(1) = 1, "y(1) = " & y(1))
1110 Call ok(getVT(forarr(1)) = "VT_EMPTY*", "getVT(forarr(1)) = " & getVT(forarr(1)))
1112 Call ok(forarr(1) = x
, "forarr(1) = " & forarr(1))
1118 Call ok(forarr(x
) = 2, "forarr(x) = " & forarr(x
))
1125 Private Sub Class_Initialize
1126 Call ok(getVT(classarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(classarr) = " & getVT(classarr
))
1127 Call testArray(-1, classnoarr
)
1134 Public Sub testVarVT
1135 Call ok(getVT(var
) = "VT_ARRAY|VT_VARIANT*", "getVT(var) = " & getVT(var
))
1139 Set obj
= new ArrClass
1140 Call ok(getVT(obj
.classarr
) = "VT_ARRAY|VT_VARIANT", "getVT(obj.classarr) = " & getVT(obj
.classarr
))
1141 'todo_wine Call ok(obj.classarr(1) = 2, "obj.classarr(1) = " & obj.classarr(1))
1144 Call ok(getVT(obj
.var
) = "VT_ARRAY|VT_VARIANT", "getVT(obj.var) = " & getVT(obj
.var
))
1147 Sub arrarg(byref refarr
, byval valarr
, byref refarr2
, byval valarr2
)
1148 Call ok(getVT(refarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr
))
1149 Call ok(getVT(valarr
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr
))
1150 Call ok(getVT(refarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2
))
1151 Call ok(getVT(valarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2
))
1154 Call arrarg(arr
, arr
, obj
.classarr
, obj
.classarr
)
1156 Sub arrarg2(byref refarr(), byval valarr(), byref refarr2(), byval valarr2())
1157 Call ok(getVT(refarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr
))
1158 Call ok(getVT(valarr
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr
))
1159 Call ok(getVT(refarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2
))
1160 Call ok(getVT(valarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2
))
1163 Call arrarg2(arr
, arr
, obj
.classarr
, obj
.classarr
)
1165 Sub testarrarg(arg(), vt
)
1166 Call ok(getVT(arg
) = vt
, "getVT() = " & getVT(arg
) & " expected " & vt
)
1169 Call testarrarg(1, "VT_I2*")
1170 Call testarrarg(false, "VT_BOOL*")
1171 Call testarrarg(Empty
, "VT_EMPTY*")
1173 ' It's allowed to declare non-builtin RegExp class...
1175 public property get Global()
1176 Call ok(false, "Global called")
1181 ' ...but there is no way to use it because builtin instance is always created
1183 Call ok(x
.Global = false, "x.Global = " & x
.Global)