Esempio n. 1
0
        public void Indexer_Null()
        {
            var ll     = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();
            var actual = ll[0];

            Assert.IsNull(actual);
        }
Esempio n. 2
0
        public void Constructor(int[] data)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>(data);

            Assert.AreEqual(data.Length, ll.Count);
            for (int i = 0; i < data.Length; i++)
            {
                Assert.AreEqual(data[i], ll[i].value);
            }
        }
Esempio n. 3
0
        public void InsertAt_Exception(int[] data, int number, int position)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            ll.InsertAt(number, position);
        }
Esempio n. 4
0
        public void Indexer_Exception(int[] data, int idx)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            var actual = ll[idx];
        }
Esempio n. 5
0
        public void Delete_Exception(int[] data, int toDelete)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            ll.Delete(toDelete);
        }
Esempio n. 6
0
        public void IndexOf_Exception(int[] data, int number, int start)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            var actual = ll.IndexOf(start, number);
        }
Esempio n. 7
0
        public void IndexOf(int[] data, int number, int start, int expected)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            var actual = ll.IndexOf(start, number);

            Assert.AreEqual(actual, expected);
        }
Esempio n. 8
0
        public void Indexer(int[] data, int idx, object expected)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            var actual = ll[idx];

            Assert.AreEqual(expected, actual?.value);
        }
Esempio n. 9
0
        public void Add(int[] data)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            Assert.AreEqual(data.Length, ll.Count);
            for (int i = 0; i < data.Length; i++)
            {
                Assert.AreEqual(data[i], ll[i].value);
            }
        }
Esempio n. 10
0
        public void InsertAt(int[] data, int number, int position, int[] expected)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            ll.InsertAt(number, position);

            Assert.AreEqual(expected.Length, ll.Count);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], ll[i].value);
            }
        }
Esempio n. 11
0
        public void Delete(int[] data, int toDelete, int[] expected)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            ll.Delete(toDelete);

            Assert.AreEqual(expected.Length, ll.Count);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], ll[i].value);
            }
        }