Exemple #1
0
    public void TestRemoveAtEmptiesRightBlock() {
      Deque<int> intDeque = new Deque<int>(16);
      for(int item = 0; item <= 16; ++item) {
        intDeque.AddLast(item);
      }
      intDeque.RemoveAt(13);

      Assert.AreEqual(16, intDeque.Count);

      for(int index = 0; index < 13; ++index) {
        Assert.AreEqual(index, intDeque[index]);
      }
      for(int index = 13; index < 16; ++index) {
        Assert.AreEqual(index + 1, intDeque[index]);
      }
    }
Exemple #2
0
    public void TestRemoveAtNonNormalized() {
      for(int testedIndex = 0; testedIndex < 96; ++testedIndex) {
        Deque<int> intDeque = new Deque<int>(16);
        for(int item = 4; item < 96; ++item) {
          intDeque.AddLast(item);
        }
        intDeque.AddFirst(3);
        intDeque.AddFirst(2);
        intDeque.AddFirst(1);
        intDeque.AddFirst(0);

        intDeque.RemoveAt(testedIndex);

        Assert.AreEqual(95, intDeque.Count);

        for(int index = 0; index < testedIndex; ++index) {
          Assert.AreEqual(index, intDeque[index]);
        }
        for(int index = testedIndex; index < 95; ++index) {
          Assert.AreEqual(index + 1, intDeque[index]);
        }
      }
    }