Merge pull request #5675 from mono/glib-debug-symbols
[mono.git] / mcs / tests / gtest-586.cs
1 using System;
2
3 struct S
4 {
5         public static bool operator == (S s, S i)
6         {
7                 throw new ApplicationException ();
8         }
9
10         public static bool operator != (S s, S i)
11         {
12                 throw new ApplicationException ();
13         }
14 }
15
16 struct S2
17 {
18         public static int counter;
19
20         public static bool operator == (S2 s, S2 i)
21         {
22                 counter++;
23                 return true;
24         }
25
26         public static bool operator != (S2 s, S2 i)
27         {
28                 throw new ApplicationException ();
29         }
30 }
31
32
33 struct S3
34 {
35         public static int counter;
36
37         public static implicit operator int?(S3 arg)
38         {
39                 counter++;
40                 return null;
41         }
42 }
43
44 class C
45 {
46         public static int Main ()
47         {
48                 S? s = new S ();
49                 S? s2 = null;
50                 S? s4 = null;
51
52                 if ((s == s2) != false)
53                         return 1;
54
55                 if ((s2 == s) != false)
56                         return 2;
57
58                 if ((s2 == s4) != true)
59                         return 3;
60
61                 S x = new S ();
62
63                 if ((s2 == x) != false)
64                         return 5;
65
66                 if ((x == s2) != false)
67                         return 6;
68
69                 S2? s2_1 = new S2 ();
70                 S2? s2_3 = new S2 ();
71                 S2 x2 = new S2 ();
72
73                 if ((s2_1 == s2_3) != true)
74                         return 7;
75
76                 if ((s2_1 == x2) != true)
77                         return 8;
78
79                 if ((x2 == s2_1) != true)
80                         return 9;
81
82                 if (S2.counter != 3)
83                         return 10;
84
85                 S3 s3;
86
87                 if ((s3 == null) != true)
88                         return 20;
89
90                 if ((null == s3) != true)
91                         return 21;
92
93                 if (S3.counter != 2)
94                         return 22;
95
96                 return 0;
97         }
98 }