mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Minor refactoring
This commit is contained in:
parent
7b64e660c6
commit
7b1ade9223
@ -150,14 +150,10 @@ string fixedBytes(
|
||||
}
|
||||
}
|
||||
|
||||
std::string ValueGenerator::addressLiteral(bool _hexPrefix)
|
||||
std::string ValueGenerator::addressLiteral()
|
||||
{
|
||||
std::uniform_int_distribution<size_t> dist(0, m_addresses.size() - 1);
|
||||
std::string addressLiteral;
|
||||
if (_hexPrefix)
|
||||
addressLiteral = "0x";
|
||||
addressLiteral += m_addresses[dist(m_rand)].hex();
|
||||
return addressLiteral;
|
||||
return "0x" + m_addresses[dist(m_rand)].hex();
|
||||
}
|
||||
|
||||
void ValueGenerator::initialiseType(TypeInfo& _t)
|
||||
@ -190,8 +186,7 @@ void ValueGenerator::initialiseType(TypeInfo& _t)
|
||||
_t.value += addressLiteral();
|
||||
break;
|
||||
case Type::Function:
|
||||
_t.value += "0x" +
|
||||
addressLiteral(false) +
|
||||
_t.value += addressLiteral() +
|
||||
":" +
|
||||
"0x" +
|
||||
fixedBytes(static_cast<size_t>(FixedBytesWidth::Bytes4), m_rand(), true);
|
||||
|
||||
@ -180,10 +180,10 @@ public:
|
||||
std::vector<ArrayInfo>& _arrayInfo,
|
||||
TypeInfo& _typeInfo
|
||||
);
|
||||
std::string addressLiteral(bool _hexPrefix = true);
|
||||
std::string addressLiteral();
|
||||
private:
|
||||
std::ostringstream m_stream;
|
||||
std::minstd_rand m_rand;
|
||||
std::mt19937_64 m_rand;
|
||||
Json::Value const& m_type;
|
||||
std::bernoulli_distribution m_bernoulli;
|
||||
std::vector<solidity::util::h160> m_addresses;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user