diff --git a/src/test/app/RCLValidations_test.cpp b/src/test/app/RCLValidations_test.cpp index 76a2cb6e6c8..713fb7fd3e4 100644 --- a/src/test/app/RCLValidations_test.cpp +++ b/src/test/app/RCLValidations_test.cpp @@ -31,15 +31,36 @@ namespace test { class RCLValidations_test : public beast::unit_test::suite { -public: void - run() override + testChangeTrusted() + { + PublicKey key = derivePublicKey(KeyType::ed25519, randomSecretKey()); + auto v = std::make_shared( + uint256(), NetClock::time_point(), key, calcNodeID(key), true); + + BEAST_EXPECT(!v->isTrusted()); + v->setTrusted(); + BEAST_EXPECT(v->isTrusted()); + v->setUntrusted(); + BEAST_EXPECT(!v->isTrusted()); + + RCLValidation rcv{v}; + BEAST_EXPECT(!rcv.trusted()); + rcv.setTrusted(); + BEAST_EXPECT(rcv.trusted()); + rcv.setUntrusted(); + BEAST_EXPECT(!rcv.trusted()); + } + + void + testRCLValidatedLedger() { beast::Journal j; using Seq = RCLValidatedLedger::Seq; using ID = RCLValidatedLedger::ID; + // This tests RCLValidatedLedger properly implements the type // requirements of a LedgerTrie ledger, with its added behavior that // only the 256 prior ledger hashes are available to determine ancestry. @@ -194,6 +215,14 @@ class RCLValidations_test : public beast::unit_test::suite } } } + +public: + void + run() override + { + testChangeTrusted(); + testRCLValidatedLedger(); + } }; BEAST_DEFINE_TESTSUITE(RCLValidations, app, ripple);