Test for version 0.10.3, .net4.0:
And there is assertion in Debug.Assert(l == buff.Length), l=965 and biff.Length=1000.
static byte[] Pack(byte[] data)
{
var ppmdProp = new PpmdProperties();
using(var mem = new MemoryStream())
using (var ppmd = new PpmdStream(ppmdProp, mem, true))
{
ppmd.Write(data, 0, data.Length);
return mem.ToArray();
}
}
static byte[] UnPack(byte[] data, int origSize)
{
var ppmdProp = new PpmdProperties();
var buff = new byte[origSize];
using(var mem = new MemoryStream(data))
using (var ppmd = new PpmdStream(ppmdProp, mem, false))
{
var l = ppmd.Read(buff, 0, origSize);
Debug.Assert(l == buff.Length);
return buff;
}
}
[Test]
public void _01_Ppmd()
{
var tb = new byte[]{1,2,3,4,5,6,7,8,9,0};
var pp = Pack(tb);
var up = UnPack(pp, tb.Length);
Assert.AreEqual(tb,up);
}
[Test]
public void _02_Ppmd()
{
var tb = Enumerable.Range(0, 1000).Select(p => (byte) p).ToArray();
var pp = Pack(tb);
var up = UnPack(pp, tb.Length);
Assert.AreEqual(tb,up);
}
In first test up = {1,2,3,4,5,6,7,8,9,10}, i.e. 10!=0.And there is assertion in Debug.Assert(l == buff.Length), l=965 and biff.Length=1000.