Review suggestions.

This commit is contained in:
Daniel Kirchner
2019-03-18 14:34:00 +01:00
parent 4a28e1eb43
commit a178486436
12 changed files with 38 additions and 40 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ using namespace dev;
using namespace std;
using namespace boost::unit_test;
SMTCheckerTest::SMTCheckerTest(string const& _filename, langutil::EVMVersion const _evmVersion)
SMTCheckerTest::SMTCheckerTest(string const& _filename, langutil::EVMVersion _evmVersion)
: SyntaxTest(_filename, _evmVersion)
{
if (!boost::algorithm::ends_with(_filename, ".sol"))
@@ -49,7 +49,7 @@ SMTCheckerTest::SMTCheckerTest(string const& _filename, langutil::EVMVersion con
BOOST_THROW_EXCEPTION(runtime_error("Invalid JSON file."));
}
bool SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
bool SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
{
StandardCompiler compiler;
+2 -2
View File
@@ -35,11 +35,11 @@ class SMTCheckerTest: public SyntaxTest
public:
static std::unique_ptr<TestCase> create(Config const& _config)
{
return std::unique_ptr<TestCase>(new SMTCheckerTest(_config.filename, _config.evmVersion));
return std::make_unique<SMTCheckerTest>(_config.filename, _config.evmVersion);
}
SMTCheckerTest(std::string const& _filename, langutil::EVMVersion _evmVersion);
bool run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
bool run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override;
private:
std::vector<std::string> hashesFromJson(Json::Value const& _jsonObj, std::string const& _auxInput, std::string const& _smtlib);
+3 -3
View File
@@ -36,7 +36,7 @@ using namespace boost::unit_test;
namespace fs = boost::filesystem;
SemanticTest::SemanticTest(string const& _filename, string const& _ipcPath, langutil::EVMVersion const _evmVersion):
SemanticTest::SemanticTest(string const& _filename, string const& _ipcPath, langutil::EVMVersion _evmVersion):
SolidityExecutionFramework(_ipcPath, _evmVersion)
{
ifstream file(_filename);
@@ -47,7 +47,7 @@ SemanticTest::SemanticTest(string const& _filename, string const& _ipcPath, lang
parseExpectations(file);
}
bool SemanticTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
bool SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
{
soltestAssert(deploy("", 0, bytes()), "Failed to deploy contract.");
@@ -87,7 +87,7 @@ bool SemanticTest::run(ostream& _stream, string const& _linePrefix, bool const _
return true;
}
void SemanticTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const
void SemanticTest::printSource(ostream& _stream, string const& _linePrefix, bool) const
{
stringstream stream(m_source);
string line;
+3 -3
View File
@@ -46,10 +46,10 @@ public:
static std::unique_ptr<TestCase> create(Config const& _options)
{ return std::make_unique<SemanticTest>(_options.filename, _options.ipcPath, _options.evmVersion); }
explicit SemanticTest(std::string const& _filename, std::string const& _ipcPath, langutil::EVMVersion const _evmVersion);
explicit SemanticTest(std::string const& _filename, std::string const& _ipcPath, langutil::EVMVersion _evmVersion);
bool run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
void printSource(std::ostream &_stream, std::string const& _linePrefix = "", bool const _formatted = false) const override;
bool run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override;
void printSource(std::ostream &_stream, std::string const& _linePrefix = "", bool _formatted = false) const override;
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix = "") const override;
/// Instantiates a test file parser that parses the additional comment section at the end of
@@ -33,7 +33,7 @@ SolidityExecutionFramework::SolidityExecutionFramework():
{
}
SolidityExecutionFramework::SolidityExecutionFramework(std::string const& _ipcPath, langutil::EVMVersion const _evmVersion):
SolidityExecutionFramework::SolidityExecutionFramework(std::string const& _ipcPath, langutil::EVMVersion _evmVersion):
ExecutionFramework(_ipcPath, _evmVersion)
{
}
@@ -43,7 +43,7 @@ class SolidityExecutionFramework: public dev::test::ExecutionFramework
public:
SolidityExecutionFramework();
SolidityExecutionFramework(std::string const& _ipcPath, langutil::EVMVersion const _evmVersion);
SolidityExecutionFramework(std::string const& _ipcPath, langutil::EVMVersion _evmVersion);
virtual bytes const& compileAndRunWithoutCheck(
std::string const& _sourceCode,
+5 -5
View File
@@ -52,7 +52,7 @@ int parseUnsignedInteger(string::iterator& _it, string::iterator _end)
}
SyntaxTest::SyntaxTest(string const& _filename, langutil::EVMVersion const _evmVersion): m_evmVersion(_evmVersion)
SyntaxTest::SyntaxTest(string const& _filename, langutil::EVMVersion _evmVersion): m_evmVersion(_evmVersion)
{
ifstream file(_filename);
if (!file)
@@ -63,7 +63,7 @@ SyntaxTest::SyntaxTest(string const& _filename, langutil::EVMVersion const _evmV
m_expectations = parseExpectations(file);
}
bool SyntaxTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
bool SyntaxTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
{
string const versionPragma = "pragma solidity >=0.0;\n";
m_compiler.reset();
@@ -95,7 +95,7 @@ bool SyntaxTest::run(ostream& _stream, string const& _linePrefix, bool const _fo
return printExpectationAndError(_stream, _linePrefix, _formatted);
}
bool SyntaxTest::printExpectationAndError(ostream& _stream, string const& _linePrefix, bool const _formatted)
bool SyntaxTest::printExpectationAndError(ostream& _stream, string const& _linePrefix, bool _formatted)
{
if (m_expectations != m_errorList)
{
@@ -109,7 +109,7 @@ bool SyntaxTest::printExpectationAndError(ostream& _stream, string const& _lineP
return true;
}
void SyntaxTest::printSource(ostream& _stream, string const& _linePrefix, bool const _formatted) const
void SyntaxTest::printSource(ostream& _stream, string const& _linePrefix, bool _formatted) const
{
if (_formatted)
{
@@ -162,7 +162,7 @@ void SyntaxTest::printErrorList(
ostream& _stream,
vector<SyntaxTestError> const& _errorList,
string const& _linePrefix,
bool const _formatted
bool _formatted
)
{
if (_errorList.empty())
+6 -6
View File
@@ -54,12 +54,12 @@ class SyntaxTest: AnalysisFramework, public TestCase
{
public:
static std::unique_ptr<TestCase> create(Config const& _config)
{ return std::unique_ptr<TestCase>(new SyntaxTest(_config.filename, _config.evmVersion)); }
SyntaxTest(std::string const& _filename, langutil::EVMVersion const _evmVersion);
{ return std::make_unique<SyntaxTest>(_config.filename, _config.evmVersion); }
SyntaxTest(std::string const& _filename, langutil::EVMVersion _evmVersion);
bool run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
bool run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override;
void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const override;
void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool _formatted = false) const override;
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override
{
if (!m_errorList.empty())
@@ -72,10 +72,10 @@ protected:
std::ostream& _stream,
std::vector<SyntaxTestError> const& _errors,
std::string const& _linePrefix,
bool const _formatted = false
bool _formatted = false
);
virtual bool printExpectationAndError(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false);
virtual bool printExpectationAndError(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false);
static std::vector<SyntaxTestError> parseExpectations(std::istream& _stream);