TestFunctionCall::formatRawParameters(): Ensure that uint8_t overload of toHex() is called

- Wrong overload results in isoltest padding each char to 32 bytes
This commit is contained in:
Kamil Śliwak
2021-11-15 20:52:25 +01:00
parent 7334420423
commit 90fdea95e7
3 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -219,7 +219,7 @@ string BytesUtils::formatString(bytes const& _bytes, size_t _cutOff)
if (isprint(v))
os << v;
else
os << "\\x" << toHex(v);
os << "\\x" << toHex(v, HexCase::Lower);
}
}
os << "\"";
+3 -1
View File
@@ -322,7 +322,9 @@ string TestFunctionCall::formatRawParameters(
if (param.format.newline)
os << endl << _linePrefix << "// ";
for (auto const c: param.rawString)
os << (c >= ' ' ? string(1, c) : "\\x" + toHex(static_cast<uint8_t>(c)));
// NOTE: Even though we have a toHex() overload specifically for uint8_t, the compiler
// chooses the one for bytes if the second argument is omitted.
os << (c >= ' ' ? string(1, c) : "\\x" + toHex(static_cast<uint8_t>(c), HexCase::Lower));
if (&param != &_params.back())
os << ", ";
}