コード例 #1
0
        private void Fill(ref CodePointBuffer b, List <int> l, int count, int range)
        {
            var rng = new Random(0);

            for (int i = 0; i < count; i++)
            {
                var n = rng.Next(i);
                var c = rng.Next(range + 1);
                l.Insert(n, c);
                b.Insert(n, c);
            }
        }
コード例 #2
0
        public void InsertTest(params int[] input)
        {
            var b = new CodePointBuffer(4);

            for (int i = 0; i < input.Length; i++)
            {
                b.Insert(i, input[i]);
            }

            Assert.Equal(input.Length, b.Count);
            for (int i = 0; i < input.Length; i++)
            {
                Assert.Equal(input[i], b[i]);
            }
        }
コード例 #3
0
        public void RemoveTest2()
        {
            var b = new CodePointBuffer(4);

            b.InsertRange(0, new int[] { 1, 2, 3, 4, 6, 7, 80000, 9 }, 0, 8);
            b.Insert(4, 5);

            b.RemoveRange(3, 4);

            Assert.Equal(5, b.Count);
            Assert.Equal(1, b[0]);
            Assert.Equal(2, b[1]);
            Assert.Equal(3, b[2]);
            Assert.Equal(80000, b[3]);
            Assert.Equal(9, b[4]);
        }