26 #include <boost/test/unit_test.hpp> 27 #include <boost/filesystem.hpp> 28 #include <boost/progress.hpp> 50 void mine(Client&
c,
int numBlocks);
52 void mine(
Block& _s, BlockChain
const& _bc, SealEngineFace* _sealer);
53 void mine(BlockHeader& _bi, SealEngineFace* _sealer,
bool _verify =
true);
67 #define ETH_TEST_REQUIRE_NO_THROW(_statement, _message) \ 72 BOOST_TEST_PASSPOINT(); \ 75 catch (boost::exception const& _e) \ 77 auto msg = std::string(_message " due to an exception thrown by " \ 78 BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \ 79 BOOST_CHECK_IMPL(false, msg, REQUIRE, CHECK_MSG); \ 83 BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \ 84 BOOST_STRINGIZE(_statement), REQUIRE, CHECK_MSG); \ 93 #define ETH_TEST_CHECK_NO_THROW(_statement, _message) \ 98 BOOST_TEST_PASSPOINT(); \ 101 catch (boost::exception const& _e) \ 103 auto msg = std::string(_message " due to an exception thrown by " \ 104 BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \ 105 BOOST_CHECK_IMPL(false, msg, CHECK, CHECK_MSG); \ 109 BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \ 110 BOOST_STRINGIZE(_statement), CHECK, CHECK_MSG ); \ 129 std::string
compileLLL(std::string
const& _code);
133 void copyFile(std::string
const& _source, std::string
const& _destination);
137 void checkStorage(std::map<u256, u256> _expectedStore, std::map<u256, u256> _resultStore,
Address _expectedAddr);
141 h256 const& _parentHash,
142 h256 const& _sha3Uncles,
144 h256 const& _stateRoot,
145 h256 const& _transactionsRoot,
146 h256 const& _receiptsRoot,
148 u256 const& _difficulty,
150 u256 const& _gasLimit,
151 u256 const& _gasUsed,
152 u256 const& _timestamp,
153 bytes const& _extraData);
180 virtual void testStarted(std::string
const& _name) = 0;
181 virtual void testFinished(int64_t _gasUsed) = 0;
183 static void registerListener(
Listener& _listener);
184 static void notifySuiteStarted(std::string
const& _name);
185 static void notifyTestStarted(std::string
const& _name);
186 static void notifyTestFinished(int64_t _gasUsed);
191 int64_t m_gasUsed = -1;
193 ExecTimeGuard(std::string
const& _testName) { notifyTestStarted(_testName); }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
#define function(a, b, c, d, k, s)
Helper class for managing data when running state tests.
string netIdToString(eth::Network _netId)
bytes importData(json_spirit::mObject const &_o)
ExecTimeGuard(std::string const &_testName)
Allows observing test execution process.
void doRlpTests(json_spirit::mValue &v, bool _fillin)
Fixture class for boost output when running testeth.
void checkOutput(bytesConstRef _output, json_spirit::mObject &_o)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>> bigint
std::vector< Transaction > Transactions
Nice name for vector of Transaction.
void connectClients(Client &c1, Client &c2)
u256 bid(eth::TransactionPriority=eth::TransactionPriority::Medium) const override
Access a block of memory.
Model of an Ethereum state, essentially a facade for the trie.
Class for handling testeth custom options.
json_spirit::mObject fillJsonWithTransaction(Transaction const &_txn)
void updateEthashSeal(dev::eth::BlockHeader &_header, h256 const &_mixHash, h64 const &_nonce)
void checkLog(LogEntries _resultLogs, LogEntries _expectedLogs)
void doStateTests(json_spirit::mValue &_v, bool _fillin)
Active model of a block within the block chain.
std::vector< h256 > LastHashes
Base class for all exceptions.
void userDefinedTest(std::function< void(json_spirit::mValue &, bool)> doTests)
mConfig::Array_type mArray
dev::eth::BlockHeader constructHeader(h256 const &_parentHash, h256 const &_sha3Uncles, Address const &_author, h256 const &_stateRoot, h256 const &_transactionsRoot, h256 const &_receiptsRoot, dev::eth::LogBloom const &_logBloom, u256 const &_difficulty, u256 const &_number, u256 const &_gasLimit, u256 const &_gasUsed, u256 const &_timestamp, bytes const &_extraData)
void doTransactionTests(json_spirit::mValue &_v, bool _fillin)
byte toByte(json_spirit::mValue const &_v)
RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject const &_tObj)
Test started/finished notification RAII helper.
json_spirit::mArray exportLog(eth::LogEntries _logs)
std::vector< byte > bytes
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
json_spirit::mObject fillJsonWithState(State const &_state)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
bytes importCode(json_spirit::mObject &_o)
void copyFile(std::string const &_source, std::string const &_destination)
Encodes a transaction, ready to be exported to or freshly imported from RLP.
std::unordered_map< Address, AccountMask > AccountMaskMap
mConfig::Object_type mObject
eth::Network stringToNetId(std::string const &_netname)
std::string compileLLL(std::string const &_code)
void doVMTests(json_spirit::mValue &_v, bool _fillin)
void replaceLLLinState(json_spirit::mObject &_o)
u256 ask(eth::Block const &) const override
LastHashes lastHashes(u256 _currentBlockNumber)
void setGasUsed(int64_t _gas)
void doBlockchainTests(json_spirit::mValue &_v, bool _fillin)
bytes importByteArray(std::string const &_str)
void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates)
virtual void suiteStarted(std::string const &)
void checkStorage(std::map< u256, u256 > _expectedStore, std::map< u256, u256 > _resultStore, Address _expectedAddr)
void executeTests(const std::string &_name, const std::string &_testPathAppendix, const std::string &_fillerPathAppendix, std::function< void(json_spirit::mValue &, bool)> doTests, bool _addFillerSuffix=true)
Class for writing to an RLP bytestream.
void mine(Client &c, int numBlocks)
LogEntries importLog(json_spirit::mArray &_a)
u256 toInt(json_spirit::mValue const &_v)
bigint const c_max256plus1
std::vector< LogEntry > LogEntries