public void RoundtripCompressDecompress(int totalSize) { byte[] data = new byte[totalSize]; new Random(42).NextBytes(data); Span <byte> compressed = new byte[BrotliPrimitives.GetMaximumCompressedSize(totalSize)]; TransformationStatus result = BrotliPrimitives.Compress(data, compressed, out int consumed, out int written); Assert.Equal(TransformationStatus.Done, result); Assert.Equal(totalSize, consumed); compressed = compressed.Slice(0, written); ValidateCompressedData(compressed, data); }
public void TestMethodCompressEx(int quality, int lgWinSize) { Assert.Throws <ArgumentOutOfRangeException>(() => BrotliPrimitives.Compress(new byte[1], new byte[1], out int consumed, out int written, quality, lgWinSize)); }