mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Mark two FIXMEs in code that handles fees wrongly. Work on doing fees correctly.
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
#include "LoadManager.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "Log.h"
|
||||
#include "Config.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
LoadManager::LoadManager(int creditRate, int creditLimit, int debitWarn, int debitLimit) :
|
||||
mCreditRate(creditRate), mCreditLimit(creditLimit), mDebitWarn(debitWarn), mDebitLimit(debitLimit),
|
||||
mCosts(LT_MAX)
|
||||
@@ -244,4 +251,30 @@ Json::Value LoadFeeTrack::getJson(int)
|
||||
return j;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(LoadManager_test)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(LoadFeeTrack_test)
|
||||
{
|
||||
cLog(lsDEBUG) << "Running load fee track test";
|
||||
|
||||
Config d; // get a default configuration object
|
||||
LoadFeeTrack l(d.TRANSACTION_FEE_BASE, d.FEE_DEFAULT);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(10000), 10000);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeLoad(10000), 10000);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(1), 1);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeLoad(1), 1);
|
||||
|
||||
// Check new default fee values give same fees as old defaults
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(d.FEE_DEFAULT), 10);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(d.FEE_ACCOUNT_RESERVE), 200 * SYSTEM_CURRENCY_PARTS);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(d.FEE_OWNER_RESERVE), 50 * SYSTEM_CURRENCY_PARTS);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(d.FEE_NICKNAME_CREATE), 1000);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(d.FEE_OFFER), 10);
|
||||
BOOST_REQUIRE_EQUAL(l.scaleFeeBase(d.FEE_CONTRACT_OPERATION), 1);
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user