public void CloneBufferOffset() { BitBuffer b = new BitBuffer(new byte[1 << 16]); b.CloneUsingPool(); for (int i = 0; i < 16; i++) { b.absOffset += 1; b.CloneUsingPool(); } }
public void CloneBufferWithPoolTest() { Random r = new Random(0); for (int offset = 0; offset < 16; offset++) { var b = new BitBuffer(new byte[32], offset); for (int k = 0; k < (b.data.Length - (int)Math.Ceiling(offset / 8f)) / sizeof(int); k++) { b.Put(r.Next()); } var clone = b.CloneUsingPool(); Assert.IsTrue(b.BufferEquals(clone), "offset=" + offset); clone.Recycle(); } }