public void ToStringAndName([Values] ZstandardLevel level) { ZstandardCodec codec = new ZstandardCodec(level); Assert.AreEqual("zstandard", codec.GetName()); Assert.AreEqual($"zstandard[{(int)level}]", codec.ToString()); }
public void Equal([Values] ZstandardLevel level) { ZstandardCodec codec1 = new ZstandardCodec(level); ZstandardCodec codec2 = new ZstandardCodec(level); Assert.IsTrue(codec1.Equals(codec1)); Assert.IsTrue(codec2.Equals(codec2)); Assert.IsTrue(codec1.Equals(codec2)); Assert.IsTrue(codec2.Equals(codec1)); }
public ZstandardCodec(ZstandardLevel level) { Level = level; }
public void HashCode([Values] ZstandardLevel level) { ZstandardCodec codec = new ZstandardCodec(level); Assert.AreNotEqual(0, codec.GetHashCode()); }
public void CompressDecompressStream([ValueSource(nameof(_testLengths))] int length, [Values] ZstandardLevel level) { byte[] data = Enumerable.Range(0, length).Select(x => (byte)x).ToArray(); ZstandardCodec codec = new ZstandardCodec(level); using (MemoryStream inputStream = new MemoryStream(data)) using (MemoryStream outputStream = new MemoryStream()) { codec.Compress(inputStream, outputStream); byte[] compressed = outputStream.ToArray(); byte[] uncompressed = codec.Decompress(compressed, compressed.Length); Assert.IsTrue(Enumerable.SequenceEqual(data, uncompressed)); } }
public void CompressDecompress([ValueSource(nameof(_testLengths))] int length, [Values] ZstandardLevel level) { byte[] data = Enumerable.Range(0, length).Select(x => (byte)x).ToArray(); ZstandardCodec codec = new ZstandardCodec(level); byte[] compressed = codec.Compress(data); byte[] uncompressed = codec.Decompress(compressed, compressed.Length); Assert.IsTrue(Enumerable.SequenceEqual(data, uncompressed)); }