Exemple #1
0
        public void Test_Single_Size_Buffer()
        {
            var ringBuffer = new BoundedFifoBuffer <byte>(1);

            for (var i = 0; i < 100; i++)
            {
                ringBuffer.Write(GetBytes("A"));
                Assert.AreEqual("A", GetString(ringBuffer.ReadToArray()));
                ringBuffer.Write(GetBytes("B"));
                Assert.AreEqual("B", GetString(ringBuffer.ReadToArray()));
            }
        }
Exemple #2
0
        public void Test_Simple_RingBuffer_Test_Read_Write_With_Dri1()
        {
            var ringBuffer = new BoundedFifoBuffer <byte>(5);

            for (var i = 0; i < 100; i++)
            {
                ringBuffer.Write(GetBytes("ABC"));
                Assert.AreEqual("ABC", GetString(ringBuffer.ReadToArray()));
                ringBuffer.Write(GetBytes("DEF"));
                Assert.AreEqual("DEF", GetString(ringBuffer.ReadToArray()));
            }
        }
        public void Test_Single_Size_Buffer()
        {
            var ringBuffer = new BoundedFifoBuffer<byte>(1);

            for (var i = 0; i < 100; i++)
            {
                ringBuffer.Write(GetBytes("A"));
                Assert.AreEqual("A", GetString(ringBuffer.ReadToArray()));
                ringBuffer.Write(GetBytes("B"));
                Assert.AreEqual("B", GetString(ringBuffer.ReadToArray()));
            }
        }
        public void Test_Simple_RingBuffer_Test_Read_Write_With_Drift2()
        {
            var ringBuffer = new BoundedFifoBuffer<byte>(5);

            for (var i = 0; i < 100; i++)
            {
                ringBuffer.Write(GetBytes("ABC"));
                Assert.AreEqual("ABC", GetString(ringBuffer.ReadToArray()));
                ringBuffer.Write(GetBytes("DEF"));
                Assert.AreEqual('D', ringBuffer[0]);
                Assert.AreEqual('E', ringBuffer[1]);
                Assert.AreEqual('F', ringBuffer[2]);
                ringBuffer.Clear();
            }
        }