2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-406.cs
blobf2aa9c4a43f15b31956a4e0869bd35f3e4ffd767
1 // Compiler options: -unsafe
3 //
4 // This tests excercises the compound assignment when the left side
5 // is an dereference operator.
6 //
7 using System;
8 namespace TestCase {
9 public unsafe class Test {
10 static int Main(string[] args) {
11 uint[] uArr = {0, 200};
12 uint[] uArr2 = {0, 200};
14 fixed (uint* u = uArr, u2 = uArr2) {
15 if (DoOp (u) != 100)
16 return 1;
18 if (uArr [0] != 100)
19 return 2;
21 if (uArr [1] != 200)
22 return 3;
24 if (DoOp2 (u2) != 100)
25 return 4;
27 if (uArr2 [0] != 100)
28 return 5;
30 if (uArr2 [1] != 200)
31 return 6;
34 return 0;
37 private static uint DoOp (uint *u) {
38 return *(u) += 100;
41 private static uint DoOp2 (uint *u) {
42 *(u) += 100;
43 return *u;