public void TestSwapCustom() { var data0 = RandomBytes(10000004, 0); var stats = TestByteBufferStatistics.Empty; using (var bb = new TestByteBuffer(data0)) { bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; } using (var bb = new TestByteBuffer(data0)) { bb.InitializeStream(); bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; } Console.WriteLine(stats); }
public void TestSwap1() { var data0 = RandomBytes(8472, -0x02F0B4EF); using (var bb = new TestByteBuffer(data0)) { bb.Swap(1); Assert.AreEqual(0, bb.StreamPosition, "Swap(1) - StreamPosition"); AssertAreEqual(data0, bb.DumpTestData(), "Swap(1)"); } using (var bb = new TestByteBuffer(data0)) { bb.InitializeStream(position: 42); bb.Swap(1); Assert.AreEqual(42, bb.StreamPosition, "Swap(1) - StreamPosition - after Stream initialized"); AssertAreEqual(data0, bb.DumpTestData(), "Swap(1) - after Stream initialized"); } }
public void TestSwapCustom() { var data0 = RandomBytes(10000004, 0); var stats = TestByteBufferStatistics.Empty; using (var bb = new TestByteBuffer(data0)) { bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; } using (var bb = new TestByteBuffer(data0)) { bb.InitializeStream(); bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; bb.Swap(7); stats += bb.LastStatistics; } Console.WriteLine(stats); }