You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
@ -155,6 +155,54 @@ namespace MonoTests.System.Runtime.InteropServices
|
||||
}
|
||||
}
|
||||
|
||||
readonly String[] TestStrings = new String[] {
|
||||
"", //Empty String
|
||||
"Test String",
|
||||
"A", //Single character string
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself. " +
|
||||
"This is a very long string as it repeats itself.",
|
||||
"This \n is \n a \n multiline \n string",
|
||||
"This \0 is \0 a \0 string \0 with \0 nulls",
|
||||
"\0string",
|
||||
"string\0",
|
||||
"\0\0\0\0\0\0\0\0"
|
||||
};
|
||||
|
||||
[Test]
|
||||
public unsafe void PtrToStringUTF8_Test ()
|
||||
{
|
||||
int i = 0;
|
||||
foreach (String srcString in TestStrings)
|
||||
{
|
||||
i++;
|
||||
// we assume string null terminated
|
||||
if (srcString.Contains("\0"))
|
||||
continue;
|
||||
|
||||
IntPtr ptrString = Marshal.StringToAllocatedMemoryUTF8(srcString);
|
||||
string retString = Marshal.PtrToStringUTF8(ptrString);
|
||||
|
||||
Assert.AreEqual (srcString, retString, "#" + i);
|
||||
if (srcString.Length > 0)
|
||||
{
|
||||
string retString2 = Marshal.PtrToStringUTF8(ptrString, srcString.Length - 1);
|
||||
Assert.AreEqual (srcString.Substring(0, srcString.Length - 1), retString2, "#s" + i);
|
||||
}
|
||||
Marshal.FreeHGlobal(ptrString);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public unsafe void UnsafeAddrOfPinnedArrayElement ()
|
||||
{
|
||||
@ -368,7 +416,6 @@ namespace MonoTests.System.Runtime.InteropServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MobileNotWorking")]
|
||||
public void BSTR_Roundtrip ()
|
||||
{
|
||||
string s = "mono";
|
||||
@ -378,7 +425,6 @@ namespace MonoTests.System.Runtime.InteropServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MobileNotWorking")]
|
||||
public void StringToBSTRWithNullValues ()
|
||||
{
|
||||
int size = 128;
|
||||
|
Reference in New Issue
Block a user