Пример #1
0
void executeGasPricerTest(string const& name, double _etherPrice, double _blockFee, string const& bcTestPath, TransactionPriority _txPrio, u256 _expectedAsk, u256 _expectedBid, eth::Network _sealEngineNetwork = eth::Network::Test)
{
	BasicGasPricer gp(u256(double(ether / 1000) / _etherPrice), u256(_blockFee * 1000));

	Json::Value vJson = test::loadJsonFromFile(test::getTestPath() + bcTestPath);
	test::BlockChainLoader bcLoader(vJson[name], _sealEngineNetwork);
	BlockChain const& bc = bcLoader.bc();

	gp.update(bc);
	BOOST_CHECK(abs(gp.ask(Block(Block::Null)) - _expectedAsk ) < 100000000);
	BOOST_CHECK(abs(gp.bid(_txPrio) - _expectedBid ) < 100000000);
}
Пример #2
0
void executeGasPricerTest(string const& name, double _etherPrice, double _blockFee, string const& bcTestPath, TransactionPriority _txPrio, u256 _expectedAsk, u256 _expectedBid)
{
	cnote << name;
	BasicGasPricer gp(u256(double(ether / 1000) / _etherPrice), u256(_blockFee * 1000));

	Json::Value vJson = test::loadJsonFromFile(test::getTestPath() + bcTestPath);
	test::BlockChainLoader bcLoader(vJson[name]);
	BlockChain const& bc = bcLoader.bc();

	gp.update(bc);
	BOOST_CHECK_EQUAL(gp.ask(State()), _expectedAsk);
	BOOST_CHECK_EQUAL(gp.bid(_txPrio), _expectedBid);
}