20 #include <ripple/beast/unit_test.h>
21 #include <ripple/overlay/impl/ProtocolVersion.h>
31 auto join = [](
auto first,
auto last) {
44 BEAST_EXPECT(
join(result.begin(), result.end()) == answer);
51 testcase(
"Convert protocol version to string");
58 testcase(
"Convert strings to protocol versions");
65 "RTXP/1.1,RTXP/1.2,RTXP/1.3,XRPL/2.1,XRPL/2.0,/XRPL/3.0",
68 "RTXP/0.9,RTXP/1.01,XRPL/0.3,XRPL/2.01,websocket",
71 "XRPL/2.0,XRPL/2.0,XRPL/19.4,XRPL/7.89,XRPL/XRPL/3.0,XRPL/2.01",
72 "XRPL/2.0,XRPL/7.89,XRPL/19.4");
74 "XRPL/2.0,XRPL/3.0,XRPL/4,XRPL/,XRPL,OPT XRPL/2.2,XRPL/5.67",
75 "XRPL/2.0,XRPL/3.0,XRPL/5.67");
80 testcase(
"Protocol version negotiation");
90 "RTXP/1.2, XRPL/2.2, XRPL/2.3, XRPL/999.999") ==
BEAST_DEFINE_TESTSUITE(AccountTxPaging, app, ripple)
Stream & join(Stream &s, Iter iter, Iter end, std::string const &delimiter)
constexpr ProtocolVersion make_protocol(std::uint16_t major, std::uint16_t minor)
std::vector< ProtocolVersion > parseProtocolVersions(boost::beast::string_view const &value)
Parse a set of protocol versions.
std::pair< std::uint16_t, std::uint16_t > ProtocolVersion
Represents a particular version of the peer-to-peer protocol.
void check(std::string const &s, std::string const &answer)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
std::optional< ProtocolVersion > negotiateProtocolVersion(std::vector< ProtocolVersion > const &versions)
Given a list of supported protocol versions, choose the one we prefer.