Пример #1
0
        public void test_buffer_resize()
        {
            const int size1  = 15;
            const int size2  = 25;
            var       buffer = new FastBuffer(size1);

            Assert.AreEqual(size1, buffer.GetCapacity());

            buffer.Reset(size2);

            Assert.AreEqual(size2, buffer.GetCapacity());

            buffer.Reset();

            Assert.AreEqual(size2, buffer.GetCapacity());
        }
Пример #2
0
        public void test_fast_buffer()
        {
            var expected = Utility.GetTestArray(16);
            var buffer   = new FastBuffer(expected);

            Assert.AreEqual(expected.Length, buffer.GetCapacity());

            Assert.AreSame(expected, buffer.Get());

            Assert.IsTrue(buffer.Do(a => Utility.CheckTestArray(a, expected)));

            Assert.AreEqual(expected.Length, buffer.GetPosition());
        }