Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-30.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 340aeddf0fce24aaa24531f6f6613f64f821282c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// Tests whether we implement the correct methods from interfaces
//

using System;

interface IA {
	void Draw ();
}

interface IB {
	void Draw ();
}

class X : IA, IB {
	public bool ia_called;
	public bool ib_called;
	
	void IA.Draw ()
	{
		ia_called = true;
	}

	void IB.Draw ()
	{
		ib_called = true;
	}
}

class test {

	public static int Main ()
	{
		X x = new X ();

		((IA) x).Draw ();
		Console.WriteLine ("IA: " + x.ia_called);
		Console.WriteLine ("IB: " + x.ib_called);

		if (x.ib_called)
			return 1;
		if (!x.ia_called)
			return 2;

		X y = new X ();
		((IB) y).Draw ();
		Console.WriteLine ("IA: " + x.ia_called);
		Console.WriteLine ("IB: " + x.ib_called);

		if (!y.ib_called)
			return 3;
		if (y.ia_called)
			return 4;

		Console.WriteLine ("All tests pass");
		return 0;
	}
}