示例#1
0
        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));
        }
示例#2
0
        /// <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));
        }