| 224 | } |
| 225 | |
| 226 | std::string CommonOptions::toString(std::vector<std::string> const& _selectedOptions) const |
| 227 | { |
| 228 | if (_selectedOptions.empty()) |
| 229 | return ""; |
| 230 | |
| 231 | auto boolToString = [](bool _value) -> std::string { return _value ? "true" : "false"; }; |
| 232 | // Using std::map to avoid if-else/switch-case block |
| 233 | std::map<std::string, std::string> optionValueMap = { |
| 234 | {"evmVersion", evmVersion().name()}, |
| 235 | {"optimize", boolToString(optimize)}, |
| 236 | {"useABIEncoderV1", boolToString(useABIEncoderV1)}, |
| 237 | {"batch", std::to_string(selectedBatch + 1) + "/" + std::to_string(batches)}, |
| 238 | {"enforceGasTest", boolToString(enforceGasTest)}, |
| 239 | {"enforceGasTestMinValue", enforceGasTestMinValue.str()}, |
| 240 | {"disableSemanticTests", boolToString(disableSemanticTests)}, |
| 241 | {"disableSMT", boolToString(disableSMT)}, |
| 242 | {"showMessages", boolToString(showMessages)}, |
| 243 | {"showMetadata", boolToString(showMetadata)} |
| 244 | }; |
| 245 | |
| 246 | soltestAssert(ranges::all_of(_selectedOptions, [&optionValueMap](std::string const& _option) { return optionValueMap.count(_option) > 0; })); |
| 247 | |
| 248 | std::vector<std::string> optionsWithValues = _selectedOptions | |
| 249 | ranges::views::transform([&optionValueMap](std::string const& _option) { return _option + "=" + optionValueMap.at(_option); }) | |
| 250 | ranges::to<std::vector>(); |
| 251 | |
| 252 | return solidity::util::joinHumanReadable(optionsWithValues); |
| 253 | } |
| 254 | |
| 255 | void CommonOptions::printSelectedOptions(std::ostream& _stream, std::string const& _linePrefix, std::vector<std::string> const& _selectedOptions) const |
| 256 | { |