/* Task 13: * Implement the ADT queue as dynamic linked list. * Use generics (LinkedQueue<T>) to allow storing different data types in the queue. */ static void Main(string[] args) { var customQueue = new CustomQueue<int>(); customQueue.Enqueue(15); customQueue.Enqueue(25); customQueue.Enqueue(35); customQueue.Enqueue(45); Console.WriteLine("Custom Queue Count: {0}", customQueue.Count()); Console.WriteLine("Removed element {0}", customQueue.Dequeue()); Console.WriteLine("Custom Queue Count: {0}", customQueue.Count()); }
public void TestQueueOnLargeDataAmount() { var queue = new CustomQueue <int>(); var array = new int[10000]; var arrayAsString = String.Empty; var queueAsString = String.Empty; for (int i = 0; i < 10000; i++) { queue.Enqueue(i); array[i] = i; } foreach (var item in array) { arrayAsString += item; } while (queue.Count() > 0) { queueAsString += queue.Dequeue(); } Assert.AreEqual(arrayAsString, queueAsString); }
public void TestCountAfterCreation() { var queue = new CustomQueue <int>(); Assert.AreEqual(0, queue.Count()); }