public virtual void TestLimitObjectSize_Length130InsertFails() { src = GetRng().NextBytes(130); dst = GetRng().NextBytes(130); DeltaIndex di = new DeltaIndex(src); NUnit.Framework.Assert.IsFalse(di.Encode(actDeltaBuf, dst, src.Length)); }
public virtual void TestLimitObjectSize_Length130CopyFails() { src = GetRng().NextBytes(130); Copy(0, 130); dst = dstBuf.ToByteArray(); // The header requires 4 bytes for these objects, so a target length // of 5 is bigger than the copy instruction and should cause an abort. // DeltaIndex di = new DeltaIndex(src); NUnit.Framework.Assert.IsFalse(di.Encode(actDeltaBuf, dst, 5)); NUnit.Framework.Assert.AreEqual(4, actDeltaBuf.Size()); }
public virtual void TestLimitObjectSize_Length130CopyOk() { src = GetRng().NextBytes(130); Copy(0, 130); dst = dstBuf.ToByteArray(); DeltaIndex di = new DeltaIndex(src); NUnit.Framework.Assert.IsTrue(di.Encode(actDeltaBuf, dst, dst.Length)); byte[] actDelta = actDeltaBuf.ToByteArray(); byte[] expDelta = expDeltaBuf.ToByteArray(); NUnit.Framework.Assert.AreEqual(BinaryDelta.Format(expDelta, false), BinaryDelta. Format(actDelta, false)); }
/// <exception cref="System.IO.IOException"></exception> private void DoTest() { dst = dstBuf.ToByteArray(); DeltaIndex di = new DeltaIndex(src); di.Encode(actDeltaBuf, dst); byte[] actDelta = actDeltaBuf.ToByteArray(); byte[] expDelta = expDeltaBuf.ToByteArray(); NUnit.Framework.Assert.AreEqual(BinaryDelta.Format(expDelta, false), BinaryDelta. Format(actDelta, false)); // NUnit.Framework.Assert.IsTrue(actDelta.Length > 0, "delta is not empty"); NUnit.Framework.Assert.AreEqual(src.Length, BinaryDelta.GetBaseSize(actDelta)); NUnit.Framework.Assert.AreEqual(dst.Length, BinaryDelta.GetResultSize(actDelta)); CollectionAssert.AreEquivalent(dst, BinaryDelta.Apply(src, actDelta)); }