コード例 #1
0
        public void CanTryDecompressWithMode(CompressionMode compressionMode)
        {
            var data             = GetData();
            var compressResult   = Lzo.TryCompress(compressionMode, data, out var compressed);
            var decompressResult = Lzo.TryDecompress(compressed, out var decompressed);

            compressResult.Should().Be(LzoResult.OK);
            compressed.Should().NotBeNull().And.NotBeEquivalentTo(data);

            decompressResult.Should().Be(LzoResult.OK);
            decompressed.Should().NotBeNull().And.BeEquivalentTo(data);
        }
コード例 #2
0
        public void CanTryDecompressWithSpan(CompressionMode compressionMode)
        {
            var data             = GetData();
            var compressed       = new byte[data.Length + data.Length / 16 + 64 + 3];
            var decompressed     = new byte[data.Length];
            var compressResult   = Lzo.TryCompress(compressionMode, data, data.Length, compressed, out var compressedLength);
            var decompressResult = Lzo.TryDecompress(compressed, compressedLength, decompressed, out var decompressedLength);

            compressResult.Should().Be(LzoResult.OK);
            compressedLength.Should().BeGreaterThan(0);
            compressed.Should().NotBeNull().And.NotBeEquivalentTo(data);

            decompressResult.Should().Be(LzoResult.OK);
            decompressedLength.Should().Be(data.Length);
            decompressed.Should().NotBeNull().And.BeEquivalentTo(data);
        }