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 ()
{
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 ()
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 ()
{
--- /dev/null
+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;
+ }
+ }
+}
<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="<PrivateImplementationDetails>">
+ <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()">