Format first-party source according to .clang-format

This commit is contained in:
Pretty Printer
2020-04-17 09:56:34 -05:00
committed by manojsdoshi
parent 65dfc5d19e
commit 50760c6935
1076 changed files with 86161 additions and 77449 deletions

View File

@@ -17,8 +17,8 @@
*/
//==============================================================================
#include <ripple/overlay/impl/ProtocolVersion.h>
#include <ripple/beast/unit_test.h>
#include <ripple/overlay/impl/ProtocolVersion.h>
namespace ripple {
@@ -26,15 +26,14 @@ class ProtocolVersion_test : public beast::unit_test::suite
{
private:
template <class FwdIt>
static
std::string
join (FwdIt first, FwdIt last, char const* sep = ",")
static std::string
join(FwdIt first, FwdIt last, char const* sep = ",")
{
std::string result;
if (first == last)
return result;
result = to_string(*first++);
while(first != last)
while (first != last)
result += sep + to_string(*first++);
return result;
}
@@ -51,27 +50,27 @@ public:
run() override
{
testcase("Convert protocol version to string");
BEAST_EXPECT(to_string( make_protocol(1,2)) == "RTXP/1.2");
BEAST_EXPECT(to_string( make_protocol(1,3)) == "XRPL/1.3");
BEAST_EXPECT(to_string( make_protocol(2,0)) == "XRPL/2.0");
BEAST_EXPECT(to_string( make_protocol(2,1)) == "XRPL/2.1");
BEAST_EXPECT(to_string(make_protocol(10,10)) == "XRPL/10.10");
BEAST_EXPECT(to_string(make_protocol(1, 2)) == "RTXP/1.2");
BEAST_EXPECT(to_string(make_protocol(1, 3)) == "XRPL/1.3");
BEAST_EXPECT(to_string(make_protocol(2, 0)) == "XRPL/2.0");
BEAST_EXPECT(to_string(make_protocol(2, 1)) == "XRPL/2.1");
BEAST_EXPECT(to_string(make_protocol(10, 10)) == "XRPL/10.10");
{
testcase("Convert strings to protocol versions");
// Empty string
check(
"",
"");
check("", "");
check(
"RTXP/1.1,RTXP/1.3,XRPL/2.1,RTXP/1.2,XRPL/2.0",
"RTXP/1.2,XRPL/2.0,XRPL/2.1");
check(
"RTXP/0.9,RTXP/1.01,XRPL/0.3,XRPL/2.01,XRPL/19.04,Oscar/123,NIKB",
"RTXP/0.9,RTXP/1.01,XRPL/0.3,XRPL/2.01,XRPL/19.04,Oscar/"
"123,NIKB",
"");
check(
"RTXP/1.2,XRPL/2.0,RTXP/1.2,XRPL/2.0,XRPL/19.4,XRPL/7.89,XRPL/A.1,XRPL/2.01",
"RTXP/1.2,XRPL/2.0,RTXP/1.2,XRPL/2.0,XRPL/19.4,XRPL/7.89,XRPL/"
"A.1,XRPL/2.01",
"RTXP/1.2,XRPL/2.0,XRPL/7.89,XRPL/19.4");
check(
"XRPL/2.0,XRPL/3.0,XRPL/4,XRPL/,XRPL,OPT XRPL/2.2,XRPL/5.67",
@@ -81,17 +80,24 @@ public:
{
testcase("Protocol version negotiation");
BEAST_EXPECT(negotiateProtocolVersion("RTXP/1.2") == make_protocol(1,2));
BEAST_EXPECT(negotiateProtocolVersion("RTXP/1.2, XRPL/2.0") == make_protocol(2,0));
BEAST_EXPECT(negotiateProtocolVersion("XRPL/2.0") == make_protocol(2,0));
BEAST_EXPECT(negotiateProtocolVersion("RTXP/1.2, XRPL/2.0, XRPL/999.999") == make_protocol(2,0));
BEAST_EXPECT(negotiateProtocolVersion("XRPL/999.999, WebSocket/1.0") == boost::none);
BEAST_EXPECT(
negotiateProtocolVersion("RTXP/1.2") == make_protocol(1, 2));
BEAST_EXPECT(
negotiateProtocolVersion("RTXP/1.2, XRPL/2.0") ==
make_protocol(2, 0));
BEAST_EXPECT(
negotiateProtocolVersion("XRPL/2.0") == make_protocol(2, 0));
BEAST_EXPECT(
negotiateProtocolVersion("RTXP/1.2, XRPL/2.0, XRPL/999.999") ==
make_protocol(2, 0));
BEAST_EXPECT(
negotiateProtocolVersion("XRPL/999.999, WebSocket/1.0") ==
boost::none);
BEAST_EXPECT(negotiateProtocolVersion("") == boost::none);
}
}
};
BEAST_DEFINE_TESTSUITE(ProtocolVersion,overlay,ripple);
}
BEAST_DEFINE_TESTSUITE(ProtocolVersion, overlay, ripple);
} // namespace ripple