Browse Source

style

cl-refactor
CJentzsch 10 years ago
parent
commit
0704562207
  1. 34
      test/libethereum/transactionqueue.cpp

34
test/libethereum/transactionqueue.cpp

@ -14,10 +14,10 @@
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file transaction.cpp
* @author Christoph Jentzsch <winsvega@mail.ru>
/** @file transactionqueue.cpp
* @author Christoph Jentzsch <cj@ethdev.com>
* @date 2015
* Transaaction test functions.
* TransactionQueue test functions.
*/
#include <libethereum/TransactionQueue.h>
@ -35,24 +35,30 @@ BOOST_AUTO_TEST_CASE(maxNonce)
dev::eth::TransactionQueue txq;
// from a94f5374fce5edbc8e2a8697c15331677e6ebf0b
Transaction tx0(0, 10 * szabo, 25000, Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87"), bytes(), 0, Secret("0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8") );
Transaction tx0_1(1, 10 * szabo, 25000, Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87"), bytes(), 0, Secret("0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8") );
Transaction tx1(0, 10 * szabo, 25000, Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87"), bytes(), 1, Secret("0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8") );
Transaction tx2(0, 10 * szabo, 25000, Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87"), bytes(), 2, Secret("0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8") );
Transaction tx9(0, 10 * szabo, 25000, Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87"), bytes(), 9, Secret("0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8") );
const u256 gasCost = 10 * szabo;
const u256 gas = 25000;
Address dest = Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87");
Address to = Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b");
Secret sec = Secret("0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8");
Transaction tx0(0, gasCost, gas, dest, bytes(), 0, sec );
Transaction tx0_1(1, gasCost, gas, dest, bytes(), 0, sec );
Transaction tx1(0, gasCost, gas, dest, bytes(), 1, sec );
Transaction tx2(0, gasCost, gas, dest, bytes(), 2, sec );
Transaction tx9(0, gasCost, gas, dest, bytes(), 9, sec );
txq.import(tx0);
BOOST_CHECK_EQUAL(1, (unsigned)txq.maxNonce(Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")));
BOOST_CHECK(1 == txq.maxNonce(to));
txq.import(tx0);
BOOST_CHECK_EQUAL(1, (unsigned)txq.maxNonce(Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")));
BOOST_CHECK(1 == txq.maxNonce(to));
txq.import(tx0_1);
BOOST_CHECK_EQUAL(1, (unsigned)txq.maxNonce(Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")));
BOOST_CHECK(1 == txq.maxNonce(to));
txq.import(tx1);
BOOST_CHECK_EQUAL(2, (unsigned)txq.maxNonce(Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")));
BOOST_CHECK(2 == txq.maxNonce(to));
txq.import(tx9);
BOOST_CHECK_EQUAL(10, (unsigned)txq.maxNonce(Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")));
BOOST_CHECK(10 == txq.maxNonce(to));
txq.import(tx2);
BOOST_CHECK_EQUAL(10, (unsigned)txq.maxNonce(Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")));
BOOST_CHECK(10 == txq.maxNonce(to));
}
BOOST_AUTO_TEST_SUITE_END()

Loading…
Cancel
Save