| 215 | }; |
| 216 | |
| 217 | BOOST_AUTO_TEST_CASE(PrevectorTestInt) |
| 218 | { |
| 219 | for (int j = 0; j < 64; j++) { |
| 220 | prevector_tester<8, int> test; |
| 221 | for (int i = 0; i < 2048; i++) { |
| 222 | if (InsecureRandBits(2) == 0) { |
| 223 | test.insert(InsecureRandRange(test.size() + 1), int(InsecureRand32())); |
| 224 | } |
| 225 | if (test.size() > 0 && InsecureRandBits(2) == 1) { |
| 226 | test.erase(InsecureRandRange(test.size())); |
| 227 | } |
| 228 | if (InsecureRandBits(3) == 2) { |
| 229 | int new_size = std::max(0, std::min(30, (int)test.size() + (int)InsecureRandRange(5) - 2)); |
| 230 | test.resize(new_size); |
| 231 | } |
| 232 | if (InsecureRandBits(3) == 3) { |
| 233 | test.insert(InsecureRandRange(test.size() + 1), 1 + InsecureRandBool(), int(InsecureRand32())); |
| 234 | } |
| 235 | if (InsecureRandBits(3) == 4) { |
| 236 | int del = std::min<int>(test.size(), 1 + (InsecureRandBool())); |
| 237 | int beg = InsecureRandRange(test.size() + 1 - del); |
| 238 | test.erase(beg, beg + del); |
| 239 | } |
| 240 | if (InsecureRandBits(4) == 5) { |
| 241 | test.push_back(int(InsecureRand32())); |
| 242 | } |
| 243 | if (test.size() > 0 && InsecureRandBits(4) == 6) { |
| 244 | test.pop_back(); |
| 245 | } |
| 246 | if (InsecureRandBits(5) == 7) { |
| 247 | int values[4]; |
| 248 | int num = 1 + (InsecureRandBits(2)); |
| 249 | for (int k = 0; k < num; k++) { |
| 250 | values[k] = int(InsecureRand32()); |
| 251 | } |
| 252 | test.insert_range(InsecureRandRange(test.size() + 1), values, values + num); |
| 253 | } |
| 254 | if (InsecureRandBits(5) == 8) { |
| 255 | int del = std::min<int>(test.size(), 1 + (InsecureRandBits(2))); |
| 256 | int beg = InsecureRandRange(test.size() + 1 - del); |
| 257 | test.erase(beg, beg + del); |
| 258 | } |
| 259 | if (InsecureRandBits(5) == 9) { |
| 260 | test.reserve(InsecureRandBits(5)); |
| 261 | } |
| 262 | if (InsecureRandBits(6) == 10) { |
| 263 | test.shrink_to_fit(); |
| 264 | } |
| 265 | if (test.size() > 0) { |
| 266 | test.update(InsecureRandRange(test.size()), int(InsecureRand32())); |
| 267 | } |
| 268 | if (InsecureRandBits(10) == 11) { |
| 269 | test.clear(); |
| 270 | } |
| 271 | if (InsecureRandBits(9) == 12) { |
| 272 | test.assign(InsecureRandBits(5), int(InsecureRand32())); |
| 273 | } |
| 274 | if (InsecureRandBits(3) == 3) { |
nothing calls this directly
no test coverage detected