示例#1
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());
        }
        public void NU_AddStart_AList1(int[] ini, int val, int size, int[] exp)
        {
            AList1 list = new AList1();

            list.Init(ini);
            list.AddStart(val);

            int[] act = list.ToArray();

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

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

            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);
        }
示例#4
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());
        }
示例#5
0
        public void AListAddStart16Test()
        {
            var a = new AList1 <Person>();

            a.Init(mas);
            Person tmp = new Person(17, "rr", "qwer", 22);

            a.AddStart(tmp);
            int size = a.Size();

            Assert.AreEqual(17, size);
            mas = new Person[17] {
                new Person(17, "rr", "qwer", 22), 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(mas.ToString(), a.ToArray().ToString());
        }