2005-06-03 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / tests / test-38.cs
old mode 100755 (executable)
new mode 100644 (file)
index 69dbbc3..73a3883
@@ -1,7 +1,8 @@
 class X {
-       int v1, v2;
+       public int v1, v2;
+       int y;
        
-       int this [int a] {
+       public int this [int a] {
                get {
                        if (a == 0)
                                return v1;
@@ -17,9 +18,62 @@ class X {
                }
        }
 
+       public int Foo () {
+               return 8;
+       }
+
+       public int Bar {
+               get {
+                       return y;
+               }
+
+               set {
+                       y = value;
+               }
+       }
+}
+
+class Y {
+       public uint v1, v2;
+       uint y;
+       
+       public uint this [uint a] {
+               get {
+                       if (a == 0)
+                               return v1;
+                       else
+                               return v2;
+               }
+
+               set {
+                       if (a == 0)
+                               v1 = value;
+                       else
+                               v2 = value;
+               }
+       }
+
+       public uint Foo () {
+               return 8;
+       }
+
+       public uint Bar {
+               get {
+                       return y;
+               }
+
+               set {
+                       y = value;
+               }
+       }
+}
+
+class Test {
+
        static int Main ()
        {
                X x = new X ();
+               Y y = new Y ();
                int b;
 
                x [0] = x [1] = 1;
@@ -30,6 +84,34 @@ class X {
                if (x [0] != 1)
                        return 2;
 
+               double d;
+               long l;
+
+               d = l = b = x [0] = x [1] = x.Bar = x [2] = x [3] = x [4] = x.Foo ();
+
+               if (x.Bar != 8)
+                       return 3;
+
+               if (l != 8)
+                       return 4;
+
+               uint e, f;
+               e = 5;
+               e = f = 8;
+
+               if (e != 8)
+                       return 5;
+
+               y [0] = y [1] = 9;
+               y [0] = y.Bar = 12;
+
+               if (y.Bar != 12)
+                       return 6;
+
+               y.Bar = 15;
+               if (y.Bar != 15)
+                       return 7;
+
                return 0;
                
        }