public void Update()
    {
        if (m_bRunTest == false)
        {
            return;
        }

        m_bRunTest = false;

        m_raqTestQueue = new RandomAccessQueue <int>(5);

        //test queue

        //queue some random items
        for (int i = 0; i < m_raqTestQueue.Capacity; i++)
        {
            m_raqTestQueue.Enqueue(i);
        }

        //peek last itme
        Debug.Log("Peak Item " + m_raqTestQueue.PeakDequeue());

        //print out results
        while (m_raqTestQueue.Count > 0)
        {
            Debug.Log("Dequeued Item " + m_raqTestQueue.Dequeue());
        }

        //test random access

        //queue some random items
        for (int i = 0; i < m_raqTestQueue.Capacity; i++)
        {
            m_raqTestQueue.Enqueue(i);
        }

        for (int i = 0; i < m_raqTestQueue.Count; i++)
        {
            Debug.Log("Random Access Item " + m_raqTestQueue[i]);
        }

        //test clear
        m_raqTestQueue.Clear();

        //test queue expansion
        for (int i = 0; i < 20; i++)
        {
            m_raqTestQueue.Enqueue(i);
        }

        for (int i = 0; i < m_raqTestQueue.Count; i++)
        {
            Debug.Log("Random Access Item " + m_raqTestQueue[i]);
        }
    }
        public Connection(byte bConnectionID)
        {
            m_bConnectionID = bConnectionID;

            m_pakReceivedPackets = new Queue <Packet>();
            m_PacketsInFlight    = new RandomAccessQueue <Packet>();

            m_iPacketsQueuedToSendCount = 0;
            m_iLastAckPacketNumberSent  = 0;
            m_iTotalPacketsReceived     = 0;
        }
Ejemplo n.º 3
0
        public IMXRT_FlexSPI(Machine machine) : base(machine)
        {
            IRQ = new GPIO();
            RegistersCollection = new DoubleWordRegisterCollection(this);
            lutMemory           = new byte[NumberOfLUTs * 4];

            rxQueue = new RandomAccessQueue(FifoDepth * 4);
            txQueue = new RandomAccessQueue(FifoDepth * 4);

            commandsEngine = new CommandsEngine(this);

            DefineRegisters();
            UpdateInterrupts();
        }
Ejemplo n.º 4
0
        public void BinarySearchIncomparable()
        {
            RandomAccessQueue <object> queue = new RandomAccessQueue <object>();

            try
            {
                // object doesn't implement IComparable
                queue.BinarySearch(new object());
                Assert.Fail("Expected exception");
            }
            catch (ArgumentException)
            {
                // Expected
            }
        }
Ejemplo n.º 5
0
        public void StronglyTypedClone()
        {
            RandomAccessQueue<object> queue = new RandomAccessQueue<object>();

            object first = new object();
            object second = new object();
            queue.Enqueue(first);
            queue.Enqueue(second);

            RandomAccessQueue<object> clone = queue.Clone();

            Assert.AreEqual(queue.Count, clone.Count);

            Assert.AreSame(first, queue.Dequeue());
            Assert.AreSame(first, clone.Dequeue());
            Assert.AreSame(second, queue.Dequeue());
            Assert.AreSame(second, clone.Dequeue());
            Assert.AreNotSame(queue.SyncRoot, clone.SyncRoot);
        }
Ejemplo n.º 6
0
        public void ICloneableClone()
        {
            RandomAccessQueue<object> queue = new RandomAccessQueue<object>();

            object first = new object();
            object second = new object();
            queue.Enqueue(first);
            queue.Enqueue(second);

            ICloneable cloneable = queue;
            RandomAccessQueue<object> clone = (RandomAccessQueue<object>)cloneable.Clone();

            Assert.AreEqual(queue.Count, clone.Count);

            Assert.AreSame(first, queue.Dequeue());
            Assert.AreSame(first, clone.Dequeue());
            Assert.AreSame(second, queue.Dequeue());
            Assert.AreSame(second, clone.Dequeue());
            Assert.AreNotSame(queue.SyncRoot, clone.SyncRoot);
        }
Ejemplo n.º 7
0
        public void BinarySearchIncomparable()
        {
            RandomAccessQueue<object> queue = new RandomAccessQueue<object>();

            try
            {
                // object doesn't implement IComparable
                queue.BinarySearch(new object());
                Assert.Fail("Expected exception");
            }
            catch (ArgumentException)
            {
                // Expected
            }
        }