blob: a1cbcef1125e24440f68deefd8331c07e841b1a3 (
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
//
// Tests properties
//
using System;
class X {
static int v;
static X ()
{
v = 10;
}
public static int Value {
get {
return v;
}
set {
v = value;
}
}
public static int Main ()
{
if (Value != 10)
return 1;
Value = 4;
if (Value != 4)
return 2;
Y y = new Y ("hello");
if (y.Value != "hello")
return 3;
y.Value = "goodbye";
if (y.Value != "goodbye")
return 4;
Z z = new Z ();
if (Z.IVal != 4)
return 5;
Z.IVal = 10;
if (Z.IVal != 10)
return 6;
z.XVal = 23;
if (z.XVal != 23)
return 7;
return 0;
}
}
class Y {
string init;
public Y (string s)
{
init = s;
}
public string Value {
get {
return init;
}
set {
init = value;
}
}
}
struct Z {
static int val;
int xval;
static Z ()
{
val = 4;
}
static public int IVal {
get {
return val;
}
set {
val= value;
}
}
public int XVal {
get {
return xval;
}
set {
xval = value;
}
}
}
|