示例#1
0
        public void Can_resize_up()
        {
            int capacity        = Resettable.StartCapacity;
            int currentPosition = Resettable.StartCapacity;

            int[] array = new int[Resettable.StartCapacity];
            Resettable <int> .IncrementPosition(ref array, ref capacity, ref currentPosition);

            Assert.AreEqual(Resettable.StartCapacity * Resettable.ResetRatio, array.Length);
        }
示例#2
0
        public void Copies_values_on_resize_up()
        {
            int capacity        = Resettable.StartCapacity;
            int currentPosition = capacity;

            int[] array = new int[Resettable.StartCapacity];
            array[0] = 30;
            Resettable <int> .IncrementPosition(ref array, ref capacity, ref currentPosition);

            Assert.AreEqual(30, array[0]);
        }
示例#3
0
        public void Does_not_resize_when_capacity_was_in_use()
        {
            int capacity        = Resettable.StartCapacity;
            int currentPosition = Resettable.StartCapacity;

            int[] array = new int[Resettable.StartCapacity];
            Resettable <int> .IncrementPosition(ref array, ref capacity, ref currentPosition);

            Assert.AreEqual(Resettable.StartCapacity * Resettable.ResetRatio, array.Length);

            Resettable <int> .Reset(ref array, ref capacity, ref currentPosition, Resettable.StartCapacity);

            Assert.AreEqual(Resettable.StartCapacity * Resettable.ResetRatio, array.Length);
        }
示例#4
0
        public void Delays_downsizing()
        {
            int capacity        = Resettable.StartCapacity;
            int currentPosition = Resettable.StartCapacity * Resettable.ResetRatio;

            int[] array = new int[Resettable.StartCapacity];

            Resettable <int> .IncrementPosition(ref array, ref capacity, ref currentPosition);

            Assert.AreEqual(Resettable.StartCapacity * Resettable.ResetRatio * Resettable.ResetRatio, array.Length);

            Resettable <int> .Reset(ref array, ref capacity, ref currentPosition);

            Assert.AreEqual(Resettable.StartCapacity * Resettable.ResetRatio * Resettable.ResetRatio, array.Length);

            Resettable <int> .Reset(ref array, ref capacity, ref currentPosition);

            Assert.AreEqual(Resettable.StartCapacity * Resettable.ResetRatio, array.Length);
        }
示例#5
0
 private void IncrementChangePosition()
 {
     Resettable <Change> .IncrementPosition(ref _changes, ref _capacity, ref _currentPosition);
 }