Beispiel #1
0
    static void Check(ulong first, ulong count)
    {
        using (Stream strm = new MemoryStream((int)(count * 8)))
        {
            ulong i, j, k;

            for (i = 0, k = first; i < count; i++, k++)
            {
                StreamPacker.PackUInt64(strm, k);
            }

            strm.Position = 0;

            for (i = 0, k = first; i < count; i++, k++)
            {
                j = StreamPacker.UnpackInt64(strm);
                if (j != k)
                {
                    throw new Exception(string.Format("failed on {0}: {1}", k, j));
                }
            }
        }
    }