[w32file] Move MonoIO.Find{First,Next,Close} to managed
[mono.git] / mcs / tests / gtest-358.cs
1 // Tests broken equality and inequality operators
2
3 using System;
4
5 struct Foo
6 {
7         public static bool operator == (Foo d1, Foo d2)
8         {
9                 throw new ApplicationException ();
10         }
11                 
12         public static bool operator != (Foo d1, Foo d2)
13         {
14                 throw new ApplicationException ();      
15         }
16 }
17
18 struct S2
19 {
20         public static bool operator == (S2 d1, S2? d2)
21         {
22                 throw new ApplicationException ();
23         }
24                 
25         public static bool operator != (S2 d1, S2? d2)
26         {
27                 throw new ApplicationException ();      
28         }
29 }
30
31 public struct S3
32 {
33         public static decimal operator != (S3 a, object b)
34         {
35                 return -1;
36         }
37         
38         public static decimal operator == (S3 a, object b)
39         {
40                 return 1;
41         }
42 }
43
44
45 public class Test
46 {
47         static Foo ctx;
48         static S2? s2;
49         static S3? s3;
50
51         public static int Main ()
52         {
53                 if (ctx == null)
54                         return 1;
55                 
56                 bool b = ctx != null;
57                 if (!b)
58                         return 2;
59                 
60                 if (s2 != null)
61                         return 3;
62                 
63                 s3 = new S3 ();
64                 decimal d = s3.Value == null;
65                 if (d != 1)
66                         return 4;
67                 
68                 Console.WriteLine ("ok");
69                 return 0;
70         }
71 }