[sdks] Fix README.md
[mono-project.git] / mcs / tests / test-882.cs
blob67200e068d29951eb695bd683ce63b1bb9c95d78
1 using System;
3 public class MyUInt32
5 public uint x;
7 public MyUInt32 (uint x)
9 this.x = x;
12 public static implicit operator uint (MyUInt32 v)
14 return v.x;
17 public static implicit operator long (MyUInt32 v)
19 throw new ApplicationException ();
22 public static implicit operator MyUInt32 (uint v)
24 return new MyUInt32 (v);
27 public static implicit operator MyUInt32 (long v)
29 throw new ApplicationException ();
33 class Test
35 static MyUInt32 test1 (MyUInt32 x)
37 x = x + 1;
38 return x;
41 static MyUInt32 test2 (MyUInt32 x)
43 x++;
44 return x;
47 static MyUInt32 test3 (MyUInt32 x)
49 ++x;
50 return x;
53 public static int Main ()
55 var m = new MyUInt32 (2);
56 m = test1 (m);
57 if (m.x != 3)
58 return 1;
60 m = new MyUInt32 (2);
61 m = test2 (m);
62 if (m.x != 3)
63 return 2;
65 m = new MyUInt32 (3);
66 m = test3 (m);
67 if (m.x != 4)
68 return 3;
70 return 0;