Exemple #1
0
        public void RotateCopyTest2()
        {
            int[] data = { 1, 2, 3, 4, 5 };

            IList <int> lst = new List <int>();

            using (IInputIterator <int> inputIterator = new InputIterator <int>(data))
            {
                IShallowClone cloneable = (IShallowClone)inputIterator;

                IInputIterator <int> cloneObj = cloneable.ShallowClone() as IInputIterator <int>;
                cloneObj.End();

                ICursor cursor = (ICursor)cloneObj;
                cursor.SetPosition(cursor.GetPosition() - 2);

                //set the first element to 4element position

                using (IOutputIterator <int> outputIterator = new BackInsertIterator <int>(lst))
                {
                    Algorithm.RotateCopy(inputIterator, cloneObj, outputIterator);
                }
            }

            bool isCorrectData = (lst[0] == 4 && lst[1] == 5 &&
                                  lst[2] == 1 && lst[3] == 2 &&
                                  lst[4] == 3);

            Assert.IsTrue(isCorrectData);
        }
Exemple #2
0
 public void End()
 {
     inputIterator.End();
 }