コード例 #1
0
        public void IsEmptyLLafterAddAndRemove()
        {
            IntLinkedList myLL = new IntLinkedList();

            myLL.InsertAtFront(111);
            myLL.InsertAtFront(222);
            myLL.RemoveFromFront();
            myLL.RemoveFromFront();
            myLL.RemoveFromFront();
        }
コード例 #2
0
        // does LL store negative numbers
        public void StoreNegativeNumbers()
        {
            IntLinkedList myLL  = new IntLinkedList();
            int           total = 0;

            myLL.InsertAtFront(-111);
            myLL.InsertAtFront(-222);
            total = total + myLL.RemoveFromFront();
            total = total + myLL.RemoveFromFront();
            Assert.AreEqual <int>(-333, total);
        }
コード例 #3
0
        // does LL hold data correctly, and in the correct order
        // insert 3 values at top, remove 2 from top, total should be = val of the last two added
        public void StoreAndRetrieveFromTop()
        {
            IntLinkedList myLL  = new IntLinkedList();
            int           total = 0;

            myLL.InsertAtFront(111);
            myLL.InsertAtFront(222);
            myLL.InsertAtFront(333);
            total = total + myLL.RemoveFromFront();
            total = total + myLL.RemoveFromFront();
            Assert.AreEqual <int>(555, total);
        }
コード例 #4
0
        // does LL store largest int32
        public void StoreLargestInt32()
        {
            IntLinkedList myLL = new IntLinkedList();

            myLL.InsertAtFront(Int32.MaxValue);
            int actual = myLL.RemoveFromFront();

            Assert.AreEqual <int>(2147483647, actual);
        }