| 147 | } |
| 148 | |
| 149 | bool Init(int argc, const char* argv[]) { |
| 150 | TVector<TString> tests; |
| 151 | try { |
| 152 | NLastGetopt::TOpts opts; |
| 153 | opts.AddHelpOption(); |
| 154 | |
| 155 | #define OPTION(opt, x) \ |
| 156 | opts.AddLongOption(opt, #x) \ |
| 157 | .Optional() \ |
| 158 | .DefaultValue(ToString(x)) \ |
| 159 | .StoreResult(&x) // end of OPTION |
| 160 | |
| 161 | OPTION('i', Iterations); |
| 162 | OPTION('k', KeyLen); |
| 163 | OPTION('v', ValueLen); |
| 164 | OPTION('r', NumReaders); |
| 165 | OPTION('w', NumWriters); |
| 166 | OPTION('b', BatchSize); |
| 167 | |
| 168 | #undef OPTION |
| 169 | |
| 170 | NLastGetopt::TOptsParseResultException optsRes(&opts, argc, argv); |
| 171 | for (const auto& opt : opts.Opts_) { |
| 172 | const NLastGetopt::TOptParseResult* r = optsRes.FindOptParseResult(opt.Get(), true); |
| 173 | if (r) { |
| 174 | LogInfo() << "[-" << opt->GetChar() << "] " << opt->GetName() << ": " << r->Back() << Endl; |
| 175 | } |
| 176 | } |
| 177 | tests = optsRes.GetFreeArgs(); |
| 178 | } catch (...) { |
| 179 | LogError() << CurrentExceptionMessage() << Endl; |
| 180 | return false; |
| 181 | } |
| 182 | |
| 183 | #define TEST(type) \ |
| 184 | AddTest(#type, std::bind(&TTestSuite::Y_CAT(TEST_, type), this)) // end of TEST |
| 185 | |
| 186 | TEST(Clear); |
| 187 | TEST(InsertRandom); |
| 188 | TEST(InsertSequential); |
| 189 | TEST(InsertSequentialSimple); |
| 190 | TEST(LookupRandom); |
| 191 | TEST(Concurrent); |
| 192 | |
| 193 | #undef TEST |
| 194 | |
| 195 | if (tests.empty()) { |
| 196 | LogError() << "no tests specified, choose from: " << PrintTests() << Endl; |
| 197 | return false; |
| 198 | } |
| 199 | |
| 200 | for (size_t i = 0; i < tests.size(); ++i) { |
| 201 | if (!AllTests.contains(tests[i])) { |
| 202 | LogError() << "unknown test name: " << tests[i] << Endl; |
| 203 | return false; |
| 204 | } |
| 205 | Tests.push_back(AllTests[tests[i]]); |
| 206 | } |
no test coverage detected