| 22 | } |
| 23 | |
| 24 | static int ParseThreadArg(const std::string& flag, const std::string& value) { |
| 25 | int parsed = 0; |
| 26 | try { |
| 27 | size_t consumed = 0; |
| 28 | parsed = std::stoi(value, &consumed); |
| 29 | if (consumed != value.size()) { |
| 30 | throw std::invalid_argument("extra characters"); |
| 31 | } |
| 32 | } catch (const std::exception&) { |
| 33 | throw std::runtime_error("Invalid " + flag + " value: " + value + " (expected >= 2)"); |
| 34 | } |
| 35 | |
| 36 | if (parsed < 2) { |
| 37 | throw std::runtime_error("Invalid " + flag + " value: " + value + " (expected >= 2)"); |
| 38 | } |
| 39 | |
| 40 | return parsed; |
| 41 | } |
| 42 | |
| 43 | BenchmarkOptions ParseBenchmarkOptions(const std::vector<std::string>& args) { |
| 44 | BenchmarkOptions options; |
no outgoing calls
no test coverage detected