One more class init order test case (to test when inlining is involved).
[mono.git] / mono / tests / pinvoke13.cs
1 using System;
2 using System.Runtime.InteropServices;
3
4 public class DumpTest
5 {
6         /* this should call HexDumpA with ANSI encoded string */
7         [DllImport("libtest.so", CharSet=CharSet.Ansi)]
8         private static extern int HexDump (string data);
9
10         /* this should call HexDump default version with Unicode string */
11         [DllImport("libtest.so", EntryPoint="HexDump", CharSet=CharSet.Unicode)]
12         private static extern int HexDump2(string data);
13
14         /* this should call HexDump1W with unicode encoding */
15         [DllImport("libtest.so", CharSet=CharSet.Unicode)]
16         private static extern int HexDump1(string data);
17
18         public static int Main()
19         {
20                 int res;
21                 
22                 res = HexDump ("First test");
23                 Console.WriteLine (res);
24                 if (res != 100769)
25                         return 1;
26
27                 res = HexDump2 ("First test");
28                 Console.WriteLine (res);
29                 if (res != 404)
30                         return 2;
31
32                 res = HexDump1 ("First test");
33                 Console.WriteLine (res);
34                 if (res != 1000404)
35                         return 3;
36
37                 return 0;               
38         }
39 }
40