Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2001-12-24 03:59:36 +0300
committerMiguel de Icaza <miguel@gnome.org>2001-12-24 03:59:36 +0300
commit8a2886f7d037b8e85fd507878e708ea72590328d (patch)
tree5e2a9a492c3b8ea5fe71b05ea31b14e4a4c833bf /mcs/tests/test-66.cs
parentae9b5fed30d5d8e7b030a6960b2ac73a007178c5 (diff)
Update tests
svn path=/trunk/mcs/; revision=1702
Diffstat (limited to 'mcs/tests/test-66.cs')
-rwxr-xr-xmcs/tests/test-66.cs134
1 files changed, 134 insertions, 0 deletions
diff --git a/mcs/tests/test-66.cs b/mcs/tests/test-66.cs
new file mode 100755
index 00000000000..7691f6e7334
--- /dev/null
+++ b/mcs/tests/test-66.cs
@@ -0,0 +1,134 @@
+//
+// This tests checks out field access to arrays
+//
+using System;
+
+struct A {
+ public int a;
+}
+
+class Y {
+ public object a;
+}
+
+class X {
+ static A [] a_single = new A [10];
+ static A [,] a_double = new A [10,10];
+ static Y [] o_single = new Y [10];
+ static Y [,] o_double = new Y [10,10];
+
+ static void FillOne ()
+ {
+ a_single [0].a = 1;
+ }
+
+ static void FillSingle ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ a_single [i].a = i + 1;
+ }
+ }
+
+ static void FillDouble ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ a_double [i,j].a = i * j;
+ }
+
+ static void FillObject ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ o_single [i] = new Y ();
+ o_single [i].a = (i + 1);
+ }
+ }
+
+ static void FillDoubleObject ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++){
+ o_double [i,j] = new Y ();
+ o_double [i,j].a = i * j;
+ }
+ }
+
+ static int TestSingle ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ if (a_single [i].a != i + 1)
+ return 1;
+ }
+ return 0;
+ }
+
+ static int TestDouble ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++){
+ for (j = 0; j < 10; j++)
+ if (a_double [i,j].a != (i *j))
+ return 2;
+ }
+
+ return 0;
+ }
+
+ static int TestObjectSingle ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ if ((int)(o_single [i].a) != i + 1)
+ return 1;
+ }
+ return 0;
+ }
+
+ static int TestObjectDouble ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++){
+ for (j = 0; j < 10; j++)
+ if (((int)o_double [i,j].a) != (i *j))
+ return 2;
+ }
+
+ return 0;
+ }
+
+ static int Main ()
+ {
+ FillSingle ();
+ FillDouble ();
+ FillObject ();
+ FillDoubleObject ();
+
+ if (TestSingle () != 0)
+ return 1;
+
+ if (TestDouble () != 0)
+ return 2;
+
+ if (TestObjectSingle () != 0)
+ return 3;
+
+ if (TestObjectDouble () != 0)
+ return 4;
+
+ Console.WriteLine ("test passes");
+ return 0;
+ }
+}