コード例 #1
0
ファイル: AList2_tests.cs プロジェクト: kenobit/Valtech_tasks
        public void AList2_AddEnd_error()
        {
            AList2 al = new AList2(new int[] { 1, 2, 9, 5, 6, 7 });

            al.AddEnd(42);
            Assert.AreEqual("1 2 9 5 6 7 42 ", al.ToString());
        }
コード例 #2
0
        public void NU_AddEnd_AList2(int val, int size, int[] exp)
        {
            AList2 list = new AList2();

            for (int i = 0; i < size; ++i)
            {
                list.AddEnd(val);
            }

            int[] act = list.ToArray();

            Assert.AreEqual(size, list.Size());
            CollectionAssert.AreEqual(exp, act);
        }
コード例 #3
0
        public void AddEnd_Upscale_AList2()
        {
            AList2 list = new AList2();

            for (int i = 0; i < 31; ++i)
            {
                list.AddEnd(0);
            }

            int[] act = list.ToArray();
            int[] exp = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            Assert.AreEqual(31, list.Size());
            CollectionAssert.AreEqual(exp, act);
        }
コード例 #4
0
        public void AListAddEnd36Test()
        {
            int[] mas = new int[36] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 33, 34, 35, 36
            };
            var a = new AList2 <int>();

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

            mas = new int[37] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 33, 34, 35, 36, -1
            };
            Assert.AreEqual(37, size);
            CollectionAssert.AreEqual(mas, a.ToArray());
        }
コード例 #5
0
        public void AListAddEnd36Test()
        {
            var a = new AList2 <Person>();

            a.Init(mas);
            a.AddEnd(new Person(0, "rr", "qwer", 22));
            int size = a.Size();

            mas = new Person[37] {
                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), new Person(17, "rr", "qwer", 22), new Person(18, "rr", "qwer", 22), new Person(19, "rr", "qwer", 22), new Person(20, "rr", "qwer", 22),
                new Person(21, "rr", "qwer", 22), new Person(22, "rr", "qwer", 22), new Person(23, "rr", "qwer", 22), new Person(24, "rr", "qwer", 22), new Person(25, "rr", "qwer", 22),
                new Person(26, "rr", "qwer", 22), new Person(27, "rr", "qwer", 22), new Person(28, "rr", "qwer", 22), new Person(29, "rr", "qwer", 22), new Person(30, "rr", "qwer", 22),
                new Person(31, "rr", "qwer", 22), new Person(32, "rr", "qwer", 22), new Person(33, "rr", "qwer", 22), new Person(34, "rr", "qwer", 22), new Person(35, "rr", "qwer", 22), new Person(36, "rr", "qwer", 22), new Person(0, "rr", "qwer", 22)
            };
            Assert.AreEqual(37, size);
            Assert.AreEqual(mas.ToString(), a.ToArray().ToString());
        }