Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-65.cs
1 //
2 // This exercises the various ways in which the new operator works
3 // with value types.
4 //
5
6 using System;
7
8 struct S {
9         int v;
10 }
11
12 class X {
13         static bool receive, create, create_and_box;
14         
15         static void receiver (S x)
16         {
17                 receive = true;
18         }
19
20         static object BoxS ()
21         {
22                 create_and_box = true;
23                 return new S ();
24         }
25
26         static S Plain ()
27         {
28                 create = true;
29                 return new S ();
30         }
31         
32         public static int Main ()
33         {
34                 object a = new S ();
35                 receiver (new S ());
36                 S s = Plain ();
37                 object o = BoxS ();
38                 
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;
47
48                 Console.WriteLine ("Test pass");
49                 return 0;
50         }
51 }