Merge pull request #487 from mayerwin/patch-1
[mono.git] / mcs / tests / gtest-etree-04.cs
1 using System;
2 using System.Linq.Expressions;
3
4 struct Foo
5 {
6         public static bool operator > (Foo d1, Foo d2)
7         {
8                 throw new ApplicationException ();
9         }
10         
11         public static bool operator < (Foo d1, Foo d2)
12         {
13                 throw new ApplicationException ();
14         }
15         
16         public static bool operator == (Foo d1, Foo d2)
17         {
18                 throw new ApplicationException ();
19         }
20                 
21         public static bool operator != (Foo d1, Foo d2)
22         {
23                 throw new ApplicationException ();
24         }
25 }
26
27 class C
28 {
29         public static int Main()
30         {
31                 Foo f;
32                 Expression<Func<bool>> e = () => f > null;
33                 if (e.Compile ().Invoke ())
34                         return 1;
35                 
36                 e = () => f < null;
37                 if (e.Compile ().Invoke ())
38                         return 2;
39                 
40                 e = () => f == null;
41                 if (e.Compile ().Invoke ())
42                         return 3;
43                 
44                 e = () => f != null;
45                 if (!e.Compile ().Invoke ())
46                         return 4;
47                 
48                 Console.WriteLine ("OK");
49                 return 0;
50         }
51 }