2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / mbas / Test / tests / Arguments_ByReferenceD.vb
1 '==============================================================================================\r
2 'Name:Manish Kumar Sinha \r
3 'Email Address: manishkumarsinha@sify.com\r
4 'Test Case Name: Argument passing by Reference:\r
5 'APR-1.3.0: If the variable elements is of reference type i.e. it contain a pointers to a class\r
6 '               then procedure can change the members of instance to which it points  \r
7 '==============================================================================================\r
8 \r
9 Imports System\r
10 Imports System.Array\r
11 Module APR_1_3_0\r
12 \r
13         Public Sub Increase(ByRef A() As Long)\r
14                 Dim J As Integer\r
15                 For J = 0 To 3\r
16                 A(J) = A(J) + 1\r
17                 Next J\r
18         End Sub\r
19    ' ...\r
20         Public Sub Replace(ByRef A() As Long)\r
21                 Dim J As Integer\r
22                 Dim K() As Long = {100, 200, 300,400}\r
23                 A = K\r
24                 For J = 0 To 3\r
25                 A(J) = A(J) + 1\r
26                 Next J\r
27         End Sub\r
28  ' ...\r
29         \r
30    Sub Main()\r
31       Dim N() As Long = {10, 20, 30, 40}\r
32         Dim N1() As Long = {11, 21, 31, 41}\r
33         Dim N2() As Long = {101, 201, 301, 401}\r
34         Dim i As Integer\r
35         Increase(N)\r
36         For i = 0 to 3\r
37         if (N(i) <> N1(i))\r
38                 Throw New System.Exception("#A1, Unexception Behaviour in Increase Function")\r
39         end if\r
40         Next i\r
41         Replace(N)\r
42         For i= 0 to 3\r
43         if ( N(i) <> N2(i))\r
44                 Throw New System.Exception("#A2, Unexception Behaviour in Increase Function")\r
45         end if\r
46         Next i\r
47 \r
48    End Sub \r
49 End Module\r
50 \r
51 '==============================================================================================