Merge pull request #5675 from mono/glib-debug-symbols
[mono.git] / mcs / tests / test-34.cs
index 06f8518a201c969136c9f68bb18ac62eb108fa07..60399d53be433ea1f04e3e8dcd25eb38b6cdcdea 100644 (file)
@@ -4,6 +4,16 @@
 //
 using System;
 
+public struct FancyInt {
+       public int value;
+
+       public FancyInt (int v)
+       {
+               value = v;
+       }
+       
+}
+
 public class Blah {
        static int got;
        
@@ -30,6 +40,37 @@ public class Blah {
                got = 3;
        }
 
+       static void In (ref int a)
+       {
+               a++;
+       }
+
+       static void Out (ref int a)
+       {
+               In (ref a);
+       }
+
+       static int AddArray (params int [] valores)
+       {
+               int total = 0;
+               
+               for (int i = 0; i < valores.Length; i++)
+                       total += valores [i];
+
+               return total;
+       }
+
+       static int AddFancy (params FancyInt [] vals)
+       {
+               int total = 0;
+               
+               for (int i = 0; i < vals.Length; i++)
+                       total += vals [i].value;
+
+               return total;
+       }
+       
+       
        public static int Main ()
        {
                int i = 1;
@@ -54,6 +95,27 @@ public class Blah {
                if (got != 2)
                        return 3;
 
+               int k = 10;
+
+               Out (ref k);
+               if (k != 11)
+                       return 10;
+
+               int [] arr2 = new int [2] {1, 2};
+
+               if (AddArray (arr2) != 3)
+                       return 11;
+
+               FancyInt f_one = new FancyInt (1);
+               FancyInt f_two = new FancyInt (2);
+
+               if (AddFancy (f_one) != 1)
+                       return 12;
+
+               if (AddFancy (f_one, f_two) != 3)
+                       return 13;
+
+               Console.WriteLine ("Test passes");
                return  0;
        }
 }