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

test-51.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6ff5c9deeb5a1c22d72312324a3a390f16347500 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// This test is used to test the `base' implementation
//
using System;

class Base {
	public int b_int_field;
	public string b_string_field;

	public const  int b_const_three = 3;
	
	public int    b_int_property {
		get {
			return b_int_field;
		}

		set {
			b_int_field = value;
		}
	}

	public string b_get_id ()
	{
		return "Base";
	}

	public Base ()
	{
		b_int_field = 1;
		b_string_field = "base";
	}
}

class Derived : Base {
	new int b_int_field;
	new string b_string_field;
	new const int b_const_three = 4;

	new int b_int_property {
			get {
				return b_int_field;
			}


			set {
				b_int_field = value;
			}

		}
	
	public Derived ()
	{
		b_int_field = 10;
		b_string_field = "derived";
	}
	
	public int Test ()
	{
		if (b_int_field != 10)
			return 1;
		if (base.b_int_field != 1)
			return 2;
		if (base.b_string_field != "base")
			return 3;
		if (b_string_field != "derived")
			return 4;
		base.b_int_property = 4;
		if (b_int_property != 10)
			return 5;
		if (b_int_property != 10)
			return 6;
		if (base.b_int_property != 4)
			return 7;
		if (b_const_three != 4)
			return 8;
		if (Base.b_const_three != 3)
			return 9;
		System.Console.WriteLine ("All tests pass");
		return 0;
	}
}

class boot {
	public static int Main ()
	{
		Derived d = new Derived ();
		return d.Test ();
	}
}