| 94 | // Copy-paste of STLPort tests |
| 95 | |
| 96 | void Test1() { |
| 97 | TVector<int> v1; // Empty vector of integers. |
| 98 | |
| 99 | UNIT_ASSERT(v1.empty() == true); |
| 100 | UNIT_ASSERT(v1.size() == 0); |
| 101 | UNIT_ASSERT(!v1); |
| 102 | |
| 103 | // UNIT_ASSERT(v1.max_size() == INT_MAX / sizeof(int)); |
| 104 | // cout << "max_size = " << v1.max_size() << endl; |
| 105 | v1.push_back(42); // Add an integer to the vector. |
| 106 | |
| 107 | UNIT_ASSERT(v1.size() == 1); |
| 108 | UNIT_ASSERT(v1); |
| 109 | |
| 110 | UNIT_ASSERT(v1[0] == 42); |
| 111 | |
| 112 | { |
| 113 | TVector<TVector<int>> vect(10); |
| 114 | TVector<TVector<int>>::iterator it(vect.begin()), end(vect.end()); |
| 115 | for (; it != end; ++it) { |
| 116 | UNIT_ASSERT((*it).empty()); |
| 117 | UNIT_ASSERT((*it).size() == 0); |
| 118 | UNIT_ASSERT((*it).capacity() == 0); |
| 119 | UNIT_ASSERT((*it).begin() == (*it).end()); |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | void Test2() { |
| 125 | TVector<double> v1; // Empty vector of doubles. |