MCPcopy Create free account
hub / github.com/argotorg/solidity / toString

Method toString

test/Common.cpp:226–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226std::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
255void CommonOptions::printSelectedOptions(std::ostream& _stream, std::string const& _linePrefix, std::vector<std::string> const& _selectedOptions) const
256{

Callers 8

matchEventMethod · 0.45
runMethod · 0.45
getErrorsMethod · 0.45
loadSourceFunction · 0.45
updateGitHubEditPathFunction · 0.45
initializeFunction · 0.45
handleClickFunction · 0.45

Calls 7

joinHumanReadableFunction · 0.85
strMethod · 0.80
atMethod · 0.80
to_stringFunction · 0.50
emptyMethod · 0.45
nameMethod · 0.45
countMethod · 0.45

Tested by 3

matchEventMethod · 0.36
runMethod · 0.36
getErrorsMethod · 0.36