New tests.
authorMarek Safar <marek.safar@gmail.com>
Tue, 22 Sep 2009 09:50:21 +0000 (09:50 -0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 22 Sep 2009 09:50:21 +0000 (09:50 -0000)
svn path=/trunk/mcs/; revision=142374

mcs/tests/gtest-etree-01.cs
mcs/tests/test-729.cs [new file with mode: 0644]
mcs/tests/ver-il-gmcs.xml

index 221132d47f77f61778cfaa10eb0029d0d559b331..b4cffde538db6e689210ab00c393cfe0c1589236 100644 (file)
@@ -605,6 +605,30 @@ class Tester
                AssertNodeType (e5, ExpressionType.ArrayIndex);
                Assert (0, e5.Compile ().Invoke ());
        }
+       
+       void ArrayIndexTest_6 ()
+       {
+               const ulong max = 3;
+               
+               Expression<Func<int[], int>> e = a => a [max];
+               AssertNodeType (e, ExpressionType.ArrayIndex);
+               Assert (4, e.Compile ().Invoke (new int [] { 1, 2, 3, 4, 5 }));
+       }
+       
+       void ArrayIndexTest_7 ()
+       {
+               const ulong max = uint.MaxValue;
+               
+               Expression<Func<int[], int>> e = a => a [max];
+               AssertNodeType (e, ExpressionType.ArrayIndex);
+               
+               try {
+                       e.Compile ().Invoke (new int [0]);
+                       throw new ApplicationException ("ArrayIndexTest_7");
+               } catch (System.OverflowException) {
+                       // Check whether CheckedConversion was generated
+               }
+       }
 
        void ArrayLengthTest ()
        {
@@ -1956,9 +1980,9 @@ class Tester
        
        void NewArrayInitTest ()
        {
-               Expression<Func<int []>> e = () => new int [0];
+               Expression<Func<int []>> e = () => new int [1] { 5 };
                AssertNodeType (e, ExpressionType.NewArrayInit);
-               Assert (new int [0], e.Compile ().Invoke ());
+               Assert (new int [1] { 5 }, e.Compile ().Invoke ());
        }       
        
        void NewArrayInitTest_2 ()
@@ -2008,7 +2032,22 @@ class Tester
                Expression<Func<int[,]>> e2 = () => new int [0,0];
                AssertNodeType (e2, ExpressionType.NewArrayBounds);
                Assert (new int [0, 0].Length, e2.Compile ().Invoke ().Length);
-       }       
+       }
+       
+       void NewArrayBoundsTest_3 ()
+       {
+               Expression<Func<int []>> e = () => new int [0];
+               AssertNodeType (e, ExpressionType.NewArrayBounds);
+               Assert (0, e.Compile ().Invoke ().Length);
+       }
+
+       void NewArrayBoundsTest_4 ()
+       {
+               const ulong max = ulong.MaxValue;
+               
+               Expression<Func<bool[]>> e = () => new bool [max];
+               AssertNodeType (e, ExpressionType.NewArrayBounds);
+       }
        
        void NewTest ()
        {
diff --git a/mcs/tests/test-729.cs b/mcs/tests/test-729.cs
new file mode 100644 (file)
index 0000000..aaf0463
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+
+namespace Primes
+{
+       class MainClass
+       {
+               public static int Main ()
+               {
+                       const ulong max = 5;
+                       bool[] numbers = new bool[max];
+
+                       for (ulong i = 0; i < max; i++)
+                               numbers[i] = true;
+
+                       for (ulong j = 1; j < max; j++)
+                               for (ulong k = (j + 1) * 2; k < max; k += j + 1)
+                                       numbers[k] = false;
+
+                       for (ulong i = 0; i < max; i++)
+                               if (numbers[i])
+                                       Console.WriteLine (i + 1);
+
+                       return 0;
+               }
+       }
+}
index 28dfa196ec72a705263f4eb51fc853a964383692..d1cb7a682a62a97df96f79fbb629ee7ecc711ddf 100644 (file)
         <size>115</size>
       </method>
       <method name="Void ArrayIndexTest_3()">
-        <size>229</size>
+        <size>199</size>
       </method>
       <method name="Void ArrayIndexTest_4()">
-        <size>258</size>
+        <size>243</size>
       </method>
       <method name="Void ArrayIndexTest_5()">
         <size>108</size>
         <size>86</size>
       </method>
       <method name="Void NewArrayInitTest()">
-        <size>64</size>
+        <size>92</size>
       </method>
       <method name="Void NewArrayInitTest_2()">
         <size>64</size>
       <method name="Void EqualTest_15()">
         <size>159</size>
       </method>
+      <method name="Void ArrayIndexTest_6()">
+        <size>122</size>
+      </method>
+      <method name="Void ArrayIndexTest_7()">
+        <size>128</size>
+      </method>
+      <method name="Void NewArrayBoundsTest_3()">
+        <size>85</size>
+      </method>
+      <method name="Void NewArrayBoundsTest_4()">
+        <size>82</size>
+      </method>
+    </type>
+    <type name="&lt;PrivateImplementationDetails&gt;">
+      <method name="Void .ctor()">
+        <size>7</size>
+      </method>
     </type>
   </test>
   <test name="gtest-etree-02.cs">
       </method>
     </type>
   </test>
+  <test name="test-729.cs">
+    <type name="Primes.MainClass">
+      <method name="Int32 Main()">
+        <size>141</size>
+      </method>
+      <method name="Void .ctor()">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-73.cs">
     <type name="Abstract">
       <method name="Void .ctor()">