Ejemplo n.º 1
0
        public void TestProcessShortList()
        {
            SinglyLinkedList <int> shortList = new SinglyLinkedList <int>();

            shortList.Add(1);
            shortList.Add(2);
            int value = ProcessList <int> .GetElementFromEndAt(shortList);
        }
Ejemplo n.º 2
0
        public void TestProcessGetLastNumber()
        {
            SinglyLinkedList <int> largerList = new SinglyLinkedList <int>();

            for (int i = 0; i <= 12; i++)
            {
                largerList.Add(i);
            }
            int value = ProcessList <int> .GetElementFromEndAt(largerList, 1);

            Assert.AreEqual(12, value);
        }
Ejemplo n.º 3
0
        public void TestProcessLargeList()
        {
            SinglyLinkedList <int> largerList = new SinglyLinkedList <int>();

            for (int i = 0; i < 33; i++)
            {
                largerList.Add(i);
            }
            int value = ProcessList <int> .GetElementFromEndAt(largerList);

            Assert.AreEqual(33 - 5, value);
        }
Ejemplo n.º 4
0
        static void RunTypedDemo <T> (IEnumerable <T> dataList, int maxFromEnd)
        {
            Console.Write("A singly linked list of the following: ");
            Console.WriteLine(String.Join(",", dataList));

            SinglyLinkedList <T> testData = new SinglyLinkedList <T>();

            dataList.ToList().ForEach(x => testData.Add(x));

            for (int position = 1; position <= maxFromEnd; position++)
            {
                Console.WriteLine(String.Format("Has this value {1} at position {0} from the end of the colleciton", position,
                                                ProcessList <T> .GetElementFromEndAt(testData, position)));
            }
            Console.ReadKey();

            Console.WriteLine();
        }
Ejemplo n.º 5
0
 public void TestProcessEmptyList()
 {
     SinglyLinkedList <int> emptyList = new SinglyLinkedList <int>();
     int value = ProcessList <int> .GetElementFromEndAt(emptyList);
 }