projects
/
mono.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
2005-07-24 Atsushi Enomoto <atsushi@ximian.com>
[mono.git]
/
mcs
/
tests
/
test-38.cs
1
class X {
2
public int v1, v2;
3
int y;
4
5
public int this [int a] {
6
get {
7
if (a == 0)
8
return v1;
9
else
10
return v2;
11
}
12
13
set {
14
if (a == 0)
15
v1 = value;
16
else
17
v2 = value;
18
}
19
}
20
21
public int Foo () {
22
return 8;
23
}
24
25
public int Bar {
26
get {
27
return y;
28
}
29
30
set {
31
y = value;
32
}
33
}
34
}
35
36
class Y {
37
public uint v1, v2;
38
uint y;
39
40
public uint this [uint a] {
41
get {
42
if (a == 0)
43
return v1;
44
else
45
return v2;
46
}
47
48
set {
49
if (a == 0)
50
v1 = value;
51
else
52
v2 = value;
53
}
54
}
55
56
public uint Foo () {
57
return 8;
58
}
59
60
public uint Bar {
61
get {
62
return y;
63
}
64
65
set {
66
y = value;
67
}
68
}
69
}
70
71
class Test {
72
73
static int Main ()
74
{
75
X x = new X ();
76
Y y = new Y ();
77
int b;
78
79
x [0] = x [1] = 1;
80
x [0] = 1;
81
if (x.v1 != 1)
82
return 1;
83
84
if (x [0] != 1)
85
return 2;
86
87
double d;
88
long l;
89
90
d = l = b = x [0] = x [1] = x.Bar = x [2] = x [3] = x [4] = x.Foo ();
91
92
if (x.Bar != 8)
93
return 3;
94
95
if (l != 8)
96
return 4;
97
98
uint e, f;
99
e = 5;
100
e = f = 8;
101
102
if (e != 8)
103
return 5;
104
105
y [0] = y [1] = 9;
106
y [0] = y.Bar = 12;
107
108
if (y.Bar != 12)
109
return 6;
110
111
y.Bar = 15;
112
if (y.Bar != 15)
113
return 7;
114
115
return 0;
116
117
}
118
}