2 // This test exercises the various ways in which mutator operators can be
3 // used in C# and the various different scenarios that the compiler would
6 // variables, linear arrays, multi-dimensional arrays, jagged arrays,
7 // properties, indexers and overloaded ++ and --
15 public int this [int n
] {
50 static public Z
operator ++ (Z v
)
59 static int p_pre_increment (X x
)
64 static int p_post_increment (X x
)
69 static int i_pre_increment (X x
)
74 static int i_post_increment (X x
)
79 static Z
overload_increment (Z z
)
84 static Z
overload_pre_increment (Z z
)
95 // Tests the ++ and -- operators on integers
97 static int simple (int i
)
112 int [] a
= new int [10];
115 for (i
= 0; i
< 10; i
++)
118 for (i
= 0; i
< 10; i
++)
122 int [,] b
= new int [10,10];
123 for (i
= 0; i
< 10; i
++){
124 for (j
= 0; j
< 10; j
++){
125 b
[i
,j
] = i
* 10 + j
;
133 for (i
= 0; i
< 10; i
++){
134 for (j
= 0; j
< 10; j
++){
135 if (b
[i
,j
] != i
* 10 + (j
+ 1))
148 if ((c
= simple (10)) != 0)
151 if (i_pre_increment (x
) != 1)
157 if (i_post_increment (x
) != 1)
163 if (p_pre_increment (x
) != 1)
169 if (p_post_increment (x
) != 1)
177 overload_increment (z
);