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

            al.Sort();
            Assert.AreEqual("1 2 5 6 7 9 ", al.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 AList1_Half_Reverse_odd_error()
        {
            AList1 al = new AList1(new int[] { 1, 2, 9, 5, 6, 7 });

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

            al.DeletePos(3);
            Assert.AreEqual("1 2 9 6 7 ", al.ToString());
        }
Пример #5
0
        public void AList1_Init_error()
        {
            AList1 al = new AList1();

            al.Init(new int[] { 1, 2, 9, 5, 6, 7 });
            Assert.AreEqual("1 2 9 5 6 7 ", al.ToString());
        }
Пример #6
0
        public void AList1_AddStart_error()
        {
            AList1 al = new AList1(new int[] { 1, 2, 9, 5, 6, 7 });

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

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

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

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

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

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

            al.Reverse();
            Assert.AreEqual("7 6 5 9 2 1 ", al.ToString());
        }
Пример #13
0
        public void AListMax16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            Person res = a.Max();

            Assert.AreEqual(16, res.ID);
        }
Пример #14
0
        public void AListSize16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            int size = a.Size();

            Assert.AreEqual(16, size);
        }
Пример #15
0
        public void AListMaxI16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            int res = a.MaxI();

            Assert.AreEqual(15, res);
        }
Пример #16
0
        public void AListGet16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            Person res = a.Get(3);

            Assert.AreEqual((new Person(10, "rr", "qwer", 22)).ToString(), res.ToString());
        }
Пример #17
0
        public void AListTOArrey16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            int size = a.Size();

            Assert.AreEqual(16, size);
            CollectionAssert.AreEqual(mas, a.ToArray());
        }
Пример #18
0
        public void AListSize16Test()
        {
            var a = new AList1 <int>();

            int[] mas = new int[16];
            a.Init(mas);
            int size = a.Size();

            Assert.AreEqual(16, size);
        }
        public void NU_Init_AList1(int[] ini, int size, int[] exp)
        {
            AList1 list = new AList1();

            list.Init(ini);

            int[] act = list.ToArray();

            Assert.AreEqual(size, list.Size());
            CollectionAssert.AreEqual(exp, act);
        }
Пример #20
0
        public void AListDelStart16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            Person res  = a.DelStart();
            int    size = a.Size();

            Assert.AreEqual(15, size);
            Assert.AreEqual(res.ToString(), (new Person(1, "rr", "qwer", 22)).ToString());
            Assert.AreEqual(a.ToArray().ToString(), mas.ToString());
        }
Пример #21
0
        public void AListGet16Test()
        {
            int[] mas = new int[16] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
            };
            var a = new AList1 <int>();

            a.Init(mas);
            int res = a.Get(3);

            Assert.AreEqual(4, res);
        }
        public void Init_AList1()
        {
            AList1 list = new AList1();

            list.Init(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });

            int[] act = list.ToArray();
            int[] exp = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            Assert.AreEqual(11, list.Size());
            CollectionAssert.AreEqual(exp, act);
        }
        public void AddPos_AList1()
        {
            AList1 list = new AList1();

            list.Init(new int[] { 0, 1, 2, 4, 5, 6, 7, 8, 9 });
            list.AddPos(3, 3);

            int[] act = list.ToArray();
            int[] exp = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            Assert.AreEqual(10, list.Size());
            CollectionAssert.AreEqual(exp, act);
        }
Пример #24
0
        public void AListTOArrey16Test()
        {
            int[] mas = new int[16] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
            };
            var a = new AList1 <int>();

            a.Init(mas);
            int size = a.Size();

            Assert.AreEqual(16, size);
            CollectionAssert.AreEqual(mas, a.ToArray());
        }
        public void TestEnumerator_AList1(int[] ini, int[] expected)
        {
            AList1 list = new AList1();

            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);
        }
Пример #26
0
        public void AListSort16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            a.Sort();
            mas = new Person[16] {
                new Person(1, "rr", "qwer", 22), new Person(2, "rr", "qwer", 22), new Person(3, "rr", "qwer", 22), new Person(4, "rr", "qwer", 22),
                new Person(5, "rr", "qwer", 22), new Person(6, "rr", "qwer", 22), new Person(7, "rr", "qwer", 22), new Person(8, "rr", "qwer", 22), new Person(9, "rr", "qwer", 22),
                new Person(10, "rr", "qwer", 22), new Person(11, "rr", "qwer", 22), new Person(12, "rr", "qwer", 22), new Person(13, "rr", "qwer", 22), new Person(14, "rr", "qwer", 22),
                new Person(15, "rr", "qwer", 22), new Person(16, "rr", "qwer", 22)
            };
            Assert.AreEqual(16, a.Size());
            Assert.AreEqual(a.ToArray().ToString(), mas.ToString());
        }
Пример #27
0
        public void AListSet16Test()
        {
            int[] mas = new int[16] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
            };
            var a = new AList1 <int>();

            a.Init(mas);
            a.Set(8, -3);
            mas = new int[16] {
                1, 2, 3, 4, 5, 6, 7, 8, -3, 10, 11, 12, 13, 14, 15, 16
            };
            Assert.AreEqual(16, a.Size());
            Assert.AreEqual(-3, a.Get(8));
            CollectionAssert.AreEqual(mas, a.ToArray());
        }
Пример #28
0
        public void AListAddStart16Test()
        {
            int[] mas = new int[16] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
            };
            var a = new AList1 <int>();

            a.Init(mas);
            a.AddStart(-1);
            int size = a.Size();

            Assert.AreEqual(17, size);
            mas = new int[17] {
                -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
            };
            CollectionAssert.AreEqual(mas, a.ToArray());
        }
Пример #29
0
        public void AListHalfREverseOdd16Test()
        {
            int[] mas = new int[15] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
            };
            var a = new AList1 <int>();

            a.Init(mas);
            a.HalfReverse();
            int size = a.Size();

            Assert.AreEqual(15, size);
            mas = new int[15] {
                9, 10, 11, 12, 13, 14, 15, 8, 1, 2, 3, 4, 5, 6, 7
            };
            CollectionAssert.AreEqual(mas, a.ToArray());
        }
Пример #30
0
        public void AListDelPos16Test()
        {
            int[] mas = new int[16] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
            };
            var a = new AList1 <int>();

            a.Init(mas);
            int res  = a.DelPos(3);
            int size = a.Size();

            Assert.AreEqual(15, size);
            Assert.AreEqual(4, res);
            mas = new int[15] {
                1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
            };
            CollectionAssert.AreEqual(mas, a.ToArray());
        }