[sdks] Fix README.md
[mono-project.git] / mcs / tests / gtest-180.cs
blob1001a86d96d396ffc0148a6facd6066b891053b6
1 using System;
2 using System.Runtime.InteropServices;
4 [module: DefaultCharSet (CharSet.Unicode)]
6 struct foo1
10 enum E
14 [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Auto)]
15 struct foo2
19 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
20 delegate void D ();
22 class C
24 public class CC
29 class Program
32 [DllImport ("bah")]
33 public static extern void test ();
35 public static int Main ()
37 DllImportAttribute dia = Attribute.GetCustomAttribute (typeof (Program).GetMethod ("test"), typeof (DllImportAttribute)) as DllImportAttribute;
38 if (dia == null)
39 return 1;
41 if (dia.CharSet != CharSet.Unicode)
42 return 2;
44 if (!typeof (C).IsUnicodeClass)
45 return 3;
47 if (!typeof (C.CC).IsUnicodeClass)
48 return 4;
50 if (!typeof (D).IsUnicodeClass)
51 return 5;
53 var ufp = typeof (D).GetCustomAttributes (false)[0] as UnmanagedFunctionPointerAttribute;
54 if (ufp.CharSet != CharSet.Unicode)
55 return 51;
57 if (!typeof (E).IsUnicodeClass)
58 return 6;
60 if (!typeof (foo1).IsUnicodeClass)
61 return 7;
63 if (!typeof (foo2).IsAutoClass)
64 return 8;
66 return 0;