projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2006-02-16 Martin Baulig <martin@ximian.com>
[mono.git]
/
mono
/
tests
/
pinvoke13.cs
diff --git
a/mono/tests/pinvoke13.cs
b/mono/tests/pinvoke13.cs
index 6a2a9cf38bfcb9ccaa06a05090577898ee1b5f49..e3f5f5788c893033b23420dd2f3c6a2fbf5622de 100644
(file)
--- a/
mono/tests/pinvoke13.cs
+++ b/
mono/tests/pinvoke13.cs
@@
-1,40
+1,58
@@
+//
+// pinvoke13.cs
+//
+// Tests for pinvoke name mangling
+//
using System;
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
-public class
DumpTest
+public class
Tests
{
{
- /* this should call HexDumpA with ANSI encoded string */
+ /*
+ * These tests exercise the search order associated with the different charset values.
+ */
+
+ /* This should call NameManglingAnsi */
[DllImport("libtest", CharSet=CharSet.Ansi)]
[DllImport("libtest", CharSet=CharSet.Ansi)]
- private static extern int HexDump (string data);
+ private static extern int NameManglingAnsi (string data);
+
+ /* This should call NameManglingAnsi2A */
+ [DllImport ("libtest", CharSet=CharSet.Ansi)]
+ private static extern int NameManglingAnsi2 (string data);
- /*
this should call HexDump default version with Unicode string
*/
- [DllImport
("libtest", EntryPoint="HexDump
", CharSet=CharSet.Unicode)]
- private static extern int
HexDump2
(string data);
+ /*
This should call NameManglingUnicodeW
*/
+ [DllImport
("libtest
", CharSet=CharSet.Unicode)]
+ private static extern int
NameManglingUnicode
(string data);
- /*
this should call HexDump1W with unicode encoding
*/
- [DllImport("libtest", CharSet=CharSet.Unicode)]
- private static extern int
HexDump1
(string data);
+ /*
This should call NameManglingUnicode2
*/
+ [DllImport
("libtest", CharSet=CharSet.Unicode)]
+ private static extern int
NameManglingUnicode2
(string data);
- public static int Main()
- {
+ /* This should call NameManglingAutoW under windows, and NameManglingAuto under unix */
+ [DllImport ("libtest", CharSet=CharSet.Auto)]
+ private static extern int NameManglingAuto (string s);
+
+ public static int Main (String[] args) {
int res;
int res;
-
- res = HexDump ("First test");
- Console.WriteLine (res);
- if (res != 100769)
- return 1;
- res = HexDump2 ("First test");
- Console.WriteLine (res);
- if (res != 404)
+ res = NameManglingAnsi ("ABC");
+ if (res != 198)
+ return 1;
+ res = NameManglingAnsi2 ("ABC");
+ if (res != 198)
return 2;
return 2;
-
- res = HexDump1 ("First test");
- Console.WriteLine (res);
- if (res != 1000404)
+ res = NameManglingUnicode ("ABC");
+ if (res != 198)
return 3;
return 3;
+ res = NameManglingUnicode2 ("ABC");
+ if (res != 198)
+ return 4;
- return 0;
+ res = NameManglingAuto ("ABC");
+ if (res != 0)
+ return 5;
+
+ return 0;
}
}
}
}