tests/test-vector.cpp
changeset 17 563aea5eba06
parent 11 cfe800908837
     1.1 --- a/tests/test-vector.cpp	Thu Aug 29 23:51:30 2013 -0700
     1.2 +++ b/tests/test-vector.cpp	Sat Aug 31 19:52:41 2013 -0700
     1.3 @@ -125,6 +125,35 @@
     1.4      if (!check(vector.length() == 3, "vector length is 3"))
     1.5        return false;
     1.6  
     1.7 +    vector.insert(0, 88);
     1.8 +    vector.insert(0, 99);
     1.9 +    vector.insert(4, 111);
    1.10 +    if (!check(vector[0] == 99, "[0] should be 99"))
    1.11 +      return false;
    1.12 +    if (!check(vector[1] == 88, "[1] should be 88"))
    1.13 +      return false;
    1.14 +    if (!check(vector[2] == 1, "[2] should be 1"))
    1.15 +      return false;
    1.16 +    if (!check(vector[3] == 2, "[3] should be 2"))
    1.17 +      return false;
    1.18 +    if (!check(vector[4] == 111, "[4] should be 111"))
    1.19 +      return false;
    1.20 +    if (!check(vector[5] == 3, "[5] should be 3"))
    1.21 +      return false;
    1.22 +    if (!check(vector.length() == 6, "length should be 6"))
    1.23 +      return false;
    1.24 +
    1.25 +    vector.remove(5);
    1.26 +    if (!check(vector[4] == 111, "[4] should still be 111"))
    1.27 +      return false;
    1.28 +    vector.remove(0);
    1.29 +    if (!check(vector[0] == 88, "[0] should be 88"))
    1.30 +      return false;
    1.31 +    if (!check(vector[3] == 111, "[3] should be 111"))
    1.32 +      return false;
    1.33 +    if (!check(vector.length() == 4, "length should be 4"))
    1.34 +      return false;
    1.35 +
    1.36      while (!vector.empty())
    1.37        vector.pop();
    1.38