From 1df63eda3295044fd6c92c79ef44ba1f0c96e1fd Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Thu, 25 Jun 2015 23:34:35 +0400 Subject: [PATCH 1/6] Coverage: script fix --- getcoverage.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getcoverage.sh b/getcoverage.sh index 196629170..4249eecfe 100755 --- a/getcoverage.sh +++ b/getcoverage.sh @@ -39,9 +39,9 @@ if which lcov >/dev/null; then lcov --capture --initial --directory $BUILD_DIR --output-file $OUTPUT_DIR/coverage_base.info echo Running testeth... - $CPP_ETHEREUM_PATH/build/test/testeth $TEST_MODE - $CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit $TEST_MODE - $CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit $TEST_MODE + $BUILD_DIR/test/testeth $TEST_MODE + $BUILD_DIR/test/testeth -t StateTests --jit $TEST_MODE + $BUILD_DIR/test/testeth -t VMTests --jit $TEST_MODE echo Prepearing coverage info... lcov --capture --directory $BUILD_DIR --output-file $OUTPUT_DIR/coverage_test.info From 4494712371660f03ca84c327facd82ab5c06da25 Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Fri, 26 Jun 2015 13:58:19 +0400 Subject: [PATCH 2/6] Coverage: Filltests option --- getcoverage.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/getcoverage.sh b/getcoverage.sh index 4249eecfe..b11f8dced 100755 --- a/getcoverage.sh +++ b/getcoverage.sh @@ -17,6 +17,10 @@ case $i in TEST_MODE="--all" shift ;; + --filltests) + TEST_FILL="--filltests" + shift + ;; esac done @@ -39,7 +43,7 @@ if which lcov >/dev/null; then lcov --capture --initial --directory $BUILD_DIR --output-file $OUTPUT_DIR/coverage_base.info echo Running testeth... - $BUILD_DIR/test/testeth $TEST_MODE + $BUILD_DIR/test/testeth $TEST_MODE $TEST_FILL $BUILD_DIR/test/testeth -t StateTests --jit $TEST_MODE $BUILD_DIR/test/testeth -t VMTests --jit $TEST_MODE From 085311d8517e217ec9cba97d4a6e9b588c9071cd Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Fri, 26 Jun 2015 14:48:59 +0400 Subject: [PATCH 3/6] Coverage: libethereum::AccountDiff --- test/libethereum/unit.cpp | 70 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/libethereum/unit.cpp diff --git a/test/libethereum/unit.cpp b/test/libethereum/unit.cpp new file mode 100644 index 000000000..28a89df81 --- /dev/null +++ b/test/libethereum/unit.cpp @@ -0,0 +1,70 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file unit.cpp + * @author Dimitry Khokhlov + * @date 2015 + * libethereum unit test functions. + */ + +#include +#include +#include +#include + +BOOST_AUTO_TEST_SUITE(libethereum) + +BOOST_AUTO_TEST_CASE(AccountDiff) +{ + std::cout << "AccountDiff" << std::endl; + dev::eth::AccountDiff accDiff; + + // exist = true exist_from = true AccountChange::Deletion + accDiff.exist = dev::Diff(true, false); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Deletion, "Account change type expected to be Deletion!"); + + // exist = true exist_from = false AccountChange::Creation + accDiff.exist = dev::Diff(false, true); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Creation, "Account change type expected to be Creation!"); + + // exist = false bn = true sc = true AccountChange::All + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::All, "Account change type expected to be All!"); + + // exist = false bn = true sc = false AccountChange::Intrinsic + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Intrinsic, "Account change type expected to be Intrinsic!"); + + // exist = false bn = false sc = true AccountChange::CodeStorage + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 1); + accDiff.balance = dev::Diff(1, 1); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::CodeStorage, "Account change type expected to be CodeStorage!"); + + // exist = false bn = false sc = false AccountChange::None + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 1); + accDiff.balance = dev::Diff(1, 1); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::None, "Account change type expected to be None!"); +} + +BOOST_AUTO_TEST_SUITE_END() From c6074f051a8b3f4ee16ed1c56984ac28e3e71d59 Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Mon, 29 Jun 2015 17:15:13 +0400 Subject: [PATCH 4/6] CodeCoverage: libethereum --- test/libethereum/unit.cpp | 133 +++++++++++++++++++++++++++++++++++++- 1 file changed, 131 insertions(+), 2 deletions(-) diff --git a/test/libethereum/unit.cpp b/test/libethereum/unit.cpp index 28a89df81..2b78d764e 100644 --- a/test/libethereum/unit.cpp +++ b/test/libethereum/unit.cpp @@ -17,40 +17,54 @@ /** @file unit.cpp * @author Dimitry Khokhlov * @date 2015 - * libethereum unit test functions. + * libethereum unit test functions coverage. */ #include #include +#include +#include "../JsonSpiritHeaders.h" + +#include + #include #include +#include +#include + +using namespace dev; +using namespace eth; BOOST_AUTO_TEST_SUITE(libethereum) BOOST_AUTO_TEST_CASE(AccountDiff) { - std::cout << "AccountDiff" << std::endl; dev::eth::AccountDiff accDiff; + // Testing changeType // exist = true exist_from = true AccountChange::Deletion accDiff.exist = dev::Diff(true, false); BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Deletion, "Account change type expected to be Deletion!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "XXX") == 0, "Deletion lead expected to be 'XXX'!"); // exist = true exist_from = false AccountChange::Creation accDiff.exist = dev::Diff(false, true); BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Creation, "Account change type expected to be Creation!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "+++") == 0, "Creation lead expected to be '+++'!"); // exist = false bn = true sc = true AccountChange::All accDiff.exist = dev::Diff(false, false); accDiff.nonce = dev::Diff(1, 2); accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::All, "Account change type expected to be All!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "***") == 0, "All lead expected to be '***'!"); // exist = false bn = true sc = false AccountChange::Intrinsic accDiff.exist = dev::Diff(false, false); accDiff.nonce = dev::Diff(1, 2); accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Intrinsic, "Account change type expected to be Intrinsic!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), " * ") == 0, "Intrinsic lead expected to be ' * '!"); // exist = false bn = false sc = true AccountChange::CodeStorage accDiff.exist = dev::Diff(false, false); @@ -58,6 +72,7 @@ BOOST_AUTO_TEST_CASE(AccountDiff) accDiff.balance = dev::Diff(1, 1); accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::CodeStorage, "Account change type expected to be CodeStorage!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "* *") == 0, "CodeStorage lead expected to be '* *'!"); // exist = false bn = false sc = false AccountChange::None accDiff.exist = dev::Diff(false, false); @@ -65,6 +80,120 @@ BOOST_AUTO_TEST_CASE(AccountDiff) accDiff.balance = dev::Diff(1, 1); accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::None, "Account change type expected to be None!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), " ") == 0, "None lead expected to be ' '!"); + + //ofstream + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.balance = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + std::map> storage; + storage[1] = accDiff.nonce; + accDiff.storage = storage; + std::stringstream buffer; + + //if (!_s.exist.to()) + buffer << accDiff; + BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "") == 0, "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + accDiff.exist = dev::Diff(false, true); + buffer << accDiff; + BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "#2 (+1) 2 (+1) $[1] ([0]) \n * 0000000000000000000000000000000000000000000000000000000000000001: 2 (1)") == 0, "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + storage[1] = dev::Diff(0, 0); + accDiff.storage = storage; + buffer << accDiff; + BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "#2 (+1) 2 (+1) $[1] ([0]) \n + 0000000000000000000000000000000000000000000000000000000000000001: 0") == 0, "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + storage[1] = dev::Diff(1, 0); + accDiff.storage = storage; + buffer << accDiff; + BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "#2 (+1) 2 (+1) $[1] ([0]) \nXXX 0000000000000000000000000000000000000000000000000000000000000001 (1)") == 0, "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + BOOST_CHECK_MESSAGE(accDiff.changed() == true, "dev::eth::AccountDiff::changed(): incorrect return value"); + + //unexpected value + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead((dev::eth::AccountChange)123), "") != 0, "Not expected output when dev::eth::lead on unexpected value"); +} + +BOOST_AUTO_TEST_CASE(StateDiff) +{ + dev::eth::StateDiff stateDiff; + dev::eth::AccountDiff accDiff; + + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.balance = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + std::map> storage; + storage[1] = accDiff.nonce; + accDiff.storage = storage; + std::stringstream buffer; + + dev::Address address("001122334455667788991011121314151617181920"); + stateDiff.accounts[address] = accDiff; + buffer << stateDiff; + + BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "1 accounts changed:\n*** 0000000000000000000000000000000000000000: \n") == 0, "Not expected output: '" + buffer.str() + "'"); +} + +BOOST_AUTO_TEST_CASE(BlockChain) +{ + std::string genesisRLP = "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a09eb47d85ccdf855f34cce66288b11d43a90d288dfc12eb7a900dcb7953a69a5a88448f2f62ce8e0392c0c0"; + dev::bytes genesisBlockRLP = dev::test::importByteArray(genesisRLP); + BlockInfo biGenesisBlock(genesisBlockRLP); + + std::string blockRLP = "0xf90260f901f9a01f08d9b73350445d921aa74a44861b5cc12d1258a4da8ac3e0a41d1757aa8112a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017a0dff021d89bbd62a468fc16a27430f8fbf0cc9e41473f26601fa9e4bebd0660d5a0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882520884558c98ed80a0f8e40e5173c7d73b2214e311c109fec63eb116b8ff90f78989e1a65082d6e74f8871f5f6541955ba68f861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0a1da1d695f9ff1595dcd950cd8f001bfb69e0ed6e731ad51353f52ed9c7117e3a0fe5f0ef2425069a91b2619d3147ab3a8386542be9b4c7ef738a0553d22361646c0"; + dev::bytes blockRLPbytes = dev::test::importByteArray(blockRLP); + BlockInfo biBlock(blockRLPbytes); + + TransientDirectory td1, td2; + State trueState(OverlayDB(State::openDB(td1.path())), BaseState::Empty, biGenesisBlock.coinbaseAddress); + dev::eth::BlockChain trueBc(genesisBlockRLP, td2.path(), WithExisting::Verify); + + json_spirit::mObject o; + json_spirit::mObject accountaddress; + json_spirit::mObject account; + account["balance"] = "0x02540be400"; + account["code"] = "0x"; + account["nonce"] = "0x00"; + account["storage"] = json_spirit::mObject(); + accountaddress["a94f5374fce5edbc8e2a8697c15331677e6ebf0b"] = account; + o["pre"] = accountaddress; + + dev::test::ImportTest importer(o["pre"].get_obj()); + importer.importState(o["pre"].get_obj(), trueState); + trueState.commit(); + + trueBc.import(blockRLPbytes, trueState.db()); + + std::stringstream buffer; + buffer << trueBc; + BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "96d3fba448912a3f714221956ad5b6b7984236d4a1748c7f8ff5d637ca88e19f00: 1 @ 1f08d9b73350445d921aa74a44861b5cc12d1258a4da8ac3e0a41d1757aa8112\n") == 0, "Not expected output: '" + buffer.str() + "'"); + + trueBc.garbageCollect(true); + + //Block Queue Test + BlockQueue bcQueue; + bcQueue.tick(trueBc); + QueueStatus bStatus = bcQueue.blockStatus(trueBc.info().hash()); + BOOST_CHECK(bStatus == QueueStatus::Unknown); + + dev::bytesConstRef bytesConst(&blockRLPbytes.at(0), blockRLPbytes.size()); + bcQueue.import(bytesConst, trueBc); + bStatus = bcQueue.blockStatus(biBlock.hash()); + BOOST_CHECK(bStatus == QueueStatus::Unknown); + + bcQueue.clear(); +} + +BOOST_AUTO_TEST_CASE(BlockQueue) +{ + } BOOST_AUTO_TEST_SUITE_END() From 101b8cda92782e32dd0d25578cccd4fee4f83439 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 5 Aug 2015 12:43:42 +0300 Subject: [PATCH 5/6] Coverage: tests --- test/TestHelper.cpp | 59 ++++++----- test/TestHelper.h | 8 +- test/libethereum/AccountDiff.cpp | 144 ++++++++++++++++++++++++++ test/libethereum/transactionTests.cpp | 7 +- 4 files changed, 186 insertions(+), 32 deletions(-) create mode 100644 test/libethereum/AccountDiff.cpp diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 399779756..fa889be16 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -191,7 +191,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state) BOOST_THROW_EXCEPTION(MissingFields() << errinfo_comment("Import State: Missing state fields!")); } -void ImportTest::importTransaction(json_spirit::mObject& _o) +void ImportTest::importTransaction (json_spirit::mObject const& _o, eth::Transaction& o_tr) { if (_o.count("secretKey") > 0) { @@ -202,18 +202,18 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) assert(_o.count("value") > 0); assert(_o.count("data") > 0); - if (bigint(_o["nonce"].get_str()) >= c_max256plus1) + if (bigint(_o.at("nonce").get_str()) >= c_max256plus1) BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); - if (bigint(_o["gasPrice"].get_str()) >= c_max256plus1) + if (bigint(_o.at("gasPrice").get_str()) >= c_max256plus1) BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); - if (bigint(_o["gasLimit"].get_str()) >= c_max256plus1) + if (bigint(_o.at("gasLimit").get_str()) >= c_max256plus1) BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); - if (bigint(_o["value"].get_str()) >= c_max256plus1) + if (bigint(_o.at("value").get_str()) >= c_max256plus1) BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") ); - m_transaction = _o["to"].get_str().empty() ? - Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str())) : - Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), Address(_o["to"].get_str()), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str())); + o_tr = _o.at("to").get_str().empty() ? + Transaction(toInt(_o.at("value")), toInt(_o.at("gasPrice")), toInt(_o.at("gasLimit")), importData(_o), toInt(_o.at("nonce")), Secret(_o.at("secretKey").get_str())) : + Transaction(toInt(_o.at("value")), toInt(_o.at("gasPrice")), toInt(_o.at("gasLimit")), Address(_o.at("to").get_str()), importData(_o), toInt(_o.at("nonce")), Secret(_o.at("secretKey").get_str())); } else { @@ -221,14 +221,14 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) RLP transactionRLP(transactionRLPStream.out()); try { - m_transaction = Transaction(transactionRLP.data(), CheckTransaction::Everything); + o_tr = Transaction(transactionRLP.data(), CheckTransaction::Everything); } catch (InvalidSignature) { // create unsigned transaction - m_transaction = _o["to"].get_str().empty() ? - Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), importData(_o), toInt(_o["nonce"])) : - Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), Address(_o["to"].get_str()), importData(_o), toInt(_o["nonce"])); + o_tr = _o.at("to").get_str().empty() ? + Transaction(toInt(_o.at("value")), toInt(_o.at("gasPrice")), toInt(_o.at("gasLimit")), importData(_o), toInt(_o.at("nonce"))) : + Transaction(toInt(_o.at("value")), toInt(_o.at("gasPrice")), toInt(_o.at("gasLimit")), Address(_o.at("to").get_str()), importData(_o), toInt(_o.at("nonce"))); } catch (Exception& _e) { @@ -237,6 +237,11 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) } } +void ImportTest::importTransaction(json_spirit::mObject const& o_tr) +{ + importTransaction(o_tr, m_transaction); +} + void ImportTest::compareStates(State const& _stateExpect, State const& _statePost, AccountMaskMap const _expectedStateOptions, WhenError _throw) { #define CHECK(a,b) \ @@ -421,13 +426,13 @@ bytes importByteArray(std::string const& _str) return fromHex(_str.substr(0, 2) == "0x" ? _str.substr(2) : _str, WhenError::Throw); } -bytes importData(json_spirit::mObject& _o) +bytes importData(json_spirit::mObject const& _o) { bytes data; - if (_o["data"].type() == json_spirit::str_type) - data = importByteArray(_o["data"].get_str()); + if (_o.at("data").type() == json_spirit::str_type) + data = importByteArray(_o.at("data").get_str()); else - for (auto const& j: _o["data"].get_array()) + for (auto const& j: _o.at("data").get_array()) data.push_back(toByte(j)); return data; } @@ -633,46 +638,46 @@ void executeTests(const string& _name, const string& _testPathAppendix, const bo } } -RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj) +RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject const& _tObj) { //Construct Rlp of the given transaction RLPStream rlpStream; rlpStream.appendList(_tObj.size()); if (_tObj.count("nonce")) - rlpStream << bigint(_tObj["nonce"].get_str()); + rlpStream << bigint(_tObj.at("nonce").get_str()); if (_tObj.count("gasPrice")) - rlpStream << bigint(_tObj["gasPrice"].get_str()); + rlpStream << bigint(_tObj.at("gasPrice").get_str()); if (_tObj.count("gasLimit")) - rlpStream << bigint(_tObj["gasLimit"].get_str()); + rlpStream << bigint(_tObj.at("gasLimit").get_str()); if (_tObj.count("to")) { - if (_tObj["to"].get_str().empty()) + if (_tObj.at("to").get_str().empty()) rlpStream << ""; else - rlpStream << importByteArray(_tObj["to"].get_str()); + rlpStream << importByteArray(_tObj.at("to").get_str()); } if (_tObj.count("value")) - rlpStream << bigint(_tObj["value"].get_str()); + rlpStream << bigint(_tObj.at("value").get_str()); if (_tObj.count("data")) rlpStream << importData(_tObj); if (_tObj.count("v")) - rlpStream << bigint(_tObj["v"].get_str()); + rlpStream << bigint(_tObj.at("v").get_str()); if (_tObj.count("r")) - rlpStream << bigint(_tObj["r"].get_str()); + rlpStream << bigint(_tObj.at("r").get_str()); if (_tObj.count("s")) - rlpStream << bigint(_tObj["s"].get_str()); + rlpStream << bigint(_tObj.at("s").get_str()); if (_tObj.count("extrafield")) - rlpStream << bigint(_tObj["extrafield"].get_str()); + rlpStream << bigint(_tObj.at("extrafield").get_str()); return rlpStream; } diff --git a/test/TestHelper.h b/test/TestHelper.h index 9d2625e19..5f2f8d6d5 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -32,7 +32,6 @@ #include #include - #ifdef NOBOOST #define TBOOST_REQUIRE(arg) if(arg == false) throw dev::Exception(); #define TBOOST_REQUIRE_EQUAL(arg1, arg2) if(arg1 != arg2) throw dev::Exception(); @@ -139,7 +138,8 @@ public: void importEnv(json_spirit::mObject& _o); static void importState(json_spirit::mObject& _o, eth::State& _state); static void importState(json_spirit::mObject& _o, eth::State& _state, eth::AccountMaskMap& o_mask); - void importTransaction(json_spirit::mObject& _o); + static void importTransaction (json_spirit::mObject const& _o, eth::Transaction& o_tr); + void importTransaction(json_spirit::mObject const& _o); static json_spirit::mObject& makeAllFieldsHex(json_spirit::mObject& _o); bytes executeTest(); @@ -168,7 +168,7 @@ protected: u256 toInt(json_spirit::mValue const& _v); byte toByte(json_spirit::mValue const& _v); bytes importCode(json_spirit::mObject& _o); -bytes importData(json_spirit::mObject& _o); +bytes importData(json_spirit::mObject const& _o); bytes importByteArray(std::string const& _str); eth::LogEntries importLog(json_spirit::mArray& _o); json_spirit::mArray exportLog(eth::LogEntries _logs); @@ -193,7 +193,7 @@ dev::eth::Ethash::BlockHeader constructHeader( void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHash, dev::eth::Nonce const& _nonce); void executeTests(const std::string& _name, const std::string& _testPathAppendix, const boost::filesystem::path _pathToFiller, std::function doTests); void userDefinedTest(std::function doTests); -RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj); +RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject const& _tObj); eth::LastHashes lastHashes(u256 _currentBlockNumber); json_spirit::mObject fillJsonWithState(eth::State _state); json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn); diff --git a/test/libethereum/AccountDiff.cpp b/test/libethereum/AccountDiff.cpp new file mode 100644 index 000000000..3b009df6c --- /dev/null +++ b/test/libethereum/AccountDiff.cpp @@ -0,0 +1,144 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file AccountDiff.cpp + * @author Dimitry Khokhlov + * @date 2015 + * libethereum unit test functions coverage. + */ + +#include +#include +#include +#include "../JsonSpiritHeaders.h" + +#include + +#include +#include +#include +#include + +using namespace dev; +using namespace eth; + +BOOST_AUTO_TEST_SUITE(libethereum) + +BOOST_AUTO_TEST_CASE(AccountDiff) +{ + dev::eth::AccountDiff accDiff; + + // Testing changeType + // exist = true exist_from = true AccountChange::Deletion + accDiff.exist = dev::Diff(true, false); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Deletion, "Account change type expected to be Deletion!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "XXX") == 0, "Deletion lead expected to be 'XXX'!"); + + // exist = true exist_from = false AccountChange::Creation + accDiff.exist = dev::Diff(false, true); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Creation, "Account change type expected to be Creation!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "+++") == 0, "Creation lead expected to be '+++'!"); + + // exist = false bn = true sc = true AccountChange::All + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::All, "Account change type expected to be All!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "***") == 0, "All lead expected to be '***'!"); + + // exist = false bn = true sc = false AccountChange::Intrinsic + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Intrinsic, "Account change type expected to be Intrinsic!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), " * ") == 0, "Intrinsic lead expected to be ' * '!"); + + // exist = false bn = false sc = true AccountChange::CodeStorage + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 1); + accDiff.balance = dev::Diff(1, 1); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::CodeStorage, "Account change type expected to be CodeStorage!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "* *") == 0, "CodeStorage lead expected to be '* *'!"); + + // exist = false bn = false sc = false AccountChange::None + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 1); + accDiff.balance = dev::Diff(1, 1); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); + BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::None, "Account change type expected to be None!"); + BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), " ") == 0, "None lead expected to be ' '!"); + + //ofstream + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.balance = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + std::map> storage; + storage[1] = accDiff.nonce; + accDiff.storage = storage; + std::stringstream buffer; + + //if (!_s.exist.to()) + buffer << accDiff; + BOOST_CHECK_MESSAGE(buffer.str() == "", "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + accDiff.exist = dev::Diff(false, true); + buffer << accDiff; + BOOST_CHECK_MESSAGE(buffer.str() == "#2 (+1) 2 (+1) $[1] ([0]) \n * 0000000000000000000000000000000000000000000000000000000000000001: 2 (1)", "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + storage[1] = dev::Diff(0, 0); + accDiff.storage = storage; + buffer << accDiff; + BOOST_CHECK_MESSAGE(buffer.str() == "#2 (+1) 2 (+1) $[1] ([0]) \n + 0000000000000000000000000000000000000000000000000000000000000001: 0", "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + storage[1] = dev::Diff(1, 0); + accDiff.storage = storage; + buffer << accDiff; + BOOST_CHECK_MESSAGE(buffer.str() == "#2 (+1) 2 (+1) $[1] ([0]) \nXXX 0000000000000000000000000000000000000000000000000000000000000001 (1)", "Not expected output: '" + buffer.str() + "'"); + buffer.str(std::string()); + + BOOST_CHECK_MESSAGE(accDiff.changed() == true, "dev::eth::AccountDiff::changed(): incorrect return value"); + + //unexpected value + //BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead((dev::eth::AccountChange)123), "") != 0, "Not expected output when dev::eth::lead on unexpected value"); +} + +BOOST_AUTO_TEST_CASE(StateDiff) +{ + dev::eth::StateDiff stateDiff; + dev::eth::AccountDiff accDiff; + + accDiff.exist = dev::Diff(false, false); + accDiff.nonce = dev::Diff(1, 2); + accDiff.balance = dev::Diff(1, 2); + accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); + std::map> storage; + storage[1] = accDiff.nonce; + accDiff.storage = storage; + std::stringstream buffer; + + dev::Address address("001122334455667788991011121314151617181920"); + stateDiff.accounts[address] = accDiff; + buffer << stateDiff; + + BOOST_CHECK_MESSAGE(buffer.str() == "1 accounts changed:\n*** 0000000000000000000000000000000000000000: \n", "Not expected output: '" + buffer.str() + "'"); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libethereum/transactionTests.cpp b/test/libethereum/transactionTests.cpp index fe620eac6..f6bde061a 100644 --- a/test/libethereum/transactionTests.cpp +++ b/test/libethereum/transactionTests.cpp @@ -34,9 +34,14 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) { for (auto& i: _v.get_obj()) { - cerr << i.first << endl; mObject& o = i.second.get_obj(); + if (test::Options::get().singleTest && test::Options::get().singleTestName != i.first) + { + o.clear(); + continue; + } + cerr << i.first << endl; if (_fillin) { TBOOST_REQUIRE((o.count("transaction") > 0)); From 383b50c7c077913db1b3a65d076c105198d45866 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 5 Aug 2015 13:15:44 +0300 Subject: [PATCH 6/6] Cover: remove unit.cpp --- test/libethereum/unit.cpp | 199 -------------------------------------- 1 file changed, 199 deletions(-) delete mode 100644 test/libethereum/unit.cpp diff --git a/test/libethereum/unit.cpp b/test/libethereum/unit.cpp deleted file mode 100644 index 2b78d764e..000000000 --- a/test/libethereum/unit.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . -*/ -/** @file unit.cpp - * @author Dimitry Khokhlov - * @date 2015 - * libethereum unit test functions coverage. - */ - -#include -#include -#include -#include "../JsonSpiritHeaders.h" - -#include - -#include -#include -#include -#include - -using namespace dev; -using namespace eth; - -BOOST_AUTO_TEST_SUITE(libethereum) - -BOOST_AUTO_TEST_CASE(AccountDiff) -{ - dev::eth::AccountDiff accDiff; - - // Testing changeType - // exist = true exist_from = true AccountChange::Deletion - accDiff.exist = dev::Diff(true, false); - BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Deletion, "Account change type expected to be Deletion!"); - BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "XXX") == 0, "Deletion lead expected to be 'XXX'!"); - - // exist = true exist_from = false AccountChange::Creation - accDiff.exist = dev::Diff(false, true); - BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Creation, "Account change type expected to be Creation!"); - BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "+++") == 0, "Creation lead expected to be '+++'!"); - - // exist = false bn = true sc = true AccountChange::All - accDiff.exist = dev::Diff(false, false); - accDiff.nonce = dev::Diff(1, 2); - accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); - BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::All, "Account change type expected to be All!"); - BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "***") == 0, "All lead expected to be '***'!"); - - // exist = false bn = true sc = false AccountChange::Intrinsic - accDiff.exist = dev::Diff(false, false); - accDiff.nonce = dev::Diff(1, 2); - accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); - BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::Intrinsic, "Account change type expected to be Intrinsic!"); - BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), " * ") == 0, "Intrinsic lead expected to be ' * '!"); - - // exist = false bn = false sc = true AccountChange::CodeStorage - accDiff.exist = dev::Diff(false, false); - accDiff.nonce = dev::Diff(1, 1); - accDiff.balance = dev::Diff(1, 1); - accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); - BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::CodeStorage, "Account change type expected to be CodeStorage!"); - BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), "* *") == 0, "CodeStorage lead expected to be '* *'!"); - - // exist = false bn = false sc = false AccountChange::None - accDiff.exist = dev::Diff(false, false); - accDiff.nonce = dev::Diff(1, 1); - accDiff.balance = dev::Diff(1, 1); - accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("00")); - BOOST_CHECK_MESSAGE(accDiff.changeType() == dev::eth::AccountChange::None, "Account change type expected to be None!"); - BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead(accDiff.changeType()), " ") == 0, "None lead expected to be ' '!"); - - //ofstream - accDiff.exist = dev::Diff(false, false); - accDiff.nonce = dev::Diff(1, 2); - accDiff.balance = dev::Diff(1, 2); - accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); - std::map> storage; - storage[1] = accDiff.nonce; - accDiff.storage = storage; - std::stringstream buffer; - - //if (!_s.exist.to()) - buffer << accDiff; - BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "") == 0, "Not expected output: '" + buffer.str() + "'"); - buffer.str(std::string()); - - accDiff.exist = dev::Diff(false, true); - buffer << accDiff; - BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "#2 (+1) 2 (+1) $[1] ([0]) \n * 0000000000000000000000000000000000000000000000000000000000000001: 2 (1)") == 0, "Not expected output: '" + buffer.str() + "'"); - buffer.str(std::string()); - - storage[1] = dev::Diff(0, 0); - accDiff.storage = storage; - buffer << accDiff; - BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "#2 (+1) 2 (+1) $[1] ([0]) \n + 0000000000000000000000000000000000000000000000000000000000000001: 0") == 0, "Not expected output: '" + buffer.str() + "'"); - buffer.str(std::string()); - - storage[1] = dev::Diff(1, 0); - accDiff.storage = storage; - buffer << accDiff; - BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "#2 (+1) 2 (+1) $[1] ([0]) \nXXX 0000000000000000000000000000000000000000000000000000000000000001 (1)") == 0, "Not expected output: '" + buffer.str() + "'"); - buffer.str(std::string()); - - BOOST_CHECK_MESSAGE(accDiff.changed() == true, "dev::eth::AccountDiff::changed(): incorrect return value"); - - //unexpected value - BOOST_CHECK_MESSAGE(strcmp(dev::eth::lead((dev::eth::AccountChange)123), "") != 0, "Not expected output when dev::eth::lead on unexpected value"); -} - -BOOST_AUTO_TEST_CASE(StateDiff) -{ - dev::eth::StateDiff stateDiff; - dev::eth::AccountDiff accDiff; - - accDiff.exist = dev::Diff(false, false); - accDiff.nonce = dev::Diff(1, 2); - accDiff.balance = dev::Diff(1, 2); - accDiff.code = dev::Diff(dev::fromHex("00"), dev::fromHex("01")); - std::map> storage; - storage[1] = accDiff.nonce; - accDiff.storage = storage; - std::stringstream buffer; - - dev::Address address("001122334455667788991011121314151617181920"); - stateDiff.accounts[address] = accDiff; - buffer << stateDiff; - - BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "1 accounts changed:\n*** 0000000000000000000000000000000000000000: \n") == 0, "Not expected output: '" + buffer.str() + "'"); -} - -BOOST_AUTO_TEST_CASE(BlockChain) -{ - std::string genesisRLP = "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a09eb47d85ccdf855f34cce66288b11d43a90d288dfc12eb7a900dcb7953a69a5a88448f2f62ce8e0392c0c0"; - dev::bytes genesisBlockRLP = dev::test::importByteArray(genesisRLP); - BlockInfo biGenesisBlock(genesisBlockRLP); - - std::string blockRLP = "0xf90260f901f9a01f08d9b73350445d921aa74a44861b5cc12d1258a4da8ac3e0a41d1757aa8112a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017a0dff021d89bbd62a468fc16a27430f8fbf0cc9e41473f26601fa9e4bebd0660d5a0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882520884558c98ed80a0f8e40e5173c7d73b2214e311c109fec63eb116b8ff90f78989e1a65082d6e74f8871f5f6541955ba68f861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0a1da1d695f9ff1595dcd950cd8f001bfb69e0ed6e731ad51353f52ed9c7117e3a0fe5f0ef2425069a91b2619d3147ab3a8386542be9b4c7ef738a0553d22361646c0"; - dev::bytes blockRLPbytes = dev::test::importByteArray(blockRLP); - BlockInfo biBlock(blockRLPbytes); - - TransientDirectory td1, td2; - State trueState(OverlayDB(State::openDB(td1.path())), BaseState::Empty, biGenesisBlock.coinbaseAddress); - dev::eth::BlockChain trueBc(genesisBlockRLP, td2.path(), WithExisting::Verify); - - json_spirit::mObject o; - json_spirit::mObject accountaddress; - json_spirit::mObject account; - account["balance"] = "0x02540be400"; - account["code"] = "0x"; - account["nonce"] = "0x00"; - account["storage"] = json_spirit::mObject(); - accountaddress["a94f5374fce5edbc8e2a8697c15331677e6ebf0b"] = account; - o["pre"] = accountaddress; - - dev::test::ImportTest importer(o["pre"].get_obj()); - importer.importState(o["pre"].get_obj(), trueState); - trueState.commit(); - - trueBc.import(blockRLPbytes, trueState.db()); - - std::stringstream buffer; - buffer << trueBc; - BOOST_CHECK_MESSAGE(strcmp(buffer.str().c_str(), "96d3fba448912a3f714221956ad5b6b7984236d4a1748c7f8ff5d637ca88e19f00: 1 @ 1f08d9b73350445d921aa74a44861b5cc12d1258a4da8ac3e0a41d1757aa8112\n") == 0, "Not expected output: '" + buffer.str() + "'"); - - trueBc.garbageCollect(true); - - //Block Queue Test - BlockQueue bcQueue; - bcQueue.tick(trueBc); - QueueStatus bStatus = bcQueue.blockStatus(trueBc.info().hash()); - BOOST_CHECK(bStatus == QueueStatus::Unknown); - - dev::bytesConstRef bytesConst(&blockRLPbytes.at(0), blockRLPbytes.size()); - bcQueue.import(bytesConst, trueBc); - bStatus = bcQueue.blockStatus(biBlock.hash()); - BOOST_CHECK(bStatus == QueueStatus::Unknown); - - bcQueue.clear(); -} - -BOOST_AUTO_TEST_CASE(BlockQueue) -{ - -} - -BOOST_AUTO_TEST_SUITE_END()