mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use evmone for testing.
This commit is contained in:
@@ -20,11 +20,14 @@
|
||||
* Tests for a fixed fee registrar contract.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <test/libsolidity/SolidityExecutionFramework.h>
|
||||
#include <test/contracts/ContractInterface.h>
|
||||
#include <test/EVMHost.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev::test;
|
||||
@@ -413,7 +416,8 @@ BOOST_AUTO_TEST_CASE(auction_simple)
|
||||
registrar.reserve(name);
|
||||
BOOST_CHECK_EQUAL(registrar.owner(name), 0);
|
||||
// "wait" until auction end
|
||||
m_rpc.test_modifyTimestamp(currentTimestamp() + m_biddingTime + 10);
|
||||
|
||||
m_evmHost->m_state.timestamp += m_biddingTime + 10;
|
||||
// trigger auction again
|
||||
registrar.reserve(name);
|
||||
BOOST_CHECK_EQUAL(registrar.owner(name), m_sender);
|
||||
@@ -425,7 +429,7 @@ BOOST_AUTO_TEST_CASE(auction_bidding)
|
||||
string name = "x";
|
||||
|
||||
unsigned startTime = 0x776347e2;
|
||||
m_rpc.test_modifyTimestamp(startTime);
|
||||
m_evmHost->m_state.timestamp = startTime;
|
||||
|
||||
RegistrarInterface registrar(*this);
|
||||
// initiate auction
|
||||
@@ -433,19 +437,19 @@ BOOST_AUTO_TEST_CASE(auction_bidding)
|
||||
registrar.reserve(name);
|
||||
BOOST_CHECK_EQUAL(registrar.owner(name), 0);
|
||||
// overbid self
|
||||
m_rpc.test_modifyTimestamp(startTime + m_biddingTime - 10);
|
||||
m_evmHost->m_state.timestamp = startTime + m_biddingTime - 10;
|
||||
registrar.setNextValue(12);
|
||||
registrar.reserve(name);
|
||||
// another bid by someone else
|
||||
sendEther(account(1), 10 * ether);
|
||||
m_sender = account(1);
|
||||
m_rpc.test_modifyTimestamp(startTime + 2 * m_biddingTime - 50);
|
||||
m_evmHost->m_state.timestamp = startTime + 2 * m_biddingTime - 50;
|
||||
registrar.setNextValue(13);
|
||||
registrar.reserve(name);
|
||||
BOOST_CHECK_EQUAL(registrar.owner(name), 0);
|
||||
// end auction by first bidder (which is not highest) trying to overbid again (too late)
|
||||
m_sender = account(0);
|
||||
m_rpc.test_modifyTimestamp(startTime + 4 * m_biddingTime);
|
||||
m_evmHost->m_state.timestamp = startTime + 4 * m_biddingTime;
|
||||
registrar.setNextValue(20);
|
||||
registrar.reserve(name);
|
||||
BOOST_CHECK_EQUAL(registrar.owner(name), account(1));
|
||||
@@ -461,17 +465,17 @@ BOOST_AUTO_TEST_CASE(auction_renewal)
|
||||
// register name by auction
|
||||
registrar.setNextValue(8);
|
||||
registrar.reserve(name);
|
||||
m_rpc.test_modifyTimestamp(startTime + 4 * m_biddingTime);
|
||||
m_evmHost->m_state.timestamp = startTime + 4 * m_biddingTime;
|
||||
registrar.reserve(name);
|
||||
BOOST_CHECK_EQUAL(registrar.owner(name), m_sender);
|
||||
|
||||
// try to re-register before interval end
|
||||
sendEther(account(1), 10 * ether);
|
||||
m_sender = account(1);
|
||||
m_rpc.test_modifyTimestamp(currentTimestamp() + m_renewalInterval - 1);
|
||||
m_evmHost->m_state.timestamp = currentTimestamp() + m_renewalInterval - 1;
|
||||
registrar.setNextValue(80);
|
||||
registrar.reserve(name);
|
||||
m_rpc.test_modifyTimestamp(currentTimestamp() + m_biddingTime);
|
||||
m_evmHost->m_state.timestamp = currentTimestamp() + m_biddingTime;
|
||||
// if there is a bug in the renewal logic, this would transfer the ownership to account(1),
|
||||
// but if there is no bug, this will initiate the auction, albeit with a zero bid
|
||||
registrar.reserve(name);
|
||||
|
||||
Reference in New Issue
Block a user