PageRenderTime 28ms CodeModel.GetById 13ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
C# | 80 lines | 65 code | 13 blank | 2 comment | 8 complexity | 2ee13e10a5284e45ed07cefd53d120bf MD5 | raw file
 1#if !CLR2 // inline linq expressions
 2using System.Linq.Expressions;
 3using System;
 4
 5namespace ExpressionCompiler { 
 6	
 7		//-------- Scenario 3013
 8		namespace Scenario3013{
 9			
10			public  class BaseClass
11			{
12			}
13			
14			public  class Test
15			{
16		    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "test1__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
17		    public static Expression test1__() {
18		       if(Main() != 0 ) {
19		           throw new Exception();
20		       } else { 
21		           return Expression.Constant(0);
22		       }
23		    }
24			public      static int Main()
25			    {
26			        bool res = Test1();
27			        return res ? 0 : 1;
28			    }
29			
30			    public static bool Test1()
31			    {
32			        Expression<Func<object[]>> expr = () => (object[])new BaseClass[1];
33			        expr.Compile();
34			        return true;
35			    }
36			}
37			
38		
39	}
40		
41		//-------- Scenario 3014
42		namespace Scenario3014{
43			
44			public  class Test
45			{
46		    [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "test2__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
47		    public static Expression test2__() {
48		       if(Main() != 0 ) {
49		           throw new Exception();
50		       } else { 
51		           return Expression.Constant(0);
52		       }
53		    }
54			public      static int Main()
55			    {
56			        bool res = Test2();
57			        return res ? 0 : 1;
58			    }
59			
60			    public static bool Test2()
61			    {
62			        Expression<Func<int,object>> x = c => new double[c,c];
63			        if (!x.ToString().Equals("c => new System.Double[,](c, c)"))
64			        {
65			            return false;
66			        }
67			        object y = x.Compile()(2);
68			        if (!y.ToString().Equals("System.Double[,]"))
69			        {
70			            return false;        
71			        }
72			        return true;
73			    }
74			}
75			
76		
77	}
78	
79}
80#endif