private static unsafe void ReadWriteTest(IGrowableBuffer <byte> writer) { // write a few bytes writer.Write(255); writer.Write(0); Equal(2L, writer.WrittenCount); var actual = new byte[2]; Equal(2, writer.CopyTo(actual)); Equal(new byte[] { 255, 0 }, actual); writer.Clear(); var expected = RandomBytes(5000); writer.Write(expected); actual = new byte[expected.Length]; writer.CopyTo <ReadOnlySpanConsumer <byte, ArrayCopyOperation> >(new ReadOnlySpanConsumer <byte, ArrayCopyOperation>(&ArrayCopyOperation.Append, new ArrayCopyOperation(actual))); Equal(expected, actual); }
private static void InitializeString(Span <char> output, IGrowableBuffer <char> input) => input.CopyTo(output);