diff --git a/Application_8cpp_source.html b/Application_8cpp_source.html index 2de563dcff..d59380f0ed 100644 --- a/Application_8cpp_source.html +++ b/Application_8cpp_source.html @@ -2567,7 +2567,7 @@ $(function() {
ripple::hotACCOUNT_NODE
@ hotACCOUNT_NODE
Definition: NodeObject.h:35
ripple::getNodeIdentity
std::pair< PublicKey, SecretKey > getNodeIdentity(Application &app, boost::program_options::variables_map const &cmdline)
The cryptographic credentials identifying this server instance.
Definition: NodeIdentity.cpp:29
ripple::make_DummyPeerSet
std::unique_ptr< PeerSet > make_DummyPeerSet(Application &app)
Make a dummy PeerSet that does not do anything.
Definition: PeerSet.cpp:187
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::make_PeerSetBuilder
std::unique_ptr< PeerSetBuilder > make_PeerSetBuilder(Application &app)
Definition: PeerSet.cpp:144
ripple::loadByHash
std::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
Definition: Ledger.cpp:1126
ripple::addJson
void addJson(Json::Value &json, LedgerFill const &fill)
Given a Ledger and options, fill a Json::Object or Json::Value with a description of the ledger.
Definition: LedgerToJson.cpp:350
@@ -2584,7 +2584,7 @@ $(function() {
ripple::fixConfigPorts
static void fixConfigPorts(Config &config, Endpoints const &endpoints)
Definition: Application.cpp:2199
ripple::make_AmendmentTable
std::unique_ptr< AmendmentTable > make_AmendmentTable(Application &app, std::chrono::seconds majorityTime, std::vector< AmendmentTable::FeatureInfo > const &supported, Section const &enabled, Section const &vetoed, beast::Journal journal)
Definition: AmendmentTable.cpp:1072
ripple::setup_Overlay
Overlay::Setup setup_Overlay(BasicConfig const &config)
Definition: OverlayImpl.cpp:1477
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
ripple::make_Overlay
std::unique_ptr< Overlay > make_Overlay(Application &app, Overlay::Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
Creates the implementation of Overlay.
Definition: OverlayImpl.cpp:1582
ripple::make_SHAMapStore
std::unique_ptr< SHAMapStore > make_SHAMapStore(Application &app, NodeStore::Scheduler &scheduler, beast::Journal journal)
Definition: SHAMapStoreImp.cpp:683
std::chrono
diff --git a/ApplyStateTable_8cpp_source.html b/ApplyStateTable_8cpp_source.html index b5c304d98c..9b7eb46dc1 100644 --- a/ApplyStateTable_8cpp_source.html +++ b/ApplyStateTable_8cpp_source.html @@ -854,7 +854,7 @@ $(function() {
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:114
ripple::LedgerEntryType
LedgerEntryType
Identifiers for on-ledger objects.
Definition: LedgerFormats.h:54
ripple::after
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: View.cpp:2984
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std
STL namespace.
std::optional
std::pair::first
T first
diff --git a/ApplyView_8cpp_source.html b/ApplyView_8cpp_source.html index 649cf1d19f..922a039666 100644 --- a/ApplyView_8cpp_source.html +++ b/ApplyView_8cpp_source.html @@ -459,7 +459,7 @@ $(function() {
ripple::dirNodeMaxPages
std::uint64_t constexpr dirNodeMaxPages
The maximum number of pages allowed in a directory.
Definition: Protocol.h:60
ripple::dirNodeMaxEntries
std::size_t constexpr dirNodeMaxEntries
The maximum number of entries per directory page.
Definition: Protocol.h:57
ripple::root
Number root(Number f, unsigned d)
Definition: Number.cpp:636
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::optional
std::shared_ptr
std::sort
T sort(T... args)
diff --git a/BaseWSPeer_8h_source.html b/BaseWSPeer_8h_source.html index 10c0bfdda7..38dc3d5a24 100644 --- a/BaseWSPeer_8h_source.html +++ b/BaseWSPeer_8h_source.html @@ -660,7 +660,7 @@ $(function() {
ripple::BuildInfo::getFullVersionString
std::string const & getFullVersionString()
Full server version string.
Definition: BuildInfo.cpp:81
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::safe_cast
constexpr std::enable_if_t< std::is_integral_v< Dest > &&std::is_integral_v< Src >, Dest > safe_cast(Src s) noexcept
Definition: safe_cast.h:42
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::http_request_type
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Definition: Handoff.h:33
ripple::get_lowest_layer
decltype(auto) get_lowest_layer(T &t) noexcept
Definition: LowestLayer.h:35
std
STL namespace.
diff --git a/BuildInfo_8cpp_source.html b/BuildInfo_8cpp_source.html index f762b37e2c..50300df2c4 100644 --- a/BuildInfo_8cpp_source.html +++ b/BuildInfo_8cpp_source.html @@ -282,7 +282,7 @@ $(function() {
ripple::BuildInfo::getVersionString
std::string const & getVersionString()
Server version.
Definition: BuildInfo.cpp:68
ripple::BuildInfo::versionString
char const *const versionString
Definition: BuildInfo.cpp:39
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
string
string_view
std::string_view::substr
T substr(T... args)
diff --git a/CryptoPRNG__test_8cpp_source.html b/CryptoPRNG__test_8cpp_source.html deleted file mode 100644 index 3cf9acf626..0000000000 --- a/CryptoPRNG__test_8cpp_source.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - -rippled: CryptoPRNG_test.cpp Source File - - - - - - - - - -
-
- - - - - - -
-
rippled -
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
CryptoPRNG_test.cpp
-
-
-
1//------------------------------------------------------------------------------
-
2/*
-
3 This file is part of rippled: https://github.com/ripple/rippled
-
4 Copyright (c) 2012-2017 Ripple Labs Inc.
-
5
-
6 Permission to use, copy, modify, and/or distribute this software for any
-
7 purpose with or without fee is hereby granted, provided that the above
-
8 copyright notice and this permission notice appear in all copies.
-
9
-
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
17*/
-
18//==============================================================================
-
19
-
20#include <test/jtx/Env.h>
-
21
-
22#include <xrpl/beast/utility/temp_dir.h>
-
23#include <xrpl/crypto/csprng.h>
-
24
-
25namespace ripple {
-
26
- -
28{
-
29 void
- -
31 {
-
32 testcase("Get Values");
-
33 try
-
34 {
-
35 auto& engine = crypto_prng();
-
36 auto rand_val = engine();
-
37 BEAST_EXPECT(rand_val >= engine.min());
-
38 BEAST_EXPECT(rand_val <= engine.max());
-
39
-
40 uint16_t twoByte{0};
-
41 engine(&twoByte, sizeof(uint16_t));
-
42 pass();
-
43 }
-
44 catch (std::exception&)
-
45 {
-
46 fail();
-
47 }
-
48 }
-
49
-
50public:
-
51 void
-
52 run() override
-
53 {
- -
55 }
-
56};
-
57
-
58BEAST_DEFINE_TESTSUITE(CryptoPRNG, core, ripple);
-
59
-
60} // namespace ripple
-
A testsuite class.
Definition: suite.h:55
-
void pass()
Record a successful test condition.
Definition: suite.h:511
-
testcase_t testcase
Memberspace for declaring test cases.
Definition: suite.h:155
-
void fail(String const &reason, char const *file, int line)
Record a failure.
Definition: suite.h:533
- -
void run() override
Runs the suite.
- - -
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
-
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
-
- - - - diff --git a/DoManifest_8cpp_source.html b/DoManifest_8cpp_source.html index f55e42e9d4..4639e131a3 100644 --- a/DoManifest_8cpp_source.html +++ b/DoManifest_8cpp_source.html @@ -166,7 +166,7 @@ $(function() {
ripple::TokenType::NodePublic
@ NodePublic
ripple::rpcINVALID_PARAMS
@ rpcINVALID_PARAMS
Definition: ErrorCodes.h:84
ripple::doManifest
Json::Value doManifest(RPC::JsonContext &context)
Definition: DoManifest.cpp:30
-
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: base64.cpp:239
+
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: libxrpl/basics/base64.cpp:239
ripple::HashPrefix::manifest
@ manifest
Manifest.
ripple::RPC::Context::app
Application & app
Definition: Context.h:41
ripple::RPC::JsonContext
Definition: Context.h:53
diff --git a/Feature_8cpp_source.html b/Feature_8cpp_source.html index 3537435f2e..a57111c213 100644 --- a/Feature_8cpp_source.html +++ b/Feature_8cpp_source.html @@ -580,7 +580,7 @@ $(function() {
ripple::registrationIsDone
bool registrationIsDone()
Tell FeatureCollections when registration is complete.
Definition: Feature.cpp:411
ripple::sha512Half
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition: digest.h:225
ripple::readOnlySet
static bool const readOnlySet
Definition: Feature.cpp:479
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
optional
std::string::size
T size(T... args)
std::size_t
diff --git a/FeeUnits_8h_source.html b/FeeUnits_8h_source.html index d9d8d2fc11..08ca1b2d7e 100644 --- a/FeeUnits_8h_source.html +++ b/FeeUnits_8h_source.html @@ -691,7 +691,7 @@ $(function() {
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::safe_cast
constexpr std::enable_if_t< std::is_integral_v< Dest > &&std::is_integral_v< Src >, Dest > safe_cast(Src s) noexcept
Definition: safe_cast.h:42
ripple::multiply
STAmount multiply(STAmount const &amount, Rate const &rate)
Definition: Rate2.cpp:53
-
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: mulDiv.cpp:32
+
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: libxrpl/basics/mulDiv.cpp:32
ripple::unsafe_cast
constexpr std::enable_if_t< std::is_integral_v< Dest > &&std::is_integral_v< Src >, Dest > unsafe_cast(Src s) noexcept
Definition: safe_cast.h:78
optional
sstream
diff --git a/FeeUnits__test_8cpp_source.html b/FeeUnits__test_8cpp_source.html index 9a2ba2d620..46c3e8355b 100644 --- a/FeeUnits__test_8cpp_source.html +++ b/FeeUnits__test_8cpp_source.html @@ -474,7 +474,7 @@ $(function() {
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::INITIAL_XRP
constexpr XRPAmount INITIAL_XRP
Configure the native currency.
Definition: SystemParameters.h:44
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
-
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: mulDiv.cpp:32
+
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: libxrpl/basics/mulDiv.cpp:32
std::remove_reference_t
ripple::test::jtx::PrettyAmount::value
STAmount const & value() const
Definition: src/test/jtx/amount.h:125
diff --git a/Handler_8cpp_source.html b/Handler_8cpp_source.html index b156d3eedb..1adbc9a2d3 100644 --- a/Handler_8cpp_source.html +++ b/Handler_8cpp_source.html @@ -493,7 +493,7 @@ $(function() {
ripple::doValidators
Json::Value doValidators(RPC::JsonContext &)
Definition: Validators.cpp:29
ripple::doOwnerInfo
Json::Value doOwnerInfo(RPC::JsonContext &)
Definition: OwnerInfo.cpp:35
ripple::doPrint
Json::Value doPrint(RPC::JsonContext &)
Definition: Print.cpp:30
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
ripple::doUnlList
Json::Value doUnlList(RPC::JsonContext &)
Definition: UnlList.cpp:30
ripple::doPathFind
Json::Value doPathFind(RPC::JsonContext &)
Definition: PathFind.cpp:33
std::pair
diff --git a/Handshake_8cpp_source.html b/Handshake_8cpp_source.html index 418f202878..00058d0aa2 100644 --- a/Handshake_8cpp_source.html +++ b/Handshake_8cpp_source.html @@ -530,7 +530,7 @@ $(function() {
ripple::buildHandshake
void buildHandshake(boost::beast::http::fields &h, ripple::uint256 const &sharedValue, std::optional< std::uint32_t > networkID, beast::IP::Address public_ip, beast::IP::Address remote_ip, Application &app)
Insert fields headers necessary for upgrading the link to the peer protocol.
Definition: Handshake.cpp:178
ripple::FEATURE_COMPR
static constexpr char FEATURE_COMPR[]
Definition: Handshake.h:141
ripple::makeFeaturesRequestHeader
std::string makeFeaturesRequestHeader(bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled)
Make request header X-Protocol-Ctl value with supported features.
Definition: Handshake.cpp:75
-
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: base64.cpp:248
+
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: libxrpl/basics/base64.cpp:248
ripple::makeResponse
http_response_type makeResponse(bool crawlPublic, http_request_type const &req, beast::IP::Address public_ip, beast::IP::Address remote_ip, uint256 const &sharedValue, std::optional< std::uint32_t > networkID, ProtocolVersion protocol, Application &app)
Make http response.
Definition: Handshake.cpp:392
ripple::FEATURE_LEDGER_REPLAY
static constexpr char FEATURE_LEDGER_REPLAY[]
Definition: Handshake.h:147
ripple::isFeatureValue
bool isFeatureValue(boost::beast::http::fields const &headers, std::string const &feature, std::string const &value)
Check if a feature's value is equal to the specified value.
Definition: Handshake.cpp:55
@@ -541,7 +541,7 @@ $(function() {
ripple::hashLastMessage
static std::optional< base_uint< 512 > > hashLastMessage(SSL const *ssl, size_t(*get)(const SSL *, void *, size_t))
Hashes the latest finished message from an SSL stream.
Definition: Handshake.cpp:128
ripple::makeSlice
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:244
ripple::KeyType::secp256k1
@ secp256k1
-
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: base64.cpp:239
+
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: libxrpl/basics/base64.cpp:239
ripple::signDigest
Buffer signDigest(PublicKey const &pk, SecretKey const &sk, uint256 const &digest)
Generate a signature for a message digest.
Definition: SecretKey.cpp:230
ripple::http_request_type
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Definition: Handoff.h:33
ripple::featureEnabled
bool featureEnabled(boost::beast::http::fields const &headers, std::string const &feature)
Check if a feature is enabled.
Definition: Handshake.cpp:67
diff --git a/JobQueue_8cpp_source.html b/JobQueue_8cpp_source.html index 55f7d0d2d6..b4412865af 100644 --- a/JobQueue_8cpp_source.html +++ b/JobQueue_8cpp_source.html @@ -610,7 +610,7 @@ $(function() {
ripple::jtGENERIC
@ jtGENERIC
Definition: Job.h:87
ripple::jtCLIENT
@ jtCLIENT
Definition: Job.h:45
ripple::jtCLIENT_WEBSOCKET
@ jtCLIENT_WEBSOCKET
Definition: Job.h:51
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::chrono
std::condition_variable::notify_all
T notify_all(T... args)
std::chrono::steady_clock::now
T now(T... args)
diff --git a/KnownFormats_8h_source.html b/KnownFormats_8h_source.html index 2b67ccb2c4..988e810067 100644 --- a/KnownFormats_8h_source.html +++ b/KnownFormats_8h_source.html @@ -276,7 +276,7 @@ $(function() {
beast
Definition: base_uint.h:662
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::KeyType
KeyType
Definition: KeyType.h:28
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::string::size
T size(T... args)
std::size_t
std::string::substr
T substr(T... args)
diff --git a/LedgerCleaner_8cpp_source.html b/LedgerCleaner_8cpp_source.html index 3b77d5e7ff..01717edb20 100644 --- a/LedgerCleaner_8cpp_source.html +++ b/LedgerCleaner_8cpp_source.html @@ -594,7 +594,7 @@ $(function() {
ripple::loadByIndex
std::shared_ptr< Ledger > loadByIndex(std::uint32_t ledgerIndex, Application &app, bool acquire)
Definition: Ledger.cpp:1113
ripple::getCandidateLedger
LedgerIndex getCandidateLedger(LedgerIndex requested)
Find a ledger index from which we could easily get the requested ledger.
Definition: View.h:407
ripple::hashOfSeq
std::optional< uint256 > hashOfSeq(ReadView const &ledger, LedgerIndex seq, beast::Journal journal)
Return the hash of a ledger by sequence.
Definition: View.cpp:960
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
ripple::pendSaveValidated
bool pendSaveValidated(Application &app, std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
Save, or arrange to save, a fully-validated ledger Returns false on error.
Definition: Ledger.cpp:993
std::condition_variable::notify_one
T notify_one(T... args)
std::optional
diff --git a/LedgerHistory_8cpp_source.html b/LedgerHistory_8cpp_source.html index 0f74f61a84..b248792808 100644 --- a/LedgerHistory_8cpp_source.html +++ b/LedgerHistory_8cpp_source.html @@ -686,7 +686,7 @@ $(function() {
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
ripple::log_metadata_difference
static void log_metadata_difference(ReadView const &builtLedger, ReadView const &validLedger, uint256 const &tx, beast::Journal j)
Definition: LedgerHistory.cpp:182
ripple::getJson
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
Definition: LedgerToJson.cpp:360
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std
STL namespace.
std::optional
std::pair::second
T second
diff --git a/LedgerHolder_8h_source.html b/LedgerHolder_8h_source.html index fb2684ae05..a777f6297d 100644 --- a/LedgerHolder_8h_source.html +++ b/LedgerHolder_8h_source.html @@ -157,7 +157,7 @@ $(function() {
std::lock_guard
mutex
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::shared_ptr
diff --git a/LedgerMaster_8cpp_source.html b/LedgerMaster_8cpp_source.html index 45216aa545..8b9168e1fa 100644 --- a/LedgerMaster_8cpp_source.html +++ b/LedgerMaster_8cpp_source.html @@ -2582,7 +2582,7 @@ $(function() {
ripple::jtADVANCE
@ jtADVANCE
Definition: Job.h:67
ripple::sha512Half
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition: digest.h:225
ripple::areCompatible
bool areCompatible(ReadView const &validLedger, ReadView const &testLedger, beast::Journal::Stream &s, char const *reason)
Return false if the test ledger is provably incompatible with the valid ledger, that is,...
Definition: View.cpp:798
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
ripple::pendSaveValidated
bool pendSaveValidated(Application &app, std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
Save, or arrange to save, a fully-validated ledger Returns false on error.
Definition: Ledger.cpp:993
std::chrono
std
STL namespace.
diff --git a/Ledger_8cpp_source.html b/Ledger_8cpp_source.html index 2481353092..dec9c032c0 100644 --- a/Ledger_8cpp_source.html +++ b/Ledger_8cpp_source.html @@ -1423,7 +1423,7 @@ $(function() {
ripple::jtPUBOLDLEDGER
@ jtPUBOLDLEDGER
Definition: Job.h:44
ripple::sha512Half
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition: digest.h:225
ripple::FLAG_LEDGER_INTERVAL
std::uint32_t constexpr FLAG_LEDGER_INTERVAL
Definition: Ledger.h:426
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
ripple::pendSaveValidated
bool pendSaveValidated(Application &app, std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
Save, or arrange to save, a fully-validated ledger Returns false on error.
Definition: Ledger.cpp:993
ripple::getNextLedgerTimeResolution
std::chrono::duration< Rep, Period > getNextLedgerTimeResolution(std::chrono::duration< Rep, Period > previousResolution, bool previousAgree, Seq ledgerSeq)
Calculates the close time resolution for the specified ledger.
Definition: LedgerTiming.h:80
std
STL namespace.
diff --git a/LoadFeeTrack_8cpp_source.html b/LoadFeeTrack_8cpp_source.html index 3d0ea680b7..a6d8f5856a 100644 --- a/LoadFeeTrack_8cpp_source.html +++ b/LoadFeeTrack_8cpp_source.html @@ -210,7 +210,7 @@ $(function() {
std::lock_guard
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::scaleFeeLoad
XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const &feeTrack, Fees const &fees, bool bUnlimited)
Definition: LoadFeeTrack.cpp:85
-
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: mulDiv.cpp:32
+
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: libxrpl/basics/mulDiv.cpp:32
ripple::Fees
Reflects the fee settings for a particular ledger.
Definition: protocol/Fees.h:33
diff --git a/LoadManager_8cpp_source.html b/LoadManager_8cpp_source.html index 2174c8669a..1cb9070a09 100644 --- a/LoadManager_8cpp_source.html +++ b/LoadManager_8cpp_source.html @@ -319,7 +319,7 @@ $(function() {
beast::setCurrentThreadName
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
Definition: CurrentThreadName.cpp:123
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::make_LoadManager
std::unique_ptr< LoadManager > make_LoadManager(Application &app, beast::Journal journal)
Definition: LoadManager.cpp:199
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::chrono
std::condition_variable::notify_all
T notify_all(T... args)
std::chrono::steady_clock::now
T now(T... args)
diff --git a/Manifest_8cpp_source.html b/Manifest_8cpp_source.html index 3bd10c15d5..3fe3058cb2 100644 --- a/Manifest_8cpp_source.html +++ b/Manifest_8cpp_source.html @@ -750,7 +750,7 @@ $(function() {
ripple::strUnHex
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
Definition: StringUtilities.h:52
ripple::saveManifests
void saveManifests(soci::session &session, std::string const &dbTable, std::function< bool(PublicKey const &)> const &isTrusted, hash_map< PublicKey, Manifest > const &map, beast::Journal j)
saveManifests Saves all given manifests to the database.
Definition: Wallet.cpp:94
ripple::verify
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical=true) noexcept
Verify a signature on a message.
Definition: PublicKey.cpp:288
-
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: base64.cpp:248
+
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: libxrpl/basics/base64.cpp:248
ripple::sfGeneric
SField const sfGeneric
ripple::publicKeyType
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
Definition: PublicKey.cpp:223
ripple::logMftAct
Stream & logMftAct(Stream &s, std::string const &action, PublicKey const &pk, std::uint32_t seq)
Definition: Manifest.cpp:168
diff --git a/Manifest__test_8cpp_source.html b/Manifest__test_8cpp_source.html index 1fcf30fad1..6dc33e20a4 100644 --- a/Manifest__test_8cpp_source.html +++ b/Manifest__test_8cpp_source.html @@ -1245,7 +1245,7 @@ $(function() {
ripple::KeyType
KeyType
Definition: KeyType.h:28
ripple::KeyType::ed25519
@ ed25519
ripple::KeyType::secp256k1
@ secp256k1
-
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: base64.cpp:239
+
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: libxrpl/basics/base64.cpp:239
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
ripple::randomKeyPair
std::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
Definition: SecretKey.cpp:386
ripple::loadValidatorToken
std::optional< ValidatorToken > loadValidatorToken(std::vector< std::string > const &blob, beast::Journal journal)
Definition: Manifest.cpp:264
diff --git a/NetworkOPs_8cpp_source.html b/NetworkOPs_8cpp_source.html index 8afa6412e8..b96958218a 100644 --- a/NetworkOPs_8cpp_source.html +++ b/NetworkOPs_8cpp_source.html @@ -5300,7 +5300,7 @@ $(function() {
ripple::multiply
STAmount multiply(STAmount const &amount, Rate const &rate)
Definition: Rate2.cpp:53
ripple::calcAccountID
AccountID calcAccountID(PublicKey const &pk)
Definition: AccountID.cpp:168
ripple::ValStatus::current
@ current
This was a new validation and was added.
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::rpcError
Json::Value rpcError(int iError)
Definition: RPCErr.cpp:31
ripple::tefPAST_SEQ
@ tefPAST_SEQ
Definition: TER.h:175
ripple::isTefFailure
bool isTefFailure(TER x) noexcept
Definition: TER.h:662
@@ -5322,7 +5322,7 @@ $(function() {
ripple::setup_FeeVote
FeeSetup setup_FeeVote(Section const &section)
Definition: Config.cpp:1128
ripple::isTemMalformed
bool isTemMalformed(TER x) noexcept
Definition: TER.h:656
ripple::root
Number root(Number f, unsigned d)
Definition: Number.cpp:636
-
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: mulDiv.cpp:32
+
ripple::mulDiv
std::optional< std::uint64_t > mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
Return value*mul/div accurately.
Definition: libxrpl/basics/mulDiv.cpp:32
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:31
ripple::tapFAIL_HARD
@ tapFAIL_HARD
Definition: ApplyView.h:36
ripple::tapUNLIMITED
@ tapUNLIMITED
Definition: ApplyView.h:43
diff --git a/OpenView_8cpp_source.html b/OpenView_8cpp_source.html index c8f92fc0b0..1d35693150 100644 --- a/OpenView_8cpp_source.html +++ b/OpenView_8cpp_source.html @@ -414,7 +414,7 @@ $(function() {
ripple::ConsensusPhase::open
@ open
We haven't closed our ledger yet, but others might have.
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
ripple::get
T get(Section const &section, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
Definition: BasicConfig.h:355
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std
STL namespace.
std::optional
std::pair
diff --git a/OverlayImpl_8cpp_source.html b/OverlayImpl_8cpp_source.html index 2a9543ef52..ca27953663 100644 --- a/OverlayImpl_8cpp_source.html +++ b/OverlayImpl_8cpp_source.html @@ -1868,7 +1868,7 @@ $(function() {
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::ManifestDisposition::accepted
@ accepted
Manifest is valid.
ripple::makeSlice
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:244
-
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: base64.cpp:239
+
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: libxrpl/basics/base64.cpp:239
ripple::stopwatch
Stopwatch & stopwatch()
Returns an instance of a wall clock.
Definition: chrono.h:119
ripple::http_request_type
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Definition: Handoff.h:33
ripple::getCountsJson
Json::Value getCountsJson(Application &app, int minObjectCount)
Definition: GetCounts.cpp:62
diff --git a/PeerImp_8cpp_source.html b/PeerImp_8cpp_source.html index 753fbac809..394e7bdb8f 100644 --- a/PeerImp_8cpp_source.html +++ b/PeerImp_8cpp_source.html @@ -3875,7 +3875,7 @@ $(function() {
ripple::ProtocolFeature::LedgerReplay
@ LedgerReplay
ripple::ProtocolFeature::ValidatorListPropagation
@ ValidatorListPropagation
ripple::ProtocolFeature::ValidatorList2Propagation
@ ValidatorList2Propagation
-
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: base64.cpp:248
+
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: libxrpl/basics/base64.cpp:248
ripple::set
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:315
ripple::makeResponse
http_response_type makeResponse(bool crawlPublic, http_request_type const &req, beast::IP::Address public_ip, beast::IP::Address remote_ip, uint256 const &sharedValue, std::optional< std::uint32_t > networkID, ProtocolVersion protocol, Application &app)
Make http response.
Definition: Handshake.cpp:392
ripple::stringIsUint256Sized
static bool stringIsUint256Sized(std::string const &pBuffStr)
Definition: PeerImp.cpp:150
diff --git a/PublicKey_8cpp_source.html b/PublicKey_8cpp_source.html index f38cbaf38a..8ac393ab56 100644 --- a/PublicKey_8cpp_source.html +++ b/PublicKey_8cpp_source.html @@ -438,7 +438,7 @@ $(function() {
ripple::calcNodeID
NodeID calcNodeID(PublicKey const &)
Calculate the 160-bit node ID from a node public key.
Definition: PublicKey.cpp:319
ripple::ed25519Canonical
static bool ed25519Canonical(Slice const &sig)
Definition: PublicKey.cpp:171
ripple::sha512Half
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition: digest.h:225
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
optional
ostream
std::string::reserve
T reserve(T... args)
diff --git a/RCLConsensus_8cpp_source.html b/RCLConsensus_8cpp_source.html index 770575b6a2..af7452d7cf 100644 --- a/RCLConsensus_8cpp_source.html +++ b/RCLConsensus_8cpp_source.html @@ -1354,7 +1354,7 @@ $(function() {
ripple::OperatingMode::CONNECTED
@ CONNECTED
convinced we are talking to the network
ripple::OperatingMode::FULL
@ FULL
we have the ledger and can even validate
ripple::SHAMapType::TRANSACTION
@ TRANSACTION
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::ConsensusState::MovedOn
@ MovedOn
The network has consensus without us.
ripple::ConsensusState::Yes
@ Yes
We have consensus along with the network.
ripple::ManifestDisposition::accepted
@ accepted
Manifest is valid.
diff --git a/RPCCall_8cpp_source.html b/RPCCall_8cpp_source.html index 0cb21b9817..ceb7b426c6 100644 --- a/RPCCall_8cpp_source.html +++ b/RPCCall_8cpp_source.html @@ -1928,7 +1928,7 @@ $(function() {
ripple::isRpcError
bool isRpcError(Json::Value jvResult)
Definition: RPCErr.cpp:40
ripple::makeSlice
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:244
ripple::setup_ServerHandler
ServerHandler::Setup setup_ServerHandler(Config const &config, std::ostream &&log)
Definition: ServerHandler.cpp:1256
-
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: base64.cpp:239
+
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: libxrpl/basics/base64.cpp:239
ripple::JSONRPCRequest
std::string JSONRPCRequest(std::string const &strMethod, Json::Value const &params, Json::Value const &id)
Definition: RPCCall.cpp:1338
ripple::rpcCmdToJson
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition: RPCCall.cpp:1440
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
diff --git a/RPCHelpers_8cpp_source.html b/RPCHelpers_8cpp_source.html index 0c41e67705..696da41e09 100644 --- a/RPCHelpers_8cpp_source.html +++ b/RPCHelpers_8cpp_source.html @@ -1358,7 +1358,7 @@ $(function() {
ripple::getJson
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
Definition: LedgerToJson.cpp:360
ripple::HashPrefix::ledgerMaster
@ ledgerMaster
ledger master data for signing
ripple::parseGenericSeed
std::optional< Seed > parseGenericSeed(std::string const &str, bool rfc1751=true)
Attempt to parse a string as a seed.
Definition: Seed.cpp:97
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::optional
std::pair
std::shared_ptr
diff --git a/Random_8cpp_source.html b/Random_8cpp_source.html index 5dbf4ae53b..59db77c185 100644 --- a/Random_8cpp_source.html +++ b/Random_8cpp_source.html @@ -140,7 +140,7 @@ $(function() {
beast::rngfill
void rngfill(void *buffer, std::size_t bytes, Generator &g)
Definition: rngfill.h:34
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::rpcINTERNAL
@ rpcINTERNAL
Definition: ErrorCodes.h:130
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::rpcError
Json::Value rpcError(int iError)
Definition: RPCErr.cpp:31
ripple::doRandom
Json::Value doRandom(RPC::JsonContext &)
Definition: Random.cpp:39
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
diff --git a/RangeSet_8cpp_source.html b/RangeSet_8cpp_source.html new file mode 100644 index 0000000000..631426d1f2 --- /dev/null +++ b/RangeSet_8cpp_source.html @@ -0,0 +1,225 @@ + + + + + + + +rippled: RangeSet.cpp Source File + + + + + + + + + +
+
+ + + + + + +
+
rippled +
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
RangeSet.cpp
+
+
+
1//------------------------------------------------------------------------------
+
2/*
+
3 This file is part of rippled: https://github.com/ripple/rippled
+
4 Copyright (c) 2012 Ripple Labs Inc.
+
5
+
6 Permission to use, copy, modify, and/or distribute this software for any
+
7 purpose with or without fee is hereby granted, provided that the above
+
8 copyright notice and this permission notice appear in all copies.
+
9
+
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
17*/
+
18//==============================================================================
+
19
+
20#include <xrpl/basics/RangeSet.h>
+
21
+
22#include <doctest/doctest.h>
+
23
+
24#include <cstdint>
+
25#include <optional>
+
26
+
27using namespace ripple;
+
28
+
29TEST_SUITE_BEGIN("RangeSet");
+
30
+
31TEST_CASE("prevMissing")
+
32{
+
33 // Set will include:
+
34 // [ 0, 5]
+
35 // [10,15]
+
36 // [20,25]
+
37 // etc...
+
38
+ +
40 for (std::uint32_t i = 0; i < 10; ++i)
+
41 set.insert(range(10 * i, 10 * i + 5));
+
42
+
43 for (std::uint32_t i = 1; i < 100; ++i)
+
44 {
+ +
46 // no prev missing in domain for i <= 6
+
47 if (i > 6)
+
48 {
+
49 std::uint32_t const oneBelowRange = (10 * (i / 10)) - 1;
+
50
+
51 expected = ((i % 10) > 6) ? (i - 1) : oneBelowRange;
+
52 }
+
53 CHECK(prevMissing(set, i) == expected);
+
54 }
+
55}
+
56
+
57TEST_CASE("toString")
+
58{
+ +
60 CHECK(to_string(set) == "empty");
+
61
+
62 set.insert(1);
+
63 CHECK(to_string(set) == "1");
+
64
+
65 set.insert(range(4u, 6u));
+
66 CHECK(to_string(set) == "1,4-6");
+
67
+
68 set.insert(2);
+
69 CHECK(to_string(set) == "1-2,4-6");
+
70
+
71 set.erase(range(4u, 5u));
+
72 CHECK(to_string(set) == "1-2,6");
+
73}
+
74
+
75TEST_CASE("fromString")
+
76{
+ +
78
+
79 CHECK(!from_string(set, ""));
+
80 CHECK(boost::icl::length(set) == 0);
+
81
+
82 CHECK(!from_string(set, "#"));
+
83 CHECK(boost::icl::length(set) == 0);
+
84
+
85 CHECK(!from_string(set, ","));
+
86 CHECK(boost::icl::length(set) == 0);
+
87
+
88 CHECK(!from_string(set, ",-"));
+
89 CHECK(boost::icl::length(set) == 0);
+
90
+
91 CHECK(!from_string(set, "1,,2"));
+
92 CHECK(boost::icl::length(set) == 0);
+
93
+
94 CHECK(from_string(set, "1"));
+
95 CHECK(boost::icl::length(set) == 1);
+
96 CHECK(boost::icl::first(set) == 1);
+
97
+
98 CHECK(from_string(set, "1,1"));
+
99 CHECK(boost::icl::length(set) == 1);
+
100 CHECK(boost::icl::first(set) == 1);
+
101
+
102 CHECK(from_string(set, "1-1"));
+
103 CHECK(boost::icl::length(set) == 1);
+
104 CHECK(boost::icl::first(set) == 1);
+
105
+
106 CHECK(from_string(set, "1,4-6"));
+
107 CHECK(boost::icl::length(set) == 4);
+
108 CHECK(boost::icl::first(set) == 1);
+
109 CHECK(!boost::icl::contains(set, 2));
+
110 CHECK(!boost::icl::contains(set, 3));
+
111 CHECK(boost::icl::contains(set, 4));
+
112 CHECK(boost::icl::contains(set, 5));
+
113 CHECK(boost::icl::last(set) == 6);
+
114
+
115 CHECK(from_string(set, "1-2,4-6"));
+
116 CHECK(boost::icl::length(set) == 5);
+
117 CHECK(boost::icl::first(set) == 1);
+
118 CHECK(boost::icl::contains(set, 2));
+
119 CHECK(boost::icl::contains(set, 4));
+
120 CHECK(boost::icl::last(set) == 6);
+
121
+
122 CHECK(from_string(set, "1-2,6"));
+
123 CHECK(boost::icl::length(set) == 3);
+
124 CHECK(boost::icl::first(set) == 1);
+
125 CHECK(boost::icl::contains(set, 2));
+
126 CHECK(boost::icl::last(set) == 6);
+
127}
+
128
+
129TEST_SUITE_END();
+ + +
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
+ +
std::optional< T > prevMissing(RangeSet< T > const &rs, T t, T minVal=0)
Find the largest value not in the set that is less than a given value.
Definition: RangeSet.h:183
+
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:315
+
bool from_string(RangeSet< T > &rs, std::string const &s)
Convert the given styled string to a RangeSet.
Definition: RangeSet.h:124
+
boost::icl::interval_set< T, std::less, ClosedInterval< T > > RangeSet
A set of closed intervals over the domain T.
Definition: RangeSet.h:70
+
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
+
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition: RangeSet.h:54
+ +
+ + + + diff --git a/RangeSet__test_8cpp_source.html b/RangeSet__test_8cpp_source.html deleted file mode 100644 index 62dd311f4d..0000000000 --- a/RangeSet__test_8cpp_source.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - -rippled: RangeSet_test.cpp Source File - - - - - - - - - -
-
- - - - - - -
-
rippled -
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
RangeSet_test.cpp
-
-
-
1//------------------------------------------------------------------------------
-
2/*
-
3 This file is part of rippled: https://github.com/ripple/rippled
-
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
-
5
-
6 Permission to use, copy, modify, and/or distribute this software for any
-
7 purpose with or without fee is hereby granted, provided that the above
-
8 copyright notice and this permission notice appear in all copies.
-
9
-
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
17*/
-
18//==============================================================================
-
19
-
20#include <xrpl/basics/RangeSet.h>
-
21#include <xrpl/beast/unit_test.h>
-
22
-
23namespace ripple {
- -
25{
-
26public:
-
27 void
- -
29 {
-
30 testcase("prevMissing");
-
31
-
32 // Set will include:
-
33 // [ 0, 5]
-
34 // [10,15]
-
35 // [20,25]
-
36 // etc...
-
37
- -
39 for (std::uint32_t i = 0; i < 10; ++i)
-
40 set.insert(range(10 * i, 10 * i + 5));
-
41
-
42 for (std::uint32_t i = 1; i < 100; ++i)
-
43 {
- -
45 // no prev missing in domain for i <= 6
-
46 if (i > 6)
-
47 {
-
48 std::uint32_t const oneBelowRange = (10 * (i / 10)) - 1;
-
49
-
50 expected = ((i % 10) > 6) ? (i - 1) : oneBelowRange;
-
51 }
-
52 BEAST_EXPECT(prevMissing(set, i) == expected);
-
53 }
-
54 }
-
55
-
56 void
- -
58 {
-
59 testcase("toString");
-
60
- -
62 BEAST_EXPECT(to_string(set) == "empty");
-
63
-
64 set.insert(1);
-
65 BEAST_EXPECT(to_string(set) == "1");
-
66
-
67 set.insert(range(4u, 6u));
-
68 BEAST_EXPECT(to_string(set) == "1,4-6");
-
69
-
70 set.insert(2);
-
71 BEAST_EXPECT(to_string(set) == "1-2,4-6");
-
72
-
73 set.erase(range(4u, 5u));
-
74 BEAST_EXPECT(to_string(set) == "1-2,6");
-
75 }
-
76
-
77 void
- -
79 {
-
80 testcase("fromString");
-
81
- -
83
-
84 BEAST_EXPECT(!from_string(set, ""));
-
85 BEAST_EXPECT(boost::icl::length(set) == 0);
-
86
-
87 BEAST_EXPECT(!from_string(set, "#"));
-
88 BEAST_EXPECT(boost::icl::length(set) == 0);
-
89
-
90 BEAST_EXPECT(!from_string(set, ","));
-
91 BEAST_EXPECT(boost::icl::length(set) == 0);
-
92
-
93 BEAST_EXPECT(!from_string(set, ",-"));
-
94 BEAST_EXPECT(boost::icl::length(set) == 0);
-
95
-
96 BEAST_EXPECT(!from_string(set, "1,,2"));
-
97 BEAST_EXPECT(boost::icl::length(set) == 0);
-
98
-
99 BEAST_EXPECT(from_string(set, "1"));
-
100 BEAST_EXPECT(boost::icl::length(set) == 1);
-
101 BEAST_EXPECT(boost::icl::first(set) == 1);
-
102
-
103 BEAST_EXPECT(from_string(set, "1,1"));
-
104 BEAST_EXPECT(boost::icl::length(set) == 1);
-
105 BEAST_EXPECT(boost::icl::first(set) == 1);
-
106
-
107 BEAST_EXPECT(from_string(set, "1-1"));
-
108 BEAST_EXPECT(boost::icl::length(set) == 1);
-
109 BEAST_EXPECT(boost::icl::first(set) == 1);
-
110
-
111 BEAST_EXPECT(from_string(set, "1,4-6"));
-
112 BEAST_EXPECT(boost::icl::length(set) == 4);
-
113 BEAST_EXPECT(boost::icl::first(set) == 1);
-
114 BEAST_EXPECT(!boost::icl::contains(set, 2));
-
115 BEAST_EXPECT(!boost::icl::contains(set, 3));
-
116 BEAST_EXPECT(boost::icl::contains(set, 4));
-
117 BEAST_EXPECT(boost::icl::contains(set, 5));
-
118 BEAST_EXPECT(boost::icl::last(set) == 6);
-
119
-
120 BEAST_EXPECT(from_string(set, "1-2,4-6"));
-
121 BEAST_EXPECT(boost::icl::length(set) == 5);
-
122 BEAST_EXPECT(boost::icl::first(set) == 1);
-
123 BEAST_EXPECT(boost::icl::contains(set, 2));
-
124 BEAST_EXPECT(boost::icl::contains(set, 4));
-
125 BEAST_EXPECT(boost::icl::last(set) == 6);
-
126
-
127 BEAST_EXPECT(from_string(set, "1-2,6"));
-
128 BEAST_EXPECT(boost::icl::length(set) == 3);
-
129 BEAST_EXPECT(boost::icl::first(set) == 1);
-
130 BEAST_EXPECT(boost::icl::contains(set, 2));
-
131 BEAST_EXPECT(boost::icl::last(set) == 6);
-
132 }
-
133 void
-
134 run() override
-
135 {
- -
137 testToString();
- -
139 }
-
140};
-
141
-
142BEAST_DEFINE_TESTSUITE(RangeSet, ripple_basics, ripple);
-
143
-
144} // namespace ripple
-
A testsuite class.
Definition: suite.h:55
-
testcase_t testcase
Memberspace for declaring test cases.
Definition: suite.h:155
- - - - -
void run() override
Runs the suite.
- -
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
-
std::optional< T > prevMissing(RangeSet< T > const &rs, T t, T minVal=0)
Find the largest value not in the set that is less than a given value.
Definition: RangeSet.h:183
-
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:315
-
bool from_string(RangeSet< T > &rs, std::string const &s)
Convert the given styled string to a RangeSet.
Definition: RangeSet.h:124
-
boost::icl::interval_set< T, std::less, ClosedInterval< T > > RangeSet
A set of closed intervals over the domain T.
Definition: RangeSet.h:70
-
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
-
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition: RangeSet.h:54
- -
- - - - diff --git a/RawStateTable_8cpp_source.html b/RawStateTable_8cpp_source.html index 5f68664faf..c954cf13e6 100644 --- a/RawStateTable_8cpp_source.html +++ b/RawStateTable_8cpp_source.html @@ -489,7 +489,7 @@ $(function() {
std::map::find
T find(T... args)
std::forward_as_tuple
T forward_as_tuple(T... args)
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::optional
std::piecewise_construct
T piecewise_construct
std::shared_ptr
diff --git a/SHAMapItem_8h_source.html b/SHAMapItem_8h_source.html index 85d0c19213..6245d694bb 100644 --- a/SHAMapItem_8h_source.html +++ b/SHAMapItem_8h_source.html @@ -299,7 +299,7 @@ $(function() {
ripple::intrusive_ptr_release
void intrusive_ptr_release(SHAMapItem const *x)
Definition: SHAMapItem.h:141
ripple::make_shamapitem
boost::intrusive_ptr< SHAMapItem > make_shamapitem(uint256 const &tag, Slice data)
Definition: SHAMapItem.h:161
ripple::intrusive_ptr_add_ref
void intrusive_ptr_add_ref(SHAMapItem const *x)
Definition: SHAMapItem.h:132
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std
STL namespace.
std::size_t
diff --git a/SHAMap_8cpp_source.html b/SHAMap_8cpp_source.html index b41d9324dc..edb8124299 100644 --- a/SHAMap_8cpp_source.html +++ b/SHAMap_8cpp_source.html @@ -1444,7 +1444,7 @@ $(function() {
ripple::SHAMapNodeType::tnINNER
@ tnINNER
ripple::SHAMapNodeType::tnTRANSACTION_NM
@ tnTRANSACTION_NM
ripple::SHAMapNodeType::tnACCOUNT_STATE
@ tnACCOUNT_STATE
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std::pair::first
T first
std::stack::pop
T pop(T... args)
std::stack::push
T push(T... args)
diff --git a/STTx_8cpp_source.html b/STTx_8cpp_source.html index 503342ce5c..f33d66fd18 100644 --- a/STTx_8cpp_source.html +++ b/STTx_8cpp_source.html @@ -1032,7 +1032,7 @@ $(function() {
ripple::HashPrefix::txSign
@ txSign
inner transaction to sign
ripple::HashPrefix::transactionID
@ transactionID
transaction plus signature to give transaction ID
ripple::maxBatchTxCount
std::size_t constexpr maxBatchTxCount
The maximum number of transactions that can be in a batch.
Definition: Protocol.h:173
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std
STL namespace.
optional
std::ref
T ref(T... args)
diff --git a/STValidation_8h_source.html b/STValidation_8h_source.html index 756c5c117c..03b7c555d6 100644 --- a/STValidation_8h_source.html +++ b/STValidation_8h_source.html @@ -401,7 +401,7 @@ $(function() {
ripple::vfFullValidation
constexpr std::uint32_t vfFullValidation
Definition: STValidation.h:41
ripple::getJson
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
Definition: LedgerToJson.cpp:360
ripple::soeREQUIRED
@ soeREQUIRED
Definition: SOTemplate.h:36
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
std
STL namespace.
optional
std::size_t
diff --git a/SecretKey_8cpp_source.html b/SecretKey_8cpp_source.html index b11e7552b2..0cfa9ff129 100644 --- a/SecretKey_8cpp_source.html +++ b/SecretKey_8cpp_source.html @@ -511,7 +511,7 @@ $(function() {
ripple::TokenType
TokenType
Definition: tokens.h:38
ripple::parseBase58
std::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
Definition: AccountID.cpp:124
ripple::generateKeyPair
std::pair< PublicKey, SecretKey > generateKeyPair(KeyType type, Seed const &seed)
Generate a key pair deterministically.
Definition: SecretKey.cpp:369
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::derivePublicKey
PublicKey derivePublicKey(KeyType type, SecretKey const &sk)
Derive the public key from a secret key.
Definition: SecretKey.cpp:331
ripple::generateSecretKey
SecretKey generateSecretKey(KeyType type, Seed const &seed)
Generate a new secret key deterministically.
Definition: SecretKey.cpp:309
ripple::sign
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &message)
Generate a signature for a message.
Definition: SecretKey.cpp:256
@@ -528,7 +528,7 @@ $(function() {
ripple::signDigest
Buffer signDigest(PublicKey const &pk, SecretKey const &sk, uint256 const &digest)
Generate a signature for a message digest.
Definition: SecretKey.cpp:230
ripple::randomKeyPair
std::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
Definition: SecretKey.cpp:386
ripple::sha512Half
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition: digest.h:225
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
ripple::secure_erase
void secure_erase(void *dest, std::size_t bytes)
Attempts to clear the given blob of memory.
Definition: secure_erase.cpp:29
optional
std::pair
diff --git a/SecretKey__test_8cpp_source.html b/SecretKey__test_8cpp_source.html index 70bfea720a..a2afa5ac69 100644 --- a/SecretKey__test_8cpp_source.html +++ b/SecretKey__test_8cpp_source.html @@ -1631,7 +1631,7 @@ $(function() {
ripple::generateKeyPair
std::pair< PublicKey, SecretKey > generateKeyPair(KeyType type, Seed const &seed)
Generate a key pair deterministically.
Definition: SecretKey.cpp:369
ripple::verify
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical=true) noexcept
Verify a signature on a message.
Definition: PublicKey.cpp:288
ripple::calcAccountID
AccountID calcAccountID(PublicKey const &pk)
Definition: AccountID.cpp:168
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::derivePublicKey
PublicKey derivePublicKey(KeyType type, SecretKey const &sk)
Derive the public key from a secret key.
Definition: SecretKey.cpp:331
ripple::generateSecretKey
SecretKey generateSecretKey(KeyType type, Seed const &seed)
Generate a new secret key deterministically.
Definition: SecretKey.cpp:309
ripple::sign
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &message)
Generate a signature for a message.
Definition: SecretKey.cpp:256
diff --git a/Seed_8cpp_source.html b/Seed_8cpp_source.html index 12cf35eb0a..1c9cd4536a 100644 --- a/Seed_8cpp_source.html +++ b/Seed_8cpp_source.html @@ -255,14 +255,14 @@ $(function() {
ripple::TokenType::FamilySeed
@ FamilySeed
ripple::parseBase58
std::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
Definition: AccountID.cpp:124
ripple::randomSeed
Seed randomSeed()
Create a seed using secure random numbers.
Definition: Seed.cpp:66
-
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: csprng.cpp:103
+
ripple::crypto_prng
csprng_engine & crypto_prng()
The default cryptographically secure PRNG.
Definition: libxrpl/crypto/csprng.cpp:103
ripple::seedAs1751
std::string seedAs1751(Seed const &seed)
Encode a Seed in RFC1751 format.
Definition: Seed.cpp:135
ripple::decodeBase58Token
std::string decodeBase58Token(std::string const &s, TokenType type)
Definition: tokens.cpp:209
ripple::digest
static Hasher::result_type digest(void const *data, std::size_t size) noexcept
Definition: tokens.cpp:156
ripple::makeSlice
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:244
ripple::parseGenericSeed
std::optional< Seed > parseGenericSeed(std::string const &str, bool rfc1751=true)
Attempt to parse a string as a seed.
Definition: Seed.cpp:97
ripple::generateSeed
Seed generateSeed(std::string const &passPhrase)
Generate a seed deterministically.
Definition: Seed.cpp:76
-
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:37
+
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: libxrpl/basics/contract.cpp:37
ripple::secure_erase
void secure_erase(void *dest, std::size_t bytes)
Attempts to clear the given blob of memory.
Definition: secure_erase.cpp:29
optional
std::string::rbegin
T rbegin(T... args)
diff --git a/ServerHandler_8cpp_source.html b/ServerHandler_8cpp_source.html index 6790d0d823..d75ae9f022 100644 --- a/ServerHandler_8cpp_source.html +++ b/ServerHandler_8cpp_source.html @@ -1489,7 +1489,7 @@ $(function() {
ripple::rpcINTERNAL
@ rpcINTERNAL
Definition: ErrorCodes.h:130
ripple::rpcFORBIDDEN
@ rpcFORBIDDEN
Definition: ErrorCodes.h:48
ripple::make_json_error
static Json::Value make_json_error(Json::Int code, Json::Value &&message)
Definition: ServerHandler.cpp:595
-
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: base64.cpp:248
+
ripple::base64_decode
std::string base64_decode(std::string_view data)
Definition: libxrpl/basics/base64.cpp:248
ripple::make_ServerHandler
std::unique_ptr< ServerHandler > make_ServerHandler(Application &app, boost::asio::io_service &io_service, JobQueue &jobQueue, NetworkOPs &networkOPs, Resource::Manager &resourceManager, CollectorManager &cm)
Definition: ServerHandler.cpp:1268
ripple::parse_Port
void parse_Port(ParsedPort &port, Section const &section, std::ostream &log)
Definition: Port.cpp:213
ripple::rpcError
Json::Value rpcError(int iError)
Definition: RPCErr.cpp:31
diff --git a/ServerStatus__test_8cpp_source.html b/ServerStatus__test_8cpp_source.html index ab1efad41f..beeff5d850 100644 --- a/ServerStatus__test_8cpp_source.html +++ b/ServerStatus__test_8cpp_source.html @@ -1407,7 +1407,7 @@ $(function() {
ripple::warnRPC_UNSUPPORTED_MAJORITY
@ warnRPC_UNSUPPORTED_MAJORITY
Definition: ErrorCodes.h:168
ripple::warnRPC_AMENDMENT_BLOCKED
@ warnRPC_AMENDMENT_BLOCKED
Definition: ErrorCodes.h:169
ripple::set
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:315
-
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: base64.cpp:239
+
ripple::base64_encode
std::string base64_encode(std::uint8_t const *data, std::size_t len)
Definition: libxrpl/basics/base64.cpp:239
ripple::to_string
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630
std::random_device
random
diff --git a/Slice__test_8cpp_source.html b/Slice_8cpp_source.html similarity index 52% rename from Slice__test_8cpp_source.html rename to Slice_8cpp_source.html index db337ae7d6..4831e54093 100644 --- a/Slice__test_8cpp_source.html +++ b/Slice_8cpp_source.html @@ -5,7 +5,7 @@ -rippled: Slice_test.cpp Source File +rippled: Slice.cpp Source File @@ -69,17 +69,17 @@ $(function() {
-
Slice_test.cpp
+
Slice.cpp
1//------------------------------------------------------------------------------
2/*
-
3 This file is part of rippled: https://github0.com/ripple/rippled
-
4 Copyright (c) 2012-2016 Ripple Labs Inc.
+
3 This file is part of rippled: https://github.com/ripple/rippled
+
4 Copyright (c) 2012 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
@@ -96,115 +96,99 @@ $(function() {
18//==============================================================================
19
20#include <xrpl/basics/Slice.h>
-
21#include <xrpl/beast/unit_test.h>
-
22
-
23#include <array>
-
24#include <cstdint>
-
25
-
26namespace ripple {
-
27namespace test {
+
21
+
22#include <doctest/doctest.h>
+
23
+
24#include <array>
+
25#include <cstdint>
+
26
+
27using namespace ripple;
28
- -
30{
-
31 void
-
32 run() override
-
33 {
-
34 std::uint8_t const data[] = {
-
35 0xa8, 0xa1, 0x38, 0x45, 0x23, 0xec, 0xe4, 0x23, 0x71, 0x6d, 0x2a,
-
36 0x18, 0xb4, 0x70, 0xcb, 0xf5, 0xac, 0x2d, 0x89, 0x4d, 0x19, 0x9c,
-
37 0xf0, 0x2c, 0x15, 0xd1, 0xf9, 0x9b, 0x66, 0xd2, 0x30, 0xd3};
-
38
-
39 {
-
40 testcase("Equality & Inequality");
-
41
-
42 Slice const s0{};
+
29static std::uint8_t const data[] = {
+
30 0xa8, 0xa1, 0x38, 0x45, 0x23, 0xec, 0xe4, 0x23, 0x71, 0x6d, 0x2a,
+
31 0x18, 0xb4, 0x70, 0xcb, 0xf5, 0xac, 0x2d, 0x89, 0x4d, 0x19, 0x9c,
+
32 0xf0, 0x2c, 0x15, 0xd1, 0xf9, 0x9b, 0x66, 0xd2, 0x30, 0xd3};
+
33
+
34TEST_SUITE_BEGIN("Slice");
+
35
+
36TEST_CASE("equality & inequality")
+
37{
+
38 Slice const s0{};
+
39
+
40 CHECK(s0.size() == 0);
+
41 CHECK(s0.data() == nullptr);
+
42 CHECK(s0 == s0);
43
-
44 BEAST_EXPECT(s0.size() == 0);
-
45 BEAST_EXPECT(s0.data() == nullptr);
-
46 BEAST_EXPECT(s0 == s0);
-
47
-
48 // Test slices of equal and unequal size pointing to same data:
-
49 for (std::size_t i = 0; i != sizeof(data); ++i)
-
50 {
-
51 Slice const s1{data, i};
-
52
-
53 BEAST_EXPECT(s1.size() == i);
-
54 BEAST_EXPECT(s1.data() != nullptr);
-
55
-
56 if (i == 0)
-
57 BEAST_EXPECT(s1 == s0);
-
58 else
-
59 BEAST_EXPECT(s1 != s0);
+
44 // Test slices of equal and unequal size pointing to same data:
+
45 for (std::size_t i = 0; i != sizeof(data); ++i)
+
46 {
+
47 Slice const s1{data, i};
+
48
+
49 CHECK(s1.size() == i);
+
50 CHECK(s1.data() != nullptr);
+
51
+
52 if (i == 0)
+
53 CHECK(s1 == s0);
+
54 else
+
55 CHECK(s1 != s0);
+
56
+
57 for (std::size_t j = 0; j != sizeof(data); ++j)
+
58 {
+
59 Slice const s2{data, j};
60
-
61 for (std::size_t j = 0; j != sizeof(data); ++j)
-
62 {
-
63 Slice const s2{data, j};
-
64
-
65 if (i == j)
-
66 BEAST_EXPECT(s1 == s2);
-
67 else
-
68 BEAST_EXPECT(s1 != s2);
-
69 }
-
70 }
+
61 if (i == j)
+
62 CHECK(s1 == s2);
+
63 else
+
64 CHECK(s1 != s2);
+
65 }
+
66 }
+
67
+
68 // Test slices of equal size but pointing to different data:
+
69 std::array<std::uint8_t, sizeof(data)> a;
+
70 std::array<std::uint8_t, sizeof(data)> b;
71
-
72 // Test slices of equal size but pointing to different data:
-
73 std::array<std::uint8_t, sizeof(data)> a;
-
74 std::array<std::uint8_t, sizeof(data)> b;
-
75
-
76 for (std::size_t i = 0; i != sizeof(data); ++i)
-
77 a[i] = b[i] = data[i];
-
78
-
79 BEAST_EXPECT(makeSlice(a) == makeSlice(b));
-
80 b[7]++;
-
81 BEAST_EXPECT(makeSlice(a) != makeSlice(b));
-
82 a[7]++;
-
83 BEAST_EXPECT(makeSlice(a) == makeSlice(b));
-
84 }
+
72 for (std::size_t i = 0; i != sizeof(data); ++i)
+
73 a[i] = b[i] = data[i];
+
74
+
75 CHECK(makeSlice(a) == makeSlice(b));
+
76 b[7]++;
+
77 CHECK(makeSlice(a) != makeSlice(b));
+
78 a[7]++;
+
79 CHECK(makeSlice(a) == makeSlice(b));
+
80}
+
81
+
82TEST_CASE("indexing")
+
83{
+
84 Slice const s{data, sizeof(data)};
85
-
86 {
-
87 testcase("Indexing");
-
88
-
89 Slice const s{data, sizeof(data)};
-
90
-
91 for (std::size_t i = 0; i != sizeof(data); ++i)
-
92 BEAST_EXPECT(s[i] == data[i]);
-
93 }
-
94
+
86 for (std::size_t i = 0; i != sizeof(data); ++i)
+
87 CHECK(s[i] == data[i]);
+
88}
+
89
+
90TEST_CASE("advancing")
+
91{
+
92 for (std::size_t i = 0; i < sizeof(data); ++i)
+
93 {
+
94 for (std::size_t j = 0; i + j < sizeof(data); ++j)
95 {
-
96 testcase("Advancing");
-
97
-
98 for (std::size_t i = 0; i < sizeof(data); ++i)
-
99 {
-
100 for (std::size_t j = 0; i + j < sizeof(data); ++j)
-
101 {
-
102 Slice s(data + i, sizeof(data) - i);
-
103 s += j;
+
96 Slice s(data + i, sizeof(data) - i);
+
97 s += j;
+
98
+
99 CHECK(s.data() == data + i + j);
+
100 CHECK(s.size() == sizeof(data) - i - j);
+
101 }
+
102 }
+
103}
104
-
105 BEAST_EXPECT(s.data() == data + i + j);
-
106 BEAST_EXPECT(s.size() == sizeof(data) - i - j);
-
107 }
-
108 }
-
109 }
-
110 }
-
111};
-
112
-
113BEAST_DEFINE_TESTSUITE(Slice, ripple_basics, ripple);
-
114
-
115} // namespace test
-
116} // namespace ripple
+
105TEST_SUITE_END();
-
A testsuite class.
Definition: suite.h:55
-
testcase_t testcase
Memberspace for declaring test cases.
Definition: suite.h:155
An immutable linear range of bytes.
Definition: Slice.h:46
-
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
Definition: Slice.h:98
-
std::size_t size() const noexcept
Returns the number of bytes in the storage.
Definition: Slice.h:81
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
+
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:244
- -
void run() override
Runs the suite.
Definition: Slice_test.cpp:32