PageRenderTime 661ms CodeModel.GetById 602ms app.highlight 41ms RepoModel.GetById 3ms app.codeStats 2ms

/IronPython_Main/Runtime/Tests/ETScenariosCSLinq/CSLinq/ExpressionCompiler/array_BackSl_index_BackSl_test0.cs

#
C# | 10651 lines | 9016 code | 1420 blank | 215 comment | 846 complexity | 58772e2b18712478e6f2280faba6af92 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1#if !CLR2
   2using System.Linq.Expressions;
   3#else
   4using Microsoft.Scripting.Ast;
   5using Microsoft.Scripting.Utils;
   6#endif
   7
   8using System.Reflection;
   9using System;
  10namespace ExpressionCompiler { 
  11	
  12			
  13			//-------- Scenario 3124
  14			namespace Scenario3124{
  15				
  16				public class Test
  17				{
  18			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "byte_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
  19			    public static Expression byte_ArrayIndex__() {
  20			       if(Main() != 0 ) {
  21			           throw new Exception();
  22			       } else { 
  23			           return Expression.Constant(0);
  24			       }
  25			    }
  26				public     static int Main()
  27				    {
  28				        Ext.StartCapture();
  29				        bool success = false;
  30				        try
  31				        {
  32				            success = check_byte_ArrayIndex();
  33				        }
  34				        finally
  35				        {
  36				            Ext.StopCapture();
  37				        }
  38				        return success ? 0 : 1;
  39				    }
  40				
  41				    static bool check_byte_ArrayIndex()
  42				    {
  43				        return checkEx_byte_ArrayIndex(null, -1) &
  44				            checkEx_byte_ArrayIndex(null, 0) &
  45				            checkEx_byte_ArrayIndex(null, 1) &
  46				
  47				            check_byte_ArrayIndex(genArrbyte_ArrayIndex(0)) &
  48				            check_byte_ArrayIndex(genArrbyte_ArrayIndex(1)) &
  49				            check_byte_ArrayIndex(genArrbyte_ArrayIndex(5));
  50				    }
  51				
  52				    static byte[] genArrbyte_ArrayIndex(int size)
  53				    {
  54				        byte[] vals = new byte[] { 0, 1, byte.MaxValue };
  55				        byte[] result = new byte[size];
  56				        for (int i = 0; i < size; i++)
  57				        {
  58				            result[i] = vals[i % vals.Length];
  59				        }
  60				        return result;
  61				    }
  62				
  63				    static bool check_byte_ArrayIndex(byte[] val)
  64				    {
  65				        bool success = checkEx_byte_ArrayIndex(val, -1);
  66				        for (int i = 0; i < val.Length; i++)
  67				        {
  68				            success &= check_byte_ArrayIndex(val, 0);
  69				        }
  70				        success &= checkEx_byte_ArrayIndex(val, val.Length);
  71				        return success;
  72				    }
  73				
  74				    static bool checkEx_byte_ArrayIndex(byte[] val, int index)
  75				    {
  76				        try
  77				        {
  78				            check_byte_ArrayIndex(val, index);
  79				            Console.WriteLine("byte_ArrayIndex[" + index + "] failed");
  80				            return false;
  81				        }
  82				        catch
  83				        {
  84				            return true;
  85				        }
  86				    }
  87				
  88				    static bool check_byte_ArrayIndex(byte[] val, int index)
  89				    {
  90				        Expression<Func<byte>> e =
  91				            Expression.Lambda<Func<byte>>(
  92				                Expression.ArrayIndex(Expression.Constant(val, typeof(byte[])),
  93				                    Expression.Constant(index, typeof(int))),
  94				                new System.Collections.Generic.List<ParameterExpression>());
  95				        Func<byte> f = e.Compile();
  96				        return object.Equals(f(), val[index]);
  97				    }
  98				}
  99			
 100			
 101			public  static class Ext {
 102			    public static void StartCapture() {
 103			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 104			//        m.Invoke(null, new object[] { "test.dll" });
 105			    }
 106			
 107			    public static void StopCapture() {
 108			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 109			//        m.Invoke(null, new object[0]);
 110			    }
 111			
 112			    public static bool IsIntegralOrEnum(Type type) {
 113			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 114			            case TypeCode.Byte:
 115			            case TypeCode.SByte:
 116			            case TypeCode.Int16:
 117			            case TypeCode.Int32:
 118			            case TypeCode.Int64:
 119			            case TypeCode.UInt16:
 120			            case TypeCode.UInt32:
 121			            case TypeCode.UInt64:
 122			                return true;
 123			            default:
 124			                return false;
 125			        }
 126			    }
 127			
 128			    public static bool IsFloating(Type type) {
 129			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 130			            case TypeCode.Single:
 131			            case TypeCode.Double:
 132			                return true;
 133			            default:
 134			                return false;
 135			        }
 136			    }
 137			
 138			    public static Type GetNonNullableType(Type type) {
 139			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 140			                type.GetGenericArguments()[0] :
 141			                type;
 142			    }
 143			}
 144			
 145		
 146	}
 147			
 148			//-------- Scenario 3125
 149			namespace Scenario3125{
 150				
 151				public class Test
 152				{
 153			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "ushort_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 154			    public static Expression ushort_ArrayIndex__() {
 155			       if(Main() != 0 ) {
 156			           throw new Exception();
 157			       } else { 
 158			           return Expression.Constant(0);
 159			       }
 160			    }
 161				public     static int Main()
 162				    {
 163				        Ext.StartCapture();
 164				        bool success = false;
 165				        try
 166				        {
 167				            success = check_ushort_ArrayIndex();
 168				        }
 169				        finally
 170				        {
 171				            Ext.StopCapture();
 172				        }
 173				        return success ? 0 : 1;
 174				    }
 175				
 176				    static bool check_ushort_ArrayIndex()
 177				    {
 178				        return checkEx_ushort_ArrayIndex(null, -1) &
 179				            checkEx_ushort_ArrayIndex(null, 0) &
 180				            checkEx_ushort_ArrayIndex(null, 1) &
 181				
 182				            check_ushort_ArrayIndex(genArrushort_ArrayIndex(0)) &
 183				            check_ushort_ArrayIndex(genArrushort_ArrayIndex(1)) &
 184				            check_ushort_ArrayIndex(genArrushort_ArrayIndex(5));
 185				    }
 186				
 187				    static ushort[] genArrushort_ArrayIndex(int size)
 188				    {
 189				        ushort[] vals = new ushort[] { 0, 1, ushort.MaxValue };
 190				        ushort[] result = new ushort[size];
 191				        for (int i = 0; i < size; i++)
 192				        {
 193				            result[i] = vals[i % vals.Length];
 194				        }
 195				        return result;
 196				    }
 197				
 198				    static bool check_ushort_ArrayIndex(ushort[] val)
 199				    {
 200				        bool success = checkEx_ushort_ArrayIndex(val, -1);
 201				        for (int i = 0; i < val.Length; i++)
 202				        {
 203				            success &= check_ushort_ArrayIndex(val, 0);
 204				        }
 205				        success &= checkEx_ushort_ArrayIndex(val, val.Length);
 206				        return success;
 207				    }
 208				
 209				    static bool checkEx_ushort_ArrayIndex(ushort[] val, int index)
 210				    {
 211				        try
 212				        {
 213				            check_ushort_ArrayIndex(val, index);
 214				            Console.WriteLine("ushort_ArrayIndex[" + index + "] failed");
 215				            return false;
 216				        }
 217				        catch
 218				        {
 219				            return true;
 220				        }
 221				    }
 222				
 223				    static bool check_ushort_ArrayIndex(ushort[] val, int index)
 224				    {
 225				        Expression<Func<ushort>> e =
 226				            Expression.Lambda<Func<ushort>>(
 227				                Expression.ArrayIndex(Expression.Constant(val, typeof(ushort[])),
 228				                    Expression.Constant(index, typeof(int))),
 229				                new System.Collections.Generic.List<ParameterExpression>());
 230				        Func<ushort> f = e.Compile();
 231				        return object.Equals(f(), val[index]);
 232				    }
 233				}
 234			
 235			
 236			public  static class Ext {
 237			    public static void StartCapture() {
 238			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 239			//        m.Invoke(null, new object[] { "test.dll" });
 240			    }
 241			
 242			    public static void StopCapture() {
 243			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 244			//        m.Invoke(null, new object[0]);
 245			    }
 246			
 247			    public static bool IsIntegralOrEnum(Type type) {
 248			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 249			            case TypeCode.Byte:
 250			            case TypeCode.SByte:
 251			            case TypeCode.Int16:
 252			            case TypeCode.Int32:
 253			            case TypeCode.Int64:
 254			            case TypeCode.UInt16:
 255			            case TypeCode.UInt32:
 256			            case TypeCode.UInt64:
 257			                return true;
 258			            default:
 259			                return false;
 260			        }
 261			    }
 262			
 263			    public static bool IsFloating(Type type) {
 264			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 265			            case TypeCode.Single:
 266			            case TypeCode.Double:
 267			                return true;
 268			            default:
 269			                return false;
 270			        }
 271			    }
 272			
 273			    public static Type GetNonNullableType(Type type) {
 274			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 275			                type.GetGenericArguments()[0] :
 276			                type;
 277			    }
 278			}
 279			
 280		
 281	}
 282			
 283			//-------- Scenario 3126
 284			namespace Scenario3126{
 285				
 286				public class Test
 287				{
 288			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "uint_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 289			    public static Expression uint_ArrayIndex__() {
 290			       if(Main() != 0 ) {
 291			           throw new Exception();
 292			       } else { 
 293			           return Expression.Constant(0);
 294			       }
 295			    }
 296				public     static int Main()
 297				    {
 298				        Ext.StartCapture();
 299				        bool success = false;
 300				        try
 301				        {
 302				            success = check_uint_ArrayIndex();
 303				        }
 304				        finally
 305				        {
 306				            Ext.StopCapture();
 307				        }
 308				        return success ? 0 : 1;
 309				    }
 310				
 311				    static bool check_uint_ArrayIndex()
 312				    {
 313				        return checkEx_uint_ArrayIndex(null, -1) &
 314				            checkEx_uint_ArrayIndex(null, 0) &
 315				            checkEx_uint_ArrayIndex(null, 1) &
 316				
 317				            check_uint_ArrayIndex(genArruint_ArrayIndex(0)) &
 318				            check_uint_ArrayIndex(genArruint_ArrayIndex(1)) &
 319				            check_uint_ArrayIndex(genArruint_ArrayIndex(5));
 320				    }
 321				
 322				    static uint[] genArruint_ArrayIndex(int size)
 323				    {
 324				        uint[] vals = new uint[] { 0, 1, uint.MaxValue };
 325				        uint[] result = new uint[size];
 326				        for (int i = 0; i < size; i++)
 327				        {
 328				            result[i] = vals[i % vals.Length];
 329				        }
 330				        return result;
 331				    }
 332				
 333				    static bool check_uint_ArrayIndex(uint[] val)
 334				    {
 335				        bool success = checkEx_uint_ArrayIndex(val, -1);
 336				        for (int i = 0; i < val.Length; i++)
 337				        {
 338				            success &= check_uint_ArrayIndex(val, 0);
 339				        }
 340				        success &= checkEx_uint_ArrayIndex(val, val.Length);
 341				        return success;
 342				    }
 343				
 344				    static bool checkEx_uint_ArrayIndex(uint[] val, int index)
 345				    {
 346				        try
 347				        {
 348				            check_uint_ArrayIndex(val, index);
 349				            Console.WriteLine("uint_ArrayIndex[" + index + "] failed");
 350				            return false;
 351				        }
 352				        catch
 353				        {
 354				            return true;
 355				        }
 356				    }
 357				
 358				    static bool check_uint_ArrayIndex(uint[] val, int index)
 359				    {
 360				        Expression<Func<uint>> e =
 361				            Expression.Lambda<Func<uint>>(
 362				                Expression.ArrayIndex(Expression.Constant(val, typeof(uint[])),
 363				                    Expression.Constant(index, typeof(int))),
 364				                new System.Collections.Generic.List<ParameterExpression>());
 365				        Func<uint> f = e.Compile();
 366				        return object.Equals(f(), val[index]);
 367				    }
 368				}
 369			
 370			
 371			public  static class Ext {
 372			    public static void StartCapture() {
 373			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 374			//        m.Invoke(null, new object[] { "test.dll" });
 375			    }
 376			
 377			    public static void StopCapture() {
 378			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 379			//        m.Invoke(null, new object[0]);
 380			    }
 381			
 382			    public static bool IsIntegralOrEnum(Type type) {
 383			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 384			            case TypeCode.Byte:
 385			            case TypeCode.SByte:
 386			            case TypeCode.Int16:
 387			            case TypeCode.Int32:
 388			            case TypeCode.Int64:
 389			            case TypeCode.UInt16:
 390			            case TypeCode.UInt32:
 391			            case TypeCode.UInt64:
 392			                return true;
 393			            default:
 394			                return false;
 395			        }
 396			    }
 397			
 398			    public static bool IsFloating(Type type) {
 399			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 400			            case TypeCode.Single:
 401			            case TypeCode.Double:
 402			                return true;
 403			            default:
 404			                return false;
 405			        }
 406			    }
 407			
 408			    public static Type GetNonNullableType(Type type) {
 409			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 410			                type.GetGenericArguments()[0] :
 411			                type;
 412			    }
 413			}
 414			
 415		
 416	}
 417			
 418			//-------- Scenario 3127
 419			namespace Scenario3127{
 420				
 421				public class Test
 422				{
 423			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "ulong_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 424			    public static Expression ulong_ArrayIndex__() {
 425			       if(Main() != 0 ) {
 426			           throw new Exception();
 427			       } else { 
 428			           return Expression.Constant(0);
 429			       }
 430			    }
 431				public     static int Main()
 432				    {
 433				        Ext.StartCapture();
 434				        bool success = false;
 435				        try
 436				        {
 437				            success = check_ulong_ArrayIndex();
 438				        }
 439				        finally
 440				        {
 441				            Ext.StopCapture();
 442				        }
 443				        return success ? 0 : 1;
 444				    }
 445				
 446				    static bool check_ulong_ArrayIndex()
 447				    {
 448				        return checkEx_ulong_ArrayIndex(null, -1) &
 449				            checkEx_ulong_ArrayIndex(null, 0) &
 450				            checkEx_ulong_ArrayIndex(null, 1) &
 451				
 452				            check_ulong_ArrayIndex(genArrulong_ArrayIndex(0)) &
 453				            check_ulong_ArrayIndex(genArrulong_ArrayIndex(1)) &
 454				            check_ulong_ArrayIndex(genArrulong_ArrayIndex(5));
 455				    }
 456				
 457				    static ulong[] genArrulong_ArrayIndex(int size)
 458				    {
 459				        ulong[] vals = new ulong[] { 0, 1, ulong.MaxValue };
 460				        ulong[] result = new ulong[size];
 461				        for (int i = 0; i < size; i++)
 462				        {
 463				            result[i] = vals[i % vals.Length];
 464				        }
 465				        return result;
 466				    }
 467				
 468				    static bool check_ulong_ArrayIndex(ulong[] val)
 469				    {
 470				        bool success = checkEx_ulong_ArrayIndex(val, -1);
 471				        for (int i = 0; i < val.Length; i++)
 472				        {
 473				            success &= check_ulong_ArrayIndex(val, 0);
 474				        }
 475				        success &= checkEx_ulong_ArrayIndex(val, val.Length);
 476				        return success;
 477				    }
 478				
 479				    static bool checkEx_ulong_ArrayIndex(ulong[] val, int index)
 480				    {
 481				        try
 482				        {
 483				            check_ulong_ArrayIndex(val, index);
 484				            Console.WriteLine("ulong_ArrayIndex[" + index + "] failed");
 485				            return false;
 486				        }
 487				        catch
 488				        {
 489				            return true;
 490				        }
 491				    }
 492				
 493				    static bool check_ulong_ArrayIndex(ulong[] val, int index)
 494				    {
 495				        Expression<Func<ulong>> e =
 496				            Expression.Lambda<Func<ulong>>(
 497				                Expression.ArrayIndex(Expression.Constant(val, typeof(ulong[])),
 498				                    Expression.Constant(index, typeof(int))),
 499				                new System.Collections.Generic.List<ParameterExpression>());
 500				        Func<ulong> f = e.Compile();
 501				        return object.Equals(f(), val[index]);
 502				    }
 503				}
 504			
 505			
 506			public  static class Ext {
 507			    public static void StartCapture() {
 508			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 509			//        m.Invoke(null, new object[] { "test.dll" });
 510			    }
 511			
 512			    public static void StopCapture() {
 513			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 514			//        m.Invoke(null, new object[0]);
 515			    }
 516			
 517			    public static bool IsIntegralOrEnum(Type type) {
 518			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 519			            case TypeCode.Byte:
 520			            case TypeCode.SByte:
 521			            case TypeCode.Int16:
 522			            case TypeCode.Int32:
 523			            case TypeCode.Int64:
 524			            case TypeCode.UInt16:
 525			            case TypeCode.UInt32:
 526			            case TypeCode.UInt64:
 527			                return true;
 528			            default:
 529			                return false;
 530			        }
 531			    }
 532			
 533			    public static bool IsFloating(Type type) {
 534			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 535			            case TypeCode.Single:
 536			            case TypeCode.Double:
 537			                return true;
 538			            default:
 539			                return false;
 540			        }
 541			    }
 542			
 543			    public static Type GetNonNullableType(Type type) {
 544			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 545			                type.GetGenericArguments()[0] :
 546			                type;
 547			    }
 548			}
 549			
 550		
 551	}
 552			
 553			//-------- Scenario 3128
 554			namespace Scenario3128{
 555				
 556				public class Test
 557				{
 558			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "sbyte_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 559			    public static Expression sbyte_ArrayIndex__() {
 560			       if(Main() != 0 ) {
 561			           throw new Exception();
 562			       } else { 
 563			           return Expression.Constant(0);
 564			       }
 565			    }
 566				public     static int Main()
 567				    {
 568				        Ext.StartCapture();
 569				        bool success = false;
 570				        try
 571				        {
 572				            success = check_sbyte_ArrayIndex();
 573				        }
 574				        finally
 575				        {
 576				            Ext.StopCapture();
 577				        }
 578				        return success ? 0 : 1;
 579				    }
 580				
 581				    static bool check_sbyte_ArrayIndex()
 582				    {
 583				        return checkEx_sbyte_ArrayIndex(null, -1) &
 584				            checkEx_sbyte_ArrayIndex(null, 0) &
 585				            checkEx_sbyte_ArrayIndex(null, 1) &
 586				
 587				            check_sbyte_ArrayIndex(genArrsbyte_ArrayIndex(0)) &
 588				            check_sbyte_ArrayIndex(genArrsbyte_ArrayIndex(1)) &
 589				            check_sbyte_ArrayIndex(genArrsbyte_ArrayIndex(5));
 590				    }
 591				
 592				    static sbyte[] genArrsbyte_ArrayIndex(int size)
 593				    {
 594				        sbyte[] vals = new sbyte[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue };
 595				        sbyte[] result = new sbyte[size];
 596				        for (int i = 0; i < size; i++)
 597				        {
 598				            result[i] = vals[i % vals.Length];
 599				        }
 600				        return result;
 601				    }
 602				
 603				    static bool check_sbyte_ArrayIndex(sbyte[] val)
 604				    {
 605				        bool success = checkEx_sbyte_ArrayIndex(val, -1);
 606				        for (int i = 0; i < val.Length; i++)
 607				        {
 608				            success &= check_sbyte_ArrayIndex(val, 0);
 609				        }
 610				        success &= checkEx_sbyte_ArrayIndex(val, val.Length);
 611				        return success;
 612				    }
 613				
 614				    static bool checkEx_sbyte_ArrayIndex(sbyte[] val, int index)
 615				    {
 616				        try
 617				        {
 618				            check_sbyte_ArrayIndex(val, index);
 619				            Console.WriteLine("sbyte_ArrayIndex[" + index + "] failed");
 620				            return false;
 621				        }
 622				        catch
 623				        {
 624				            return true;
 625				        }
 626				    }
 627				
 628				    static bool check_sbyte_ArrayIndex(sbyte[] val, int index)
 629				    {
 630				        Expression<Func<sbyte>> e =
 631				            Expression.Lambda<Func<sbyte>>(
 632				                Expression.ArrayIndex(Expression.Constant(val, typeof(sbyte[])),
 633				                    Expression.Constant(index, typeof(int))),
 634				                new System.Collections.Generic.List<ParameterExpression>());
 635				        Func<sbyte> f = e.Compile();
 636				        return object.Equals(f(), val[index]);
 637				    }
 638				}
 639			
 640			
 641			public  static class Ext {
 642			    public static void StartCapture() {
 643			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 644			//        m.Invoke(null, new object[] { "test.dll" });
 645			    }
 646			
 647			    public static void StopCapture() {
 648			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 649			//        m.Invoke(null, new object[0]);
 650			    }
 651			
 652			    public static bool IsIntegralOrEnum(Type type) {
 653			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 654			            case TypeCode.Byte:
 655			            case TypeCode.SByte:
 656			            case TypeCode.Int16:
 657			            case TypeCode.Int32:
 658			            case TypeCode.Int64:
 659			            case TypeCode.UInt16:
 660			            case TypeCode.UInt32:
 661			            case TypeCode.UInt64:
 662			                return true;
 663			            default:
 664			                return false;
 665			        }
 666			    }
 667			
 668			    public static bool IsFloating(Type type) {
 669			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 670			            case TypeCode.Single:
 671			            case TypeCode.Double:
 672			                return true;
 673			            default:
 674			                return false;
 675			        }
 676			    }
 677			
 678			    public static Type GetNonNullableType(Type type) {
 679			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 680			                type.GetGenericArguments()[0] :
 681			                type;
 682			    }
 683			}
 684			
 685		
 686	}
 687			
 688			//-------- Scenario 3129
 689			namespace Scenario3129{
 690				
 691				public class Test
 692				{
 693			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "short_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 694			    public static Expression short_ArrayIndex__() {
 695			       if(Main() != 0 ) {
 696			           throw new Exception();
 697			       } else { 
 698			           return Expression.Constant(0);
 699			       }
 700			    }
 701				public     static int Main()
 702				    {
 703				        Ext.StartCapture();
 704				        bool success = false;
 705				        try
 706				        {
 707				            success = check_short_ArrayIndex();
 708				        }
 709				        finally
 710				        {
 711				            Ext.StopCapture();
 712				        }
 713				        return success ? 0 : 1;
 714				    }
 715				
 716				    static bool check_short_ArrayIndex()
 717				    {
 718				        return checkEx_short_ArrayIndex(null, -1) &
 719				            checkEx_short_ArrayIndex(null, 0) &
 720				            checkEx_short_ArrayIndex(null, 1) &
 721				
 722				            check_short_ArrayIndex(genArrshort_ArrayIndex(0)) &
 723				            check_short_ArrayIndex(genArrshort_ArrayIndex(1)) &
 724				            check_short_ArrayIndex(genArrshort_ArrayIndex(5));
 725				    }
 726				
 727				    static short[] genArrshort_ArrayIndex(int size)
 728				    {
 729				        short[] vals = new short[] { 0, 1, -1, short.MinValue, short.MaxValue };
 730				        short[] result = new short[size];
 731				        for (int i = 0; i < size; i++)
 732				        {
 733				            result[i] = vals[i % vals.Length];
 734				        }
 735				        return result;
 736				    }
 737				
 738				    static bool check_short_ArrayIndex(short[] val)
 739				    {
 740				        bool success = checkEx_short_ArrayIndex(val, -1);
 741				        for (int i = 0; i < val.Length; i++)
 742				        {
 743				            success &= check_short_ArrayIndex(val, 0);
 744				        }
 745				        success &= checkEx_short_ArrayIndex(val, val.Length);
 746				        return success;
 747				    }
 748				
 749				    static bool checkEx_short_ArrayIndex(short[] val, int index)
 750				    {
 751				        try
 752				        {
 753				            check_short_ArrayIndex(val, index);
 754				            Console.WriteLine("short_ArrayIndex[" + index + "] failed");
 755				            return false;
 756				        }
 757				        catch
 758				        {
 759				            return true;
 760				        }
 761				    }
 762				
 763				    static bool check_short_ArrayIndex(short[] val, int index)
 764				    {
 765				        Expression<Func<short>> e =
 766				            Expression.Lambda<Func<short>>(
 767				                Expression.ArrayIndex(Expression.Constant(val, typeof(short[])),
 768				                    Expression.Constant(index, typeof(int))),
 769				                new System.Collections.Generic.List<ParameterExpression>());
 770				        Func<short> f = e.Compile();
 771				        return object.Equals(f(), val[index]);
 772				    }
 773				}
 774			
 775			
 776			public  static class Ext {
 777			    public static void StartCapture() {
 778			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 779			//        m.Invoke(null, new object[] { "test.dll" });
 780			    }
 781			
 782			    public static void StopCapture() {
 783			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 784			//        m.Invoke(null, new object[0]);
 785			    }
 786			
 787			    public static bool IsIntegralOrEnum(Type type) {
 788			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 789			            case TypeCode.Byte:
 790			            case TypeCode.SByte:
 791			            case TypeCode.Int16:
 792			            case TypeCode.Int32:
 793			            case TypeCode.Int64:
 794			            case TypeCode.UInt16:
 795			            case TypeCode.UInt32:
 796			            case TypeCode.UInt64:
 797			                return true;
 798			            default:
 799			                return false;
 800			        }
 801			    }
 802			
 803			    public static bool IsFloating(Type type) {
 804			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 805			            case TypeCode.Single:
 806			            case TypeCode.Double:
 807			                return true;
 808			            default:
 809			                return false;
 810			        }
 811			    }
 812			
 813			    public static Type GetNonNullableType(Type type) {
 814			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 815			                type.GetGenericArguments()[0] :
 816			                type;
 817			    }
 818			}
 819			
 820		
 821	}
 822			
 823			//-------- Scenario 3130
 824			namespace Scenario3130{
 825				
 826				public class Test
 827				{
 828			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "int_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 829			    public static Expression int_ArrayIndex__() {
 830			       if(Main() != 0 ) {
 831			           throw new Exception();
 832			       } else { 
 833			           return Expression.Constant(0);
 834			       }
 835			    }
 836				public     static int Main()
 837				    {
 838				        Ext.StartCapture();
 839				        bool success = false;
 840				        try
 841				        {
 842				            success = check_int_ArrayIndex();
 843				        }
 844				        finally
 845				        {
 846				            Ext.StopCapture();
 847				        }
 848				        return success ? 0 : 1;
 849				    }
 850				
 851				    static bool check_int_ArrayIndex()
 852				    {
 853				        return checkEx_int_ArrayIndex(null, -1) &
 854				            checkEx_int_ArrayIndex(null, 0) &
 855				            checkEx_int_ArrayIndex(null, 1) &
 856				
 857				            check_int_ArrayIndex(genArrint_ArrayIndex(0)) &
 858				            check_int_ArrayIndex(genArrint_ArrayIndex(1)) &
 859				            check_int_ArrayIndex(genArrint_ArrayIndex(5));
 860				    }
 861				
 862				    static int[] genArrint_ArrayIndex(int size)
 863				    {
 864				        int[] vals = new int[] { 0, 1, -1, int.MinValue, int.MaxValue };
 865				        int[] result = new int[size];
 866				        for (int i = 0; i < size; i++)
 867				        {
 868				            result[i] = vals[i % vals.Length];
 869				        }
 870				        return result;
 871				    }
 872				
 873				    static bool check_int_ArrayIndex(int[] val)
 874				    {
 875				        bool success = checkEx_int_ArrayIndex(val, -1);
 876				        for (int i = 0; i < val.Length; i++)
 877				        {
 878				            success &= check_int_ArrayIndex(val, 0);
 879				        }
 880				        success &= checkEx_int_ArrayIndex(val, val.Length);
 881				        return success;
 882				    }
 883				
 884				    static bool checkEx_int_ArrayIndex(int[] val, int index)
 885				    {
 886				        try
 887				        {
 888				            check_int_ArrayIndex(val, index);
 889				            Console.WriteLine("int_ArrayIndex[" + index + "] failed");
 890				            return false;
 891				        }
 892				        catch
 893				        {
 894				            return true;
 895				        }
 896				    }
 897				
 898				    static bool check_int_ArrayIndex(int[] val, int index)
 899				    {
 900				        Expression<Func<int>> e =
 901				            Expression.Lambda<Func<int>>(
 902				                Expression.ArrayIndex(Expression.Constant(val, typeof(int[])),
 903				                    Expression.Constant(index, typeof(int))),
 904				                new System.Collections.Generic.List<ParameterExpression>());
 905				        Func<int> f = e.Compile();
 906				        return object.Equals(f(), val[index]);
 907				    }
 908				}
 909			
 910			
 911			public  static class Ext {
 912			    public static void StartCapture() {
 913			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 914			//        m.Invoke(null, new object[] { "test.dll" });
 915			    }
 916			
 917			    public static void StopCapture() {
 918			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 919			//        m.Invoke(null, new object[0]);
 920			    }
 921			
 922			    public static bool IsIntegralOrEnum(Type type) {
 923			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 924			            case TypeCode.Byte:
 925			            case TypeCode.SByte:
 926			            case TypeCode.Int16:
 927			            case TypeCode.Int32:
 928			            case TypeCode.Int64:
 929			            case TypeCode.UInt16:
 930			            case TypeCode.UInt32:
 931			            case TypeCode.UInt64:
 932			                return true;
 933			            default:
 934			                return false;
 935			        }
 936			    }
 937			
 938			    public static bool IsFloating(Type type) {
 939			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 940			            case TypeCode.Single:
 941			            case TypeCode.Double:
 942			                return true;
 943			            default:
 944			                return false;
 945			        }
 946			    }
 947			
 948			    public static Type GetNonNullableType(Type type) {
 949			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 950			                type.GetGenericArguments()[0] :
 951			                type;
 952			    }
 953			}
 954			
 955		
 956	}
 957			
 958			//-------- Scenario 3131
 959			namespace Scenario3131{
 960				
 961				public class Test
 962				{
 963			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "long_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 964			    public static Expression long_ArrayIndex__() {
 965			       if(Main() != 0 ) {
 966			           throw new Exception();
 967			       } else { 
 968			           return Expression.Constant(0);
 969			       }
 970			    }
 971				public     static int Main()
 972				    {
 973				        Ext.StartCapture();
 974				        bool success = false;
 975				        try
 976				        {
 977				            success = check_long_ArrayIndex();
 978				        }
 979				        finally
 980				        {
 981				            Ext.StopCapture();
 982				        }
 983				        return success ? 0 : 1;
 984				    }
 985				
 986				    static bool check_long_ArrayIndex()
 987				    {
 988				        return checkEx_long_ArrayIndex(null, -1) &
 989				            checkEx_long_ArrayIndex(null, 0) &
 990				            checkEx_long_ArrayIndex(null, 1) &
 991				
 992				            check_long_ArrayIndex(genArrlong_ArrayIndex(0)) &
 993				            check_long_ArrayIndex(genArrlong_ArrayIndex(1)) &
 994				            check_long_ArrayIndex(genArrlong_ArrayIndex(5));
 995				    }
 996				
 997				    static long[] genArrlong_ArrayIndex(int size)
 998				    {
 999				        long[] vals = new long[] { 0, 1, -1, long.MinValue, long.MaxValue };
1000				        long[] result = new long[size];
1001				        for (int i = 0; i < size; i++)
1002				        {
1003				            result[i] = vals[i % vals.Length];
1004				        }
1005				        return result;
1006				    }
1007				
1008				    static bool check_long_ArrayIndex(long[] val)
1009				    {
1010				        bool success = checkEx_long_ArrayIndex(val, -1);
1011				        for (int i = 0; i < val.Length; i++)
1012				        {
1013				            success &= check_long_ArrayIndex(val, 0);
1014				        }
1015				        success &= checkEx_long_ArrayIndex(val, val.Length);
1016				        return success;
1017				    }
1018				
1019				    static bool checkEx_long_ArrayIndex(long[] val, int index)
1020				    {
1021				        try
1022				        {
1023				            check_long_ArrayIndex(val, index);
1024				            Console.WriteLine("long_ArrayIndex[" + index + "] failed");
1025				            return false;
1026				        }
1027				        catch
1028				        {
1029				            return true;
1030				        }
1031				    }
1032				
1033				    static bool check_long_ArrayIndex(long[] val, int index)
1034				    {
1035				        Expression<Func<long>> e =
1036				            Expression.Lambda<Func<long>>(
1037				                Expression.ArrayIndex(Expression.Constant(val, typeof(long[])),
1038				                    Expression.Constant(index, typeof(int))),
1039				                new System.Collections.Generic.List<ParameterExpression>());
1040				        Func<long> f = e.Compile();
1041				        return object.Equals(f(), val[index]);
1042				    }
1043				}
1044			
1045			
1046			public  static class Ext {
1047			    public static void StartCapture() {
1048			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1049			//        m.Invoke(null, new object[] { "test.dll" });
1050			    }
1051			
1052			    public static void StopCapture() {
1053			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1054			//        m.Invoke(null, new object[0]);
1055			    }
1056			
1057			    public static bool IsIntegralOrEnum(Type type) {
1058			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1059			            case TypeCode.Byte:
1060			            case TypeCode.SByte:
1061			            case TypeCode.Int16:
1062			            case TypeCode.Int32:
1063			            case TypeCode.Int64:
1064			            case TypeCode.UInt16:
1065			            case TypeCode.UInt32:
1066			            case TypeCode.UInt64:
1067			                return true;
1068			            default:
1069			                return false;
1070			        }
1071			    }
1072			
1073			    public static bool IsFloating(Type type) {
1074			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1075			            case TypeCode.Single:
1076			            case TypeCode.Double:
1077			                return true;
1078			            default:
1079			                return false;
1080			        }
1081			    }
1082			
1083			    public static Type GetNonNullableType(Type type) {
1084			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
1085			                type.GetGenericArguments()[0] :
1086			                type;
1087			    }
1088			}
1089			
1090		
1091	}
1092			
1093			//-------- Scenario 3132
1094			namespace Scenario3132{
1095				
1096				public class Test
1097				{
1098			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "float_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
1099			    public static Expression float_ArrayIndex__() {
1100			       if(Main() != 0 ) {
1101			           throw new Exception();
1102			       } else { 
1103			           return Expression.Constant(0);
1104			       }
1105			    }
1106				public     static int Main()
1107				    {
1108				        Ext.StartCapture();
1109				        bool success = false;
1110				        try
1111				        {
1112				            success = check_float_ArrayIndex();
1113				        }
1114				        finally
1115				        {
1116				            Ext.StopCapture();
1117				        }
1118				        return success ? 0 : 1;
1119				    }
1120				
1121				    static bool check_float_ArrayIndex()
1122				    {
1123				        return checkEx_float_ArrayIndex(null, -1) &
1124				            checkEx_float_ArrayIndex(null, 0) &
1125				            checkEx_float_ArrayIndex(null, 1) &
1126				
1127				            check_float_ArrayIndex(genArrfloat_ArrayIndex(0)) &
1128				            check_float_ArrayIndex(genArrfloat_ArrayIndex(1)) &
1129				            check_float_ArrayIndex(genArrfloat_ArrayIndex(5));
1130				    }
1131				
1132				    static float[] genArrfloat_ArrayIndex(int size)
1133				    {
1134				        float[] vals = new float[] { 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN };
1135				        float[] result = new float[size];
1136				        for (int i = 0; i < size; i++)
1137				        {
1138				            result[i] = vals[i % vals.Length];
1139				        }
1140				        return result;
1141				    }
1142				
1143				    static bool check_float_ArrayIndex(float[] val)
1144				    {
1145				        bool success = checkEx_float_ArrayIndex(val, -1);
1146				        for (int i = 0; i < val.Length; i++)
1147				        {
1148				            success &= check_float_ArrayIndex(val, 0);
1149				        }
1150				        success &= checkEx_float_ArrayIndex(val, val.Length);
1151				        return success;
1152				    }
1153				
1154				    static bool checkEx_float_ArrayIndex(float[] val, int index)
1155				    {
1156				        try
1157				        {
1158				            check_float_ArrayIndex(val, index);
1159				            Console.WriteLine("float_ArrayIndex[" + index + "] failed");
1160				            return false;
1161				        }
1162				        catch
1163				        {
1164				            return true;
1165				        }
1166				    }
1167				
1168				    static bool check_float_ArrayIndex(float[] val, int index)
1169				    {
1170				        Expression<Func<float>> e =
1171				            Expression.Lambda<Func<float>>(
1172				                Expression.ArrayIndex(Expression.Constant(val, typeof(float[])),
1173				                    Expression.Constant(index, typeof(int))),
1174				                new System.Collections.Generic.List<ParameterExpression>());
1175				        Func<float> f = e.Compile();
1176				        return object.Equals(f(), val[index]);
1177				    }
1178				}
1179			
1180			
1181			public  static class Ext {
1182			    public static void StartCapture() {
1183			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1184			//        m.Invoke(null, new object[] { "test.dll" });
1185			    }
1186			
1187			    public static void StopCapture() {
1188			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1189			//        m.Invoke(null, new object[0]);
1190			    }
1191			
1192			    public static bool IsIntegralOrEnum(Type type) {
1193			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1194			            case TypeCode.Byte:
1195			            case TypeCode.SByte:
1196			            case TypeCode.Int16:
1197			            case TypeCode.Int32:
1198			            case TypeCode.Int64:
1199			            case TypeCode.UInt16:
1200			            case TypeCode.UInt32:
1201			            case TypeCode.UInt64:
1202			                return true;
1203			            default:
1204			                return false;
1205			        }
1206			    }
1207			
1208			    public static bool IsFloating(Type type) {
1209			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1210			            case TypeCode.Single:
1211			            case TypeCode.Double:
1212			                return true;
1213			            default:
1214			                return false;
1215			        }
1216			    }
1217			
1218			    public static Type GetNonNullableType(Type type) {
1219			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
1220			                type.GetGenericArguments()[0] :
1221			                type;
1222			    }
1223			}
1224			
1225		
1226	}
1227			
1228			//-------- Scenario 3133
1229			namespace Scenario3133{
1230				
1231				public class Test
1232				{
1233			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "double_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
1234			    public static Expression double_ArrayIndex__() {
1235			       if(Main() != 0 ) {
1236			           throw new Exception();
1237			       } else { 
1238			           return Expression.Constant(0);
1239			       }
1240			    }
1241				public     static int Main()
1242				    {
1243				        Ext.StartCapture();
1244				        bool success = false;
1245				        try
1246				        {
1247				            success = check_double_ArrayIndex();
1248				        }
1249				        finally
1250				        {
1251				            Ext.StopCapture();
1252				        }
1253				        return success ? 0 : 1;
1254				    }
1255				
1256				    static bool check_double_ArrayIndex()
1257				    {
1258				        return checkEx_double_ArrayIndex(null, -1) &
1259				            checkEx_double_ArrayIndex(null, 0) &
1260				            checkEx_double_ArrayIndex(null, 1) &
1261				
1262				            check_double_ArrayIndex(genArrdouble_ArrayIndex(0)) &
1263				            check_double_ArrayIndex(genArrdouble_ArrayIndex(1)) &
1264				            check_double_ArrayIndex(genArrdouble_ArrayIndex(5));
1265				    }
1266				
1267				    static double[] genArrdouble_ArrayIndex(int size)
1268				    {
1269				        double[] vals = new double[] { 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN };
1270				        double[] result = new double[size];
1271				        for (int i = 0; i < size; i++)
1272				        {
1273				            result[i] = vals[i % vals.Length];
1274				        }
1275				        return result;
1276				    }
1277				
1278				    static bool check_double_ArrayIndex(double[] val)
1279				    {
1280				        bool success = checkEx_double_ArrayIndex(val, -1);
1281				        for (int i = 0; i < val.Length; i++)
1282				        {
1283				            success &= check_double_ArrayIndex(val, 0);
1284				        }
1285				        success &= checkEx_double_ArrayIndex(val, val.Length);
1286				        return success;
1287				    }
1288				
1289				    static bool checkEx_double_ArrayIndex(double[] val, int index)
1290				    {
1291				        try
1292				        {
1293				            check_double_ArrayIndex(val, index);
1294				            Console.WriteLine("double_ArrayIndex[" + index + "] failed");
1295				            return false;
1296				        }
1297				        catch
1298				        {
1299				            return true;
1300				        }
1301				    }
1302				
1303				    static bool check_double_ArrayIndex(double[] val, int index)
1304				    {
1305				        Expression<Func<double>> e =
1306				            Expression.Lambda<Func<double>>(
1307				                Expression.ArrayIndex(Expression.Constant(val, typeof(double[])),
1308				                    Expression.Constant(index, typeof(int))),
1309				                new System.Collections.Generic.List<ParameterExpression>());
1310				        Func<double> f = e.Compile();
1311				        return object.Equals(f(), val[index]);
1312				    }
1313				}
1314			
1315			
1316			public  static class Ext {
1317			    public static void StartCapture() {
1318			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1319			//        m.Invoke(null, new object[] { "test.dll" });
1320			    }
1321			
1322			    public static void StopCapture() {
1323			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1324			//        m.Invoke(null, new object[0]);
1325			    }
1326			
1327			    public static bool IsIntegralOrEnum(Type type) {
1328			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1329			            case TypeCode.Byte:
1330			            case TypeCode.SByte:
1331			            case TypeCode.Int16:
1332			            case TypeCode.Int32:
1333			            case TypeCode.Int64:
1334			            case TypeCode.UInt16:
1335			            case TypeCode.UInt32:
1336			            case TypeCode.UInt64:
1337			                return true;
1338			            default:
1339			                return false;
1340			        }
1341			    }
1342			
1343			    public static bool IsFloating(Type type) {
1344			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1345			            case TypeCode.Single:
1346			            case TypeCode.Double:
1347			                return true;
1348			            default:
1349			                return false;
1350			        }
1351			    }
1352			
1353			    public static Type GetNonNullableType(Type type) {
1354			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
1355			                type.GetGenericArguments()[0] :
1356			                type;
1357			    }
1358			}
1359			
1360		
1361	}
1362			
1363			//-------- Scenario 3134
1364			namespace Scenario3134{
1365				
1366				public class Test
1367				{
1368			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "decimal_ArrayIndex__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
1369			    public static Expression decimal_ArrayIndex__() {
1370			       if(Main() != 0 ) {
1371			           throw new Exception();
1372			       } else { 
1373			           return Expression.Constant(0);
1374			       }
1375			    }
1376				public     static int Main()
1377				    {
1378				        Ext.StartCapture();
1379				        bool success = false;
1380				        try
1381				        {
1382				            success = check_decimal_ArrayIndex();
1383				        }
1384				        finally
1385				        {
1386				            Ext.StopCapture();
1387				        }
1388				        return success ? 0 : 1;
1389				    }
1390				
1391				    static bool check_decimal_ArrayIndex()
1392				    {
1393				        return checkEx_decimal_ArrayIndex(null, -1) &
1394				            checkEx_decimal_ArrayIndex(null, 0) &
1395				            checkEx_decimal_ArrayIndex(null, 1) &
1396				
1397				            check_decimal_ArrayIndex(genArrdecimal_ArrayIndex(0)) &
1398				            check_decimal_ArrayIndex(genArrdecimal_ArrayIndex(1)) &
1399				            check_decimal_ArrayIndex(genArrdecimal_ArrayIndex(5));
1400				    }
1401				
1402				    static decimal[] genArrdecimal_ArrayIndex(int size)
1403				    {
1404				        decimal[] vals = new decimal[] { decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue };
1405				        decimal[] result = new decimal[size];
1406				        for (int i = 0; i < size; i++)
1407				        {
1408				            result[i] = vals[i % vals.Length];
1409				        }
1410				        return result;
1411				    }
1412				
1413				    static bool check_decimal_ArrayIndex(decimal[] val)
1414				    {
1415				        bool success = checkEx_decimal_ArrayIndex(val, -1);
1416				        for (int i = 0; i < val.Length; i++)
1417				        {
1418				            success &= check_decimal_ArrayIndex(val, 0);
1419				        }
1420				        success &= checkEx_decimal_ArrayIndex(val, val.Length);
1421				        return success;
1422				    }
1423				
1424				    static bool checkEx_decimal_ArrayIndex(decimal[] val, int index)
1425				    {
1426				        try
1427				        {
1428				            check_decimal_ArrayIndex(val, index);
1429				            Console.WriteLine("decimal_ArrayIndex[" + index + "] failed");
1430				            return false;
1431				        }
1432				        catch
1433			

Large files files are truncated, but you can click here to view the full file