Exemplo n.º 1
0
        public void BackwardInputIteratorTest2()
        {
            int[] data = { 1, 2, 2, 3 };

            int[] output = new int[2];

            int removeValue = 2;

            using (IIntRandomAccessIterator <int> inputIterator = new BackwardInputIterator <int>(data))
            {
                int index = 0;

                IRemoveable removeable = inputIterator as IRemoveable;

                while (!inputIterator.IsEnd())
                {
                    //testing if the remove work

                    if (inputIterator.Read().Equals(removeValue))
                    {
                        removeable.Remove();
                    }
                    else
                    {
                        output[index] = inputIterator.Read();

                        ++index;
                    }

                    inputIterator.MoveNext();
                }

                Assert.IsTrue(output[0] == 3 && output[1] == 1);
            }
        }
Exemplo n.º 2
0
        public void BackwardInputIteratorTest()
        {
            int[] data = { 1, 2, 3 };

            int[] output = new int[data.Length];

            using (IIntRandomAccessIterator <int> inputIterator = new BackwardInputIterator <int>(data))
            {
                int index = 0;

                while (!inputIterator.IsEnd())
                {
                    output[index] = inputIterator.Read();

                    inputIterator.MoveNext();

                    ++index;
                }

                Assert.IsTrue(output[0] == 3 && output[1] == 2 && output[2] == 1);
            }
        }