Address PR feedback

This commit is contained in:
jonawals
2021-05-28 15:39:28 +01:00
parent 728d3b4b98
commit c63de35b68
2 changed files with 14 additions and 11 deletions
@@ -50,14 +50,14 @@ namespace TestImpact
CommandLineOptionsException,
AZStd::string::format("Unexpected number of parameters for %s option", optionName.c_str()));
const auto str = cmd.GetSwitchValue(optionName, 0);
size_t end = 0;
auto value = AZStd::stoul(str, &end, 0);
const auto strValue = cmd.GetSwitchValue(optionName, 0);
size_t successfulParse = 0; // Will be non-zero if the parse was successful
auto value = AZStd::stoul(strValue, &successfulParse, 0);
AZ_TestImpact_Eval(
end,
successfulParse,
CommandLineOptionsException,
AZStd::string::format("Couldn't parse unsigned integer option value: %s", str.c_str()));
AZStd::string::format("Couldn't parse unsigned integer option value: %s", strValue.c_str()));
return aznumeric_caster(value);
}
@@ -47,13 +47,15 @@ namespace TestImpact
AZStd::string::format("Unexpected number of parameters for %s option", optionName.c_str()));
const auto option = cmd.GetSwitchValue(optionName, 0);
if (option == state.first.first)
if (const auto& [optionValueText, optionValue] = state.first;
option == optionValueText)
{
return state.first.second;
return optionValue;
}
else if (option == state.second.first)
if (const auto& [optionValueText, optionValue] = state.second;
option == optionValueText)
{
return state.second.second;
return optionValue;
}
throw CommandLineOptionsException(
@@ -81,9 +83,10 @@ namespace TestImpact
const auto option = cmd.GetSwitchValue(optionName, 0);
for (const auto& state : states)
{
if (option == state.first)
if (const auto& [optionValueText, optionValue] = state;
option == optionValueText)
{
return state.second;
return optionValue;
}
}