public static void NarrowUtf16ToAscii_EmptyInput_NonNullReference() { char c = default; byte b = default; Assert.Equal(UIntPtr.Zero, (UIntPtr)ASCIIUtility.NarrowUtf16ToAscii(&c, &b, UIntPtr.Zero)); }
private static int CallNarrowUtf16ToAscii(ReadOnlySpan <char> utf16, Span <byte> ascii) { Assert.Equal(utf16.Length, ascii.Length); fixed(char *pUtf16 = &MemoryMarshal.GetReference(utf16)) fixed(byte *pAscii = &MemoryMarshal.GetReference(ascii)) { // Conversions between UIntPtr <-> int are not checked by default. return(checked ((int)ASCIIUtility.NarrowUtf16ToAscii(pUtf16, pAscii, (UIntPtr)utf16.Length))); } }
public static unsafe void NarrowUtf16ToAscii_EmptyInput_NullReferences() { Assert.Equal(UIntPtr.Zero, (UIntPtr)ASCIIUtility.NarrowUtf16ToAscii(null, null, UIntPtr.Zero)); }