Merge pull request #487 from mayerwin/patch-1
[mono.git] / mcs / tests / test-44.cs
old mode 100755 (executable)
new mode 100644 (file)
index aa8e24e..fa0367e
@@ -16,8 +16,22 @@ class X {
 
                return total;
        }
+
+       //
+       // This tests typecasting from an object to an array of ints
+       // and then doing foreach
+       //
+       static int count (object o)
+       {
+               int total = 0;
+
+               foreach (int i in (int []) o)
+                       total += i;
+
+               return total;
+       }
        
-       static void Main ()
+       public static int Main ()
        {
                int [,] b = new int [10,10];
 
@@ -28,6 +42,13 @@ class X {
                if (dob (b) != 4950)
                        return 1;
 
+               int [] a = new int [10];
+               for (int i = 0; i < 10; i++)
+                       a [i] = 2;
+
+               if (count (a) != 20)
+                       return 2;
+               
                return 0;
        }
 }