public void TripleTest(string oldName, string newName) { using (var old = GetTestDataStream(oldName)) using (var old2 = GetTestDataStream(oldName)) using (var @new = GetTestDataStream(newName)) using (var actual = new MemoryStream()) { var builder = new SignatureBuilder(); var sigJob = new SignatureJob(old, builder); sigJob.Run(); old.Seek(0, SeekOrigin.Begin); using (var delta = new MemoryStream()) { var deltaEmitter = new DeltaEmitter(delta); var deltaJob = new DeltaJob(builder.GetSignature(), @new, deltaEmitter); deltaJob.Run(); delta.Seek(0, SeekOrigin.Begin); var patchJob = new DeltaReadJob(delta, new PatchProcessor(old2, actual)); patchJob.Run(); } actual.Seek(0, SeekOrigin.Begin); @new.Seek(0, SeekOrigin.Begin); Assert.AreEqual(StreamToArray(@new), StreamToArray(actual)); } }
public void Issue1Test() { using (var ms = new MemoryStream()) { var emitter = new DeltaEmitter(ms); emitter.Header(); emitter.Literal(new byte[0x1ffffff], 0, 0x1ffffff); emitter.Copy(0x1ffffff, 0x1ffffff); emitter.End(); ms.Seek(0, SeekOrigin.Begin); var processor = new HumanReadableDeltaWriter(); var readJob = new DeltaReadJob(ms, processor); readJob.Run(); // 33554431 == 0x1ffffff Assert.AreEqual(Multiline("LITERAL 33554431", "COPY 33554431 33554431"), processor.ToString()); } }