Ejemplo n.º 1
0
        public void Setup()
        {
            string inputString = UtfEncoderHelper.GenerateStringData(Length, this.CodePointInfo.MinCodePoint, CodePointInfo.MaxCodePoint, CodePointInfo.Special);

            _characters   = inputString.AsSpan().ToArray();
            _utf8Encoding = Encoding.UTF8;
            int utf8Length = _utf8Encoding.GetByteCount(_characters);

            _utf8Destination = new byte[utf8Length];

            _utf16Source = MemoryMarshal.AsBytes(inputString.AsSpan()).ToArray();
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            string inputString = UtfEncoderHelper.GenerateStringData(Length, CodePointInfo.MinCodePoint, CodePointInfo.MaxCodePoint, CodePointInfo.Special);

            _characters   = inputString.AsSpan().ToArray();
            _utf8Encoding = Encoding.UTF8;
            int utf8Length = _utf8Encoding.GetByteCount(_characters);

            _utf8Destination = new byte[utf8Length];
            _utf32Encoding   = Encoding.UTF32;

            int utf32Length = _utf32Encoding.GetByteCount(_characters);

            _utf32Source = new byte[utf32Length];
            _utf32Encoding.GetBytes(_characters, 0, _characters.Length, _utf32Source, 0);
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            string inputString = UtfEncoderHelper.GenerateStringData(Length, CodePointInfo.MinCodePoint, CodePointInfo.MaxCodePoint, CodePointInfo.Special);

            _characters = inputString.AsSpan().ToArray();

            _utf32Encoding = Encoding.UTF32;
            _utf32Source   = Text.Encoding.UTF32.GetBytes(inputString);

            OperationStatus status = Buffers.Text.Encodings.Utf32.ToUtf16Length(_utf32Source, out int needed);

            if (status != OperationStatus.Done)
            {
                throw new Exception();
            }

            _utf16Destination = new byte[needed];
        }
Ejemplo n.º 4
0
 public IEnumerable <CodePoint> GetEncodingPerformanceTestData()
 {
     return(UtfEncoderHelper.GetEncodingPerformanceTestData());
 }