示例#1
0
        public void ConstructorTest()
        {
            var q = UnsafeRingBuffer.Allocate <int>(10);

            Assert.AreEqual(0, UnsafeRingBuffer.GetCount(q));
            Assert.AreEqual(10, UnsafeRingBuffer.GetCapacity(q));

            UnsafeRingBuffer.Free(q);
        }
示例#2
0
        public void PushTest()
        {
            var q = UnsafeRingBuffer.Allocate <int>(10);

            for (int i = 0; i < 10; i++)
            {
                UnsafeRingBuffer.Push(q, i * i);
            }

            Assert.AreEqual(10, UnsafeRingBuffer.GetCount(q));
            Assert.AreEqual(10, UnsafeRingBuffer.GetCapacity(q));

            UnsafeRingBuffer.Clear(q);

            Assert.AreEqual(0, UnsafeRingBuffer.GetCount(q));
            Assert.AreEqual(10, UnsafeRingBuffer.GetCapacity(q));

            UnsafeRingBuffer.Free(q);
        }