Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-30.cs
1 //
2 // Tests whether we implement the correct methods from interfaces
3 //
4
5 using System;
6
7 interface IA {
8         void Draw ();
9 }
10
11 interface IB {
12         void Draw ();
13 }
14
15 class X : IA, IB {
16         public bool ia_called;
17         public bool ib_called;
18         
19         void IA.Draw ()
20         {
21                 ia_called = true;
22         }
23
24         void IB.Draw ()
25         {
26                 ib_called = true;
27         }
28 }
29
30 class test {
31
32         public static int Main ()
33         {
34                 X x = new X ();
35
36                 ((IA) x).Draw ();
37                 Console.WriteLine ("IA: " + x.ia_called);
38                 Console.WriteLine ("IB: " + x.ib_called);
39
40                 if (x.ib_called)
41                         return 1;
42                 if (!x.ia_called)
43                         return 2;
44
45                 X y = new X ();
46                 ((IB) y).Draw ();
47                 Console.WriteLine ("IA: " + x.ia_called);
48                 Console.WriteLine ("IB: " + x.ib_called);
49
50                 if (!y.ib_called)
51                         return 3;
52                 if (y.ia_called)
53                         return 4;
54
55                 Console.WriteLine ("All tests pass");
56                 return 0;
57         }
58 }
59
60