Exemple #1
0
        public void TestInsert()
        {
            var l = new Listard <Position>();

            Position[] block = new Position[] { new Position("47|11"), new Position("47|12"), new Position("48|13") };
            l.Add(block);
            l.InsertAt(new Position[] { new Position("57|14"), new Position("57|15") }, 3);
            l.InsertAt(new Position[] { new Position("57|16"), new Position("57|17") }, 2);
            l.InsertAt(new Position[] { new Position("57|18"), new Position("57|19") }, 1);
            l.InsertAt(new Position[] { new Position("57|20"), new Position("57|21") }, 0);

            string[] check =
            {
                "57|20", "57|21", "47|11",
                "57|18", "57|19", "47|12",
                "57|16", "57|17", "48|13",
                "57|14", "57|15"
            };
            for (int i = 0; i < check.Length; i++)
            {
                if (l[i].Text != check[i])
                {
                    throw new Exception();
                }
            }
        }
        public void TestInsert()
        {
            var l = new Listard <int>();

            l.Add(new int[] { 10, 20, 30 });
            l.InsertAt(new int[] { 300, 301 }, 3);
            l.InsertAt(new int[] { 200, 201 }, 2);
            l.InsertAt(new int[] { 100, 101 }, 1);
            l.InsertAt(new int[] { 000, 001 }, 0);

            int[] block = { 0, 1, 10, 100, 101, 20, 200, 201, 30, 300, 301 };
            for (int i = 0; i < block.Length; i++)
            {
                if (l[i] != block[i])
                {
                    throw new Exception();
                }
            }
        }