Пример #1
0
        public void llist1_Delete_Start_DeleteValue_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.DeleteStart();
            Assert.AreEqual("2 9 5 6 7 ", ll.ToString());
        }
        private IList ConvertToListType(string iniString)
        {
            IList list = null;

            switch (iniString)
            {
            case "AList0":
                list = new AList0();
                break;

            case "AList1":
                list = new AList1();
                break;

            case "AList2":
                list = new AList2();
                break;

            case "AListR":
                list = new AListR();
                break;

            case "LList1":
                list = new LList1();
                break;

            default:
                break;
            }
            return(list);
        }
Пример #3
0
        public void llist1_AddPosition_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.AddPosition(42, 4);
            Assert.AreEqual("1 2 9 5 42 6 7 ", ll.ToString());
        }
Пример #4
0
        public void llist1_Delete_Position_DeleteValue_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.DeletePos(3);
            Assert.AreEqual("1 2 9 6 7 ", ll.ToString());
        }
Пример #5
0
        public void llist1_AddEnd_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.AddEnd(42);
            Assert.AreEqual("1 2 9 5 6 7 42 ", ll.ToString());
        }
Пример #6
0
        public void llist1_AddStart_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.AddStart(42);
            Assert.AreEqual("42 1 2 9 5 6 7 ", ll.ToString());
        }
Пример #7
0
        public void llist1_Half_Reverse_odd_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.HalfReverse();
            Assert.AreEqual("9 2 1 5 6 7 ", ll.ToString());
        }
Пример #8
0
        public void llist1_Delete_End_DeleteValue_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.DeleteEnd();
            Assert.AreEqual("1 2 9 5 6 ", ll.ToString());
        }
Пример #9
0
        public void llist1_Sort_error()
        {
            LList1 ll = new LList1(new int[] { 2, 1, 9, 5, 6, 7 });

            ll.Sort();
            Assert.AreEqual("1 2 5 6 7 9 ", ll.ToString());
        }
Пример #10
0
        public void llist1_Set_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.Set(42, 3);
            Assert.AreEqual("1 2 9 42 6 7 ", ll.ToString());
        }
Пример #11
0
        public void llist1_Reverse_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            ll.Reverse();
            Assert.AreEqual("7 6 5 9 2 1 ", ll.ToString());
        }
Пример #12
0
        public void llist2_Init_error()
        {
            LList2 ll = new LList2();

            ll.Init(new int[] { 1, 2, 9, 5, 6, 2 });
            LList1 al1 = new LList1();

            al1.Init(new int[] { 1, 2, 9, 5, 6, 2 });
            // llist al1 = new llist(new int[] { 1, 2, 9, 5, 6, 2 });
            Assert.AreEqual(ll.ToString(), al1.ToString());
            //Assert.AreEqual("1 2 9 5 6 ", al.ToString());
        }
        public void TestEnumerator_LList1(int[] ini, int[] expected)
        {
            LList1 list = new LList1();

            list.Init(ini);
            int[] actual   = new int[ini.Length];
            int   iterator = 0;

            foreach (var item in list)
            {
                actual[iterator++] = (int)item;
            }
            CollectionAssert.AreEqual(actual, expected);
        }
Пример #14
0
        public void llist1_Min_Index_error()
        {
            LList1 ll = new LList1(new int[] { 0, 2, 9, 5, 6, 7 });

            Assert.AreEqual(0, ll.MinIndex());
        }
Пример #15
0
        public void llist1_Max_Index_error()
        {
            LList1 ll = new LList1(new int[] { 1, 2, 9, 5, 6, 7 });

            Assert.AreEqual(2, ll.MaxIndex());
        }