Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-51.cs
1 //
2 // This test is used to test the `base' implementation
3 //
4 using System;
5
6 class Base {
7         public int b_int_field;
8         public string b_string_field;
9
10         public const  int b_const_three = 3;
11         
12         public int    b_int_property {
13                 get {
14                         return b_int_field;
15                 }
16
17                 set {
18                         b_int_field = value;
19                 }
20         }
21
22         public string b_get_id ()
23         {
24                 return "Base";
25         }
26
27         public Base ()
28         {
29                 b_int_field = 1;
30                 b_string_field = "base";
31         }
32 }
33
34 class Derived : Base {
35         new int b_int_field;
36         new string b_string_field;
37         new const int b_const_three = 4;
38
39         new int b_int_property {
40                         get {
41                                 return b_int_field;
42                         }
43
44
45                         set {
46                                 b_int_field = value;
47                         }
48
49                 }
50         
51         public Derived ()
52         {
53                 b_int_field = 10;
54                 b_string_field = "derived";
55         }
56         
57         public int Test ()
58         {
59                 if (b_int_field != 10)
60                         return 1;
61                 if (base.b_int_field != 1)
62                         return 2;
63                 if (base.b_string_field != "base")
64                         return 3;
65                 if (b_string_field != "derived")
66                         return 4;
67                 base.b_int_property = 4;
68                 if (b_int_property != 10)
69                         return 5;
70                 if (b_int_property != 10)
71                         return 6;
72                 if (base.b_int_property != 4)
73                         return 7;
74                 if (b_const_three != 4)
75                         return 8;
76                 if (Base.b_const_three != 3)
77                         return 9;
78                 System.Console.WriteLine ("All tests pass");
79                 return 0;
80         }
81 }
82
83 class boot {
84         public static int Main ()
85         {
86                 Derived d = new Derived ();
87                 return d.Test ();
88         }
89 }