mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
API for improved Unit Testing (RIPD-432):
* Added new test APIs allowing easy ways to create ledgers, apply transactions to them, close and advance them. * Moved Ledger tests from Ledger.cpp to Ledger.test.cpp. * Changed several TransactionEngine log priorities from lsINFO to lsDEBUG to reduce unnecessary verbosity in the log messages while running these tests. * Moved LedgerConsensus:applyTransactions from a private member function to a free function so that it could be accessed externally, and without having to reference a LedgerConsensus object. This was done to facilitate the new testing API.
This commit is contained in:
committed by
Nik Bougalis
parent
c62ccf4870
commit
eafa6f960f
@@ -1899,43 +1899,6 @@ std::vector<uint256> Ledger::getNeededAccountStateHashes (
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class Ledger_test : public beast::unit_test::suite
|
||||
{
|
||||
void test_genesis_ledger ()
|
||||
{
|
||||
RippleAddress rootSeedMaster
|
||||
= RippleAddress::createSeedGeneric ("masterpassphrase");
|
||||
RippleAddress rootGeneratorMaster
|
||||
= RippleAddress::createGeneratorPublic (rootSeedMaster);
|
||||
RippleAddress rootAddress
|
||||
= RippleAddress::createAccountPublic (rootGeneratorMaster, 0);
|
||||
std::uint64_t startAmount (100000);
|
||||
Ledger::pointer ledger (std::make_shared <Ledger> (
|
||||
rootAddress, startAmount));
|
||||
ledger->updateHash();
|
||||
expect(ledger->assertSane());
|
||||
}
|
||||
|
||||
void test_getQuality ()
|
||||
{
|
||||
uint256 uBig (
|
||||
"D2DC44E5DC189318DB36EF87D2104CDF0A0FE3A4B698BEEE55038D7EA4C68000");
|
||||
|
||||
// VFALCO NOTE This fails in the original version as well.
|
||||
expect (6125895493223874560 == getQuality (uBig));
|
||||
}
|
||||
public:
|
||||
void run ()
|
||||
{
|
||||
test_genesis_ledger ();
|
||||
test_getQuality ();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(Ledger,ripple_app,ripple);
|
||||
|
||||
Ledger::StaticLockType Ledger::sPendingSaveLock;
|
||||
std::set<std::uint32_t> Ledger::sPendingSaves;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user