xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
test
app
LoadFeeTrack_test.cpp
1
#include <xrpld/core/Config.h>
2
3
#include <xrpl/beast/unit_test/suite.h>
4
#include <xrpl/protocol/XRPAmount.h>
5
#include <xrpl/server/LoadFeeTrack.h>
6
7
namespace
xrpl
{
8
9
class
LoadFeeTrack_test
:
public
beast::unit_test::Suite
10
{
11
public
:
12
void
13
run
()
override
14
{
15
Config
d;
// get a default configuration object
16
LoadFeeTrack
const
l;
17
{
18
Fees
const
fees = [&]() {
19
Fees
f;
20
f.
base
= d.
fees
.
referenceFee
;
21
f.
reserve
= 200 *
kDropsPerXrp
;
22
f.
increment
= 50 *
kDropsPerXrp
;
23
return
f;
24
}();
25
26
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{0}, l, fees,
false
) ==
XRPAmount
{0});
27
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{10000}, l, fees,
false
) ==
XRPAmount
{10000});
28
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{1}, l, fees,
false
) ==
XRPAmount
{1});
29
}
30
{
31
Fees
const
fees = [&]() {
32
Fees
f;
33
f.
base
= d.
fees
.
referenceFee
* 10;
34
f.
reserve
= 200 *
kDropsPerXrp
;
35
f.
increment
= 50 *
kDropsPerXrp
;
36
return
f;
37
}();
38
39
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{0}, l, fees,
false
) ==
XRPAmount
{0});
40
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{10000}, l, fees,
false
) ==
XRPAmount
{10000});
41
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{1}, l, fees,
false
) ==
XRPAmount
{1});
42
}
43
{
44
Fees
const
fees = [&]() {
45
Fees
f;
46
f.
base
= d.
fees
.
referenceFee
;
47
f.
reserve
= 200 *
kDropsPerXrp
;
48
f.
increment
= 50 *
kDropsPerXrp
;
49
return
f;
50
}();
51
52
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{0}, l, fees,
false
) ==
XRPAmount
{0});
53
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{10000}, l, fees,
false
) ==
XRPAmount
{10000});
54
BEAST_EXPECT(
scaleFeeLoad
(
XRPAmount
{1}, l, fees,
false
) ==
XRPAmount
{1});
55
}
56
}
57
};
58
59
BEAST_DEFINE_TESTSUITE
(
LoadFeeTrack
, app,
xrpl
);
60
61
}
// namespace xrpl
beast::unit_test::Suite
A testsuite class.
Definition
suite.h:52
xrpl::Config
Definition
src/xrpld/core/Config.h:89
xrpl::Config::fees
FeeSetup fees
Definition
src/xrpld/core/Config.h:206
xrpl::LoadFeeTrack_test
Definition
LoadFeeTrack_test.cpp:10
xrpl::LoadFeeTrack_test::run
void run() override
Runs the suite.
Definition
LoadFeeTrack_test.cpp:13
xrpl::LoadFeeTrack
Manages the current fee schedule.
Definition
LoadFeeTrack.h:27
xrpl::XRPAmount
Definition
XRPAmount.h:28
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::kDropsPerXrp
constexpr XRPAmount kDropsPerXrp
Number of drops per 1 XRP.
Definition
XRPAmount.h:254
xrpl::scaleFeeLoad
XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const &feeTrack, Fees const &fees, bool bUnlimited)
Definition
LoadFeeTrack.cpp:64
xrpl::BEAST_DEFINE_TESTSUITE
BEAST_DEFINE_TESTSUITE(AccountTxPaging, app, xrpl)
xrpl::FeeSetup::referenceFee
XRPAmount referenceFee
The cost of a reference transaction in drops.
Definition
src/xrpld/core/Config.h:58
xrpl::Fees
Reflects the fee settings for a particular ledger.
Definition
protocol/Fees.h:20
xrpl::Fees::reserve
XRPAmount reserve
Minimum XRP an account must hold to exist on the ledger.
Definition
protocol/Fees.h:29
xrpl::Fees::increment
XRPAmount increment
Additional XRP reserve required per owned ledger object.
Definition
protocol/Fees.h:34
xrpl::Fees::base
XRPAmount base
Cost of a reference transaction in drops.
Definition
protocol/Fees.h:24
Generated by
1.17.0