public void PackingWorks(LzwGifToolsTestCase testCase) { StreamPacker packer = new StreamPacker(testCase.LzwMinimumCodeSize); List <byte> packedBytes = packer.Pack(testCase.LzwCompressedCodeStream); CollectionAssert.AreEqual(testCase.PackedBytes, packedBytes); }
public void StreamPackingIsReversible(LzwGifToolsTestCase testCase) { StreamUnpacker unpacker = new StreamUnpacker(testCase.LzwMinimumCodeSize); StreamPacker packer = new StreamPacker(testCase.LzwMinimumCodeSize); List <int> lzwCompressedCodeStream = unpacker.Unpack(testCase.PackedBytes); List <byte> packedBytes = new List <byte>(); packedBytes = packer.Pack(lzwCompressedCodeStream); CollectionAssert.AreEqual(testCase.PackedBytes, packedBytes); }
public void AllMethodsWork(LzwGifToolsTestCase testCase) { LzwCompressor compressor = new LzwCompressor(testCase.LzwMinimumCodeSize); StreamPacker packer = new StreamPacker(testCase.LzwMinimumCodeSize); StreamUnpacker unpacker = new StreamUnpacker(testCase.LzwMinimumCodeSize); LzwDecompressor decompressor = new LzwDecompressor(testCase.LzwMinimumCodeSize); List <int> lzwEncodedCodeStream = compressor.Compress(testCase.CodeStream); List <byte> packedBytes = packer.Pack(lzwEncodedCodeStream); List <int> lzwEncodedCodeStream2 = unpacker.Unpack(packedBytes); List <int> codeStream = decompressor.Decompress(lzwEncodedCodeStream2); CollectionAssert.AreEqual(testCase.CodeStream, codeStream); }