2010-05-19 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-65.cs
blobb117ae309a4ba23af0f8062b23dfc253028ba695
1 //
2 // This exercises the various ways in which the new operator works
3 // with value types.
4 //
6 using System;
8 struct S {
9 int v;
12 class X {
13 static bool receive, create, create_and_box;
15 static void receiver (S x)
17 receive = true;
20 static object BoxS ()
22 create_and_box = true;
23 return new S ();
26 static S Plain ()
28 create = true;
29 return new S ();
32 static int Main ()
34 object a = new S ();
35 receiver (new S ());
36 S s = Plain ();
37 object o = BoxS ();
39 if (a == null)
40 return 1;
41 if (receive == false)
42 return 2;
43 if (create == false)
44 return 3;
45 if (create_and_box == false)
46 return 4;
48 Console.WriteLine ("Test pass");
49 return 0;