Skip to content

Combination of CompressionStream and Decompressor fails to Unwrap on multiple iterations #27

Description

@DruSchmitt
    [TestCase(new byte[0], 0, 0)]
    [TestCase(new byte[] { 1, 2, 3 }, 1, 2)]
    [TestCase(new byte[] { 1, 2, 3 }, 0, 2)]
    [TestCase(new byte[] { 1, 2, 3 }, 1, 1)]
    [TestCase(new byte[] { 1, 2, 3 }, 0, 3)]
    public void StreamCompressAndRegularDecompress(byte[] data, int offset, int count)
    {
        var tempStream = new MemoryStream();
        using (var compressionStream = new CompressionStream(tempStream))
            compressionStream.Write(data, offset, count);

		byte[] decompressedBytes;
        using (Decompressor decompressor = new Decompressor())
        {
            decompressedBytes = decompressor.Unwrap(tempStream.ToArray());
        }

        var dataToCompress = new byte[count];
        Array.Copy(data, offset, dataToCompress, 0, count);

        Assert.AreEqual(dataToCompress, decompressedBytes);
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions