public void Can_decompress_python_compressed_file() { SnappyDecoderForTest decoder = new SnappyDecoderForTest(); byte[] expectedUncompressed = Bytes.FromHexString(File.ReadAllText(Path.Combine(TestContext.CurrentContext.WorkDirectory, "Rlpx", _uncompressedTestFileName))); byte[] compressed = Bytes.FromHexString(File.ReadAllText(Path.Combine(TestContext.CurrentContext.WorkDirectory, "Rlpx", _pythonCompressedTestFileName))); byte[] uncompressedResult = decoder.TestDecode(compressed); Assert.AreEqual(expectedUncompressed, uncompressedResult); }
public void Roundtrip_zero() { SnappyDecoderForTest decoder = new SnappyDecoderForTest(); ZeroSnappyEncoderForTest encoder = new ZeroSnappyEncoderForTest(); byte[] expectedUncompressed = Bytes.FromHexString(File.ReadAllText(Path.Combine(TestContext.CurrentContext.WorkDirectory, "Rlpx", _uncompressedTestFileName))); byte[] compressed = encoder.TestEncode(Bytes.Concat(1, expectedUncompressed)); byte[] uncompressedResult = decoder.TestDecode(compressed.Skip(1).ToArray()); Assert.AreEqual(expectedUncompressed, uncompressedResult); }
public void Roundtrip() { SnappyDecoderForTest decoder = new SnappyDecoderForTest(); SnappyEncoderForTest encoder = new SnappyEncoderForTest(); byte[] expectedUncompressed = new Hex(File.ReadAllText(Path.Combine(TestContext.CurrentContext.WorkDirectory, "Rlpx", _uncompressedTestFileName))); byte[] compressed = encoder.TestEncode(expectedUncompressed); byte[] uncompressedResult = decoder.TestDecode(compressed); Assert.AreEqual(expectedUncompressed, uncompressedResult); }