| 3388 | } |
| 3389 | |
| 3390 | static std::string createRandomData (size_t length) |
| 3391 | { |
| 3392 | std::ostringstream out (std::ios::binary); |
| 3393 | size_t total = 0; |
| 3394 | |
| 3395 | while (total < length) |
| 3396 | { |
| 3397 | size_t reps = 1; |
| 3398 | |
| 3399 | if ((rand() & 7) > 4) |
| 3400 | reps += (size_t) ((rand() & 7) < 5 ? (rand() & 7) : (rand() & 1023)); |
| 3401 | |
| 3402 | auto c = rand() & 255; |
| 3403 | |
| 3404 | for (size_t i = 0; i < reps; ++i) |
| 3405 | out << (char) c; |
| 3406 | |
| 3407 | total += reps; |
| 3408 | } |
| 3409 | |
| 3410 | return out.str().substr (0, length); |
| 3411 | } |
| 3412 | |
| 3413 | static void testZLIB (choc::test::TestProgress& progress) |
| 3414 | { |