Merge pull request #3563 from lewurm/interpreter
[mono.git] / mcs / tests / test-181.cs
1 //
2 // test-181.cs: Test whenever mcs correctly handles the MethodImplAttributes
3 // custom attribute.
4 //
5
6 using System;
7 using System.Reflection;
8 using System.Runtime.CompilerServices;
9
10 class Test
11 {
12         [MethodImplAttribute(MethodImplOptions.Synchronized)]
13         public void test ()
14         {
15         }
16
17         [MethodImplAttribute((short)MethodImplOptions.Synchronized)]
18         public void test2 ()
19         {
20         }
21
22         [MethodImplAttribute((byte)32)]
23         public void test3 ()
24         {
25         }
26
27         [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
28         public void test4 ()
29         {
30         }
31
32         public static int Main ()
33         {
34                 MethodImplAttributes iflags;
35                 iflags = typeof (Test).GetMethod ("test").GetMethodImplementationFlags ();
36                 if ((iflags & MethodImplAttributes.Synchronized) == 0)
37                         return 1;
38
39                 iflags = typeof (Test).GetMethod ("test2").GetMethodImplementationFlags ();
40                 if ((iflags & MethodImplAttributes.Synchronized) == 0)
41                         return 2;
42
43                 iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
44                 if ((iflags & MethodImplAttributes.Synchronized) == 0)
45                         return 3;
46
47                 iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
48                 if ((iflags & MethodImplAttributes.Synchronized) == 0)
49                         return 4;
50
51                 return 0;
52         }
53 }
54                 
55