Merge pull request #5636 from BrzVlad/fix-xmm-scan
[mono.git] / mcs / tests / test-anon-80.cs
1 using System;
2
3 namespace MonoBug
4 {
5         sealed public class MyTest
6         {
7                 sealed private class EventHandlers
8                 {
9                         private EventHandler _handler = DoNothingEventHandler;
10
11                         public static EventHandler DoNothingEventHandler
12                         {
13                                 get
14                                 {
15                                         return delegate {
16                                         };
17                                 }
18                         }
19
20                         private int i;
21                         public EventHandler DoSomethingEventHandler
22                         {
23                                 get
24                                 {
25                                         return delegate {
26                                                 ++i;
27                                         };
28                                 }
29                         }
30
31                         public EventHandler Handler
32                         {
33                                 get
34                                 {
35                                         return _handler;
36                                 }
37                                 set
38                                 {
39                                         _handler = value;
40                                 }
41                         }
42                 }
43
44                 public static int Main ()
45                 {
46                         EventHandlers handlers = new EventHandlers ();
47                         handlers.Handler = handlers.DoSomethingEventHandler;
48
49                         Console.WriteLine ("Is handlers.Handler == handlers.DoSomethingEventHandler (instance)?");
50                         Console.WriteLine ("Expected: True");
51                         Console.Write ("Actual:   ");
52                         bool instanceEqual = handlers.Handler == handlers.DoSomethingEventHandler;
53                         Console.WriteLine (instanceEqual);
54                         Console.WriteLine ();
55
56                         handlers.Handler = EventHandlers.DoNothingEventHandler;
57                         Console.WriteLine ("Is handlers.Handler == EventHandlers.DoNothingEventHandler (static)?");
58                         Console.WriteLine ("Expected: True");
59                         Console.Write ("Actual:   ");
60                         bool staticEqual = handlers.Handler == EventHandlers.DoNothingEventHandler;
61                         Console.WriteLine (staticEqual);
62
63                         if (instanceEqual)
64                                 if (staticEqual)
65                                         return 0; // instance passed, static passed
66                                 else
67                                         return 1; // instance passed, static failed
68                         else
69                                 if (staticEqual)
70                                         return 2; // instance failed, static passed
71                                 else
72                                         return 3; // instance failed, static failed
73                 }
74         }
75 }
76