Example #1
0
        public void TestQueueBehavior()
        {
            List <char> chars = new List <char> {
                'a', 'b', 'c'
            };

            SimpleQueue <char> charQueue = new SimpleQueue <char>(chars);

            chars.Add('d');
            chars.Add('e');
            chars.Add('f');

            charQueue.Enqueue('d');
            charQueue.Enqueue('e');
            charQueue.Enqueue('f');

            int index = 0;

            while (!charQueue.IsEmpty())
            {
                Assert.AreEqual(chars[index++], charQueue.Dequeue());
            }

            Assert.AreEqual(0, charQueue.Count);
        }
Example #2
0
        static bool TestCase_IsEmpty()  //Drabosenig Andreas
        {
            bool        result = false;
            SimpleQueue q1     = new SimpleQueue(3);

            if (q1.IsEmpty() == true)
            {
                result = true;
            }
            return(result);
        }
Example #3
0
        public void TestClearBehavior()
        {
            List <char> chars = new List <char> {
                'a', 'b', 'c'
            };

            SimpleQueue <char> charQueue = new SimpleQueue <char>(chars);

            charQueue.Clear();

            Assert.AreEqual(0, charQueue.Count);
            Assert.AreEqual(true, charQueue.IsEmpty());
        }