示例#1
0
        public void Ts3Client_RingQueueTest2()
        {
            int ov;
            var q = new RingQueue <int>(50, ushort.MaxValue + 1);

            for (int i = 0; i < ushort.MaxValue - 10; i++)
            {
                q.Set(i, 42);
                q.TryDequeue(out ov);
            }

            Assert.True(q.IsSet(ushort.MaxValue - 20));

            for (int i = ushort.MaxValue - 10; i < ushort.MaxValue + 10; i++)
            {
                q.Set(i % (ushort.MaxValue + 1), 42);
            }
        }
示例#2
0
        public void Ts3Client_RingQueueTest2()
        {
            var q = new RingQueue <int>(50, ushort.MaxValue + 1);

            for (int i = 0; i < ushort.MaxValue - 10; i++)
            {
                q.Set(i, 42);
                q.TryDequeue(out var _);
            }

            var setStatus = q.IsSet(ushort.MaxValue - 20);

            Assert.True(setStatus.HasFlag(ItemSetStatus.Set));

            for (int i = ushort.MaxValue - 10; i < ushort.MaxValue + 10; i++)
            {
                q.Set(i % (ushort.MaxValue + 1), 42);
            }
        }
示例#3
0
        public void RingQueueTest2()
        {
            var q = new RingQueue <int>(50, ushort.MaxValue + 1);

            for (int i = 0; i < ushort.MaxValue - 10; i++)
            {
                q.Set(i, i);
                Assert.True(q.TryDequeue(out var iCheck));
                Assert.AreEqual(i, iCheck);
            }

            var setStatus = q.IsSet(ushort.MaxValue - 20);

            Assert.True(setStatus.HasFlag(ItemSetStatus.Set));

            for (int i = ushort.MaxValue - 10; i < ushort.MaxValue + 10; i++)
            {
                q.Set(i % (ushort.MaxValue + 1), 42);
            }
        }