mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[isoltest] Fixes hex (plus alignment) formatting.
This commit is contained in:
parent
42290f912b
commit
e206ad6c24
@ -101,7 +101,7 @@ contract C {
|
|||||||
// g1() -> FAILURE
|
// g1() -> FAILURE
|
||||||
// h(uint256,uint256): 1, -2 -> 3
|
// h(uint256,uint256): 1, -2 -> 3
|
||||||
// j(bool): true -> false
|
// j(bool): true -> false
|
||||||
// k(bytes32): 0x10 -> 0x10, 0x10
|
// k(bytes32): 0x1001 -> 0x1001, 0x1001
|
||||||
// l(): hex"4200efef" -> 8
|
// l(): hex"4200efef" -> 8
|
||||||
// m(bytes): 32, 32, 0x20 -> 32, 32, 0x20
|
// m(bytes): 32, 32, 0x20 -> 32, 32, 0x20
|
||||||
// m(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB)
|
// m(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB)
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include <liblangutil/Common.h>
|
#include <liblangutil/Common.h>
|
||||||
|
|
||||||
|
#include <libdevcore/StringUtils.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -159,13 +161,8 @@ string BytesUtils::formatBoolean(bytes const& _bytes)
|
|||||||
|
|
||||||
string BytesUtils::formatHex(bytes const& _bytes)
|
string BytesUtils::formatHex(bytes const& _bytes)
|
||||||
{
|
{
|
||||||
stringstream os;
|
u256 value = fromBigEndian<u256>(_bytes);
|
||||||
|
return toCompactHexWithPrefix(value);
|
||||||
string hex{toHex(_bytes, HexPrefix::Add)};
|
|
||||||
boost::algorithm::replace_all(hex, "00", "");
|
|
||||||
os << hex;
|
|
||||||
|
|
||||||
return os.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string BytesUtils::formatHexString(bytes const& _bytes)
|
string BytesUtils::formatHexString(bytes const& _bytes)
|
||||||
|
@ -193,7 +193,7 @@ string TestFunctionCall::formatBytesParameters(
|
|||||||
fill_n(
|
fill_n(
|
||||||
back_inserter(defaultParameters),
|
back_inserter(defaultParameters),
|
||||||
ceil(_bytes.size() / 32),
|
ceil(_bytes.size() / 32),
|
||||||
Parameter{bytes(), "", ABIType{ABIType::UnsignedDec}, FormatInfo{}}
|
Parameter{bytes(), "", ABIType{ABIType::Hex}, FormatInfo{}}
|
||||||
);
|
);
|
||||||
ContractABIUtils::overwriteParameters(_errorReporter, defaultParameters, _parameters);
|
ContractABIUtils::overwriteParameters(_errorReporter, defaultParameters, _parameters);
|
||||||
os << BytesUtils::formatBytesRange(_bytes, defaultParameters, _highlight);
|
os << BytesUtils::formatBytesRange(_bytes, defaultParameters, _highlight);
|
||||||
|
Loading…
Reference in New Issue
Block a user