public void ReverseDeepTest()
        {
            Random rnd = new Random(0);

            int[] random = Enumerable.Range(1, 1_000_000)
                           .Select(n => rnd.Next(1, 100)).ToArray();

            Q1LinkedList list = new Q1LinkedList();

            for (int i = 0; i < random.Length; i++)
            {
                list.Insert(random[i]);
            }

            list.DeepReverse();

            int idx = 0;

            foreach (var k in list.GetReverseEnumerator())
            {
                Assert.AreEqual(random[idx++], k);
            }

            foreach (var k in list.GetForwardEnumerator())
            {
                Assert.AreEqual(random[--idx], k);
            }
        }
        public void DeepReverseSimpleTest()
        {
            Q1LinkedList list = new Q1LinkedList();

            for (int i = 0; i < 5; i++)
            {
                list.Insert(i);
            }

            list.DeepReverse();

            int idx = 0;

            foreach (var k in list.GetReverseEnumerator())
            {
                Assert.AreEqual(idx++, k);
            }

            foreach (var k in list.GetForwardEnumerator())
            {
                Assert.AreEqual(--idx, k);
            }
        }
Example #3
0
        public void DeepReverseSimpleTest()
        {
            //Assert.Inconclusive("Not Implemented");
            Q1LinkedList list = new Q1LinkedList();

            for (int i = 0; i < 100; i++)
            {
                list.Insert(i);
            }

            list.DeepReverse();

            int idx = 0;

            foreach (var k in list.GetReverseEnumerator())
            {
                Assert.AreEqual(idx++, k);
            }

            foreach (var k in list.GetForwardEnumerator())
            {
                Assert.AreEqual(--idx, k);
            }
        }