diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-06 22:34:02 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-06 22:34:02 +0800 |
commit | 5fb44b241debf9230aea69b7708e204a88ba9d83 (patch) | |
tree | 0644526a7861d260a4b021de0694afec921a2f25 /stateOriginal.cpp | |
parent | 51e376efb8dc2f410872c682e4bf36955ec7caca (diff) | |
parent | 1234526c938504134b6b86252353ab5e2ae6319f (diff) | |
download | dexon-solidity-5fb44b241debf9230aea69b7708e204a88ba9d83.tar dexon-solidity-5fb44b241debf9230aea69b7708e204a88ba9d83.tar.gz dexon-solidity-5fb44b241debf9230aea69b7708e204a88ba9d83.tar.bz2 dexon-solidity-5fb44b241debf9230aea69b7708e204a88ba9d83.tar.lz dexon-solidity-5fb44b241debf9230aea69b7708e204a88ba9d83.tar.xz dexon-solidity-5fb44b241debf9230aea69b7708e204a88ba9d83.tar.zst dexon-solidity-5fb44b241debf9230aea69b7708e204a88ba9d83.zip |
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'stateOriginal.cpp')
-rw-r--r-- | stateOriginal.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/stateOriginal.cpp b/stateOriginal.cpp index 65ff5084..5b7b0415 100644 --- a/stateOriginal.cpp +++ b/stateOriginal.cpp @@ -20,6 +20,7 @@ * State test functions. */ +#include <boost/test/unit_test.hpp> #include <boost/filesystem/operations.hpp> #include <secp256k1/secp256k1.h> #include <libethereum/CanonBlockChain.h> @@ -29,7 +30,21 @@ using namespace std; using namespace dev; using namespace dev::eth; -int stateTest() +namespace dev +{ +namespace test +{ + +int stateTest(); + +BOOST_AUTO_TEST_SUITE(StateIntegration) + +BOOST_AUTO_TEST_CASE(Basic) +{ + State s; +} + +BOOST_AUTO_TEST_CASE(Complex) { cnote << "Testing State..."; @@ -37,14 +52,15 @@ int stateTest() KeyPair myMiner = sha3("Gav's Miner"); // KeyPair you = sha3("123"); - Defaults::setDBPath(boost::filesystem::temp_directory_path().string()); + Defaults::setDBPath(boost::filesystem::temp_directory_path().string() + "/" + toString(chrono::system_clock::now().time_since_epoch().count())); OverlayDB stateDB = State::openDB(); CanonBlockChain bc; - State s(myMiner.address(), stateDB); - cout << bc; + State s(myMiner.address(), stateDB); + cout << s; + // Sync up - this won't do much until we use the last state. s.sync(bc); @@ -52,7 +68,7 @@ int stateTest() // Mine to get some ether! s.commitToMine(bc); - while (!s.mine(100).completed) {} + while (!s.mine(100, true).completed) {} s.completeMine(); bc.attemptImport(s.blockData(), stateDB); @@ -65,7 +81,7 @@ int stateTest() // Inject a transaction to transfer funds from miner to me. bytes tx; { - Transaction t(1000, 0, 0, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret()); + Transaction t(1000, 10000, 10000, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret()); assert(t.sender() == myMiner.address()); tx = t.rlp(); } @@ -76,7 +92,7 @@ int stateTest() // Mine to get some ether and set in stone. s.commitToMine(bc); s.commitToMine(bc); - while (!s.mine(50).completed) { s.commitToMine(bc); } + while (!s.mine(100, true).completed) {} s.completeMine(); bc.attemptImport(s.blockData(), stateDB); @@ -85,7 +101,9 @@ int stateTest() s.sync(bc); cout << s; - - return 0; } +BOOST_AUTO_TEST_SUITE_END() + +} +} |