mirror of
https://github.com/aria2/aria2.git
synced 2025-04-04 21:17:41 +03:00
make clang-format using clang-format-3.6
This commit is contained in:
parent
4abad2f64c
commit
b1132d6b10
1095 changed files with 30423 additions and 33770 deletions
|
@ -12,12 +12,13 @@
|
|||
|
||||
namespace aria2 {
|
||||
|
||||
class DHTGetPeersReplyMessageTest:public CppUnit::TestFixture {
|
||||
class DHTGetPeersReplyMessageTest : public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(DHTGetPeersReplyMessageTest);
|
||||
CPPUNIT_TEST(testGetBencodedMessage);
|
||||
CPPUNIT_TEST(testGetBencodedMessage6);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
void setUp() {}
|
||||
|
||||
|
@ -28,7 +29,6 @@ public:
|
|||
void testGetBencodedMessage6();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(DHTGetPeersReplyMessageTest);
|
||||
|
||||
void DHTGetPeersReplyMessageTest::testGetBencodedMessage()
|
||||
|
@ -42,8 +42,8 @@ void DHTGetPeersReplyMessageTest::testGetBencodedMessage()
|
|||
|
||||
std::string token = "token";
|
||||
|
||||
DHTGetPeersReplyMessage msg
|
||||
(AF_INET, localNode, remoteNode, token, transactionID);
|
||||
DHTGetPeersReplyMessage msg(AF_INET, localNode, remoteNode, token,
|
||||
transactionID);
|
||||
msg.setVersion("A200");
|
||||
Dict dict;
|
||||
dict.put("t", transactionID);
|
||||
|
@ -55,34 +55,32 @@ void DHTGetPeersReplyMessageTest::testGetBencodedMessage()
|
|||
{
|
||||
std::string compactNodeInfo;
|
||||
std::shared_ptr<DHTNode> nodes[8];
|
||||
for(size_t i = 0; i < DHTBucket::K; ++i) {
|
||||
for (size_t i = 0; i < DHTBucket::K; ++i) {
|
||||
nodes[i].reset(new DHTNode());
|
||||
nodes[i]->setIPAddress("192.168.0."+util::uitos(i+1));
|
||||
nodes[i]->setPort(6881+i);
|
||||
nodes[i]->setIPAddress("192.168.0." + util::uitos(i + 1));
|
||||
nodes[i]->setPort(6881 + i);
|
||||
|
||||
unsigned char buf[COMPACT_LEN_IPV6];
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(COMPACT_LEN_IPV4,
|
||||
bittorrent::packcompact
|
||||
(buf, nodes[i]->getIPAddress(), nodes[i]->getPort()));
|
||||
compactNodeInfo +=
|
||||
std::string(&nodes[i]->getID()[0], &nodes[i]->getID()[DHT_ID_LENGTH])+
|
||||
std::string(&buf[0], &buf[COMPACT_LEN_IPV4]);
|
||||
CPPUNIT_ASSERT_EQUAL(COMPACT_LEN_IPV4, bittorrent::packcompact(
|
||||
buf, nodes[i]->getIPAddress(),
|
||||
nodes[i]->getPort()));
|
||||
compactNodeInfo += std::string(&nodes[i]->getID()[0],
|
||||
&nodes[i]->getID()[DHT_ID_LENGTH]) +
|
||||
std::string(&buf[0], &buf[COMPACT_LEN_IPV4]);
|
||||
}
|
||||
msg.setClosestKNodes
|
||||
(std::vector<std::shared_ptr<DHTNode> >(&nodes[0], &nodes[DHTBucket::K]));
|
||||
msg.setClosestKNodes(
|
||||
std::vector<std::shared_ptr<DHTNode>>(&nodes[0], &nodes[DHTBucket::K]));
|
||||
rDict->put("nodes", compactNodeInfo);
|
||||
|
||||
std::vector<std::shared_ptr<Peer>> peers;
|
||||
auto valuesList = List::g();
|
||||
for(size_t i = 0; i < 4; ++i) {
|
||||
auto peer = std::make_shared<Peer>("192.168.0."+util::uitos(i+1),
|
||||
6881+i);
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
auto peer =
|
||||
std::make_shared<Peer>("192.168.0." + util::uitos(i + 1), 6881 + i);
|
||||
unsigned char buffer[COMPACT_LEN_IPV6];
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(COMPACT_LEN_IPV4,
|
||||
bittorrent::packcompact
|
||||
(buffer, peer->getIPAddress(), peer->getPort()));
|
||||
CPPUNIT_ASSERT_EQUAL(COMPACT_LEN_IPV4,
|
||||
bittorrent::packcompact(buffer, peer->getIPAddress(),
|
||||
peer->getPort()));
|
||||
valuesList->append(String::g(buffer, COMPACT_LEN_IPV4));
|
||||
peers.push_back(peer);
|
||||
}
|
||||
|
@ -107,8 +105,8 @@ void DHTGetPeersReplyMessageTest::testGetBencodedMessage6()
|
|||
|
||||
std::string token = "token";
|
||||
|
||||
DHTGetPeersReplyMessage msg
|
||||
(AF_INET6, localNode, remoteNode, token, transactionID);
|
||||
DHTGetPeersReplyMessage msg(AF_INET6, localNode, remoteNode, token,
|
||||
transactionID);
|
||||
msg.setVersion("A200");
|
||||
Dict dict;
|
||||
dict.put("t", transactionID);
|
||||
|
@ -120,32 +118,32 @@ void DHTGetPeersReplyMessageTest::testGetBencodedMessage6()
|
|||
{
|
||||
std::string compactNodeInfo;
|
||||
std::shared_ptr<DHTNode> nodes[8];
|
||||
for(size_t i = 0; i < DHTBucket::K; ++i) {
|
||||
for (size_t i = 0; i < DHTBucket::K; ++i) {
|
||||
nodes[i].reset(new DHTNode());
|
||||
nodes[i]->setIPAddress("2001::000"+util::uitos(i+1));
|
||||
nodes[i]->setPort(6881+i);
|
||||
nodes[i]->setIPAddress("2001::000" + util::uitos(i + 1));
|
||||
nodes[i]->setPort(6881 + i);
|
||||
|
||||
unsigned char buf[COMPACT_LEN_IPV6];
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(COMPACT_LEN_IPV6, bittorrent::packcompact
|
||||
(buf, nodes[i]->getIPAddress(), nodes[i]->getPort()));
|
||||
compactNodeInfo +=
|
||||
std::string(&nodes[i]->getID()[0], &nodes[i]->getID()[DHT_ID_LENGTH])+
|
||||
std::string(&buf[0], &buf[COMPACT_LEN_IPV6]);
|
||||
CPPUNIT_ASSERT_EQUAL(COMPACT_LEN_IPV6, bittorrent::packcompact(
|
||||
buf, nodes[i]->getIPAddress(),
|
||||
nodes[i]->getPort()));
|
||||
compactNodeInfo += std::string(&nodes[i]->getID()[0],
|
||||
&nodes[i]->getID()[DHT_ID_LENGTH]) +
|
||||
std::string(&buf[0], &buf[COMPACT_LEN_IPV6]);
|
||||
}
|
||||
msg.setClosestKNodes
|
||||
(std::vector<std::shared_ptr<DHTNode> >(&nodes[0], &nodes[DHTBucket::K]));
|
||||
msg.setClosestKNodes(
|
||||
std::vector<std::shared_ptr<DHTNode>>(&nodes[0], &nodes[DHTBucket::K]));
|
||||
rDict->put("nodes6", compactNodeInfo);
|
||||
|
||||
std::vector<std::shared_ptr<Peer> > peers;
|
||||
std::vector<std::shared_ptr<Peer>> peers;
|
||||
auto valuesList = List::g();
|
||||
for(size_t i = 0; i < 4; ++i) {
|
||||
auto peer = std::make_shared<Peer>("2001::100"+util::uitos(i+1), 6881+i);
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
auto peer =
|
||||
std::make_shared<Peer>("2001::100" + util::uitos(i + 1), 6881 + i);
|
||||
unsigned char buffer[COMPACT_LEN_IPV6];
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(COMPACT_LEN_IPV6,
|
||||
bittorrent::packcompact
|
||||
(buffer, peer->getIPAddress(), peer->getPort()));
|
||||
CPPUNIT_ASSERT_EQUAL(COMPACT_LEN_IPV6,
|
||||
bittorrent::packcompact(buffer, peer->getIPAddress(),
|
||||
peer->getPort()));
|
||||
valuesList->append(String::g(buffer, COMPACT_LEN_IPV6));
|
||||
peers.push_back(peer);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue