update readme (#21797)
[mono-project.git] / mcs / tests / test-121.cs
blob5fa9778d6dc1ca48733cd754f5b44ca48742daea
1 //
2 // This test excercises the fact that array evaluation in UnaryMutator and
3 // CompoundAssign expressions should never mutate data more than once
4 //
5 class X {
6 static int g_calls;
8 static int g ()
10 g_calls++;
11 return 0;
15 public static int Main ()
17 int [] a = new int [10];
18 int i = 0;
20 a [0] = 1;
22 a [i++] += 3;
24 if (i != 1)
25 return 1;
26 if (a [0] != 4)
27 return 2;
29 a [g ()]++ ;
31 if (g_calls != 1)
32 return 3;
33 return 0;