public void DecoderStillWorksWhenReadingSlowFile(string original, bool high, int block) { original = Tools.FindFile($".corpus/{original}"); var encoded = Path.GetTempFileName(); var decoded = Path.GetTempFileName(); try { TestedLZ4.Encode(original, encoded, high, block, Mem.K64); using (var source = LZ4Legacy.Decode(Tools.Slow(File.OpenRead(encoded)))) using (var target = File.Create(decoded)) { var buffer = new byte[Mem.K64]; while (true) { var read = source.Read(buffer, 0, buffer.Length); if (read == 0) { break; } target.Write(buffer, 0, read); } } Tools.SameFiles(original, decoded); } finally { File.Delete(encoded); File.Delete(decoded); } }
private static void TestEncoder(string original, int chunkSize, LZ4Settings settings) { original = Tools.FindFile(original); var encoded = Path.GetTempFileName(); var decoded = Path.GetTempFileName(); try { TestedLZ4.Encode(original, encoded, chunkSize, settings); ReferenceLZ4.Decode(encoded, decoded); Tools.SameFiles(original, decoded); } finally { File.Delete(encoded); File.Delete(decoded); } }
private static void TestEncoder(string original, bool high, int block, int chunk) { original = Tools.FindFile(original); var encoded = Path.GetTempFileName(); var decoded = Path.GetTempFileName(); try { TestedLZ4.Encode(original, encoded, high, block, chunk); ReferenceLZ4.Decode(encoded, decoded, chunk); Tools.SameFiles(original, decoded); } finally { File.Delete(encoded); File.Delete(decoded); } }
private static void TestRoundtrip(string fileName, int chunkSize, LZ4Settings settings) { var original = Tools.FindFile(fileName); var encoded = Path.GetTempFileName(); var decoded = Path.GetTempFileName(); try { TestedLZ4.Encode(original, encoded, chunkSize, settings); TestedLZ4.Decode(encoded, decoded, chunkSize); Tools.SameFiles(original, decoded); } finally { File.Delete(encoded); File.Delete(decoded); } }