Esempio n. 1
0
        public void TestRemoveBeforeDataPresentItemBeforeNotPresent()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.RemoveBefore(1);
        }
Esempio n. 2
0
        public void TestRemoveAfterDataPresentItemAfterNotPresent()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.RemoveAfter(3);
        }
Esempio n. 3
0
        public void TestAddBeforeDataNotPresent()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.AddBefore(4, 2);
        }
Esempio n. 4
0
        public void TestDeleteIndexOutOfRangePositive()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.DeleteIndex(3);
        }
Esempio n. 5
0
        public void TestNodeDataLinkedListValue()
        {
            MyLL <int>         llinner = new MyLL <int>(1);
            MyLL <MyLL <int> > llouter = new MyLL <MyLL <int> >(llinner);
            var actual = llouter.GetHeadData();

            Assert.IsInstanceOfType(actual, llinner.GetType());
        }
Esempio n. 6
0
        public void TestToStringOverrideEmptyList()
        {
            MyLL <int> ll     = new MyLL <int>();
            var        expect = "";
            var        actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 7
0
        public void TestPopEndNonEmptyList()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);
            var        expect   = 3;
            var        actual   = ll.PopEnd();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 8
0
        public void TestGetSizeEmptyList()
        {
            // Doubles as test of Empty Constructor
            MyLL <int> ll     = new MyLL <int>();
            var        expect = (int)0;
            var        actual = ll.GetSize();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 9
0
        public void TestToStringOverride()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);
            var        expect   = "1, 2, 3";
            var        actual   = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 10
0
        public void TestAddAtEndToEmptyList()
        {
            MyLL <int> ll     = new MyLL <int>();
            var        expect = "1";

            ll.AddAtEnd(1);
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 11
0
        public void TestGetSizeMultipleNodeList()
        {
            // Doubles as test of Multiple Data Constructor
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);
            var        expect   = (int)3;
            var        actual   = ll.GetSize();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 12
0
        public void TestAddAtFrontToNonEmptyList()
        {
            MyLL <int> ll     = new MyLL <int>(1);
            var        expect = "2, 1";

            ll.AddAtFront(2);
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 13
0
        public void TestAddBeforeDataPresent()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.AddBefore(2, 4);
            var expect = "1, 4, 2, 3";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 14
0
        public void TestAppendEmptyToEmpty()
        {
            MyLL <int> lla = new MyLL <int>();
            MyLL <int> llb = new MyLL <int>();

            lla.Append(llb);
            var expect = 0;
            var actual = lla.GetSize();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 15
0
        public void TestGetSizeOneNodeList()
        {
            // Doubles as test of Single Data Constructor
            MyLL <int> ll     = new MyLL <int>(3);
            var        expect = (int)1;
            var        actual = ll.GetSize();

            Assert.AreEqual(expect, actual);
            // CAUTION: Head and Tail of 1 node list should be the same node, not just equivalent value
            Assert.AreEqual(ll.GetHeadData(), ll.GetTailData());
        }
Esempio n. 16
0
        public void TestRemoveBeforeDataPresentItemBeforePresentFirstItem()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.RemoveBefore(2);
            var expect = "2, 3";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 17
0
        public void TestAppendNonEmptyToEmpty()
        {
            MyLL <int> lla = new MyLL <int>(1);
            MyLL <int> llb = new MyLL <int>();

            lla.Append(llb);
            var expect = "1";
            var actual = lla.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 18
0
        public void TestRemoveAfterDataPresentItemAfterPresentLastItem()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.RemoveAfter(2);
            var expect = "1, 2";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 19
0
        public void TestDeleteIndexPresent()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.DeleteIndex(1);
            var expect = "1, 3";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 20
0
        public void TestAppendNonEmptyToNonEmpty()
        {
            int[]      intsA = { 1, 2 };
            int[]      intsB = { 3, 4 };
            MyLL <int> lla   = new MyLL <int>(intsA);
            MyLL <int> llb   = new MyLL <int>(intsB);

            lla.Append(llb);
            var expect = "1, 2, 3, 4";
            var actual = lla.ToString();

            Assert.AreEqual(expect, actual);
        }
Esempio n. 21
0
 public void TestGetTailDataNullValue()
 {
     MyLL <string> ll     = new MyLL <string>();
     var           errata = ll.GetTailData();
 }
Esempio n. 22
0
 public void TestPopEndEmptyList()
 {
     MyLL <int> ll     = new MyLL <int>();
     var        errata = ll.PopEnd();
 }