| 93 | } |
| 94 | |
| 95 | std::string getRandomAsciiStr(unsigned int len) { |
| 96 | std::string s; |
| 97 | s.reserve(len); |
| 98 | static const char start[] = {'a', 'A', '0'}; |
| 99 | static const int size[] = {26, 26, 10}; |
| 100 | |
| 101 | for (unsigned int i = 0; i < len; i++) { |
| 102 | unsigned int index = |
| 103 | folly::Random::rand32(sizeof(start) / sizeof(start[0])); |
| 104 | const char c = |
| 105 | (start[index] + static_cast<char>(folly::Random::rand32(size[index]))); |
| 106 | s += c; |
| 107 | } |
| 108 | XDCHECK_EQ(s.length(), len); |
| 109 | return s; |
| 110 | } |
| 111 | |
| 112 | } // namespace test_util |
| 113 | } // namespace cachelib |
no outgoing calls
no test coverage detected