add ISafeSerializationData
[mcs.git] / tests / test-228.cs
blob32124f7c8e510eaae753a55d838de97bf0bd73eb
1 //
2 // Test for bug reported on the list. The bug was that the
3 // compiler was generating copies of the static variable, before
4 // passing it. A trick that we do for readonly variables
5 using System;
7 namespace BadRefTest
10 public class CtorInc
12 static int x, y;
14 static int IncByRef(ref int i) { return ++i; }
16 public CtorInc() { IncByRef(ref x); ++y; }
18 public static bool Results(int total)
20 Console.WriteLine("CtorInc test {0}: x == {1}, y == {2}",
21 x == y && x == total? "passed": "failed", x, y);
23 return x == y && x == total;
27 public class Runner
29 public static int Main()
31 int i = 0;
32 for (; i < 5; i++)
34 CtorInc t = new CtorInc();
36 return CtorInc.Results(i) ? 0 : 1;