Exemple #1
0
        public void Normal()
        {
            PredictableList <int> list = new PredictableList <int>(2);

            Assert.AreEqual(0, list.count);

            list.Add(3);
            Assert.AreEqual(1, list.count);
            list.Add(8);
            list.Add(5);
            Assert.AreEqual(3, list.count);

            Assert.AreEqual(3, list.buffer[0]);
            Assert.AreEqual(8, list.buffer[1]);
            Assert.AreEqual(5, list.buffer[2]);

            list.Clear();
            Assert.AreEqual(0, list.count);
        }
Exemple #2
0
        public void Alocation()
        {
            PredictableList <int> list = new PredictableList <int>(2);

            Assert.AreEqual(0, list.count);
            Assert.AreEqual(2, list.buffer.Length);

            list.Add(3);
            Assert.AreEqual(1, list.count);
            CollectionAssert.AreEqual(new int[] { 3, 0 }, list.buffer);

            list.Add(8);
            Assert.AreEqual(2, list.count);
            CollectionAssert.AreEqual(new int[] { 3, 8 }, list.buffer);

            list.Add(5);
            Assert.AreEqual(3, list.count);
            CollectionAssert.AreEqual(new int[] { 3, 8, 5, 0 }, list.buffer);

            list.Clear();
            Assert.AreEqual(0, list.count);
            CollectionAssert.AreEqual(new int[] { 0, 0, 0, 0 }, list.buffer);
        }