xrpld
Loading...
Searching...
No Matches
PendingSaves_test.cpp
1#include <xrpl/beast/unit_test/suite.h>
2#include <xrpl/ledger/PendingSaves.h>
3
4namespace xrpl::test {
5
7{
8 void
10 {
11 PendingSaves ps;
12
13 // Basic test
14 BEAST_EXPECT(!ps.pending(0));
15 BEAST_EXPECT(!ps.startWork(0));
16 BEAST_EXPECT(ps.shouldWork(0, true));
17 BEAST_EXPECT(ps.startWork(0));
18 BEAST_EXPECT(ps.pending(0));
19 BEAST_EXPECT(!ps.shouldWork(0, false));
20 ps.finishWork(0);
21 BEAST_EXPECT(!ps.pending(0));
22
23 // Test work stealing
24 BEAST_EXPECT(ps.shouldWork(0, false));
25 BEAST_EXPECT(ps.pending(0));
26 BEAST_EXPECT(ps.shouldWork(0, true));
27 BEAST_EXPECT(ps.pending(0));
28 BEAST_EXPECT(ps.startWork(0));
29 BEAST_EXPECT(!ps.startWork(0));
30 ps.finishWork(0);
31 BEAST_EXPECT(!ps.pending(0));
32 }
33
34 void
35 run() override
36 {
37 testSaves();
38 }
39};
40
42
43} // namespace xrpl::test
A testsuite class.
Definition suite.h:50
Keeps track of which ledgers haven't been fully saved.
void finishWork(LedgerIndex seq)
Finish working on a ledger.
bool shouldWork(LedgerIndex seq, bool isSynchronous)
Check if a ledger should be dispatched.
bool startWork(LedgerIndex seq)
Start working on a ledger.
bool pending(LedgerIndex seq)
Return true if a ledger is in the progress of being saved.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
void run() override
Runs the suite.