Improve speed of unit test

This commit is contained in:
Marcus Holland-Moritz 2020-11-22 15:21:22 +01:00
parent d5b52e98f6
commit c288466b2a
2 changed files with 4 additions and 3 deletions

View File

@ -177,7 +177,7 @@ void basic_end_to_end_test(const std::string& compressor,
std::ostringstream logss; std::ostringstream logss;
stream_logger lgr(logss); // TODO: mock stream_logger lgr(logss); // TODO: mock
lgr.set_policy<debug_logger_policy>(); lgr.set_policy<prod_logger_policy>();
scanner s(lgr, wg, cfg, scanner s(lgr, wg, cfg,
entry_factory::create(no_owner, no_time, entry_factory::create(no_owner, no_time,

View File

@ -416,10 +416,11 @@ const std::string& loremipsum() { return s_loremipsum; }
std::string loremipsum(size_t size) { std::string loremipsum(size_t size) {
std::string str; std::string str;
while (str.size() < size) { str.reserve(size);
while (str.size() + s_loremipsum.size() <= size) {
str += s_loremipsum; str += s_loremipsum;
} }
str.resize(size); str.append(s_loremipsum.data(), size - str.size());
return str; return str;
} }
} // namespace test } // namespace test