rippled
Loading...
Searching...
No Matches
LoadFeeTrack_test.cpp
1#include <xrpld/app/misc/LoadFeeTrack.h>
2#include <xrpld/core/Config.h>
3
4#include <xrpl/beast/unit_test.h>
5#include <xrpl/ledger/ReadView.h>
6
7namespace ripple {
8
10{
11public:
12 void
13 run() override
14 {
15 Config d; // get a default configuration object
17 {
18 Fees const fees = [&]() {
19 Fees f;
21 f.reserve = 200 * DROPS_PER_XRP;
22 f.increment = 50 * DROPS_PER_XRP;
23 return f;
24 }();
25
26 BEAST_EXPECT(
27 scaleFeeLoad(XRPAmount{0}, l, fees, false) == XRPAmount{0});
28 BEAST_EXPECT(
29 scaleFeeLoad(XRPAmount{10000}, l, fees, false) ==
30 XRPAmount{10000});
31 BEAST_EXPECT(
32 scaleFeeLoad(XRPAmount{1}, l, fees, false) == XRPAmount{1});
33 }
34 {
35 Fees const fees = [&]() {
36 Fees f;
37 f.base = d.FEES.reference_fee * 10;
38 f.reserve = 200 * DROPS_PER_XRP;
39 f.increment = 50 * DROPS_PER_XRP;
40 return f;
41 }();
42
43 BEAST_EXPECT(
44 scaleFeeLoad(XRPAmount{0}, l, fees, false) == XRPAmount{0});
45 BEAST_EXPECT(
46 scaleFeeLoad(XRPAmount{10000}, l, fees, false) ==
47 XRPAmount{10000});
48 BEAST_EXPECT(
49 scaleFeeLoad(XRPAmount{1}, l, fees, false) == XRPAmount{1});
50 }
51 {
52 Fees const fees = [&]() {
53 Fees f;
55 f.reserve = 200 * DROPS_PER_XRP;
56 f.increment = 50 * DROPS_PER_XRP;
57 return f;
58 }();
59
60 BEAST_EXPECT(
61 scaleFeeLoad(XRPAmount{0}, l, fees, false) == XRPAmount{0});
62 BEAST_EXPECT(
63 scaleFeeLoad(XRPAmount{10000}, l, fees, false) ==
64 XRPAmount{10000});
65 BEAST_EXPECT(
66 scaleFeeLoad(XRPAmount{1}, l, fees, false) == XRPAmount{1});
67 }
68 }
69};
70
71BEAST_DEFINE_TESTSUITE(LoadFeeTrack, app, ripple);
72
73} // namespace ripple
A testsuite class.
Definition suite.h:52
FeeSetup FEES
Definition Config.h:185
void run() override
Runs the suite.
Manages the current fee schedule.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const &feeTrack, Fees const &fees, bool bUnlimited)
constexpr XRPAmount DROPS_PER_XRP
Number of drops per 1 XRP.
Definition XRPAmount.h:240
XRPAmount reference_fee
The cost of a reference transaction in drops.
Definition Config.h:49
Reflects the fee settings for a particular ledger.
XRPAmount base
XRPAmount increment
XRPAmount reserve