Пример #1
0
        public void Empty()
        {
            LinkedListToy <int> list = new LinkedListToy <int>();

            C02Q01.RemoveDupes(list);
            Assert.Null(list.Head);
        }
Пример #2
0
        public void TwoElements()
        {
            LinkedListToy <int> list = new LinkedListToy <int>(7, 7);

            C02Q01.RemoveDupes(list);
            Assert.NotNull(list.Head);
            Assert.Equal(7, list.Head.Data);
            Assert.Null(list.Head.Next);
        }
Пример #3
0
        public void SingleElement()
        {
            LinkedListToy <int> list = new LinkedListToy <int>(1);

            C02Q01.RemoveDupes(list);
            Assert.NotNull(list.Head);
            Assert.Equal(1, list.Head.Data);
            Assert.Null(list.Head.Next);
        }
Пример #4
0
        public void NoDupes()
        {
            LinkedListToy <int> list = new LinkedListToy <int>(7, 8, 9);

            C02Q01.RemoveDupes(list);
            Assert.NotNull(list.Head);
            Assert.Equal(7, list.Head.Data);
            Assert.Equal(8, list.Head.Next.Data);
            Assert.Equal(9, list.Head.Next.Next.Data);
            Assert.Null(list.Head.Next.Next.Next);
        }
Пример #5
0
        public void ShortTest()
        {
            LinkedListToy <int> list = new LinkedListToy <int>(1, 2, 2, 3, 1);

            C02Q01.RemoveDupes(list);

            var node = list.Head;

            int[] expectedOutcome = { 1, 2, 3 };
            foreach (int i in expectedOutcome)
            {
                Assert.Equal(i, node.Data);
                node = node.Next;
            }
            Assert.Null(node);
        }