Randomly fills the contents of 'string' up to the given length.
| 76 | |
| 77 | /// Randomly fills the contents of 'string' up to the given length. |
| 78 | void RandomlyFillString(char* string, const int length) { |
| 79 | ASSERT_GT(length, 0); |
| 80 | unsigned int rand_seed = RandSeed(); |
| 81 | int char_count = static_cast<int>('~') - static_cast<int>(' ') + 1; |
| 82 | for (int i = 0; i < length - 1; ++i) { |
| 83 | string[i] = ' ' + rand_r(&rand_seed) % char_count; |
| 84 | } |
| 85 | string[length - 1] = '\0'; |
| 86 | } |
| 87 | |
| 88 | void AssertErrorMessageContains(const std::string& message, const char* expected) { |
| 89 | ASSERT_TRUE(message.find(expected) != std::string::npos) |
no test coverage detected