Skip to content

Commit

Permalink
[FOLD] Add setTrusted unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
bachase committed Feb 21, 2018
1 parent 639a294 commit eab5edf
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/test/app/RCLValidations_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<STValidation>(
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.
Expand Down Expand Up @@ -194,6 +215,14 @@ class RCLValidations_test : public beast::unit_test::suite
}
}
}

public:
void
run() override
{
testChangeTrusted();
testRCLValidatedLedger();
}
};

BEAST_DEFINE_TESTSUITE(RCLValidations, app, ripple);
Expand Down

0 comments on commit eab5edf

Please sign in to comment.