Beispiel #1
0
        public unsafe void Utf16EncodeDecode([Range(0, 0xD7FF, 997)] int input_ucs)
        {
            var converted = new char[2];

            fixed(char *c = converted)
            {
                ConversionError error;
                int             write_length = 0;

                error = NativeString.UcsToUtf16(c, ref write_length, converted.Length, input_ucs);
                Assert.AreEqual(ConversionError.None, error);
                int read_length = 0;

                error = NativeString.Utf16ToUcs(out int output_ucs, c, ref read_length, write_length);
                Assert.AreEqual(ConversionError.None, error);
                Assert.AreEqual(write_length, read_length);
                Assert.AreEqual(output_ucs, input_ucs);
            }
        }