mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11287 from ethereum/isoltest-minor
Small refactorings for isoltest
This commit is contained in:
commit
1eff128b6d
@ -83,13 +83,18 @@ string TestFunctionCall::format(
|
|||||||
stream << _linePrefix << newline << ws << m_call.signature;
|
stream << _linePrefix << newline << ws << m_call.signature;
|
||||||
if (m_call.value.value > u256(0))
|
if (m_call.value.value > u256(0))
|
||||||
{
|
{
|
||||||
if (m_call.value.unit == FunctionValueUnit::Ether)
|
switch (m_call.value.unit)
|
||||||
|
{
|
||||||
|
case FunctionValueUnit::Ether:
|
||||||
stream << comma << ws << (m_call.value.value / exp256(10, 18)) << ws << ether;
|
stream << comma << ws << (m_call.value.value / exp256(10, 18)) << ws << ether;
|
||||||
else if (m_call.value.unit == FunctionValueUnit::Wei)
|
break;
|
||||||
|
case FunctionValueUnit::Wei:
|
||||||
stream << comma << ws << m_call.value.value << ws << wei;
|
stream << comma << ws << m_call.value.value << ws << wei;
|
||||||
else
|
break;
|
||||||
|
default:
|
||||||
soltestAssert(false, "");
|
soltestAssert(false, "");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!m_call.arguments.rawBytes().empty())
|
if (!m_call.arguments.rawBytes().empty())
|
||||||
{
|
{
|
||||||
string output = formatRawParameters(m_call.arguments.parameters, _linePrefix);
|
string output = formatRawParameters(m_call.arguments.parameters, _linePrefix);
|
||||||
@ -360,6 +365,7 @@ void TestFunctionCall::reset()
|
|||||||
{
|
{
|
||||||
m_rawBytes = bytes{};
|
m_rawBytes = bytes{};
|
||||||
m_failure = true;
|
m_failure = true;
|
||||||
|
m_contractABI = Json::Value{};
|
||||||
m_calledNonExistingFunction = false;
|
m_calledNonExistingFunction = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ private:
|
|||||||
bool m_failure = true;
|
bool m_failure = true;
|
||||||
/// JSON object which holds the contract ABI and that is used to set the output formatting
|
/// JSON object which holds the contract ABI and that is used to set the output formatting
|
||||||
/// in the interactive update routine.
|
/// in the interactive update routine.
|
||||||
Json::Value m_contractABI;
|
Json::Value m_contractABI = Json::Value{};
|
||||||
/// Flags that the test failed because the called function is not known to exist on the contract.
|
/// Flags that the test failed because the called function is not known to exist on the contract.
|
||||||
bool m_calledNonExistingFunction = false;
|
bool m_calledNonExistingFunction = false;
|
||||||
};
|
};
|
||||||
|
@ -151,7 +151,6 @@ bool TestTool::m_exitRequested = false;
|
|||||||
TestTool::Result TestTool::process()
|
TestTool::Result TestTool::process()
|
||||||
{
|
{
|
||||||
bool formatted{!m_options.noColor};
|
bool formatted{!m_options.noColor};
|
||||||
std::stringstream outputMessages;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -168,6 +167,8 @@ TestTool::Result TestTool::process()
|
|||||||
m_options.enforceGasTestMinValue
|
m_options.enforceGasTestMinValue
|
||||||
});
|
});
|
||||||
if (m_test->shouldRun())
|
if (m_test->shouldRun())
|
||||||
|
{
|
||||||
|
std::stringstream outputMessages;
|
||||||
switch (TestCase::TestResult result = m_test->run(outputMessages, " ", formatted))
|
switch (TestCase::TestResult result = m_test->run(outputMessages, " ", formatted))
|
||||||
{
|
{
|
||||||
case TestCase::TestResult::Success:
|
case TestCase::TestResult::Success:
|
||||||
@ -183,6 +184,7 @@ TestTool::Result TestTool::process()
|
|||||||
cout << endl << outputMessages.str() << endl;
|
cout << endl << outputMessages.str() << endl;
|
||||||
return result == TestCase::TestResult::FatalError ? Result::Exception : Result::Failure;
|
return result == TestCase::TestResult::FatalError ? Result::Exception : Result::Failure;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AnsiColorized(cout, formatted, {BOLD, YELLOW}) << "NOT RUN" << endl;
|
AnsiColorized(cout, formatted, {BOLD, YELLOW}) << "NOT RUN" << endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user