PageRenderTime 75ms CodeModel.GetById 19ms app.highlight 48ms RepoModel.GetById 1ms app.codeStats 1ms

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

#
C# | 1045 lines | 866 code | 139 blank | 40 comment | 64 complexity | 6450423675f1aae5cd9539264c550c5b MD5 | raw 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 302
  14			namespace Scenario302{
  15				
  16				public class Test
  17				{
  18			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "byteq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
  19			    public static Expression byteq_Not__1() {
  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_byteq_Not();
  33				        }
  34				        finally
  35				        {
  36				            Ext.StopCapture();
  37				        }
  38				        return success ? 0 : 1;
  39				    }
  40				
  41				    static bool check_byteq_Not() {
  42				        foreach (byte? val in new byte?[] { 0, 1, byte.MaxValue }) {
  43				            if (!check_byteq_Not(val)) {
  44				                Console.WriteLine("byteq_Not failed");
  45				                return false;
  46				            }
  47				        }
  48				        return true;
  49				    }
  50				
  51				    static bool check_byteq_Not(byte? val) {
  52				        ParameterExpression p = Expression.Parameter(typeof(byte?), "p");
  53				        Expression<Func<byte?>> e1 = Expression.Lambda<Func<byte?>>(
  54				            Expression.Invoke(
  55				                Expression.Lambda<Func<byte?, byte?>>(
  56				                    Expression.Not(p),
  57				                    new ParameterExpression[] { p }),
  58				                new Expression[] { Expression.Constant(val, typeof(byte?)) }),
  59				            new System.Collections.Generic.List<ParameterExpression>());
  60				        Func<byte?> f1 = e1.Compile();
  61				
  62				        Expression<Func<byte?, Func<byte?>>> e2 = Expression.Lambda<Func<byte?, Func<byte?>>>(
  63				            Expression.Lambda<Func<byte?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
  64				            new ParameterExpression[] { p });
  65				        Func<byte?, Func<byte?>> f2 = e2.Compile();
  66				
  67				        Expression<Func<Func<byte?, byte?>>> e3 = Expression.Lambda<Func<Func<byte?, byte?>>>(
  68				            Expression.Invoke(
  69				                Expression.Lambda<Func<Func<byte?, byte?>>>(
  70				                    Expression.Lambda<Func<byte?, byte?>>(
  71				                        Expression.Not(p),
  72				                        new ParameterExpression[] { p }),
  73				                    new System.Collections.Generic.List<ParameterExpression>()),
  74				                new System.Collections.Generic.List<Expression>()),
  75				            new System.Collections.Generic.List<ParameterExpression>());
  76				        Func<byte?, byte?> f3 = e3.Compile()();
  77				
  78				        Expression<Func<Func<byte?, byte?>>> e4 = Expression.Lambda<Func<Func<byte?, byte?>>>(
  79				            Expression.Lambda<Func<byte?, byte?>>(
  80				                Expression.Not(p),
  81				                    new ParameterExpression[] { p }),
  82				            new System.Collections.Generic.List<ParameterExpression>());
  83				        Func<Func<byte?, byte?>> f4 = e4.Compile();
  84				
  85				        byte? expected = (byte?) ~val;
  86				
  87				        return object.Equals(f1(), expected) &&
  88				            object.Equals(f2(val)(), expected) &&
  89				            object.Equals(f3(val), expected) &&
  90				            object.Equals(f4()(val), expected);
  91				    }
  92				}
  93			
  94			
  95			public  static class Ext {
  96			    public static void StartCapture() {
  97			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
  98			//        m.Invoke(null, new object[] { "test.dll" });
  99			    }
 100			
 101			    public static void StopCapture() {
 102			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 103			//        m.Invoke(null, new object[0]);
 104			    }
 105			
 106			    public static bool IsIntegralOrEnum(Type type) {
 107			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 108			            case TypeCode.Byte:
 109			            case TypeCode.SByte:
 110			            case TypeCode.Int16:
 111			            case TypeCode.Int32:
 112			            case TypeCode.Int64:
 113			            case TypeCode.UInt16:
 114			            case TypeCode.UInt32:
 115			            case TypeCode.UInt64:
 116			                return true;
 117			            default:
 118			                return false;
 119			        }
 120			    }
 121			
 122			    public static bool IsFloating(Type type) {
 123			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 124			            case TypeCode.Single:
 125			            case TypeCode.Double:
 126			                return true;
 127			            default:
 128			                return false;
 129			        }
 130			    }
 131			
 132			    public static Type GetNonNullableType(Type type) {
 133			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 134			                type.GetGenericArguments()[0] :
 135			                type;
 136			    }
 137			}
 138			
 139		
 140	}
 141			
 142			//-------- Scenario 303
 143			namespace Scenario303{
 144				
 145				public class Test
 146				{
 147			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "sbyteq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 148			    public static Expression sbyteq_Not__1() {
 149			       if(Main() != 0 ) {
 150			           throw new Exception();
 151			       } else { 
 152			           return Expression.Constant(0);
 153			       }
 154			    }
 155				public     static int Main()
 156				    {
 157				        Ext.StartCapture();
 158				        bool success = false;
 159				        try
 160				        {
 161				            success = check_sbyteq_Not();
 162				        }
 163				        finally
 164				        {
 165				            Ext.StopCapture();
 166				        }
 167				        return success ? 0 : 1;
 168				    }
 169				
 170				    static bool check_sbyteq_Not() {
 171				        foreach (sbyte? val in new sbyte?[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }) {
 172				            if (!check_sbyteq_Not(val)) {
 173				                Console.WriteLine("sbyteq_Not failed");
 174				                return false;
 175				            }
 176				        }
 177				        return true;
 178				    }
 179				
 180				    static bool check_sbyteq_Not(sbyte? val) {
 181				        ParameterExpression p = Expression.Parameter(typeof(sbyte?), "p");
 182				        Expression<Func<sbyte?>> e1 = Expression.Lambda<Func<sbyte?>>(
 183				            Expression.Invoke(
 184				                Expression.Lambda<Func<sbyte?, sbyte?>>(
 185				                    Expression.Not(p),
 186				                    new ParameterExpression[] { p }),
 187				                new Expression[] { Expression.Constant(val, typeof(sbyte?)) }),
 188				            new System.Collections.Generic.List<ParameterExpression>());
 189				        Func<sbyte?> f1 = e1.Compile();
 190				
 191				        Expression<Func<sbyte?, Func<sbyte?>>> e2 = Expression.Lambda<Func<sbyte?, Func<sbyte?>>>(
 192				            Expression.Lambda<Func<sbyte?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
 193				            new ParameterExpression[] { p });
 194				        Func<sbyte?, Func<sbyte?>> f2 = e2.Compile();
 195				
 196				        Expression<Func<Func<sbyte?, sbyte?>>> e3 = Expression.Lambda<Func<Func<sbyte?, sbyte?>>>(
 197				            Expression.Invoke(
 198				                Expression.Lambda<Func<Func<sbyte?, sbyte?>>>(
 199				                    Expression.Lambda<Func<sbyte?, sbyte?>>(
 200				                        Expression.Not(p),
 201				                        new ParameterExpression[] { p }),
 202				                    new System.Collections.Generic.List<ParameterExpression>()),
 203				                new System.Collections.Generic.List<Expression>()),
 204				            new System.Collections.Generic.List<ParameterExpression>());
 205				        Func<sbyte?, sbyte?> f3 = e3.Compile()();
 206				
 207				        Expression<Func<Func<sbyte?, sbyte?>>> e4 = Expression.Lambda<Func<Func<sbyte?, sbyte?>>>(
 208				            Expression.Lambda<Func<sbyte?, sbyte?>>(
 209				                Expression.Not(p),
 210				                    new ParameterExpression[] { p }),
 211				            new System.Collections.Generic.List<ParameterExpression>());
 212				        Func<Func<sbyte?, sbyte?>> f4 = e4.Compile();
 213				
 214				        sbyte? expected = (sbyte?) ~val;
 215				
 216				        return object.Equals(f1(), expected) &&
 217				            object.Equals(f2(val)(), expected) &&
 218				            object.Equals(f3(val), expected) &&
 219				            object.Equals(f4()(val), expected);
 220				    }
 221				}
 222			
 223			
 224			public  static class Ext {
 225			    public static void StartCapture() {
 226			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 227			//        m.Invoke(null, new object[] { "test.dll" });
 228			    }
 229			
 230			    public static void StopCapture() {
 231			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 232			//        m.Invoke(null, new object[0]);
 233			    }
 234			
 235			    public static bool IsIntegralOrEnum(Type type) {
 236			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 237			            case TypeCode.Byte:
 238			            case TypeCode.SByte:
 239			            case TypeCode.Int16:
 240			            case TypeCode.Int32:
 241			            case TypeCode.Int64:
 242			            case TypeCode.UInt16:
 243			            case TypeCode.UInt32:
 244			            case TypeCode.UInt64:
 245			                return true;
 246			            default:
 247			                return false;
 248			        }
 249			    }
 250			
 251			    public static bool IsFloating(Type type) {
 252			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 253			            case TypeCode.Single:
 254			            case TypeCode.Double:
 255			                return true;
 256			            default:
 257			                return false;
 258			        }
 259			    }
 260			
 261			    public static Type GetNonNullableType(Type type) {
 262			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 263			                type.GetGenericArguments()[0] :
 264			                type;
 265			    }
 266			}
 267			
 268		
 269	}
 270			
 271			//-------- Scenario 304
 272			namespace Scenario304{
 273				
 274				public class Test
 275				{
 276			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "ushortq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 277			    public static Expression ushortq_Not__1() {
 278			       if(Main() != 0 ) {
 279			           throw new Exception();
 280			       } else { 
 281			           return Expression.Constant(0);
 282			       }
 283			    }
 284				public     static int Main()
 285				    {
 286				        Ext.StartCapture();
 287				        bool success = false;
 288				        try
 289				        {
 290				            success = check_ushortq_Not();
 291				        }
 292				        finally
 293				        {
 294				            Ext.StopCapture();
 295				        }
 296				        return success ? 0 : 1;
 297				    }
 298				
 299				    static bool check_ushortq_Not() {
 300				        foreach (ushort? val in new ushort?[] { 0, 1, ushort.MaxValue }) {
 301				            if (!check_ushortq_Not(val)) {
 302				                Console.WriteLine("ushortq_Not failed");
 303				                return false;
 304				            }
 305				        }
 306				        return true;
 307				    }
 308				
 309				    static bool check_ushortq_Not(ushort? val) {
 310				        ParameterExpression p = Expression.Parameter(typeof(ushort?), "p");
 311				        Expression<Func<ushort?>> e1 = Expression.Lambda<Func<ushort?>>(
 312				            Expression.Invoke(
 313				                Expression.Lambda<Func<ushort?, ushort?>>(
 314				                    Expression.Not(p),
 315				                    new ParameterExpression[] { p }),
 316				                new Expression[] { Expression.Constant(val, typeof(ushort?)) }),
 317				            new System.Collections.Generic.List<ParameterExpression>());
 318				        Func<ushort?> f1 = e1.Compile();
 319				
 320				        Expression<Func<ushort?, Func<ushort?>>> e2 = Expression.Lambda<Func<ushort?, Func<ushort?>>>(
 321				            Expression.Lambda<Func<ushort?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
 322				            new ParameterExpression[] { p });
 323				        Func<ushort?, Func<ushort?>> f2 = e2.Compile();
 324				
 325				        Expression<Func<Func<ushort?, ushort?>>> e3 = Expression.Lambda<Func<Func<ushort?, ushort?>>>(
 326				            Expression.Invoke(
 327				                Expression.Lambda<Func<Func<ushort?, ushort?>>>(
 328				                    Expression.Lambda<Func<ushort?, ushort?>>(
 329				                        Expression.Not(p),
 330				                        new ParameterExpression[] { p }),
 331				                    new System.Collections.Generic.List<ParameterExpression>()),
 332				                new System.Collections.Generic.List<Expression>()),
 333				            new System.Collections.Generic.List<ParameterExpression>());
 334				        Func<ushort?, ushort?> f3 = e3.Compile()();
 335				
 336				        Expression<Func<Func<ushort?, ushort?>>> e4 = Expression.Lambda<Func<Func<ushort?, ushort?>>>(
 337				            Expression.Lambda<Func<ushort?, ushort?>>(
 338				                Expression.Not(p),
 339				                    new ParameterExpression[] { p }),
 340				            new System.Collections.Generic.List<ParameterExpression>());
 341				        Func<Func<ushort?, ushort?>> f4 = e4.Compile();
 342				
 343				        ushort? expected = (ushort?) ~val;
 344				
 345				        return object.Equals(f1(), expected) &&
 346				            object.Equals(f2(val)(), expected) &&
 347				            object.Equals(f3(val), expected) &&
 348				            object.Equals(f4()(val), expected);
 349				    }
 350				}
 351			
 352			
 353			public  static class Ext {
 354			    public static void StartCapture() {
 355			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 356			//        m.Invoke(null, new object[] { "test.dll" });
 357			    }
 358			
 359			    public static void StopCapture() {
 360			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 361			//        m.Invoke(null, new object[0]);
 362			    }
 363			
 364			    public static bool IsIntegralOrEnum(Type type) {
 365			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 366			            case TypeCode.Byte:
 367			            case TypeCode.SByte:
 368			            case TypeCode.Int16:
 369			            case TypeCode.Int32:
 370			            case TypeCode.Int64:
 371			            case TypeCode.UInt16:
 372			            case TypeCode.UInt32:
 373			            case TypeCode.UInt64:
 374			                return true;
 375			            default:
 376			                return false;
 377			        }
 378			    }
 379			
 380			    public static bool IsFloating(Type type) {
 381			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 382			            case TypeCode.Single:
 383			            case TypeCode.Double:
 384			                return true;
 385			            default:
 386			                return false;
 387			        }
 388			    }
 389			
 390			    public static Type GetNonNullableType(Type type) {
 391			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 392			                type.GetGenericArguments()[0] :
 393			                type;
 394			    }
 395			}
 396			
 397		
 398	}
 399			
 400			//-------- Scenario 305
 401			namespace Scenario305{
 402				
 403				public class Test
 404				{
 405			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "shortq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 406			    public static Expression shortq_Not__1() {
 407			       if(Main() != 0 ) {
 408			           throw new Exception();
 409			       } else { 
 410			           return Expression.Constant(0);
 411			       }
 412			    }
 413				public     static int Main()
 414				    {
 415				        Ext.StartCapture();
 416				        bool success = false;
 417				        try
 418				        {
 419				            success = check_shortq_Not();
 420				        }
 421				        finally
 422				        {
 423				            Ext.StopCapture();
 424				        }
 425				        return success ? 0 : 1;
 426				    }
 427				
 428				    static bool check_shortq_Not() {
 429				        foreach (short? val in new short?[] { 0, 1, -1, short.MinValue, short.MaxValue }) {
 430				            if (!check_shortq_Not(val)) {
 431				                Console.WriteLine("shortq_Not failed");
 432				                return false;
 433				            }
 434				        }
 435				        return true;
 436				    }
 437				
 438				    static bool check_shortq_Not(short? val) {
 439				        ParameterExpression p = Expression.Parameter(typeof(short?), "p");
 440				        Expression<Func<short?>> e1 = Expression.Lambda<Func<short?>>(
 441				            Expression.Invoke(
 442				                Expression.Lambda<Func<short?, short?>>(
 443				                    Expression.Not(p),
 444				                    new ParameterExpression[] { p }),
 445				                new Expression[] { Expression.Constant(val, typeof(short?)) }),
 446				            new System.Collections.Generic.List<ParameterExpression>());
 447				        Func<short?> f1 = e1.Compile();
 448				
 449				        Expression<Func<short?, Func<short?>>> e2 = Expression.Lambda<Func<short?, Func<short?>>>(
 450				            Expression.Lambda<Func<short?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
 451				            new ParameterExpression[] { p });
 452				        Func<short?, Func<short?>> f2 = e2.Compile();
 453				
 454				        Expression<Func<Func<short?, short?>>> e3 = Expression.Lambda<Func<Func<short?, short?>>>(
 455				            Expression.Invoke(
 456				                Expression.Lambda<Func<Func<short?, short?>>>(
 457				                    Expression.Lambda<Func<short?, short?>>(
 458				                        Expression.Not(p),
 459				                        new ParameterExpression[] { p }),
 460				                    new System.Collections.Generic.List<ParameterExpression>()),
 461				                new System.Collections.Generic.List<Expression>()),
 462				            new System.Collections.Generic.List<ParameterExpression>());
 463				        Func<short?, short?> f3 = e3.Compile()();
 464				
 465				        Expression<Func<Func<short?, short?>>> e4 = Expression.Lambda<Func<Func<short?, short?>>>(
 466				            Expression.Lambda<Func<short?, short?>>(
 467				                Expression.Not(p),
 468				                    new ParameterExpression[] { p }),
 469				            new System.Collections.Generic.List<ParameterExpression>());
 470				        Func<Func<short?, short?>> f4 = e4.Compile();
 471				
 472				        short? expected = (short?) ~val;
 473				
 474				        return object.Equals(f1(), expected) &&
 475				            object.Equals(f2(val)(), expected) &&
 476				            object.Equals(f3(val), expected) &&
 477				            object.Equals(f4()(val), expected);
 478				    }
 479				}
 480			
 481			
 482			public  static class Ext {
 483			    public static void StartCapture() {
 484			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 485			//        m.Invoke(null, new object[] { "test.dll" });
 486			    }
 487			
 488			    public static void StopCapture() {
 489			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 490			//        m.Invoke(null, new object[0]);
 491			    }
 492			
 493			    public static bool IsIntegralOrEnum(Type type) {
 494			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 495			            case TypeCode.Byte:
 496			            case TypeCode.SByte:
 497			            case TypeCode.Int16:
 498			            case TypeCode.Int32:
 499			            case TypeCode.Int64:
 500			            case TypeCode.UInt16:
 501			            case TypeCode.UInt32:
 502			            case TypeCode.UInt64:
 503			                return true;
 504			            default:
 505			                return false;
 506			        }
 507			    }
 508			
 509			    public static bool IsFloating(Type type) {
 510			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 511			            case TypeCode.Single:
 512			            case TypeCode.Double:
 513			                return true;
 514			            default:
 515			                return false;
 516			        }
 517			    }
 518			
 519			    public static Type GetNonNullableType(Type type) {
 520			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 521			                type.GetGenericArguments()[0] :
 522			                type;
 523			    }
 524			}
 525			
 526		
 527	}
 528			
 529			//-------- Scenario 306
 530			namespace Scenario306{
 531				
 532				public class Test
 533				{
 534			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "uintq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 535			    public static Expression uintq_Not__1() {
 536			       if(Main() != 0 ) {
 537			           throw new Exception();
 538			       } else { 
 539			           return Expression.Constant(0);
 540			       }
 541			    }
 542				public     static int Main()
 543				    {
 544				        Ext.StartCapture();
 545				        bool success = false;
 546				        try
 547				        {
 548				            success = check_uintq_Not();
 549				        }
 550				        finally
 551				        {
 552				            Ext.StopCapture();
 553				        }
 554				        return success ? 0 : 1;
 555				    }
 556				
 557				    static bool check_uintq_Not() {
 558				        foreach (uint? val in new uint?[] { 0, 1, uint.MaxValue }) {
 559				            if (!check_uintq_Not(val)) {
 560				                Console.WriteLine("uintq_Not failed");
 561				                return false;
 562				            }
 563				        }
 564				        return true;
 565				    }
 566				
 567				    static bool check_uintq_Not(uint? val) {
 568				        ParameterExpression p = Expression.Parameter(typeof(uint?), "p");
 569				        Expression<Func<uint?>> e1 = Expression.Lambda<Func<uint?>>(
 570				            Expression.Invoke(
 571				                Expression.Lambda<Func<uint?, uint?>>(
 572				                    Expression.Not(p),
 573				                    new ParameterExpression[] { p }),
 574				                new Expression[] { Expression.Constant(val, typeof(uint?)) }),
 575				            new System.Collections.Generic.List<ParameterExpression>());
 576				        Func<uint?> f1 = e1.Compile();
 577				
 578				        Expression<Func<uint?, Func<uint?>>> e2 = Expression.Lambda<Func<uint?, Func<uint?>>>(
 579				            Expression.Lambda<Func<uint?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
 580				            new ParameterExpression[] { p });
 581				        Func<uint?, Func<uint?>> f2 = e2.Compile();
 582				
 583				        Expression<Func<Func<uint?, uint?>>> e3 = Expression.Lambda<Func<Func<uint?, uint?>>>(
 584				            Expression.Invoke(
 585				                Expression.Lambda<Func<Func<uint?, uint?>>>(
 586				                    Expression.Lambda<Func<uint?, uint?>>(
 587				                        Expression.Not(p),
 588				                        new ParameterExpression[] { p }),
 589				                    new System.Collections.Generic.List<ParameterExpression>()),
 590				                new System.Collections.Generic.List<Expression>()),
 591				            new System.Collections.Generic.List<ParameterExpression>());
 592				        Func<uint?, uint?> f3 = e3.Compile()();
 593				
 594				        Expression<Func<Func<uint?, uint?>>> e4 = Expression.Lambda<Func<Func<uint?, uint?>>>(
 595				            Expression.Lambda<Func<uint?, uint?>>(
 596				                Expression.Not(p),
 597				                    new ParameterExpression[] { p }),
 598				            new System.Collections.Generic.List<ParameterExpression>());
 599				        Func<Func<uint?, uint?>> f4 = e4.Compile();
 600				
 601				        uint? expected = (uint?) ~val;
 602				
 603				        return object.Equals(f1(), expected) &&
 604				            object.Equals(f2(val)(), expected) &&
 605				            object.Equals(f3(val), expected) &&
 606				            object.Equals(f4()(val), expected);
 607				    }
 608				}
 609			
 610			
 611			public  static class Ext {
 612			    public static void StartCapture() {
 613			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 614			//        m.Invoke(null, new object[] { "test.dll" });
 615			    }
 616			
 617			    public static void StopCapture() {
 618			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 619			//        m.Invoke(null, new object[0]);
 620			    }
 621			
 622			    public static bool IsIntegralOrEnum(Type type) {
 623			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 624			            case TypeCode.Byte:
 625			            case TypeCode.SByte:
 626			            case TypeCode.Int16:
 627			            case TypeCode.Int32:
 628			            case TypeCode.Int64:
 629			            case TypeCode.UInt16:
 630			            case TypeCode.UInt32:
 631			            case TypeCode.UInt64:
 632			                return true;
 633			            default:
 634			                return false;
 635			        }
 636			    }
 637			
 638			    public static bool IsFloating(Type type) {
 639			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 640			            case TypeCode.Single:
 641			            case TypeCode.Double:
 642			                return true;
 643			            default:
 644			                return false;
 645			        }
 646			    }
 647			
 648			    public static Type GetNonNullableType(Type type) {
 649			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 650			                type.GetGenericArguments()[0] :
 651			                type;
 652			    }
 653			}
 654			
 655		
 656	}
 657			
 658			//-------- Scenario 307
 659			namespace Scenario307{
 660				
 661				public class Test
 662				{
 663			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "intq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 664			    public static Expression intq_Not__1() {
 665			       if(Main() != 0 ) {
 666			           throw new Exception();
 667			       } else { 
 668			           return Expression.Constant(0);
 669			       }
 670			    }
 671				public     static int Main()
 672				    {
 673				        Ext.StartCapture();
 674				        bool success = false;
 675				        try
 676				        {
 677				            success = check_intq_Not();
 678				        }
 679				        finally
 680				        {
 681				            Ext.StopCapture();
 682				        }
 683				        return success ? 0 : 1;
 684				    }
 685				
 686				    static bool check_intq_Not() {
 687				        foreach (int? val in new int?[] { 0, 1, -1, int.MinValue, int.MaxValue }) {
 688				            if (!check_intq_Not(val)) {
 689				                Console.WriteLine("intq_Not failed");
 690				                return false;
 691				            }
 692				        }
 693				        return true;
 694				    }
 695				
 696				    static bool check_intq_Not(int? val) {
 697				        ParameterExpression p = Expression.Parameter(typeof(int?), "p");
 698				        Expression<Func<int?>> e1 = Expression.Lambda<Func<int?>>(
 699				            Expression.Invoke(
 700				                Expression.Lambda<Func<int?, int?>>(
 701				                    Expression.Not(p),
 702				                    new ParameterExpression[] { p }),
 703				                new Expression[] { Expression.Constant(val, typeof(int?)) }),
 704				            new System.Collections.Generic.List<ParameterExpression>());
 705				        Func<int?> f1 = e1.Compile();
 706				
 707				        Expression<Func<int?, Func<int?>>> e2 = Expression.Lambda<Func<int?, Func<int?>>>(
 708				            Expression.Lambda<Func<int?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
 709				            new ParameterExpression[] { p });
 710				        Func<int?, Func<int?>> f2 = e2.Compile();
 711				
 712				        Expression<Func<Func<int?, int?>>> e3 = Expression.Lambda<Func<Func<int?, int?>>>(
 713				            Expression.Invoke(
 714				                Expression.Lambda<Func<Func<int?, int?>>>(
 715				                    Expression.Lambda<Func<int?, int?>>(
 716				                        Expression.Not(p),
 717				                        new ParameterExpression[] { p }),
 718				                    new System.Collections.Generic.List<ParameterExpression>()),
 719				                new System.Collections.Generic.List<Expression>()),
 720				            new System.Collections.Generic.List<ParameterExpression>());
 721				        Func<int?, int?> f3 = e3.Compile()();
 722				
 723				        Expression<Func<Func<int?, int?>>> e4 = Expression.Lambda<Func<Func<int?, int?>>>(
 724				            Expression.Lambda<Func<int?, int?>>(
 725				                Expression.Not(p),
 726				                    new ParameterExpression[] { p }),
 727				            new System.Collections.Generic.List<ParameterExpression>());
 728				        Func<Func<int?, int?>> f4 = e4.Compile();
 729				
 730				        int? expected = (int?) ~val;
 731				
 732				        return object.Equals(f1(), expected) &&
 733				            object.Equals(f2(val)(), expected) &&
 734				            object.Equals(f3(val), expected) &&
 735				            object.Equals(f4()(val), expected);
 736				    }
 737				}
 738			
 739			
 740			public  static class Ext {
 741			    public static void StartCapture() {
 742			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 743			//        m.Invoke(null, new object[] { "test.dll" });
 744			    }
 745			
 746			    public static void StopCapture() {
 747			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 748			//        m.Invoke(null, new object[0]);
 749			    }
 750			
 751			    public static bool IsIntegralOrEnum(Type type) {
 752			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 753			            case TypeCode.Byte:
 754			            case TypeCode.SByte:
 755			            case TypeCode.Int16:
 756			            case TypeCode.Int32:
 757			            case TypeCode.Int64:
 758			            case TypeCode.UInt16:
 759			            case TypeCode.UInt32:
 760			            case TypeCode.UInt64:
 761			                return true;
 762			            default:
 763			                return false;
 764			        }
 765			    }
 766			
 767			    public static bool IsFloating(Type type) {
 768			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 769			            case TypeCode.Single:
 770			            case TypeCode.Double:
 771			                return true;
 772			            default:
 773			                return false;
 774			        }
 775			    }
 776			
 777			    public static Type GetNonNullableType(Type type) {
 778			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 779			                type.GetGenericArguments()[0] :
 780			                type;
 781			    }
 782			}
 783			
 784		
 785	}
 786			
 787			//-------- Scenario 308
 788			namespace Scenario308{
 789				
 790				public class Test
 791				{
 792			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "ulongq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 793			    public static Expression ulongq_Not__1() {
 794			       if(Main() != 0 ) {
 795			           throw new Exception();
 796			       } else { 
 797			           return Expression.Constant(0);
 798			       }
 799			    }
 800				public     static int Main()
 801				    {
 802				        Ext.StartCapture();
 803				        bool success = false;
 804				        try
 805				        {
 806				            success = check_ulongq_Not();
 807				        }
 808				        finally
 809				        {
 810				            Ext.StopCapture();
 811				        }
 812				        return success ? 0 : 1;
 813				    }
 814				
 815				    static bool check_ulongq_Not() {
 816				        foreach (ulong? val in new ulong?[] { 0, 1, ulong.MaxValue }) {
 817				            if (!check_ulongq_Not(val)) {
 818				                Console.WriteLine("ulongq_Not failed");
 819				                return false;
 820				            }
 821				        }
 822				        return true;
 823				    }
 824				
 825				    static bool check_ulongq_Not(ulong? val) {
 826				        ParameterExpression p = Expression.Parameter(typeof(ulong?), "p");
 827				        Expression<Func<ulong?>> e1 = Expression.Lambda<Func<ulong?>>(
 828				            Expression.Invoke(
 829				                Expression.Lambda<Func<ulong?, ulong?>>(
 830				                    Expression.Not(p),
 831				                    new ParameterExpression[] { p }),
 832				                new Expression[] { Expression.Constant(val, typeof(ulong?)) }),
 833				            new System.Collections.Generic.List<ParameterExpression>());
 834				        Func<ulong?> f1 = e1.Compile();
 835				
 836				        Expression<Func<ulong?, Func<ulong?>>> e2 = Expression.Lambda<Func<ulong?, Func<ulong?>>>(
 837				            Expression.Lambda<Func<ulong?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
 838				            new ParameterExpression[] { p });
 839				        Func<ulong?, Func<ulong?>> f2 = e2.Compile();
 840				
 841				        Expression<Func<Func<ulong?, ulong?>>> e3 = Expression.Lambda<Func<Func<ulong?, ulong?>>>(
 842				            Expression.Invoke(
 843				                Expression.Lambda<Func<Func<ulong?, ulong?>>>(
 844				                    Expression.Lambda<Func<ulong?, ulong?>>(
 845				                        Expression.Not(p),
 846				                        new ParameterExpression[] { p }),
 847				                    new System.Collections.Generic.List<ParameterExpression>()),
 848				                new System.Collections.Generic.List<Expression>()),
 849				            new System.Collections.Generic.List<ParameterExpression>());
 850				        Func<ulong?, ulong?> f3 = e3.Compile()();
 851				
 852				        Expression<Func<Func<ulong?, ulong?>>> e4 = Expression.Lambda<Func<Func<ulong?, ulong?>>>(
 853				            Expression.Lambda<Func<ulong?, ulong?>>(
 854				                Expression.Not(p),
 855				                    new ParameterExpression[] { p }),
 856				            new System.Collections.Generic.List<ParameterExpression>());
 857				        Func<Func<ulong?, ulong?>> f4 = e4.Compile();
 858				
 859				        ulong? expected = (ulong?) ~val;
 860				
 861				        return object.Equals(f1(), expected) &&
 862				            object.Equals(f2(val)(), expected) &&
 863				            object.Equals(f3(val), expected) &&
 864				            object.Equals(f4()(val), expected);
 865				    }
 866				}
 867			
 868			
 869			public  static class Ext {
 870			    public static void StartCapture() {
 871			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 872			//        m.Invoke(null, new object[] { "test.dll" });
 873			    }
 874			
 875			    public static void StopCapture() {
 876			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
 877			//        m.Invoke(null, new object[0]);
 878			    }
 879			
 880			    public static bool IsIntegralOrEnum(Type type) {
 881			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 882			            case TypeCode.Byte:
 883			            case TypeCode.SByte:
 884			            case TypeCode.Int16:
 885			            case TypeCode.Int32:
 886			            case TypeCode.Int64:
 887			            case TypeCode.UInt16:
 888			            case TypeCode.UInt32:
 889			            case TypeCode.UInt64:
 890			                return true;
 891			            default:
 892			                return false;
 893			        }
 894			    }
 895			
 896			    public static bool IsFloating(Type type) {
 897			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
 898			            case TypeCode.Single:
 899			            case TypeCode.Double:
 900			                return true;
 901			            default:
 902			                return false;
 903			        }
 904			    }
 905			
 906			    public static Type GetNonNullableType(Type type) {
 907			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
 908			                type.GetGenericArguments()[0] :
 909			                type;
 910			    }
 911			}
 912			
 913		
 914	}
 915			
 916			//-------- Scenario 309
 917			namespace Scenario309{
 918				
 919				public class Test
 920				{
 921			    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "longq_Not__1", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
 922			    public static Expression longq_Not__1() {
 923			       if(Main() != 0 ) {
 924			           throw new Exception();
 925			       } else { 
 926			           return Expression.Constant(0);
 927			       }
 928			    }
 929				public     static int Main()
 930				    {
 931				        Ext.StartCapture();
 932				        bool success = false;
 933				        try
 934				        {
 935				            success = check_longq_Not();
 936				        }
 937				        finally
 938				        {
 939				            Ext.StopCapture();
 940				        }
 941				        return success ? 0 : 1;
 942				    }
 943				
 944				    static bool check_longq_Not() {
 945				        foreach (long? val in new long?[] { 0, 1, -1, long.MinValue, long.MaxValue }) {
 946				            if (!check_longq_Not(val)) {
 947				                Console.WriteLine("longq_Not failed");
 948				                return false;
 949				            }
 950				        }
 951				        return true;
 952				    }
 953				
 954				    static bool check_longq_Not(long? val) {
 955				        ParameterExpression p = Expression.Parameter(typeof(long?), "p");
 956				        Expression<Func<long?>> e1 = Expression.Lambda<Func<long?>>(
 957				            Expression.Invoke(
 958				                Expression.Lambda<Func<long?, long?>>(
 959				                    Expression.Not(p),
 960				                    new ParameterExpression[] { p }),
 961				                new Expression[] { Expression.Constant(val, typeof(long?)) }),
 962				            new System.Collections.Generic.List<ParameterExpression>());
 963				        Func<long?> f1 = e1.Compile();
 964				
 965				        Expression<Func<long?, Func<long?>>> e2 = Expression.Lambda<Func<long?, Func<long?>>>(
 966				            Expression.Lambda<Func<long?>>(Expression.Not(p), new System.Collections.Generic.List<ParameterExpression>()),
 967				            new ParameterExpression[] { p });
 968				        Func<long?, Func<long?>> f2 = e2.Compile();
 969				
 970				        Expression<Func<Func<long?, long?>>> e3 = Expression.Lambda<Func<Func<long?, long?>>>(
 971				            Expression.Invoke(
 972				                Expression.Lambda<Func<Func<long?, long?>>>(
 973				                    Expression.Lambda<Func<long?, long?>>(
 974				                        Expression.Not(p),
 975				                        new ParameterExpression[] { p }),
 976				                    new System.Collections.Generic.List<ParameterExpression>()),
 977				                new System.Collections.Generic.List<Expression>()),
 978				            new System.Collections.Generic.List<ParameterExpression>());
 979				        Func<long?, long?> f3 = e3.Compile()();
 980				
 981				        Expression<Func<Func<long?, long?>>> e4 = Expression.Lambda<Func<Func<long?, long?>>>(
 982				            Expression.Lambda<Func<long?, long?>>(
 983				                Expression.Not(p),
 984				                    new ParameterExpression[] { p }),
 985				            new System.Collections.Generic.List<ParameterExpression>());
 986				        Func<Func<long?, long?>> f4 = e4.Compile();
 987				
 988				        long? expected = (long?) ~val;
 989				
 990				        return object.Equals(f1(), expected) &&
 991				            object.Equals(f2(val)(), expected) &&
 992				            object.Equals(f3(val), expected) &&
 993				            object.Equals(f4()(val), expected);
 994				    }
 995				}
 996			
 997			
 998			public  static class Ext {
 999			    public static void StartCapture() {
1000			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1001			//        m.Invoke(null, new object[] { "test.dll" });
1002			    }
1003			
1004			    public static void StopCapture() {
1005			//        MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
1006			//        m.Invoke(null, new object[0]);
1007			    }
1008			
1009			    public static bool IsIntegralOrEnum(Type type) {
1010			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1011			            case TypeCode.Byte:
1012			            case TypeCode.SByte:
1013			            case TypeCode.Int16:
1014			            case TypeCode.Int32:
1015			            case TypeCode.Int64:
1016			            case TypeCode.UInt16:
1017			            case TypeCode.UInt32:
1018			            case TypeCode.UInt64:
1019			                return true;
1020			            default:
1021			                return false;
1022			        }
1023			    }
1024			
1025			    public static bool IsFloating(Type type) {
1026			        switch (Type.GetTypeCode(GetNonNullableType(type))) {
1027			            case TypeCode.Single:
1028			            case TypeCode.Double:
1029			                return true;
1030			            default:
1031			                return false;
1032			        }
1033			    }
1034			
1035			    public static Type GetNonNullableType(Type type) {
1036			        return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
1037			                type.GetGenericArguments()[0] :
1038			                type;
1039			    }
1040			}
1041			
1042		
1043	}
1044	
1045}