Browse Source

Adding ETH_TEST macros to ABI and EndToEndTests

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
557af1e691
  1. 12
      test/SolidityABIJSON.cpp
  2. 14
      test/solidityExecutionFramework.h

12
test/SolidityABIJSON.cpp

@ -20,7 +20,7 @@
* Unit tests for the solidity compiler JSON Interface output.
*/
#include <boost/test/unit_test.hpp>
#include "TestHelper.h"
#include <libsolidity/CompilerStack.h>
#include <json/json.h>
#include <libdevcore/Exceptions.h>
@ -39,15 +39,7 @@ public:
void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString)
{
try
{
m_compilerStack.parse(_code);
}
catch(boost::exception const& _e)
{
auto msg = std::string("Parsing contract failed with: ") + boost::diagnostic_information(_e);
BOOST_FAIL(msg);
}
ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse(_code), "Parsing contract failed");
std::string generatedInterfaceString = m_compilerStack.getMetadata("", DocumentationType::ABIInterface);
Json::Value generatedInterface;
m_reader.parse(generatedInterfaceString, generatedInterface);

14
test/solidityExecutionFramework.h

@ -25,7 +25,7 @@
#include <string>
#include <tuple>
#include <boost/test/unit_test.hpp>
#include "TestHelper.h"
#include <libethereum/State.h>
#include <libethereum/Executive.h>
#include <libsolidity/CompilerStack.h>
@ -46,16 +46,8 @@ public:
bytes const& compileAndRun(std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "")
{
dev::solidity::CompilerStack compiler(m_addStandardSources);
try
{
compiler.addSource("", _sourceCode);
compiler.compile(m_optimize);
}
catch(boost::exception const& _e)
{
auto msg = std::string("Compiling contract failed with: ") + boost::diagnostic_information(_e);
BOOST_FAIL(msg);
}
compiler.addSource("", _sourceCode);
ETH_TEST_REQUIRE_NO_THROW(compiler.compile(m_optimize), "Compiling contract failed");
bytes code = compiler.getBytecode(_contractName);
sendMessage(code, true, _value);

Loading…
Cancel
Save