mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Check State
style changes
This commit is contained in:
parent
923e452846
commit
c38c8bb567
@ -157,7 +157,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state, stateOptio
|
|||||||
_state.setStorage(address, toInt(j.first), toInt(j.second));
|
_state.setStorage(address, toInt(j.first), toInt(j.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<iNonce; ++i)
|
for (int i=0; i < iNonce; ++i)
|
||||||
_state.noteSending(address);
|
_state.noteSending(address);
|
||||||
|
|
||||||
_state.ensureCached(address, false, false);
|
_state.ensureCached(address, false, false);
|
||||||
@ -208,10 +208,12 @@ void ImportTest::importTransaction(json_spirit::mObject& _o)
|
|||||||
void ImportTest::checkExpectedState(State const& _stateExpect, State const& _statePost, stateOptionsMap const _expectedStateOptions, WhenError _throw)
|
void ImportTest::checkExpectedState(State const& _stateExpect, State const& _statePost, stateOptionsMap const _expectedStateOptions, WhenError _throw)
|
||||||
{
|
{
|
||||||
#define CHECK(a,b) \
|
#define CHECK(a,b) \
|
||||||
|
{ \
|
||||||
if (_throw == WhenError::Throw) \
|
if (_throw == WhenError::Throw) \
|
||||||
BOOST_CHECK_MESSAGE(a,b); \
|
BOOST_CHECK_MESSAGE(a,b); \
|
||||||
else \
|
else \
|
||||||
BOOST_WARN_MESSAGE(a,b);
|
BOOST_WARN_MESSAGE(a,b); \
|
||||||
|
}
|
||||||
|
|
||||||
for (auto const& a: _stateExpect.addresses())
|
for (auto const& a: _stateExpect.addresses())
|
||||||
{
|
{
|
||||||
@ -233,16 +235,12 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (addressOptions.m_bHasBalance)
|
if (addressOptions.m_bHasBalance)
|
||||||
{
|
|
||||||
CHECK(_stateExpect.balance(a.first) == _statePost.balance(a.first),
|
CHECK(_stateExpect.balance(a.first) == _statePost.balance(a.first),
|
||||||
"Check State: " << a.first << ": incorrect balance " << _statePost.balance(a.first) << ", expected " << _stateExpect.balance(a.first));
|
"Check State: " << a.first << ": incorrect balance " << _statePost.balance(a.first) << ", expected " << _stateExpect.balance(a.first));
|
||||||
}
|
|
||||||
|
|
||||||
if (addressOptions.m_bHasNonce)
|
if (addressOptions.m_bHasNonce)
|
||||||
{
|
|
||||||
CHECK(_stateExpect.transactionsFrom(a.first) == _statePost.transactionsFrom(a.first),
|
CHECK(_stateExpect.transactionsFrom(a.first) == _statePost.transactionsFrom(a.first),
|
||||||
"Check State: " << a.first << ": incorrect nonce " << _statePost.transactionsFrom(a.first) << ", expected " << _stateExpect.transactionsFrom(a.first));
|
"Check State: " << a.first << ": incorrect nonce " << _statePost.transactionsFrom(a.first) << ", expected " << _stateExpect.transactionsFrom(a.first));
|
||||||
}
|
|
||||||
|
|
||||||
if (addressOptions.m_bHasStorage)
|
if (addressOptions.m_bHasStorage)
|
||||||
{
|
{
|
||||||
@ -259,12 +257,10 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (addressOptions.m_bHasCode)
|
if (addressOptions.m_bHasCode)
|
||||||
{
|
|
||||||
CHECK(_stateExpect.code(a.first) == _statePost.code(a.first),
|
CHECK(_stateExpect.code(a.first) == _statePost.code(a.first),
|
||||||
"Check State: " << a.first << ": incorrect code '" << toHex(_statePost.code(a.first)) << "', expected '" << toHex(_stateExpect.code(a.first)) << "'");
|
"Check State: " << a.first << ": incorrect code '" << toHex(_statePost.code(a.first)) << "', expected '" << toHex(_stateExpect.code(a.first)) << "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportTest::exportTest(bytes const& _output, State const& _statePost)
|
void ImportTest::exportTest(bytes const& _output, State const& _statePost)
|
||||||
|
Loading…
Reference in New Issue
Block a user