1c2c66affSColin Finck' 2c2c66affSColin Finck' Copyright 2011 Jacek Caban for CodeWeavers 3c2c66affSColin Finck' 4c2c66affSColin Finck' This library is free software; you can redistribute it and/or 5c2c66affSColin Finck' modify it under the terms of the GNU Lesser General Public 6c2c66affSColin Finck' License as published by the Free Software Foundation; either 7c2c66affSColin Finck' version 2.1 of the License, or (at your option) any later version. 8c2c66affSColin Finck' 9c2c66affSColin Finck' This library is distributed in the hope that it will be useful, 10c2c66affSColin Finck' but WITHOUT ANY WARRANTY; without even the implied warranty of 11c2c66affSColin Finck' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12c2c66affSColin Finck' Lesser General Public License for more details. 13c2c66affSColin Finck' 14c2c66affSColin Finck' You should have received a copy of the GNU Lesser General Public 15c2c66affSColin Finck' License along with this library; if not, write to the Free Software 16c2c66affSColin Finck' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17c2c66affSColin Finck' 18c2c66affSColin Finck 19*942c4265SAmine KhaldiOPTION EXPLICIT : : DIM W 20c2c66affSColin Finck 21c2c66affSColin Finckdim x, y, z 22c2c66affSColin FinckDim obj 23c2c66affSColin Finck 24c2c66affSColin Finckcall ok(true, "true is not true?") 25c2c66affSColin Finckok true, "true is not true?" 26c2c66affSColin Finckcall ok((true), "true is not true?") 27c2c66affSColin Finck 28c2c66affSColin Finckok not false, "not false but not true?" 29c2c66affSColin Finckok not not true, "not not true but not true?" 30c2c66affSColin Finck 31c2c66affSColin FinckCall ok(true = true, "true = true is false") 32c2c66affSColin FinckCall ok(false = false, "false = false is false") 33c2c66affSColin FinckCall ok(not (true = false), "true = false is true") 34c2c66affSColin FinckCall ok("x" = "x", """x"" = ""x"" is false") 35c2c66affSColin FinckCall ok(empty = empty, "empty = empty is false") 36c2c66affSColin FinckCall ok(empty = "", "empty = """" is false") 37c2c66affSColin FinckCall ok(0 = 0.0, "0 <> 0.0") 38c2c66affSColin FinckCall ok(16 = &h10&, "16 <> &h10&") 39c2c66affSColin FinckCall ok(010 = 10, "010 <> 10") 40c2c66affSColin FinckCall ok(10. = 10, "10. <> 10") 41c2c66affSColin FinckCall ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1") 42c2c66affSColin FinckCall ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1") 43c2c66affSColin FinckCall ok(34e5 = 3400000, "34e5 <> 3400000") 44c2c66affSColin FinckCall ok(56.789e5 = 5678900, "56.789e5 = 5678900") 45c2c66affSColin FinckCall ok(56.789e-2 = 0.56789, "56.789e-2 <> 0.56789") 46c2c66affSColin FinckCall ok(1e-94938484 = 0, "1e-... <> 0") 47c2c66affSColin FinckCall ok(34e0 = 34, "34e0 <> 34") 48c2c66affSColin FinckCall ok(34E1 = 340, "34E0 <> 340") 49c2c66affSColin FinckCall ok(--1 = 1, "--1 = " & --1) 50c2c66affSColin FinckCall ok(-empty = 0, "-empty = " & (-empty)) 51c2c66affSColin FinckCall ok(true = -1, "! true = -1") 52c2c66affSColin FinckCall ok(false = 0, "false <> 0") 53c2c66affSColin FinckCall ok(&hff = 255, "&hff <> 255") 54c2c66affSColin FinckCall ok(&Hff = 255, "&Hff <> 255") 55c2c66affSColin Finck 56*942c4265SAmine KhaldiW = 5 57*942c4265SAmine KhaldiCall ok(W = 5, "W = " & W & " expected " & 5) 58*942c4265SAmine Khaldi 59c2c66affSColin Finckx = "xx" 60c2c66affSColin FinckCall ok(x = "xx", "x = " & x & " expected ""xx""") 61c2c66affSColin Finck 62c2c66affSColin FinckCall ok(true <> false, "true <> false is false") 63c2c66affSColin FinckCall ok(not (true <> true), "true <> true is true") 64c2c66affSColin FinckCall ok(not ("x" <> "x"), """x"" <> ""x"" is true") 65c2c66affSColin FinckCall ok(not (empty <> empty), "empty <> empty is true") 66c2c66affSColin FinckCall ok(x <> "x", "x = ""x""") 67c2c66affSColin FinckCall ok("true" <> true, """true"" = true is true") 68c2c66affSColin Finck 69c2c66affSColin FinckCall ok("" = true = false, """"" = true = false is false") 70c2c66affSColin FinckCall ok(not(false = true = ""), "false = true = """" is true") 71c2c66affSColin FinckCall ok(not (false = false <> false = false), "false = false <> false = false is true") 72c2c66affSColin FinckCall ok(not ("" <> false = false), """"" <> false = false is true") 73c2c66affSColin Finck 74c2c66affSColin FinckCall ok(getVT(false) = "VT_BOOL", "getVT(false) is not VT_BOOL") 75c2c66affSColin FinckCall ok(getVT(true) = "VT_BOOL", "getVT(true) is not VT_BOOL") 76c2c66affSColin FinckCall ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR") 77c2c66affSColin FinckCall ok(getVT("test") = "VT_BSTR", "getVT(""test"") is not VT_BSTR") 78c2c66affSColin FinckCall ok(getVT(Empty) = "VT_EMPTY", "getVT(Empty) is not VT_EMPTY") 79c2c66affSColin FinckCall ok(getVT(null) = "VT_NULL", "getVT(null) is not VT_NULL") 80c2c66affSColin FinckCall ok(getVT(0) = "VT_I2", "getVT(0) is not VT_I2") 81c2c66affSColin FinckCall ok(getVT(1) = "VT_I2", "getVT(1) is not VT_I2") 82c2c66affSColin FinckCall ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8") 83c2c66affSColin FinckCall ok(getVT(0.0) = "VT_R8", "getVT(0.0) is not VT_R8") 84c2c66affSColin FinckCall ok(getVT(2147483647) = "VT_I4", "getVT(2147483647) is not VT_I4") 85c2c66affSColin FinckCall ok(getVT(2147483648) = "VT_R8", "getVT(2147483648) is not VT_R8") 86c2c66affSColin FinckCall ok(getVT(&h10&) = "VT_I2", "getVT(&h10&) is not VT_I2") 87c2c66affSColin FinckCall ok(getVT(&h10000&) = "VT_I4", "getVT(&h10000&) is not VT_I4") 88c2c66affSColin FinckCall ok(getVT(&H10000&) = "VT_I4", "getVT(&H10000&) is not VT_I4") 89c2c66affSColin FinckCall ok(getVT(&hffFFffFF&) = "VT_I2", "getVT(&hffFFffFF&) is not VT_I2") 90c2c66affSColin FinckCall ok(getVT(1e2) = "VT_R8", "getVT(1e2) is not VT_R8") 91c2c66affSColin FinckCall ok(getVT(1e0) = "VT_R8", "getVT(1e0) is not VT_R8") 92c2c66affSColin FinckCall ok(getVT(0.1e2) = "VT_R8", "getVT(0.1e2) is not VT_R8") 93c2c66affSColin FinckCall ok(getVT(1 & 100000) = "VT_BSTR", "getVT(1 & 100000) is not VT_BSTR") 94c2c66affSColin FinckCall ok(getVT(-empty) = "VT_I2", "getVT(-empty) = " & getVT(-empty)) 95c2c66affSColin FinckCall ok(getVT(-null) = "VT_NULL", "getVT(-null) = " & getVT(-null)) 96c2c66affSColin FinckCall ok(getVT(y) = "VT_EMPTY*", "getVT(y) = " & getVT(y)) 97c2c66affSColin FinckCall ok(getVT(nothing) = "VT_DISPATCH", "getVT(nothing) = " & getVT(nothing)) 98c2c66affSColin Finckset x = nothing 99c2c66affSColin FinckCall ok(getVT(x) = "VT_DISPATCH*", "getVT(x=nothing) = " & getVT(x)) 100c2c66affSColin Finckx = true 101c2c66affSColin FinckCall ok(getVT(x) = "VT_BOOL*", "getVT(x) = " & getVT(x)) 102c2c66affSColin FinckCall ok(getVT(false or true) = "VT_BOOL", "getVT(false) is not VT_BOOL") 103c2c66affSColin Finckx = "x" 104c2c66affSColin FinckCall ok(getVT(x) = "VT_BSTR*", "getVT(x) is not VT_BSTR*") 105c2c66affSColin Finckx = 0.0 106c2c66affSColin FinckCall ok(getVT(x) = "VT_R8*", "getVT(x) = " & getVT(x)) 107c2c66affSColin Finck 108c2c66affSColin FinckCall ok(isNullDisp(nothing), "nothing is not nulldisp?") 109c2c66affSColin Finck 110c2c66affSColin Finckx = "xx" 111c2c66affSColin FinckCall ok("ab" & "cd" = "abcd", """ab"" & ""cd"" <> ""abcd""") 112c2c66affSColin FinckCall ok("ab " & null = "ab ", """ab"" & null = " & ("ab " & null)) 113c2c66affSColin FinckCall ok("ab " & empty = "ab ", """ab"" & empty = " & ("ab " & empty)) 114c2c66affSColin FinckCall ok(1 & 100000 = "1100000", "1 & 100000 = " & (1 & 100000)) 115c2c66affSColin FinckCall ok("ab" & x = "abxx", """ab"" & x = " & ("ab"&x)) 116c2c66affSColin Finck 117c2c66affSColin Finckif(isEnglishLang) then 118c2c66affSColin Finck Call ok("" & true = "True", """"" & true = " & true) 119c2c66affSColin Finck Call ok(true & false = "TrueFalse", "true & false = " & (true & false)) 120c2c66affSColin Finckend if 121c2c66affSColin Finck 122c2c66affSColin Finckcall ok(true and true, "true and true is not true") 123c2c66affSColin Finckcall ok(true and not false, "true and not false is not true") 124c2c66affSColin Finckcall ok(not (false and true), "not (false and true) is not true") 125c2c66affSColin Finckcall ok(getVT(null and true) = "VT_NULL", "getVT(null and true) = " & getVT(null and true)) 126c2c66affSColin Finck 127c2c66affSColin Finckcall ok(false or true, "false or uie is false?") 128c2c66affSColin Finckcall ok(not (false or false), "false or false is not false?") 129c2c66affSColin Finckcall ok(false and false or true, "false and false or true is false?") 130c2c66affSColin Finckcall ok(true or false and false, "true or false and false is false?") 131c2c66affSColin Finckcall ok(null or true, "null or true is false") 132c2c66affSColin Finck 133c2c66affSColin Finckcall ok(true xor false, "true xor false is false?") 134c2c66affSColin Finckcall ok(not (false xor false), "false xor false is true?") 135c2c66affSColin Finckcall ok(not (true or false xor true), "true or false xor true is true?") 136c2c66affSColin Finckcall ok(not (true xor false or true), "true xor false or true is true?") 137c2c66affSColin Finck 138c2c66affSColin Finckcall ok(false eqv false, "false does not equal false?") 139c2c66affSColin Finckcall ok(not (false eqv true), "false equals true?") 140c2c66affSColin Finckcall ok(getVT(false eqv null) = "VT_NULL", "getVT(false eqv null) = " & getVT(false eqv null)) 141c2c66affSColin Finck 142c2c66affSColin Finckcall ok(true imp true, "true does not imp true?") 143c2c66affSColin Finckcall ok(false imp false, "false does not imp false?") 144c2c66affSColin Finckcall ok(not (true imp false), "true imp false?") 145c2c66affSColin Finckcall ok(false imp null, "false imp null is false?") 146c2c66affSColin Finck 147c2c66affSColin FinckCall ok(2 >= 1, "! 2 >= 1") 148c2c66affSColin FinckCall ok(2 >= 2, "! 2 >= 2") 149c2c66affSColin FinckCall ok(not(true >= 2), "true >= 2 ?") 150c2c66affSColin FinckCall ok(2 > 1, "! 2 > 1") 151c2c66affSColin FinckCall ok(false > true, "! false < true") 152c2c66affSColin FinckCall ok(0 > true, "! 0 > true") 153c2c66affSColin FinckCall ok(not (true > 0), "true > 0") 154c2c66affSColin FinckCall ok(not (0 > 1 = 1), "0 > 1 = 1") 155c2c66affSColin FinckCall ok(1 < 2, "! 1 < 2") 156c2c66affSColin FinckCall ok(1 = 1 < 0, "! 1 = 1 < 0") 157c2c66affSColin FinckCall ok(1 <= 2, "! 1 <= 2") 158c2c66affSColin FinckCall ok(2 <= 2, "! 2 <= 2") 159c2c66affSColin Finck 160c2c66affSColin FinckCall ok(isNull(0 = null), "'(0 = null)' is not null") 161c2c66affSColin FinckCall ok(isNull(null = 1), "'(null = 1)' is not null") 162c2c66affSColin FinckCall ok(isNull(0 > null), "'(0 > null)' is not null") 163c2c66affSColin FinckCall ok(isNull(null > 1), "'(null > 1)' is not null") 164c2c66affSColin FinckCall ok(isNull(0 < null), "'(0 < null)' is not null") 165c2c66affSColin FinckCall ok(isNull(null < 1), "'(null < 1)' is not null") 166c2c66affSColin FinckCall ok(isNull(0 <> null), "'(0 <> null)' is not null") 167c2c66affSColin FinckCall ok(isNull(null <> 1), "'(null <> 1)' is not null") 168c2c66affSColin FinckCall ok(isNull(0 >= null), "'(0 >= null)' is not null") 169c2c66affSColin FinckCall ok(isNull(null >= 1), "'(null >= 1)' is not null") 170c2c66affSColin FinckCall ok(isNull(0 <= null), "'(0 <= null)' is not null") 171c2c66affSColin FinckCall ok(isNull(null <= 1), "'(null <= 1)' is not null") 172c2c66affSColin Finck 173c2c66affSColin Finckx = 3 174c2c66affSColin FinckCall ok(2+2 = 4, "2+2 = " & (2+2)) 175c2c66affSColin FinckCall ok(false + 6 + true = 5, "false + 6 + true <> 5") 176c2c66affSColin FinckCall ok(getVT(2+null) = "VT_NULL", "getVT(2+null) = " & getVT(2+null)) 177c2c66affSColin FinckCall ok(2+empty = 2, "2+empty = " & (2+empty)) 178c2c66affSColin FinckCall ok(x+x = 6, "x+x = " & (x+x)) 179c2c66affSColin Finck 180c2c66affSColin FinckCall ok(5-1 = 4, "5-1 = " & (5-1)) 181c2c66affSColin FinckCall ok(3+5-true = 9, "3+5-true <> 9") 182c2c66affSColin FinckCall ok(getVT(2-null) = "VT_NULL", "getVT(2-null) = " & getVT(2-null)) 183c2c66affSColin FinckCall ok(2-empty = 2, "2-empty = " & (2-empty)) 184c2c66affSColin FinckCall ok(2-x = -1, "2-x = " & (2-x)) 185c2c66affSColin Finck 186c2c66affSColin FinckCall ok(9 Mod 6 = 3, "9 Mod 6 = " & (9 Mod 6)) 187c2c66affSColin FinckCall ok(11.6 Mod 5.5 = False, "11.6 Mod 5.5 = " & (11.6 Mod 5.5 = 0.6)) 188c2c66affSColin FinckCall ok(7 Mod 4+2 = 5, "7 Mod 4+2 <> 5") 189c2c66affSColin FinckCall ok(getVT(2 mod null) = "VT_NULL", "getVT(2 mod null) = " & getVT(2 mod null)) 190c2c66affSColin FinckCall ok(getVT(null mod 2) = "VT_NULL", "getVT(null mod 2) = " & getVT(null mod 2)) 191c2c66affSColin Finck'FIXME: Call ok(empty mod 2 = 0, "empty mod 2 = " & (empty mod 2)) 192c2c66affSColin Finck 193c2c66affSColin FinckCall ok(5 \ 2 = 2, "5 \ 2 = " & (5\2)) 194c2c66affSColin FinckCall ok(4.6 \ 1.5 = 2, "4.6 \ 1.5 = " & (4.6\1.5)) 195c2c66affSColin FinckCall ok(4.6 \ 1.49 = 5, "4.6 \ 1.49 = " & (4.6\1.49)) 196c2c66affSColin FinckCall ok(2+3\4 = 2, "2+3\4 = " & (2+3\4)) 197c2c66affSColin Finck 198c2c66affSColin FinckCall ok(2*3 = 6, "2*3 = " & (2*3)) 199c2c66affSColin FinckCall ok(3/2 = 1.5, "3/2 = " & (3/2)) 200c2c66affSColin FinckCall ok(5\4/2 = 2, "5\4/2 = " & (5\2/1)) 201c2c66affSColin FinckCall ok(12/3\2 = 2, "12/3\2 = " & (12/3\2)) 202c2c66affSColin FinckCall ok(5/1000000 = 0.000005, "5/1000000 = " & (5/1000000)) 203c2c66affSColin Finck 204c2c66affSColin FinckCall ok(2^3 = 8, "2^3 = " & (2^3)) 205c2c66affSColin FinckCall ok(2^3^2 = 64, "2^3^2 = " & (2^3^2)) 206c2c66affSColin FinckCall ok(-3^2 = 9, "-3^2 = " & (-3^2)) 207c2c66affSColin FinckCall ok(2*3^2 = 18, "2*3^2 = " & (2*3^2)) 208c2c66affSColin Finck 209c2c66affSColin Finckx =_ 210c2c66affSColin Finck 3 211c2c66affSColin Finckx _ 212c2c66affSColin Finck = 3 213c2c66affSColin Finck 214c2c66affSColin Finckx = 3 215c2c66affSColin Finck 216c2c66affSColin Finckif true then y = true : x = y 217c2c66affSColin Finckok x, "x is false" 218c2c66affSColin Finck 219c2c66affSColin Finckx = true : if false then x = false 220c2c66affSColin Finckok x, "x is false, if false called?" 221c2c66affSColin Finck 222c2c66affSColin Finckif not false then x = true 223c2c66affSColin Finckok x, "x is false, if not false not called?" 224c2c66affSColin Finck 225c2c66affSColin Finckif not false then x = "test" : x = true 226c2c66affSColin Finckok x, "x is false, if not false not called?" 227c2c66affSColin Finck 228c2c66affSColin Finckif false then x = y : call ok(false, "if false .. : called") 229c2c66affSColin Finck 230c2c66affSColin Finckif false then x = y : call ok(false, "if false .. : called") else x = "else" 231c2c66affSColin FinckCall ok(x = "else", "else not called?") 232c2c66affSColin Finck 233c2c66affSColin Finckif true then x = y else y = x : Call ok(false, "in else?") 234c2c66affSColin Finck 235c2c66affSColin Finckif false then : 236c2c66affSColin Finck 237c2c66affSColin Finckif false then x = y : if true then call ok(false, "embedded if called") 238c2c66affSColin Finck 239c2c66affSColin Finckif false then x=1 else x=2 end if 240c2c66affSColin Finckif true then x=1 end if 241c2c66affSColin Finck 242c2c66affSColin Finckx = false 243c2c66affSColin Finckif false then x = true : x = true 244c2c66affSColin FinckCall ok(x = false, "x <> false") 245c2c66affSColin Finck 246c2c66affSColin Finckif false then 247c2c66affSColin Finck ok false, "if false called" 248c2c66affSColin Finckend if 249c2c66affSColin Finck 250c2c66affSColin Finckx = true 251c2c66affSColin Finckif x then 252c2c66affSColin Finck x = false 253c2c66affSColin Finckend if 254c2c66affSColin FinckCall ok(not x, "x is false, if not evaluated?") 255c2c66affSColin Finck 256c2c66affSColin Finckx = false 257c2c66affSColin FinckIf false Then 258c2c66affSColin Finck Call ok(false, "inside if false") 259c2c66affSColin FinckElse 260c2c66affSColin Finck x = true 261c2c66affSColin FinckEnd If 262c2c66affSColin FinckCall ok(x, "else not called?") 263c2c66affSColin Finck 264c2c66affSColin Finckx = false 265c2c66affSColin FinckIf false Then 266c2c66affSColin Finck Call ok(false, "inside if false") 267c2c66affSColin FinckElseIf not True Then 268c2c66affSColin Finck Call ok(false, "inside elseif not true") 269c2c66affSColin FinckElse 270c2c66affSColin Finck x = true 271c2c66affSColin FinckEnd If 272c2c66affSColin FinckCall ok(x, "else not called?") 273c2c66affSColin Finck 274c2c66affSColin Finckx = false 275c2c66affSColin FinckIf false Then 276c2c66affSColin Finck Call ok(false, "inside if false") 277c2c66affSColin Finck x = 1 278c2c66affSColin Finck y = 10+x 279c2c66affSColin FinckElseIf not False Then 280c2c66affSColin Finck x = true 281c2c66affSColin FinckElse 282c2c66affSColin Finck Call ok(false, "inside else not true") 283c2c66affSColin FinckEnd If 284c2c66affSColin FinckCall ok(x, "elseif not called?") 285c2c66affSColin Finck 286c2c66affSColin Finckx = false 287c2c66affSColin FinckIf false Then 288c2c66affSColin Finck Call ok(false, "inside if false") 289c2c66affSColin FinckElseIf not False Then 290c2c66affSColin Finck x = true 291c2c66affSColin FinckEnd If 292c2c66affSColin FinckCall ok(x, "elseif not called?") 293c2c66affSColin Finck 294c2c66affSColin Finckx = false 295c2c66affSColin Finckif 1 then x = true 296c2c66affSColin FinckCall ok(x, "if 1 not run?") 297c2c66affSColin Finck 298c2c66affSColin Finckx = false 299c2c66affSColin Finckif &h10000& then x = true 300c2c66affSColin FinckCall ok(x, "if &h10000& not run?") 301c2c66affSColin Finck 302c2c66affSColin Finckx = false 303c2c66affSColin Fincky = false 304c2c66affSColin Finckwhile not (x and y) 305c2c66affSColin Finck if x then 306c2c66affSColin Finck y = true 307c2c66affSColin Finck end if 308c2c66affSColin Finck x = true 309c2c66affSColin Finckwend 310c2c66affSColin Finckcall ok((x and y), "x or y is false after while") 311c2c66affSColin Finck 312c2c66affSColin Finckif false then 313c2c66affSColin Finck' empty body 314c2c66affSColin Finckend if 315c2c66affSColin Finck 316c2c66affSColin Finckif false then 317c2c66affSColin Finck x = false 318c2c66affSColin Finckelseif true then 319c2c66affSColin Finck' empty body 320c2c66affSColin Finckend if 321c2c66affSColin Finck 322c2c66affSColin Finckif false then 323c2c66affSColin Finck x = false 324c2c66affSColin Finckelse 325c2c66affSColin Finck' empty body 326c2c66affSColin Finckend if 327c2c66affSColin Finck 328c2c66affSColin Finckwhile false 329c2c66affSColin Finckwend 330c2c66affSColin Finck 331c2c66affSColin Finckx = 0 332c2c66affSColin FinckWHILE x < 3 : x = x + 1 333c2c66affSColin FinckWend 334c2c66affSColin FinckCall ok(x = 3, "x not equal to 3") 335c2c66affSColin Finck 336*942c4265SAmine Khaldiz = 2 337*942c4265SAmine Khaldiwhile z > -4 : 338*942c4265SAmine Khaldi 339*942c4265SAmine Khaldi 340*942c4265SAmine Khaldiz = z -2 341*942c4265SAmine Khaldiwend 342*942c4265SAmine Khaldi 343c2c66affSColin Finckx = false 344c2c66affSColin Fincky = false 345c2c66affSColin Finckdo while not (x and y) 346c2c66affSColin Finck if x then 347c2c66affSColin Finck y = true 348c2c66affSColin Finck end if 349c2c66affSColin Finck x = true 350c2c66affSColin Finckloop 351c2c66affSColin Finckcall ok((x and y), "x or y is false after while") 352c2c66affSColin Finck 353c2c66affSColin Finckdo while false 354c2c66affSColin Finckloop 355c2c66affSColin Finck 356c2c66affSColin Finckdo while true 357c2c66affSColin Finck exit do 358c2c66affSColin Finck ok false, "exit do didn't work" 359c2c66affSColin Finckloop 360c2c66affSColin Finck 361c2c66affSColin Finckx = 0 362c2c66affSColin FinckDo While x < 2 : x = x + 1 363c2c66affSColin FinckLoop 364c2c66affSColin FinckCall ok(x = 2, "x not equal to 2") 365c2c66affSColin Finck 366*942c4265SAmine Khaldix = 0 367*942c4265SAmine KhaldiDo While x >= -2 : 368*942c4265SAmine Khaldix = x - 1 369*942c4265SAmine KhaldiLoop 370*942c4265SAmine KhaldiCall ok(x = -3, "x not equal to -3") 371*942c4265SAmine Khaldi 372c2c66affSColin Finckx = false 373c2c66affSColin Fincky = false 374c2c66affSColin Finckdo until x and y 375c2c66affSColin Finck if x then 376c2c66affSColin Finck y = true 377c2c66affSColin Finck end if 378c2c66affSColin Finck x = true 379c2c66affSColin Finckloop 380c2c66affSColin Finckcall ok((x and y), "x or y is false after do until") 381c2c66affSColin Finck 382c2c66affSColin Finckdo until true 383c2c66affSColin Finckloop 384c2c66affSColin Finck 385c2c66affSColin Finckdo until false 386c2c66affSColin Finck exit do 387c2c66affSColin Finck ok false, "exit do didn't work" 388c2c66affSColin Finckloop 389c2c66affSColin Finck 390c2c66affSColin Finckx = 0 391c2c66affSColin FinckDo: :: x = x + 2 392c2c66affSColin FinckLoop Until x = 4 393c2c66affSColin FinckCall ok(x = 4, "x not equal to 4") 394c2c66affSColin Finck 395*942c4265SAmine Khaldix = 5 396*942c4265SAmine KhaldiDo: : 397*942c4265SAmine Khaldi 398*942c4265SAmine Khaldi: x = x * 2 399*942c4265SAmine KhaldiLoop Until x = 40 400*942c4265SAmine KhaldiCall ok(x = 40, "x not equal to 40") 401*942c4265SAmine Khaldi 402*942c4265SAmine Khaldi 403c2c66affSColin Finckx = false 404c2c66affSColin Finckdo 405c2c66affSColin Finck if x then exit do 406c2c66affSColin Finck x = true 407c2c66affSColin Finckloop 408c2c66affSColin Finckcall ok(x, "x is false after do..loop?") 409c2c66affSColin Finck 410c2c66affSColin Finckx = 0 411c2c66affSColin FinckDo :If x = 6 Then 412c2c66affSColin Finck Exit Do 413c2c66affSColin Finck End If 414c2c66affSColin Finck x = x + 3 415c2c66affSColin FinckLoop 416c2c66affSColin FinckCall ok(x = 6, "x not equal to 6") 417c2c66affSColin Finck 418c2c66affSColin Finckx = false 419c2c66affSColin Fincky = false 420c2c66affSColin Finckdo 421c2c66affSColin Finck if x then 422c2c66affSColin Finck y = true 423c2c66affSColin Finck end if 424c2c66affSColin Finck x = true 425c2c66affSColin Finckloop until x and y 426c2c66affSColin Finckcall ok((x and y), "x or y is false after while") 427c2c66affSColin Finck 428c2c66affSColin Finckdo 429c2c66affSColin Finckloop until true 430c2c66affSColin Finck 431c2c66affSColin Finckdo 432c2c66affSColin Finck exit do 433c2c66affSColin Finck ok false, "exit do didn't work" 434c2c66affSColin Finckloop until false 435c2c66affSColin Finck 436c2c66affSColin Finckx = false 437c2c66affSColin Fincky = false 438c2c66affSColin Finckdo 439c2c66affSColin Finck if x then 440c2c66affSColin Finck y = true 441c2c66affSColin Finck end if 442c2c66affSColin Finck x = true 443c2c66affSColin Finckloop while not (x and y) 444c2c66affSColin Finckcall ok((x and y), "x or y is false after while") 445c2c66affSColin Finck 446c2c66affSColin Finckdo 447c2c66affSColin Finckloop while false 448c2c66affSColin Finck 449c2c66affSColin Finckdo 450c2c66affSColin Finck exit do 451c2c66affSColin Finck ok false, "exit do didn't work" 452c2c66affSColin Finckloop while true 453c2c66affSColin Finck 454c2c66affSColin Fincky = "for1:" 455c2c66affSColin Finckfor x = 5 to 8 456c2c66affSColin Finck y = y & " " & x 457c2c66affSColin Fincknext 458c2c66affSColin FinckCall ok(y = "for1: 5 6 7 8", "y = " & y) 459c2c66affSColin Finck 460c2c66affSColin Fincky = "for2:" 461c2c66affSColin Finckfor x = 5 to 8 step 2 462c2c66affSColin Finck y = y & " " & x 463c2c66affSColin Fincknext 464c2c66affSColin FinckCall ok(y = "for2: 5 7", "y = " & y) 465c2c66affSColin Finck 466c2c66affSColin Fincky = "for3:" 467c2c66affSColin Finckx = 2 468c2c66affSColin Finckfor x = x+3 to 8 469c2c66affSColin Finck y = y & " " & x 470c2c66affSColin Fincknext 471c2c66affSColin FinckCall ok(y = "for3: 5 6 7 8", "y = " & y) 472c2c66affSColin Finck 473c2c66affSColin Fincky = "for4:" 474c2c66affSColin Finckfor x = 5 to 4 475c2c66affSColin Finck y = y & " " & x 476c2c66affSColin Fincknext 477c2c66affSColin FinckCall ok(y = "for4:", "y = " & y) 478c2c66affSColin Finck 479c2c66affSColin Fincky = "for5:" 480c2c66affSColin Finckfor x = 5 to 3 step true 481c2c66affSColin Finck y = y & " " & x 482c2c66affSColin Fincknext 483c2c66affSColin FinckCall ok(y = "for5: 5 4 3", "y = " & y) 484c2c66affSColin Finck 485c2c66affSColin Fincky = "for6:" 486c2c66affSColin Finckz = 4 487c2c66affSColin Finckfor x = 5 to z step 3-4 488c2c66affSColin Finck y = y & " " & x 489c2c66affSColin Finck z = 0 490c2c66affSColin Fincknext 491c2c66affSColin FinckCall ok(y = "for6: 5 4", "y = " & y) 492c2c66affSColin Finck 493c2c66affSColin Fincky = "for7:" 494c2c66affSColin Finckz = 1 495c2c66affSColin Finckfor x = 5 to 8 step z 496c2c66affSColin Finck y = y & " " & x 497c2c66affSColin Finck z = 2 498c2c66affSColin Fincknext 499c2c66affSColin FinckCall ok(y = "for7: 5 6 7 8", "y = " & y) 500c2c66affSColin Finck 501c2c66affSColin Finckz = 0 502c2c66affSColin FinckFor x = 10 To 18 Step 2 : : z = z + 1 503c2c66affSColin FinckNext 504c2c66affSColin FinckCall ok(z = 5, "z not equal to 5") 505c2c66affSColin Finck 506c2c66affSColin Fincky = "for8:" 507c2c66affSColin Finckfor x = 5 to 8 508c2c66affSColin Finck y = y & " " & x 509c2c66affSColin Finck x = x+1 510c2c66affSColin Fincknext 511c2c66affSColin FinckCall ok(y = "for8: 5 7", "y = " & y) 512c2c66affSColin Finck 513c2c66affSColin Finckfor x = 1.5 to 1 514c2c66affSColin Finck Call ok(false, "for..to called when unexpected") 515c2c66affSColin Fincknext 516c2c66affSColin Finck 517c2c66affSColin Finckfor x = 1 to 100 518c2c66affSColin Finck exit for 519c2c66affSColin Finck Call ok(false, "exit for not escaped the loop?") 520c2c66affSColin Fincknext 521c2c66affSColin Finck 522*942c4265SAmine Khaldifor x = 1 to 5 : 523*942c4265SAmine Khaldi: 524*942c4265SAmine Khaldi: :exit for 525*942c4265SAmine Khaldi Call ok(false, "exit for not escaped the loop?") 526*942c4265SAmine Khaldinext 527*942c4265SAmine Khaldi 528c2c66affSColin Finckdo while true 529c2c66affSColin Finck for x = 1 to 100 530c2c66affSColin Finck exit do 531c2c66affSColin Finck next 532c2c66affSColin Finckloop 533c2c66affSColin Finck 534c2c66affSColin Finckif null then call ok(false, "if null evaluated") 535c2c66affSColin Finck 536c2c66affSColin Finckwhile null 537c2c66affSColin Finck call ok(false, "while null evaluated") 538c2c66affSColin Finckwend 539c2c66affSColin Finck 540c2c66affSColin FinckCall collectionObj.reset() 541c2c66affSColin Fincky = 0 542*942c4265SAmine Khaldifor each x in collectionObj : 543*942c4265SAmine Khaldi 544*942c4265SAmine Khaldi :y = y + 3 545*942c4265SAmine Khaldinext 546*942c4265SAmine KhaldiCall ok(y = 9, "y = " & y) 547*942c4265SAmine Khaldi 548*942c4265SAmine KhaldiCall collectionObj.reset() 549*942c4265SAmine Khaldiy = 0 550c2c66affSColin Finckx = 10 551c2c66affSColin Finckz = 0 552c2c66affSColin Finckfor each x in collectionObj : z = z + 2 553c2c66affSColin Finck y = y+1 554c2c66affSColin Finck Call ok(x = y, "x <> y") 555c2c66affSColin Fincknext 556c2c66affSColin FinckCall ok(y = 3, "y = " & y) 557c2c66affSColin FinckCall ok(z = 6, "z = " & z) 558c2c66affSColin FinckCall ok(getVT(x) = "VT_EMPTY*", "getVT(x) = " & getVT(x)) 559c2c66affSColin Finck 560c2c66affSColin FinckCall collectionObj.reset() 561c2c66affSColin Fincky = false 562c2c66affSColin Finckfor each x in collectionObj 563c2c66affSColin Finck if x = 2 then exit for 564c2c66affSColin Finck y = 1 565c2c66affSColin Fincknext 566c2c66affSColin FinckCall ok(y = 1, "y = " & y) 567c2c66affSColin FinckCall ok(x = 2, "x = " & x) 568c2c66affSColin Finck 569c2c66affSColin FinckSet obj = collectionObj 570c2c66affSColin FinckCall obj.reset() 571c2c66affSColin Fincky = 0 572c2c66affSColin Finckx = 10 573c2c66affSColin Finckfor each x in obj 574c2c66affSColin Finck y = y+1 575c2c66affSColin Finck Call ok(x = y, "x <> y") 576c2c66affSColin Fincknext 577c2c66affSColin FinckCall ok(y = 3, "y = " & y) 578c2c66affSColin FinckCall ok(getVT(x) = "VT_EMPTY*", "getVT(x) = " & getVT(x)) 579c2c66affSColin Finck 580c2c66affSColin Finckx = false 581c2c66affSColin Finckselect case 3 582c2c66affSColin Finck case 2 583c2c66affSColin Finck Call ok(false, "unexpected case") 584c2c66affSColin Finck case 2 585c2c66affSColin Finck Call ok(false, "unexpected case") 586c2c66affSColin Finck case 4 587c2c66affSColin Finck Call ok(false, "unexpected case") 588c2c66affSColin Finck case "test" 589c2c66affSColin Finck case "another case" 590c2c66affSColin Finck Call ok(false, "unexpected case") 591c2c66affSColin Finck case 0, false, 2+1, 10 592c2c66affSColin Finck x = true 593c2c66affSColin Finck case ok(false, "unexpected case") 594c2c66affSColin Finck Call ok(false, "unexpected case") 595c2c66affSColin Finck case else 596c2c66affSColin Finck Call ok(false, "unexpected case") 597c2c66affSColin Finckend select 598c2c66affSColin FinckCall ok(x, "wrong case") 599c2c66affSColin Finck 600c2c66affSColin Finckx = false 601c2c66affSColin Finckselect case 3 602c2c66affSColin Finck case 3 603c2c66affSColin Finck x = true 604c2c66affSColin Finckend select 605c2c66affSColin FinckCall ok(x, "wrong case") 606c2c66affSColin Finck 607c2c66affSColin Finckx = false 608c2c66affSColin Finckselect case 2+2 609c2c66affSColin Finck case 3 610c2c66affSColin Finck Call ok(false, "unexpected case") 611c2c66affSColin Finck case else 612c2c66affSColin Finck x = true 613c2c66affSColin Finckend select 614c2c66affSColin FinckCall ok(x, "wrong case") 615c2c66affSColin Finck 616c2c66affSColin Fincky = "3" 617c2c66affSColin Finckx = false 618c2c66affSColin Finckselect case y 619c2c66affSColin Finck case "3" 620c2c66affSColin Finck x = true 621c2c66affSColin Finck case 3 622c2c66affSColin Finck Call ok(false, "unexpected case") 623c2c66affSColin Finckend select 624c2c66affSColin FinckCall ok(x, "wrong case") 625c2c66affSColin Finck 626c2c66affSColin Finckselect case 0 627c2c66affSColin Finck case 1 628c2c66affSColin Finck Call ok(false, "unexpected case") 629c2c66affSColin Finck case "2" 630c2c66affSColin Finck Call ok(false, "unexpected case") 631c2c66affSColin Finckend select 632c2c66affSColin Finck 633c2c66affSColin Finckselect case 0 634c2c66affSColin Finckend select 635c2c66affSColin Finck 636c2c66affSColin Finckx = false 637c2c66affSColin Finckselect case 2 638c2c66affSColin Finck case 3,1,2,4: x = true 639c2c66affSColin Finck case 5,6,7 640c2c66affSColin Finck Call ok(false, "unexpected case") 641c2c66affSColin Finckend select 642c2c66affSColin FinckCall ok(x, "wrong case") 643c2c66affSColin Finck 644c2c66affSColin Finckx = false 645c2c66affSColin Finckselect case 2: case 5,6,7: Call ok(false, "unexpected case") 646c2c66affSColin Finck case 2,1,2,4 647c2c66affSColin Finck x = true 648c2c66affSColin Finck case else: Call ok(false, "unexpected case else") 649c2c66affSColin Finckend select 650c2c66affSColin FinckCall ok(x, "wrong case") 651c2c66affSColin Finck 652*942c4265SAmine Khaldix = False 653*942c4265SAmine Khaldiselect case 1 : 654*942c4265SAmine Khaldi 655*942c4265SAmine Khaldi :case 3, 4 : 656*942c4265SAmine Khaldi 657*942c4265SAmine Khaldi 658*942c4265SAmine Khaldi case 5 659*942c4265SAmine Khaldi: 660*942c4265SAmine Khaldi Call ok(false, "unexpected case") : 661*942c4265SAmine Khaldi Case Else: 662*942c4265SAmine Khaldi 663*942c4265SAmine Khaldi x = True 664*942c4265SAmine Khaldiend select 665*942c4265SAmine KhaldiCall ok(x, "wrong case") 666*942c4265SAmine Khaldi 667c2c66affSColin Finckif false then 668c2c66affSColin FinckSub testsub 669c2c66affSColin Finck x = true 670c2c66affSColin FinckEnd Sub 671c2c66affSColin Finckend if 672c2c66affSColin Finck 673c2c66affSColin Finckx = false 674c2c66affSColin FinckCall testsub 675c2c66affSColin FinckCall ok(x, "x is false, testsub not called?") 676c2c66affSColin Finck 677c2c66affSColin FinckSub SubSetTrue(v) 678c2c66affSColin Finck Call ok(not v, "v is not true") 679c2c66affSColin Finck v = true 680c2c66affSColin FinckEnd Sub 681c2c66affSColin Finck 682c2c66affSColin Finckx = false 683c2c66affSColin FinckSubSetTrue x 684c2c66affSColin FinckCall ok(x, "x was not set by SubSetTrue") 685c2c66affSColin Finck 686c2c66affSColin FinckSubSetTrue false 687c2c66affSColin FinckCall ok(not false, "false is no longer false?") 688c2c66affSColin Finck 689c2c66affSColin FinckSub SubSetTrue2(ByRef v) 690c2c66affSColin Finck Call ok(not v, "v is not true") 691c2c66affSColin Finck v = true 692c2c66affSColin FinckEnd Sub 693c2c66affSColin Finck 694c2c66affSColin Finckx = false 695c2c66affSColin FinckSubSetTrue2 x 696c2c66affSColin FinckCall ok(x, "x was not set by SubSetTrue") 697c2c66affSColin Finck 698c2c66affSColin FinckSub TestSubArgVal(ByVal v) 699c2c66affSColin Finck Call ok(not v, "v is not false") 700c2c66affSColin Finck v = true 701c2c66affSColin Finck Call ok(v, "v is not true?") 702c2c66affSColin FinckEnd Sub 703c2c66affSColin Finck 704c2c66affSColin Finckx = false 705c2c66affSColin FinckCall TestSubArgVal(x) 706c2c66affSColin FinckCall ok(not x, "x is true after TestSubArgVal call?") 707c2c66affSColin Finck 708c2c66affSColin FinckSub TestSubMultiArgs(a,b,c,d,e) 709c2c66affSColin Finck Call ok(a=1, "a = " & a) 710c2c66affSColin Finck Call ok(b=2, "b = " & b) 711c2c66affSColin Finck Call ok(c=3, "c = " & c) 712c2c66affSColin Finck Call ok(d=4, "d = " & d) 713c2c66affSColin Finck Call ok(e=5, "e = " & e) 714c2c66affSColin FinckEnd Sub 715c2c66affSColin Finck 716c2c66affSColin FinckSub TestSubExit(ByRef a) 717c2c66affSColin Finck If a Then 718c2c66affSColin Finck Exit Sub 719c2c66affSColin Finck End If 720c2c66affSColin Finck Call ok(false, "Exit Sub not called?") 721c2c66affSColin FinckEnd Sub 722c2c66affSColin Finck 723c2c66affSColin FinckCall TestSubExit(true) 724c2c66affSColin Finck 725c2c66affSColin FinckSub TestSubExit2 726c2c66affSColin Finck for x = 1 to 100 727c2c66affSColin Finck Exit Sub 728c2c66affSColin Finck next 729c2c66affSColin FinckEnd Sub 730c2c66affSColin FinckCall TestSubExit2 731c2c66affSColin Finck 732c2c66affSColin FinckTestSubMultiArgs 1, 2, 3, 4, 5 733c2c66affSColin FinckCall TestSubMultiArgs(1, 2, 3, 4, 5) 734c2c66affSColin Finck 735c2c66affSColin FinckSub TestSubLocalVal 736c2c66affSColin Finck x = false 737c2c66affSColin Finck Call ok(not x, "local x is not false?") 738c2c66affSColin Finck Dim x 739c2c66affSColin Finck Dim a,b, c 740c2c66affSColin FinckEnd Sub 741c2c66affSColin Finck 742c2c66affSColin Finckx = true 743c2c66affSColin Fincky = true 744c2c66affSColin FinckCall TestSubLocalVal 745c2c66affSColin FinckCall ok(x, "global x is not true?") 746c2c66affSColin Finck 747c2c66affSColin FinckPublic Sub TestPublicSub 748c2c66affSColin FinckEnd Sub 749c2c66affSColin FinckCall TestPublicSub 750c2c66affSColin Finck 751c2c66affSColin FinckPrivate Sub TestPrivateSub 752c2c66affSColin FinckEnd Sub 753c2c66affSColin FinckCall TestPrivateSub 754c2c66affSColin Finck 755*942c4265SAmine KhaldiPublic Sub TestSeparatorSub : : 756*942c4265SAmine Khaldi: 757*942c4265SAmine KhaldiEnd Sub 758*942c4265SAmine KhaldiCall TestSeparatorSub 759*942c4265SAmine Khaldi 760c2c66affSColin Finckif false then 761c2c66affSColin FinckFunction testfunc 762c2c66affSColin Finck x = true 763c2c66affSColin FinckEnd Function 764c2c66affSColin Finckend if 765c2c66affSColin Finck 766c2c66affSColin Finckx = false 767c2c66affSColin FinckCall TestFunc 768c2c66affSColin FinckCall ok(x, "x is false, testfunc not called?") 769c2c66affSColin Finck 770c2c66affSColin FinckFunction FuncSetTrue(v) 771c2c66affSColin Finck Call ok(not v, "v is not true") 772c2c66affSColin Finck v = true 773c2c66affSColin FinckEnd Function 774c2c66affSColin Finck 775c2c66affSColin Finckx = false 776c2c66affSColin FinckFuncSetTrue x 777c2c66affSColin FinckCall ok(x, "x was not set by FuncSetTrue") 778c2c66affSColin Finck 779c2c66affSColin FinckFuncSetTrue false 780c2c66affSColin FinckCall ok(not false, "false is no longer false?") 781c2c66affSColin Finck 782c2c66affSColin FinckFunction FuncSetTrue2(ByRef v) 783c2c66affSColin Finck Call ok(not v, "v is not true") 784c2c66affSColin Finck v = true 785c2c66affSColin FinckEnd Function 786c2c66affSColin Finck 787c2c66affSColin Finckx = false 788c2c66affSColin FinckFuncSetTrue2 x 789c2c66affSColin FinckCall ok(x, "x was not set by FuncSetTrue") 790c2c66affSColin Finck 791c2c66affSColin FinckFunction TestFuncArgVal(ByVal v) 792c2c66affSColin Finck Call ok(not v, "v is not false") 793c2c66affSColin Finck v = true 794c2c66affSColin Finck Call ok(v, "v is not true?") 795c2c66affSColin FinckEnd Function 796c2c66affSColin Finck 797c2c66affSColin Finckx = false 798c2c66affSColin FinckCall TestFuncArgVal(x) 799c2c66affSColin FinckCall ok(not x, "x is true after TestFuncArgVal call?") 800c2c66affSColin Finck 801c2c66affSColin FinckFunction TestFuncMultiArgs(a,b,c,d,e) 802c2c66affSColin Finck Call ok(a=1, "a = " & a) 803c2c66affSColin Finck Call ok(b=2, "b = " & b) 804c2c66affSColin Finck Call ok(c=3, "c = " & c) 805c2c66affSColin Finck Call ok(d=4, "d = " & d) 806c2c66affSColin Finck Call ok(e=5, "e = " & e) 807c2c66affSColin FinckEnd Function 808c2c66affSColin Finck 809c2c66affSColin FinckTestFuncMultiArgs 1, 2, 3, 4, 5 810c2c66affSColin FinckCall TestFuncMultiArgs(1, 2, 3, 4, 5) 811c2c66affSColin Finck 812c2c66affSColin FinckFunction TestFuncLocalVal 813c2c66affSColin Finck x = false 814c2c66affSColin Finck Call ok(not x, "local x is not false?") 815c2c66affSColin Finck Dim x 816c2c66affSColin FinckEnd Function 817c2c66affSColin Finck 818c2c66affSColin Finckx = true 819c2c66affSColin Fincky = true 820c2c66affSColin FinckCall TestFuncLocalVal 821c2c66affSColin FinckCall ok(x, "global x is not true?") 822c2c66affSColin Finck 823c2c66affSColin FinckFunction TestFuncExit(ByRef a) 824c2c66affSColin Finck If a Then 825c2c66affSColin Finck Exit Function 826c2c66affSColin Finck End If 827c2c66affSColin Finck Call ok(false, "Exit Function not called?") 828c2c66affSColin FinckEnd Function 829c2c66affSColin Finck 830c2c66affSColin FinckCall TestFuncExit(true) 831c2c66affSColin Finck 832c2c66affSColin FinckFunction TestFuncExit2(ByRef a) 833c2c66affSColin Finck For x = 1 to 100 834c2c66affSColin Finck For y = 1 to 100 835c2c66affSColin Finck Exit Function 836c2c66affSColin Finck Next 837c2c66affSColin Finck Next 838c2c66affSColin Finck Call ok(false, "Exit Function not called?") 839c2c66affSColin FinckEnd Function 840c2c66affSColin Finck 841c2c66affSColin FinckCall TestFuncExit2(true) 842c2c66affSColin Finck 843c2c66affSColin FinckSub SubParseTest 844c2c66affSColin FinckEnd Sub : x = false 845c2c66affSColin FinckCall SubParseTest 846c2c66affSColin Finck 847c2c66affSColin FinckFunction FuncParseTest 848c2c66affSColin FinckEnd Function : x = false 849c2c66affSColin Finck 850c2c66affSColin FinckFunction ReturnTrue 851c2c66affSColin Finck ReturnTrue = false 852c2c66affSColin Finck ReturnTrue = true 853c2c66affSColin FinckEnd Function 854c2c66affSColin Finck 855c2c66affSColin FinckCall ok(ReturnTrue(), "ReturnTrue returned false?") 856c2c66affSColin Finck 857c2c66affSColin FinckFunction SetVal(ByRef x, ByVal v) 858c2c66affSColin Finck x = v 859c2c66affSColin Finck SetVal = x 860c2c66affSColin Finck Exit Function 861c2c66affSColin FinckEnd Function 862c2c66affSColin Finck 863c2c66affSColin Finckx = false 864c2c66affSColin Finckok SetVal(x, true), "SetVal returned false?" 865c2c66affSColin FinckCall ok(x, "x is not set to true by SetVal?") 866c2c66affSColin Finck 867c2c66affSColin FinckPublic Function TestPublicFunc 868c2c66affSColin FinckEnd Function 869c2c66affSColin FinckCall TestPublicFunc 870c2c66affSColin Finck 871c2c66affSColin FinckPrivate Function TestPrivateFunc 872c2c66affSColin FinckEnd Function 873c2c66affSColin FinckCall TestPrivateFunc 874c2c66affSColin Finck 875*942c4265SAmine KhaldiPublic Function TestSepFunc(ByVal a) : : 876*942c4265SAmine Khaldi: TestSepFunc = a 877*942c4265SAmine KhaldiEnd Function 878*942c4265SAmine KhaldiCall ok(TestSepFunc(1) = 1, "Function did not return 1") 879*942c4265SAmine Khaldi 880*942c4265SAmine Khaldi 881c2c66affSColin Finck' Stop has an effect only in debugging mode 882c2c66affSColin FinckStop 883c2c66affSColin Finck 884c2c66affSColin Finckset x = testObj 885c2c66affSColin FinckCall ok(getVT(x) = "VT_DISPATCH*", "getVT(x=testObj) = " & getVT(x)) 886c2c66affSColin Finck 887c2c66affSColin FinckSet obj = New EmptyClass 888c2c66affSColin FinckCall ok(getVT(obj) = "VT_DISPATCH*", "getVT(obj) = " & getVT(obj)) 889c2c66affSColin Finck 890c2c66affSColin FinckClass EmptyClass 891c2c66affSColin FinckEnd Class 892c2c66affSColin Finck 893c2c66affSColin FinckSet x = obj 894c2c66affSColin FinckCall ok(getVT(x) = "VT_DISPATCH*", "getVT(x) = " & getVT(x)) 895c2c66affSColin Finck 896c2c66affSColin FinckClass TestClass 897c2c66affSColin Finck Public publicProp 898c2c66affSColin Finck 899c2c66affSColin Finck Private privateProp 900c2c66affSColin Finck 901c2c66affSColin Finck Public Function publicFunction() 902c2c66affSColin Finck privateSub() 903c2c66affSColin Finck publicFunction = 4 904c2c66affSColin Finck End Function 905c2c66affSColin Finck 906c2c66affSColin Finck Public Property Get gsProp() 907c2c66affSColin Finck gsProp = privateProp 908c2c66affSColin Finck funcCalled = "gsProp get" 909c2c66affSColin Finck exit property 910c2c66affSColin Finck Call ok(false, "exit property not returned?") 911c2c66affSColin Finck End Property 912c2c66affSColin Finck 913c2c66affSColin Finck Public Default Property Get DefValGet 914c2c66affSColin Finck DefValGet = privateProp 915c2c66affSColin Finck funcCalled = "GetDefVal" 916c2c66affSColin Finck End Property 917c2c66affSColin Finck 918c2c66affSColin Finck Public Property Let DefValGet(x) 919c2c66affSColin Finck End Property 920c2c66affSColin Finck 921c2c66affSColin Finck Public publicProp2 922c2c66affSColin Finck 923c2c66affSColin Finck Public Sub publicSub 924c2c66affSColin Finck End Sub 925c2c66affSColin Finck 926c2c66affSColin Finck Public Property Let gsProp(val) 927c2c66affSColin Finck privateProp = val 928c2c66affSColin Finck funcCalled = "gsProp let" 929c2c66affSColin Finck exit property 930c2c66affSColin Finck Call ok(false, "exit property not returned?") 931c2c66affSColin Finck End Property 932c2c66affSColin Finck 933c2c66affSColin Finck Public Property Set gsProp(val) 934c2c66affSColin Finck funcCalled = "gsProp set" 935c2c66affSColin Finck exit property 936c2c66affSColin Finck Call ok(false, "exit property not returned?") 937c2c66affSColin Finck End Property 938c2c66affSColin Finck 939c2c66affSColin Finck Public Sub setPrivateProp(x) 940c2c66affSColin Finck privateProp = x 941c2c66affSColin Finck End Sub 942c2c66affSColin Finck 943c2c66affSColin Finck Function getPrivateProp 944c2c66affSColin Finck getPrivateProp = privateProp 945c2c66affSColin Finck End Function 946c2c66affSColin Finck 947c2c66affSColin Finck Private Sub privateSub 948c2c66affSColin Finck End Sub 949c2c66affSColin Finck 950c2c66affSColin Finck Public Sub Class_Initialize 951c2c66affSColin Finck publicProp2 = 2 952c2c66affSColin Finck privateProp = true 953c2c66affSColin Finck Call ok(getVT(privateProp) = "VT_BOOL*", "getVT(privateProp) = " & getVT(privateProp)) 954c2c66affSColin Finck Call ok(getVT(publicProp2) = "VT_I2*", "getVT(publicProp2) = " & getVT(publicProp2)) 955c2c66affSColin Finck Call ok(getVT(Me.publicProp2) = "VT_I2", "getVT(Me.publicProp2) = " & getVT(Me.publicProp2)) 956c2c66affSColin Finck End Sub 957c2c66affSColin Finck 958c2c66affSColin Finck Property Get gsGetProp(x) 959c2c66affSColin Finck gsGetProp = x 960c2c66affSColin Finck End Property 961c2c66affSColin FinckEnd Class 962c2c66affSColin Finck 963c2c66affSColin FinckCall testDisp(new testClass) 964c2c66affSColin Finck 965c2c66affSColin FinckSet obj = New TestClass 966c2c66affSColin Finck 967c2c66affSColin FinckCall ok(obj.publicFunction = 4, "obj.publicFunction = " & obj.publicFunction) 968c2c66affSColin FinckCall ok(obj.publicFunction() = 4, "obj.publicFunction() = " & obj.publicFunction()) 969c2c66affSColin Finck 970c2c66affSColin Finckobj.publicSub() 971c2c66affSColin FinckCall obj.publicSub 972c2c66affSColin FinckCall obj.publicFunction() 973c2c66affSColin Finck 974c2c66affSColin FinckCall ok(getVT(obj.publicProp) = "VT_EMPTY", "getVT(obj.publicProp) = " & getVT(obj.publicProp)) 975c2c66affSColin Finckobj.publicProp = 3 976c2c66affSColin FinckCall ok(getVT(obj.publicProp) = "VT_I2", "getVT(obj.publicProp) = " & getVT(obj.publicProp)) 977c2c66affSColin FinckCall ok(obj.publicProp = 3, "obj.publicProp = " & obj.publicProp) 978c2c66affSColin Finckobj.publicProp() = 3 979c2c66affSColin Finck 980c2c66affSColin FinckCall ok(obj.getPrivateProp() = true, "obj.getPrivateProp() = " & obj.getPrivateProp()) 981c2c66affSColin FinckCall obj.setPrivateProp(6) 982c2c66affSColin FinckCall ok(obj.getPrivateProp = 6, "obj.getPrivateProp = " & obj.getPrivateProp) 983c2c66affSColin Finck 984c2c66affSColin FinckDim funcCalled 985c2c66affSColin FinckfuncCalled = "" 986c2c66affSColin FinckCall ok(obj.gsProp = 6, "obj.gsProp = " & obj.gsProp) 987c2c66affSColin FinckCall ok(funcCalled = "gsProp get", "funcCalled = " & funcCalled) 988c2c66affSColin Finckobj.gsProp = 3 989c2c66affSColin FinckCall ok(funcCalled = "gsProp let", "funcCalled = " & funcCalled) 990c2c66affSColin FinckCall ok(obj.getPrivateProp = 3, "obj.getPrivateProp = " & obj.getPrivateProp) 991c2c66affSColin FinckSet obj.gsProp = New testclass 992c2c66affSColin FinckCall ok(funcCalled = "gsProp set", "funcCalled = " & funcCalled) 993c2c66affSColin Finck 994c2c66affSColin Finckx = obj 995c2c66affSColin FinckCall ok(x = 3, "(x = obj) = " & x) 996c2c66affSColin FinckCall ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled) 997c2c66affSColin FinckfuncCalled = "" 998c2c66affSColin FinckCall ok(obj = 3, "(x = obj) = " & obj) 999c2c66affSColin FinckCall ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled) 1000c2c66affSColin Finck 1001c2c66affSColin FinckCall obj.Class_Initialize 1002c2c66affSColin FinckCall ok(obj.getPrivateProp() = true, "obj.getPrivateProp() = " & obj.getPrivateProp()) 1003c2c66affSColin Finck 1004c2c66affSColin Finckx = (New testclass).publicProp 1005c2c66affSColin Finck 1006c2c66affSColin FinckClass TermTest 1007c2c66affSColin Finck Public Sub Class_Terminate() 1008c2c66affSColin Finck funcCalled = "terminate" 1009c2c66affSColin Finck End Sub 1010c2c66affSColin FinckEnd Class 1011c2c66affSColin Finck 1012c2c66affSColin FinckSet obj = New TermTest 1013c2c66affSColin FinckfuncCalled = "" 1014c2c66affSColin FinckSet obj = Nothing 1015c2c66affSColin FinckCall ok(funcCalled = "terminate", "funcCalled = " & funcCalled) 1016c2c66affSColin Finck 1017c2c66affSColin FinckSet obj = New TermTest 1018c2c66affSColin FinckfuncCalled = "" 1019c2c66affSColin FinckCall obj.Class_Terminate 1020c2c66affSColin FinckCall ok(funcCalled = "terminate", "funcCalled = " & funcCalled) 1021c2c66affSColin FinckfuncCalled = "" 1022c2c66affSColin FinckSet obj = Nothing 1023c2c66affSColin FinckCall ok(funcCalled = "terminate", "funcCalled = " & funcCalled) 1024c2c66affSColin Finck 1025c2c66affSColin FinckCall (New testclass).publicSub() 1026c2c66affSColin FinckCall (New testclass).publicSub 1027c2c66affSColin Finck 1028c2c66affSColin Finckclass PropTest 1029c2c66affSColin Finck property get prop0() 1030c2c66affSColin Finck prop0 = 1 1031c2c66affSColin Finck end property 1032c2c66affSColin Finck 1033c2c66affSColin Finck property get prop1(x) 1034c2c66affSColin Finck prop1 = x+1 1035c2c66affSColin Finck end property 1036c2c66affSColin Finck 1037c2c66affSColin Finck property get prop2(x, y) 1038c2c66affSColin Finck prop2 = x+y 1039c2c66affSColin Finck end property 1040c2c66affSColin Finckend class 1041c2c66affSColin Finck 1042c2c66affSColin Finckset obj = new PropTest 1043c2c66affSColin Finck 1044c2c66affSColin Finckcall ok(obj.prop0 = 1, "obj.prop0 = " & obj.prop0) 1045c2c66affSColin Finckcall ok(obj.prop1(3) = 4, "obj.prop1(3) = " & obj.prop1(3)) 1046c2c66affSColin Finckcall ok(obj.prop2(3,4) = 7, "obj.prop2(3,4) = " & obj.prop2(3,4)) 1047c2c66affSColin Finckcall obj.prop0() 1048c2c66affSColin Finckcall obj.prop1(2) 1049c2c66affSColin Finckcall obj.prop2(3,4) 1050c2c66affSColin Finck 1051c2c66affSColin Finckx = "following ':' is correct syntax" : 1052c2c66affSColin Finckx = "following ':' is correct syntax" :: : 1053c2c66affSColin Finck:: x = "also correct syntax" 1054c2c66affSColin Finckrem another ugly way for comments 1055c2c66affSColin Finckx = "rem as simplestatement" : rem rem comment 1056c2c66affSColin Finck: 1057c2c66affSColin Finck 1058c2c66affSColin FinckSet obj = new EmptyClass 1059c2c66affSColin FinckSet x = obj 1060c2c66affSColin FinckSet y = new EmptyClass 1061c2c66affSColin Finck 1062c2c66affSColin FinckCall ok(obj is x, "obj is not x") 1063c2c66affSColin FinckCall ok(x is obj, "x is not obj") 1064c2c66affSColin FinckCall ok(not (obj is y), "obj is not y") 1065c2c66affSColin FinckCall ok(not obj is y, "obj is not y") 1066c2c66affSColin FinckCall ok(not (x is Nothing), "x is 1") 1067c2c66affSColin FinckCall ok(Nothing is Nothing, "Nothing is not Nothing") 1068c2c66affSColin FinckCall ok(x is obj and true, "x is obj and true is false") 1069c2c66affSColin Finck 1070c2c66affSColin FinckClass TestMe 1071c2c66affSColin Finck Public Sub Test(MyMe) 1072c2c66affSColin Finck Call ok(Me is MyMe, "Me is not MyMe") 1073c2c66affSColin Finck End Sub 1074c2c66affSColin FinckEnd Class 1075c2c66affSColin Finck 1076c2c66affSColin FinckSet obj = New TestMe 1077c2c66affSColin FinckCall obj.test(obj) 1078c2c66affSColin Finck 1079c2c66affSColin FinckCall ok(getVT(test) = "VT_DISPATCH", "getVT(test) = " & getVT(test)) 1080c2c66affSColin FinckCall ok(Me is Test, "Me is not Test") 1081c2c66affSColin Finck 1082c2c66affSColin FinckConst c1 = 1, c2 = 2, c3 = -3 1083c2c66affSColin FinckCall ok(c1 = 1, "c1 = " & c1) 1084c2c66affSColin FinckCall ok(getVT(c1) = "VT_I2", "getVT(c1) = " & getVT(c1)) 1085c2c66affSColin FinckCall ok(c3 = -3, "c3 = " & c3) 1086c2c66affSColin FinckCall ok(getVT(c3) = "VT_I2", "getVT(c3) = " & getVT(c3)) 1087c2c66affSColin Finck 1088c2c66affSColin FinckConst cb = True, cs = "test", cnull = null 1089c2c66affSColin FinckCall ok(cb, "cb = " & cb) 1090c2c66affSColin FinckCall ok(getVT(cb) = "VT_BOOL", "getVT(cb) = " & getVT(cb)) 1091c2c66affSColin FinckCall ok(cs = "test", "cs = " & cs) 1092c2c66affSColin FinckCall ok(getVT(cs) = "VT_BSTR", "getVT(cs) = " & getVT(cs)) 1093c2c66affSColin FinckCall ok(isNull(cnull), "cnull = " & cnull) 1094c2c66affSColin FinckCall ok(getVT(cnull) = "VT_NULL", "getVT(cnull) = " & getVT(cnull)) 1095c2c66affSColin Finck 1096c2c66affSColin Finckif false then Const conststr = "str" 1097c2c66affSColin FinckCall ok(conststr = "str", "conststr = " & conststr) 1098c2c66affSColin FinckCall ok(getVT(conststr) = "VT_BSTR", "getVT(conststr) = " & getVT(conststr)) 1099c2c66affSColin FinckCall ok(conststr = "str", "conststr = " & conststr) 1100c2c66affSColin Finck 1101c2c66affSColin FinckSub ConstTestSub 1102c2c66affSColin Finck Const funcconst = 1 1103c2c66affSColin Finck Call ok(c1 = 1, "c1 = " & c1) 1104c2c66affSColin Finck Call ok(funcconst = 1, "funcconst = " & funcconst) 1105c2c66affSColin FinckEnd Sub 1106c2c66affSColin Finck 1107c2c66affSColin FinckCall ConstTestSub 1108c2c66affSColin FinckDim funcconst 1109c2c66affSColin Finck 1110c2c66affSColin Finck' Property may be used as an identifier (although it's a keyword) 1111c2c66affSColin FinckSub TestProperty 1112c2c66affSColin Finck Dim Property 1113c2c66affSColin Finck PROPERTY = true 1114c2c66affSColin Finck Call ok(property, "property = " & property) 1115c2c66affSColin Finck 1116c2c66affSColin Finck for property = 1 to 2 1117c2c66affSColin Finck next 1118c2c66affSColin FinckEnd Sub 1119c2c66affSColin Finck 1120c2c66affSColin FinckCall TestProperty 1121c2c66affSColin Finck 1122c2c66affSColin FinckClass Property 1123c2c66affSColin Finck Public Sub Property() 1124c2c66affSColin Finck End Sub 1125c2c66affSColin Finck 1126c2c66affSColin Finck Sub Test(byref property) 1127c2c66affSColin Finck End Sub 1128c2c66affSColin FinckEnd Class 1129c2c66affSColin Finck 1130c2c66affSColin FinckClass Property2 1131c2c66affSColin Finck Function Property() 1132c2c66affSColin Finck End Function 1133c2c66affSColin Finck 1134c2c66affSColin Finck Sub Test(property) 1135c2c66affSColin Finck End Sub 1136c2c66affSColin Finck 1137c2c66affSColin Finck Sub Test2(byval property) 1138c2c66affSColin Finck End Sub 1139c2c66affSColin FinckEnd Class 1140c2c66affSColin Finck 1141*942c4265SAmine KhaldiClass SeparatorTest : : Dim varTest1 1142*942c4265SAmine Khaldi: 1143*942c4265SAmine Khaldi Private Sub Class_Initialize : varTest1 = 1 1144*942c4265SAmine Khaldi End Sub :: 1145*942c4265SAmine Khaldi 1146*942c4265SAmine Khaldi Property Get Test1() : 1147*942c4265SAmine Khaldi Test1 = varTest1 1148*942c4265SAmine Khaldi End Property :: 1149*942c4265SAmine Khaldi: : 1150*942c4265SAmine Khaldi Property Let Test1(a) : 1151*942c4265SAmine Khaldi varTest1 = a 1152*942c4265SAmine Khaldi End Property : 1153*942c4265SAmine Khaldi 1154*942c4265SAmine Khaldi Public Function AddToTest1(ByVal a) :: : 1155*942c4265SAmine Khaldi varTest1 = varTest1 + a 1156*942c4265SAmine Khaldi AddToTest1 = varTest1 1157*942c4265SAmine Khaldi End Function : End Class : :: Set obj = New SeparatorTest 1158*942c4265SAmine Khaldi 1159*942c4265SAmine KhaldiCall ok(obj.Test1 = 1, "obj.Test1 is not 1") 1160*942c4265SAmine Khaldiobj.Test1 = 6 1161*942c4265SAmine KhaldiCall ok(obj.Test1 = 6, "obj.Test1 is not 6") 1162*942c4265SAmine Khaldiobj.AddToTest1(5) 1163*942c4265SAmine KhaldiCall ok(obj.Test1 = 11, "obj.Test1 is not 11") 1164*942c4265SAmine Khaldi 1165c2c66affSColin Finck' Array tests 1166c2c66affSColin Finck 1167c2c66affSColin FinckCall ok(getVT(arr) = "VT_EMPTY*", "getVT(arr) = " & getVT(arr)) 1168c2c66affSColin Finck 1169c2c66affSColin FinckDim arr(3) 1170c2c66affSColin FinckDim arr2(4,3), arr3(5,4,3), arr0(0), noarr() 1171c2c66affSColin Finck 1172c2c66affSColin FinckCall ok(getVT(arr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr) = " & getVT(arr)) 1173c2c66affSColin FinckCall ok(getVT(arr2) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr2) = " & getVT(arr2)) 1174c2c66affSColin FinckCall ok(getVT(arr0) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr0) = " & getVT(arr0)) 1175c2c66affSColin FinckCall ok(getVT(noarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(noarr) = " & getVT(noarr)) 1176c2c66affSColin Finck 1177c2c66affSColin FinckCall testArray(1, arr) 1178c2c66affSColin FinckCall testArray(2, arr2) 1179c2c66affSColin FinckCall testArray(3, arr3) 1180c2c66affSColin FinckCall testArray(0, arr0) 1181c2c66affSColin FinckCall testArray(-1, noarr) 1182c2c66affSColin Finck 1183c2c66affSColin FinckCall ok(getVT(arr(1)) = "VT_EMPTY*", "getVT(arr(1)) = " & getVT(arr(1))) 1184c2c66affSColin FinckCall ok(getVT(arr2(1,2)) = "VT_EMPTY*", "getVT(arr2(1,2)) = " & getVT(arr2(1,2))) 1185c2c66affSColin FinckCall ok(getVT(arr3(1,2,2)) = "VT_EMPTY*", "getVT(arr3(1,2,3)) = " & getVT(arr3(1,2,2))) 1186c2c66affSColin FinckCall ok(getVT(arr(0)) = "VT_EMPTY*", "getVT(arr(0)) = " & getVT(arr(0))) 1187c2c66affSColin FinckCall ok(getVT(arr(3)) = "VT_EMPTY*", "getVT(arr(3)) = " & getVT(arr(3))) 1188c2c66affSColin FinckCall ok(getVT(arr0(0)) = "VT_EMPTY*", "getVT(arr0(0)) = " & getVT(arr0(0))) 1189c2c66affSColin Finck 1190c2c66affSColin Finckarr(2) = 3 1191c2c66affSColin FinckCall ok(arr(2) = 3, "arr(2) = " & arr(2)) 1192c2c66affSColin FinckCall ok(getVT(arr(2)) = "VT_I2*", "getVT(arr(2)) = " & getVT(arr(2))) 1193c2c66affSColin Finck 1194c2c66affSColin Finckarr3(3,2,1) = 1 1195c2c66affSColin Finckarr3(1,2,3) = 2 1196c2c66affSColin FinckCall ok(arr3(3,2,1) = 1, "arr3(3,2,1) = " & arr3(3,2,1)) 1197c2c66affSColin FinckCall ok(arr3(1,2,3) = 2, "arr3(1,2,3) = " & arr3(1,2,3)) 1198*942c4265SAmine Khaldiarr2(4,3) = 1 1199*942c4265SAmine KhaldiCall ok(arr2(4,3) = 1, "arr2(4,3) = " & arr2(4,3)) 1200c2c66affSColin Finck 1201c2c66affSColin Finckx = arr3 1202c2c66affSColin FinckCall ok(x(3,2,1) = 1, "x(3,2,1) = " & x(3,2,1)) 1203c2c66affSColin Finck 1204c2c66affSColin FinckFunction getarr() 1205c2c66affSColin Finck Dim arr(3) 1206c2c66affSColin Finck arr(2) = 2 1207c2c66affSColin Finck getarr = arr 1208c2c66affSColin Finck arr(3) = 3 1209c2c66affSColin FinckEnd Function 1210c2c66affSColin Finck 1211c2c66affSColin Finckx = getarr() 1212c2c66affSColin FinckCall ok(getVT(x) = "VT_ARRAY|VT_VARIANT*", "getVT(x) = " & getVT(x)) 1213c2c66affSColin FinckCall ok(x(2) = 2, "x(2) = " & x(2)) 1214c2c66affSColin FinckCall ok(getVT(x(3)) = "VT_EMPTY*", "getVT(x(3)) = " & getVT(x(3))) 1215c2c66affSColin Finck 1216c2c66affSColin Finckx(1) = 1 1217c2c66affSColin FinckCall ok(x(1) = 1, "x(1) = " & x(1)) 1218c2c66affSColin Finckx = getarr() 1219c2c66affSColin FinckCall ok(getVT(x(1)) = "VT_EMPTY*", "getVT(x(1)) = " & getVT(x(1))) 1220c2c66affSColin FinckCall ok(x(2) = 2, "x(2) = " & x(2)) 1221c2c66affSColin Finck 1222c2c66affSColin Finckx(1) = 1 1223c2c66affSColin Fincky = x 1224c2c66affSColin Finckx(1) = 2 1225c2c66affSColin FinckCall ok(y(1) = 1, "y(1) = " & y(1)) 1226c2c66affSColin Finck 1227c2c66affSColin Finckfor x=1 to 1 1228c2c66affSColin Finck Dim forarr(3) 1229c2c66affSColin Finck if x=1 then 1230c2c66affSColin Finck Call ok(getVT(forarr(1)) = "VT_EMPTY*", "getVT(forarr(1)) = " & getVT(forarr(1))) 1231c2c66affSColin Finck else 1232c2c66affSColin Finck Call ok(forarr(1) = x, "forarr(1) = " & forarr(1)) 1233c2c66affSColin Finck end if 1234c2c66affSColin Finck forarr(1) = x+1 1235c2c66affSColin Fincknext 1236c2c66affSColin Finck 1237c2c66affSColin Finckx=1 1238c2c66affSColin FinckCall ok(forarr(x) = 2, "forarr(x) = " & forarr(x)) 1239c2c66affSColin Finck 1240c2c66affSColin FinckClass ArrClass 1241c2c66affSColin Finck Dim classarr(3) 1242c2c66affSColin Finck Dim classnoarr() 1243c2c66affSColin Finck Dim var 1244c2c66affSColin Finck 1245c2c66affSColin Finck Private Sub Class_Initialize 1246c2c66affSColin Finck Call ok(getVT(classarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(classarr) = " & getVT(classarr)) 1247c2c66affSColin Finck Call testArray(-1, classnoarr) 1248c2c66affSColin Finck classarr(0) = 1 1249c2c66affSColin Finck classarr(1) = 2 1250c2c66affSColin Finck classarr(2) = 3 1251c2c66affSColin Finck classarr(3) = 4 1252c2c66affSColin Finck End Sub 1253c2c66affSColin Finck 1254c2c66affSColin Finck Public Sub testVarVT 1255c2c66affSColin Finck Call ok(getVT(var) = "VT_ARRAY|VT_VARIANT*", "getVT(var) = " & getVT(var)) 1256c2c66affSColin Finck End Sub 1257c2c66affSColin FinckEnd Class 1258c2c66affSColin Finck 1259c2c66affSColin FinckSet obj = new ArrClass 1260c2c66affSColin FinckCall ok(getVT(obj.classarr) = "VT_ARRAY|VT_VARIANT", "getVT(obj.classarr) = " & getVT(obj.classarr)) 1261c2c66affSColin Finck'todo_wine Call ok(obj.classarr(1) = 2, "obj.classarr(1) = " & obj.classarr(1)) 1262c2c66affSColin Finck 1263c2c66affSColin Finckobj.var = arr 1264c2c66affSColin FinckCall ok(getVT(obj.var) = "VT_ARRAY|VT_VARIANT", "getVT(obj.var) = " & getVT(obj.var)) 1265c2c66affSColin FinckCall obj.testVarVT 1266c2c66affSColin Finck 1267c2c66affSColin FinckSub arrarg(byref refarr, byval valarr, byref refarr2, byval valarr2) 1268c2c66affSColin Finck Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr)) 1269c2c66affSColin Finck Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr)) 1270c2c66affSColin Finck Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2)) 1271c2c66affSColin Finck Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2)) 1272c2c66affSColin FinckEnd Sub 1273c2c66affSColin Finck 1274c2c66affSColin FinckCall arrarg(arr, arr, obj.classarr, obj.classarr) 1275c2c66affSColin Finck 1276c2c66affSColin FinckSub arrarg2(byref refarr(), byval valarr(), byref refarr2(), byval valarr2()) 1277c2c66affSColin Finck Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr)) 1278c2c66affSColin Finck Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr)) 1279c2c66affSColin Finck Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2)) 1280c2c66affSColin Finck Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2)) 1281c2c66affSColin FinckEnd Sub 1282c2c66affSColin Finck 1283c2c66affSColin FinckCall arrarg2(arr, arr, obj.classarr, obj.classarr) 1284c2c66affSColin Finck 1285c2c66affSColin FinckSub testarrarg(arg(), vt) 1286c2c66affSColin Finck Call ok(getVT(arg) = vt, "getVT() = " & getVT(arg) & " expected " & vt) 1287c2c66affSColin FinckEnd Sub 1288c2c66affSColin Finck 1289c2c66affSColin FinckCall testarrarg(1, "VT_I2*") 1290c2c66affSColin FinckCall testarrarg(false, "VT_BOOL*") 1291c2c66affSColin FinckCall testarrarg(Empty, "VT_EMPTY*") 1292c2c66affSColin Finck 1293*942c4265SAmine KhaldiSub modifyarr(arr) 1294*942c4265SAmine Khaldi 'Following test crashes on wine 1295*942c4265SAmine Khaldi 'Call ok(arr(0) = "not modified", "arr(0) = " & arr(0)) 1296*942c4265SAmine Khaldi arr(0) = "modified" 1297*942c4265SAmine KhaldiEnd Sub 1298*942c4265SAmine Khaldi 1299*942c4265SAmine Khaldiarr(0) = "not modified" 1300*942c4265SAmine KhaldiCall modifyarr(arr) 1301*942c4265SAmine KhaldiCall ok(arr(0) = "modified", "arr(0) = " & arr(0)) 1302*942c4265SAmine Khaldi 1303*942c4265SAmine Khaldiarr(0) = "not modified" 1304*942c4265SAmine Khaldimodifyarr(arr) 1305*942c4265SAmine KhaldiCall todo_wine_ok(arr(0) = "not modified", "arr(0) = " & arr(0)) 1306*942c4265SAmine Khaldi 1307*942c4265SAmine Khaldifor x = 0 to UBound(arr) 1308*942c4265SAmine Khaldi arr(x) = x 1309*942c4265SAmine Khaldinext 1310*942c4265SAmine Khaldiy = 0 1311*942c4265SAmine Khaldifor each x in arr 1312*942c4265SAmine Khaldi Call ok(x = y, "x = " & x & ", expected " & y) 1313*942c4265SAmine Khaldi Call ok(arr(y) = y, "arr(" & y & ") = " & arr(y)) 1314*942c4265SAmine Khaldi arr(y) = 1 1315*942c4265SAmine Khaldi x = 1 1316*942c4265SAmine Khaldi y = y+1 1317*942c4265SAmine Khaldinext 1318*942c4265SAmine KhaldiCall ok(y = 4, "y = " & y & " after array enumeration") 1319*942c4265SAmine Khaldi 1320*942c4265SAmine Khaldifor x=0 to UBound(arr2, 1) 1321*942c4265SAmine Khaldi for y=0 to UBound(arr2, 2) 1322*942c4265SAmine Khaldi arr2(x, y) = x + y*(UBound(arr2, 1)+1) 1323*942c4265SAmine Khaldi next 1324*942c4265SAmine Khaldinext 1325*942c4265SAmine Khaldiy = 0 1326*942c4265SAmine Khaldifor each x in arr2 1327*942c4265SAmine Khaldi Call ok(x = y, "x = " & x & ", expected " & y) 1328*942c4265SAmine Khaldi y = y+1 1329*942c4265SAmine Khaldinext 1330*942c4265SAmine KhaldiCall ok(y = 20, "y = " & y & " after array enumeration") 1331*942c4265SAmine Khaldi 1332*942c4265SAmine Khaldifor each x in noarr 1333*942c4265SAmine Khaldi Call ok(false, "Empty array contains: " & x) 1334*942c4265SAmine Khaldinext 1335*942c4265SAmine Khaldi 1336c2c66affSColin Finck' It's allowed to declare non-builtin RegExp class... 1337c2c66affSColin Finckclass RegExp 1338c2c66affSColin Finck public property get Global() 1339c2c66affSColin Finck Call ok(false, "Global called") 1340c2c66affSColin Finck Global = "fail" 1341c2c66affSColin Finck end property 1342c2c66affSColin Finckend class 1343c2c66affSColin Finck 1344c2c66affSColin Finck' ...but there is no way to use it because builtin instance is always created 1345c2c66affSColin Finckset x = new RegExp 1346c2c66affSColin FinckCall ok(x.Global = false, "x.Global = " & x.Global) 1347c2c66affSColin Finck 1348c2c66affSColin FinckreportSuccess() 1349