Author: sudha
Date: 2005-04-29 00:07:24 -0400 (Fri, 29 Apr 2005)
New Revision: 43765
Added:
trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceA.vb
trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceB.vb
trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceC.vb
trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueA.vb
trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueB.vb
trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueC.vb
trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueD.vb
trunk/mcs/mbas/Test/tests/latebinding/ArrayA.vb
trunk/mcs/mbas/Test/tests/latebinding/ArrayB.vb
trunk/mcs/mbas/Test/tests/latebinding/Changelog
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropA.vb
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropB.vb
trunk/mcs/mbas/Test/tests/latebinding/ExpressionMemberAccess.vb
trunk/mcs/mbas/Test/tests/latebinding/ExpressionOverLoadMethodA.vb
trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceA.vb
trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceB.vb
trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceC.vb
trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueA.vb
trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueB.vb
trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueC.vb
trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueD.vb
trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayA.vb
trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayB.vb
trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayC.vb
trunk/mcs/mbas/Test/tests/latebinding/Inheritance.vb
trunk/mcs/mbas/Test/tests/latebinding/InheritanceA.vb
trunk/mcs/mbas/Test/tests/latebinding/InheritanceB.vb
trunk/mcs/mbas/Test/tests/latebinding/InheritanceC.vb
trunk/mcs/mbas/Test/tests/latebinding/InvocationStatementA.vb
trunk/mcs/mbas/Test/tests/latebinding/ParamArrayA.vb
trunk/mcs/mbas/Test/tests/latebinding/ParamArrayB.vb
trunk/mcs/mbas/Test/tests/latebinding/ParamArrayC.vb
trunk/mcs/mbas/Test/tests/latebinding/ParamArrayD.vb
trunk/mcs/mbas/Test/tests/latebinding/ParamArrayE.vb
trunk/mcs/mbas/Test/tests/latebinding/PropertyA.vb
Log:
Some late bindig testcases
Added: trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceA.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceA.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,19 @@
+Imports System
+Module APR_1_0_0
+ Class C1
+ Sub F(ByRef p As Integer)
+ p += 1
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C1()
+ Dim a As Integer = 1
+ obj.F(a)
+ if (a=1)
+ Throw New System.Exception("#A1, Unexcepted Behaviour
in Arguments_ByReferenceA.vb")
+ end if
+ End Sub
+End Module
+
+'============================================================================================
Added: trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceB.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceB.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,43 @@
+Imports System
+Imports System.Array
+Module APR_1_3_0
+ Class C1
+
+ Public Sub Increase(ByRef A() As Long)
+ Dim J As Integer
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ End Sub
+ ' ...
+ Public Sub Replace(ByRef A() As Long)
+ Dim J As Integer
+ Dim K() As Long = {100, 200, 300,400}
+ A = K
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ End Sub
+ ' ...
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C1()
+ Dim N() As Long = {10, 20, 30, 40}
+ Dim N1() As Long = {11, 21, 31, 41}
+ Dim N2() As Long = {101, 201, 301, 401}
+ Dim i As Integer
+ obj.Increase(N)
+ For i = 0 to 3
+ if (N(i) <> N1(i))
+ Throw New System.Exception("#A1, Unexception
Behaviour in Increase Function")
+ end if
+ Next i
+ obj.Replace(N)
+ For i= 0 to 3
+ if ( N(i) <> N2(i))
+ Throw New System.Exception("#A2, Unexception
Behaviour in Increase Function")
+ end if
+ Next i
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceC.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByReferenceC.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,17 @@
+Imports System
+Module APR_1_1_0
+ Class C1
+ Sub F(ByRef p As String)
+ p = "Sinha"
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C1()
+ Dim a As String = "Manish"
+ obj.F(a)
+ if (a="Manish")
+ Throw New System.Exception("#A1, Unexcepted behaviour
of ByRef of String Datatype")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueA.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueA.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,17 @@
+Imports System
+Module APV1_0
+ Class C
+ Sub F(ByVal p As Integer)
+ p += 1
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C ()
+ Dim a As Integer = 1
+ obj.F(a)
+ if a<>1
+ Throw new System.Exception("#A1, Unexcepted behaviour")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueB.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueB.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,16 @@
+Imports System
+Module APV1_4_0
+ Class C
+ Sub F(p As Integer)
+ p += 1
+ End Sub
+ End Class
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer = 1
+ obj.F(a)
+ if a<>1
+ Throw new System.Exception("#A1, uncexcepted behaviour
of Default VB pass arguments")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueC.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueC.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,17 @@
+Imports System
+Module APV1_1_0
+ Class C
+ Sub F(p As String)
+ p = "Sinha"
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C ()
+ Dim a As String = "Manish"
+ obj.F(a)
+ if a<>"Manish"
+ Throw New System.Exception("#A1, Unexcepted behaviour
in string of APV1_1_0")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueD.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueD.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Arguments_ByValueD.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,43 @@
+Imports System.Array
+Module APV1_0
+
+ Class C
+ Public Sub Increase(ByVal A() As Long)
+ Dim J As Integer
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ End Sub
+ ' ...
+ Public Sub Replace(ByVal A() As Long)
+ Dim J As Integer
+ Dim K() As Long = {100, 200, 300, 400}
+ A = K
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ End Sub
+ ' ...
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim N() As Long = {10, 20, 30, 40}
+ Dim N1() As Long = {11, 21, 31, 41}
+ Dim N2() As Long = {100, 200, 300, 400}
+ Dim i As Integer
+ obj.Increase(N)
+ For i=0 To 3
+ if(N(i)<>N1(i))
+ Throw new System.Exception ("#A1, Unexpected
behavior in Increase function")
+ end if
+ Next i
+ i=0
+ obj.Replace(N)
+ For i=0 To 3
+ if(N(i)=N2(i))
+ Throw new System.Exception ("#A2, Unexpected
behavior in Replace function")
+ end if
+ Next i
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ArrayA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ArrayA.vb 2005-04-29 02:35:01 UTC
(rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ArrayA.vb 2005-04-29 04:07:24 UTC
(rev 43765)
@@ -0,0 +1,34 @@
+Imports System
+
+Module VariableC
+ Dim a() As Integer = {1, 2, 3, 4, 5}
+ Dim b(3) As Integer
+ Dim e as Integer() = {1, 2, 3}
+ Dim g as Integer(,) = { {1,1}, {2,2}, {3,3} }
+
+ Sub Main()
+ Dim obj As Object = a
+
+ If obj(2) <> 3 Then
+ Throw New Exception("#A1, value mismatch")
+ End If
+
+ obj = b
+ obj(0) = 2
+ obj(1) = 5
+ obj(2) = 10
+ If obj(1) <> 5 Then
+ Throw New Exception("#A2, value mismatch")
+ End If
+
+ obj = e
+ If obj(1) <> 2 Then
+ Throw New Exception("#A3, value mismatch")
+ End If
+
+ obj = g
+ If obj(2,1) <> 3 Then
+ Throw New Exception("#A4, value mismatch")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ArrayB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ArrayB.vb 2005-04-29 02:35:01 UTC
(rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ArrayB.vb 2005-04-29 04:07:24 UTC
(rev 43765)
@@ -0,0 +1,31 @@
+Imports System
+
+Module ArrayF
+
+ Sub Main()
+ Dim arr As Integer(,) = {{1, 2, 3}, {3, 4, 7}}
+ ReDim arr(1, 1)
+ Dim obj As Object = arr
+ If obj(0, 0) = 1 Then
+ Throw New Exception("#AF1 - ReDim Statement failed")
+ End If
+
+ obj(0, 0) = 1
+ obj(0, 1) = 2
+ If obj(0, 0) <> 1 Then
+ Throw New Exception("#AF2 - ReDim Statement failed")
+ End If
+
+ Try
+ Erase arr
+ obj = arr
+ Console.WriteLine(obj(0, 0))
+ Catch e As Exception
+ If e.GetType.ToString <>
"System.NullReferenceException" Then
+ Throw New Exception("#AF3 - Erase Statement
failed")
+ End If
+ End Try
+
+ End Sub
+
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Changelog
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Changelog 2005-04-29 02:35:01 UTC
(rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Changelog 2005-04-29 04:07:24 UTC
(rev 43765)
@@ -0,0 +1,8 @@
+2005-04-29 Satya Sudha K <[EMAIL PROTECTED]>
+ * Some testcases for late binding
+
+2005-04-26 Satya Sudha K <[EMAIL PROTECTED]>
+ Sudharsan V <[EMAIL PROTECTED]>
+
+ * Testcases for Late binding
+
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropA.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropA.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,25 @@
+'Author:
+' V. Sudharsan ([EMAIL PROTECTED])
+'
+' (C) 2005 Novell, Inc.
+
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new base()
+ Dim i as Integer
+ i = a(10)
+ if i<>10 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropB.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropB.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,38 @@
+'Author:
+' V. Sudharsan ([EMAIL PROTECTED])
+'
+' (C) 2005 Novell, Inc.
+
+REM LineNo: 19
+REM ExpectedWarning: BC40007
+REM WarningMessage: Default property 'Item1' conflicts with default property
'Item' in the base class 'base' and so should be declared 'Shadows'.
+
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Overloads Default ReadOnly Property Item1(ByVal i as Integer)As
Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ExpressionMemberAccess.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ExpressionMemberAccess.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ExpressionMemberAccess.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,17 @@
+Imports System
+Class C
+ Public F As Integer = 10
+End Class
+
+Module Test
+ Public Function ReturnC() As Object
+ Console.WriteLine("Returning a new instance of C.")
+ Return New C()
+ End Function
+
+ Public Sub Main()
+ if Returnc().F <> 10 Then
+ Throw New Exception ("Unexpected Behavior Returnc().F
should be 10")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ExpressionOverLoadMethodA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ExpressionOverLoadMethodA.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ExpressionOverLoadMethodA.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,35 @@
+Imports System
+Module Test
+
+ Class C
+ Sub F(i as integer)
+ if i <> 10 Then
+ Throw New Exception ("got in to the one with 1
argu ")
+ End if
+ End Sub
+
+ Sub F()
+ Dim Funct = "With no argument"
+ End Sub
+
+ Sub F(i as integer, j as integer)
+ if i <> 10 And j <> 20 Then
+ Throw New Exception ("got in to the one with 1
argu ")
+ End if
+ End Sub
+
+ Sub F(i as integer, j as integer, k as integer)
+ if i <> 10 And j <> 20 And k <> 30 Then
+ Throw New Exception ("got in to the one with 1
argu ")
+ End if
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim a As Object = new C()
+ a.F()
+ a.F(10)
+ a.F(10, 20)
+ a.F(10, 20, 30)
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceA.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceA.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,19 @@
+Imports System
+Module APR_1_0_0
+ Class C
+ Function F(ByRef p As Integer) as Integer
+ p += 1
+ return p
+ End Function
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer = 1
+ Dim b as Integer = 0
+ b=obj.F(a)
+ if (b<>a)
+ Throw New System.Exception("#A1, Unexcepted Behaviour
in Arguments_ByReferenceA.vb")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceB.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceB.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,44 @@
+Imports System
+Imports System.Array
+Module APR_1_3_0
+ Class C
+ Public Function Increase(ByRef A() As Long) As Long()
+ Dim J As Integer
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ return A
+ End Function
+ ' ...
+ Public Function Replace(ByRef A() As Long) As Long()
+ Dim J As Integer
+ Dim K() As Long = {100, 200, 300,400}
+ A = K
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ return A
+ End Function
+ ' ...
+ End Class
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim N() As Long = {10, 20, 30, 40}
+ Dim N1(3) As Long
+ Dim N2(3) As Long
+ Dim i As Integer
+ N1=obj.Increase(N)
+ For i = 0 to 3
+ if (N(i) <> N1(i))
+ Throw New System.Exception("#A1, Unexception
Behaviour in Increase Function")
+ end if
+ Next i
+ N2=obj.Replace(N)
+ For i= 0 to 3
+ if ( N(i) <> N2(i))
+ Throw New System.Exception("#A2, Unexception
Behaviour in Increase Function")
+ end if
+ Next i
+
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceC.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByReferenceC.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,18 @@
+Module APR_1_1_0
+ Class C
+ Function F(ByRef p As String) as String
+ p = "Sinha"
+ return p
+ End Function
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As String = "Manish"
+ Dim b As String = ""
+ b=obj.F(a)
+ if (b<>a)
+ Throw New System.Exception("#A1, Unexcepted behaviour
of ByRef of String Datatype")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueA.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueA.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,18 @@
+Imports System
+Module APV1_0
+ Class C
+ Function F(ByVal p As Integer) As Integer
+ p += 1
+ return p
+ End Function
+ End Class
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer = 1
+ Dim b As Integer = 0
+ b = obj.F(a)
+ if b=a
+ Throw new System.Exception("#A1, Unexcepted behaviour")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueB.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueB.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,19 @@
+Imports System
+Module APV1_4_0
+ Class C
+ Function F(p As Integer) as Integer
+ p += 1
+ return p
+ End Function
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer = 1
+ Dim b as Integer = 0
+ b = obj.F(a)
+ if b=a
+ Throw new System.Exception("#A1, uncexcepted behaviour
of Default VB pass arguments")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueC.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueC.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,18 @@
+Module APV1_1_0
+ Class C
+ Function F(p As String) As String
+ p = "Sinha"
+ return p
+ End Function
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As String = "Manish"
+ Dim b as String = ""
+ b = obj.F(a)
+ if a=b
+ Throw New System.Exception("#A1, Unexcepted behaviour
in string of APV1_1_0")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueD.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueD.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/FunctionArgu_ByValueD.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,44 @@
+Imports System
+Imports System.Array
+Module APV1_0
+ Class C
+ Function Increase(ByVal A() As Long) As Long()
+ Dim J As Integer
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ return A
+ End Function
+ ' ...
+ Function Replace(ByVal A() As Long) As Long()
+ Dim J As Integer
+ Dim K() As Long = {100, 200, 300, 400}
+ A = K
+ For J = 0 To 3
+ A(J) = A(J) + 1
+ Next J
+ return A
+ End Function
+ ' ...
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new c()
+ Dim N() As Long = {10, 20, 30, 40}
+ Dim N1() As Long = {0,0,0,0}
+ Dim N2(3) As Long
+ Dim i As Integer
+ N1=obj.Increase(N)
+ For i=0 To 3
+ if(N(i)<>N1(i))
+ Throw new System.Exception ("#A1, Unexpected
behavior in Increase function")
+ end if
+ Next i
+ N2=obj.Replace(N)
+ For i=0 To 3
+ if(N(i)=N2(i))
+ Throw new System.Exception ("#A2, Unexpected
behavior in Replace function")
+ end if
+ Next i
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayA.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayA.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,29 @@
+Imports System
+Module PA_1_2_1
+ Class C
+ Function F(ParamArray ByVal args() As Integer)As Integer
+ Dim a as integer
+ a = args.Length
+ return a
+ End Function
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer() = { 1, 2, 3 }
+ Dim b as Integer
+ b= obj.F(a)
+ if b<>3
+ Throw New System.Exception("#A1, Unexcepted Behaviour
in F(a)")
+ end if
+
+ b = obj.F(10, 20, 30, 40)
+ if b<>4
+ Throw New System.Exception("#A2, Unexcepted Behaviour
in F(10,20,30,40)")
+ end if
+ b = obj.F()
+ if b<>0
+ Throw New System.Exception("#A3, Unexcepted Behaviour
in F()")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayB.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayB.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,27 @@
+Module PA_1_0_0
+ Class C
+ Function F(ParamArray args() As Integer)as Integer
+ Dim a as integer
+ a = args.Length
+ return a
+ End Function
+ End Class
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer() = { 1, 2, 3 }
+ Dim b as Integer = 1
+ b= obj.F(a)
+ if b<>3
+ Throw New System.Exception("#A1, Unexcepted Behaviour
in F(a)")
+ end if
+
+ b = obj.F(10, b, 30, 40)
+ if b<>4
+ Throw New System.Exception("#A2, Unexcepted Behaviour
in F(10,20,30,40)")
+ end if
+ b = obj.F()
+ if b<>0
+ Throw New System.Exception("#A3, Unexcepted Behaviour
in F()")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayC.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Function_ParamArrayC.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,24 @@
+Module PA_1_0_0
+ Class C
+ Function F(ByVal b as Integer ,ParamArray args() As Integer)as
Boolean
+ Dim a as integer
+ a = args.Length
+ if a=b
+ return true
+ else
+ return false
+ end if
+ End Function
+ End Class
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer() = { 1, 2, 3 }
+ Dim c as Integer
+ c = a.Length
+ Dim b as Boolean
+ b= obj.F(c, a)
+ if b<>true
+ Throw New System.Exception("#A1, Unexcepted Behaviour
in F(a)")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/Inheritance.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/Inheritance.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/Inheritance.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,67 @@
+Imports System
+
+'Testing simple and multi-level inheritence with all methods declared public
+
+Public Class C1
+ Public Function f1()As Integer
+ Return 1
+ End Function
+
+ Public Function fn() As Integer
+ Return 5
+ End Function
+End Class
+
+Public Class C2
+ Inherits C1
+ Public Function f2()As Integer
+ Return f1()
+ End Function
+End Class
+
+Public Class c3
+ Inherits C2
+End Class
+
+Module Inheritance
+ Sub Main()
+
+ Dim c1 As object = New C1()
+ Dim a As Integer=c1.f1()
+ If a<>1 Then
+ Throw New Exception("#A1- Inheritence:Failed")
+ End If
+
+ Dim c2 As object = New C2()
+ Dim b As Integer = c2.f1()
+ Dim c As Integer = c2.f2()
+ Dim d As Integer = c2.fn()
+
+ If b<>1 Then
+ Throw New Exception("#A2- Inheritence:Failed")
+ End If
+ If c<>1 Then
+ Throw New Exception("#A2- Inheritence:Failed")
+ End If
+ If d<>5 Then
+ Throw New Exception("#A2- Inheritence:Failed")
+ End If
+
+
+ Dim c3 As object = New c3()
+ b=c3.f1()
+ c=c3.f2()
+ d=c3.fn()
+
+ If b<>1 Then
+ Throw New Exception("#A3- Inheritence:Failed")
+ End If
+ If c<>1 Then
+ Throw New Exception("#A3- Inheritence:Failed")
+ End If
+ If d<>5 Then
+ Throw New Exception("#A3- Inheritence:Failed")
+ End If
+
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/InheritanceA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/InheritanceA.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/InheritanceA.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,51 @@
+Imports System
+Public Class C1
+ dim t1 as Type = GetType (C1)
+
+ Function f1 (name as string)
+ If t1.name <> name Then
+ Throw New System.Exception("#A1 Unexpected result")
+ End If
+ End Function
+
+ Function f1 (name as string, t as type)
+ If t.name <> name Then
+ Throw New System.Exception("#A2 Unexpected result")
+ End If
+ End Function
+
+ Function fn() As Integer
+ Return 5
+ End Function
+End Class
+
+Public Class C2
+ Inherits C1
+ dim t as Type = GetType (C2)
+
+ Function f2(name as string)
+ f1(name, t)
+ End Function
+End Class
+
+Public Class C3
+ Inherits C2
+End Class
+
+Module Inheritance
+ Sub Main()
+ Dim a As Integer
+ Dim c1 As Object = New C1()
+ a = c1.f1("C1")
+
+ Dim c2 As Object = New C2()
+ a = c2.f1("C1")
+ a = c2.f2("C2")
+ a = c2.fn()
+
+ Dim c3 As Object = New c3()
+ c3.f1("C1")
+ c3.f2("C2")
+ c3.fn()
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/InheritanceB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/InheritanceB.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/InheritanceB.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,34 @@
+Imports System
+
+Public Class C1
+ Public Overridable Sub F1(ByVal name As String)
+ Dim t As Type = GetType (C1)
+ if t.name <> name Then
+ throw new Exception ("#A1, Should not some here")
+ End If
+ End Sub
+End Class
+
+Public Class C2
+ Inherits C1
+
+ Public Overrides Sub F1(ByVal name As String)
+ Dim t As Type = GetType (C2)
+ if t.name <> name Then
+ throw new Exception ("#A2, Should not some here")
+ End If
+ End Sub
+End Class
+
+Module InheritanceE
+ Sub Main()
+ dim b as object = New C1()
+ b.F1("C1")
+
+ Dim d As object = New C2()
+ d.F1("C2")
+ End Sub
+End Module
+
+
+
Added: trunk/mcs/mbas/Test/tests/latebinding/InheritanceC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/InheritanceC.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/InheritanceC.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,24 @@
+'Testing access to protected members of a class from it's derived class
+Class C1
+ Protected a As Integer
+ Protected Sub S()
+ a=47
+ End Sub
+End Class
+Class C2
+ Inherits C1
+ Public Function F() As Integer
+ S()
+ Return a
+ End Function
+End Class
+
+Module Inheritence
+ Sub Main()
+ Dim myC As Object = New C2()
+ Dim b As Integer=myC.F()
+ If b<>47 Then
+ Throw New System.Exception("InheritenceF:Failed-Error
in accessing protected member from a derived class")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/InvocationStatementA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/InvocationStatementA.vb
2005-04-29 02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/InvocationStatementA.vb
2005-04-29 04:07:24 UTC (rev 43765)
@@ -0,0 +1,56 @@
+Imports Microsoft.VisualBasic
+Imports System
+
+Module InvocationStatementA
+ Dim i As Integer = 0
+ Class C
+
+ Sub f1()
+ i += 1
+ f2()
+ End Sub
+
+ Function f2() As Integer
+ i += 2
+ End Function
+
+ Function f2(ByVal i As Integer) As Integer
+ i += 5
+ Return i
+ End Function
+
+ Function f2(ByVal o As Object) As Boolean
+ Return True
+ End Function
+
+ Function f3(ByVal j As Integer)
+ i += j
+ End Function
+
+ Function f4(ByVal j As Integer)
+ i += j * 10
+ End Function
+ End Class
+
+ Sub main()
+ Dim obj As Object = new C()
+ Call obj.f1()
+ If i <> 3 Then
+ Throw New Exception("#ISB1 - Invocation Statement
failed")
+ End If
+
+ If obj.f2(i) <> 8 Then
+ Throw New Exception("#ISB2 - Invocation Statement
failed")
+ End If
+
+ If Not obj.f2("Hello") Then
+ Throw New Exception("#ISB3 - Invocation Statement
failed")
+ End If
+
+ If Not obj.f2(2.3D) Then
+ Throw New Exception("#ISB4 - Invocation Statement
failed")
+ End If
+
+ End Sub
+
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ParamArrayA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ParamArrayA.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ParamArrayA.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,20 @@
+Imports System
+Module Module1
+ Class C
+ Sub F(ParamArray ByVal args() As Integer)
+ Dim a as Integer
+ a = args.Length
+ if a=0
+ Throw New System.Exception("#A1, Unexcepted
behavoiur of PARAM ARRAY")
+ end if
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Integer() = { 1, 2, 3 }
+ obj.F(a)
+ Dim x As Integer = 10
+ obj.F(x, x, x, x)
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ParamArrayB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ParamArrayB.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ParamArrayB.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,24 @@
+Module PA_1_0_0
+ Class C
+ Sub F(ParamArray args() As Long)
+ Dim a as Integer
+ a=args.Length
+ if a <> 3
+ Throw New System.Exception("#A1, Unexcepted
behavoiur of PARAM ARRAY")
+ end if
+ End Sub
+ Sub F(ParamArray args() As Integer)
+ Dim a as Integer
+ a=args.Length
+ if a <> 4
+ Throw New System.Exception("#A1, Unexcepted
behavoiur of PARAM ARRAY")
+ end if
+ End Sub
+ End Class
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As long() = { 1, 2, 3 }
+ obj.F(a)
+ obj.F(10, 20, 30, 40)
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ParamArrayC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ParamArrayC.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ParamArrayC.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,25 @@
+Module PA_1_0_0
+ Class C
+ Sub F(ParamArray args() As Long)
+ Dim a as Integer
+ a=args.Length
+ if a <> 3
+ Throw New System.Exception("#A1, Unexcepted
behavoiur of PARAM ARRAY")
+ end if
+ End Sub
+ Sub F(ParamArray args() As Integer)
+ Dim a as Integer
+ a=args.Length
+ if a <> 4
+ Throw New System.Exception("#A1, Unexcepted
behavoiur of PARAM ARRAY")
+ end if
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As long() = { 1, 2, 3 }
+ obj.F(a)
+ obj.F(10, 20, 30, 40)
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ParamArrayD.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ParamArrayD.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ParamArrayD.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,19 @@
+Imports System
+Module Module1
+ Class C
+ Sub F(ParamArray ByVal args() As Short)
+ Console.WriteLine ("Integer")
+ Dim a as Integer
+ a = args.Length
+ End Sub
+ Sub F(ParamArray ByVal args() As Long)
+ Throw New System.Exception("#A1, Unexcepted behavoiur
of PARAM ARRAY")
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ Dim a As Byte = 1
+ obj.F(a,a,a,a)
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/ParamArrayE.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ParamArrayE.vb 2005-04-29
02:35:01 UTC (rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/ParamArrayE.vb 2005-04-29
04:07:24 UTC (rev 43765)
@@ -0,0 +1,39 @@
+Imports System
+
+Module Module1
+ Class C
+ Function F(ByVal ParamArray a As Object()) As Integer
+ return 0
+ End Function
+
+ Function F()
+ return 1
+ End Function
+
+ Function F(ByVal a As Object, ByVal b As Object)
+ return 2
+ End Function
+
+ Function F(ByVal a As Object, ByVal b As Object, _
+ ByVal ParamArray c As Object())
+ return 3
+ End Function
+ End Class
+
+ Sub Main()
+ Dim obj As Object = new C()
+ if obj.F() <> 1 Then
+ Throw new exception ("#A1 - Overload resolution not
working in Late binding")
+ End If
+ if obj.F(1) <> 0 Then
+ Throw new exception ("#A2 - Overload resolution not
working in Late binding")
+ End If
+ if obj.F(1, 2) <> 2
+ Throw new exception ("#A3 - Overload resolution not
working in Late binding")
+ End If
+ if obj.F(1, 2, 3) <> 3 Then
+ Throw new exception ("#A4 - Overload resolution not
working in Late binding")
+ End If
+
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/PropertyA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/PropertyA.vb 2005-04-29 02:35:01 UTC
(rev 43764)
+++ trunk/mcs/mbas/Test/tests/latebinding/PropertyA.vb 2005-04-29 04:07:24 UTC
(rev 43765)
@@ -0,0 +1,25 @@
+Imports System
+Module M
+ Class C
+ private i as integer = 20
+
+ public Property p() as Integer
+ GET
+ return i
+ END GET
+
+ SET (ByVal val as Integer)
+ i = val
+ End SET
+
+ End Property
+ End Class
+
+ Sub Main()
+ Dim o As Object = new C()
+ if (o.p <> 20) Then
+ throw new Exception ("Property Access not working in
LateBinding!!")
+ End If
+ End Sub
+
+End Module
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches