make clang-format using clang-format-3.6

This commit is contained in:
Tatsuhiro Tsujikawa 2015-12-27 18:39:47 +09:00
parent 4abad2f64c
commit b1132d6b10
1095 changed files with 30423 additions and 33770 deletions

View file

@ -16,12 +16,13 @@
namespace aria2 {
class DHTRoutingTableDeserializerTest:public CppUnit::TestFixture {
class DHTRoutingTableDeserializerTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(DHTRoutingTableDeserializerTest);
CPPUNIT_TEST(testDeserialize);
CPPUNIT_TEST(testDeserialize6);
CPPUNIT_TEST_SUITE_END();
public:
void setUp() {}
@ -32,18 +33,17 @@ public:
void testDeserialize6();
};
CPPUNIT_TEST_SUITE_REGISTRATION(DHTRoutingTableDeserializerTest);
void DHTRoutingTableDeserializerTest::testDeserialize()
{
std::shared_ptr<DHTNode> localNode(new DHTNode());
std::vector<std::shared_ptr<DHTNode> > nodes(3);
for(size_t i = 0; i < nodes.size(); ++i) {
std::vector<std::shared_ptr<DHTNode>> nodes(3);
for (size_t i = 0; i < nodes.size(); ++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);
}
nodes[1]->setIPAddress("non-numerical-name");
@ -51,7 +51,8 @@ void DHTRoutingTableDeserializerTest::testDeserialize()
s.setLocalNode(localNode);
s.setNodes(nodes);
std::string filename = A2_TEST_OUT_DIR"/aria2_DHTRoutingTableDeserializerTest_testDeserialize";
std::string filename =
A2_TEST_OUT_DIR "/aria2_DHTRoutingTableDeserializerTest_testDeserialize";
s.serialize(filename);
DHTRoutingTableDeserializer d(AF_INET);
@ -61,13 +62,15 @@ void DHTRoutingTableDeserializerTest::testDeserialize()
DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT_EQUAL((size_t)2, d.getNodes().size());
const std::vector<std::shared_ptr<DHTNode> >& dsnodes = d.getNodes();
const std::vector<std::shared_ptr<DHTNode>>& dsnodes = d.getNodes();
CPPUNIT_ASSERT_EQUAL(std::string("192.168.0.1"), dsnodes[0]->getIPAddress());
CPPUNIT_ASSERT_EQUAL((uint16_t)6881, dsnodes[0]->getPort());
CPPUNIT_ASSERT(memcmp(nodes[0]->getID(), dsnodes[0]->getID(), DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT(
memcmp(nodes[0]->getID(), dsnodes[0]->getID(), DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT_EQUAL(std::string("192.168.0.3"), dsnodes[1]->getIPAddress());
CPPUNIT_ASSERT_EQUAL((uint16_t)6883, dsnodes[1]->getPort());
CPPUNIT_ASSERT(memcmp(nodes[2]->getID(), dsnodes[1]->getID(), DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT(
memcmp(nodes[2]->getID(), dsnodes[1]->getID(), DHT_ID_LENGTH) == 0);
}
void DHTRoutingTableDeserializerTest::testDeserialize6()
@ -75,10 +78,10 @@ void DHTRoutingTableDeserializerTest::testDeserialize6()
std::shared_ptr<DHTNode> localNode(new DHTNode());
std::vector<std::shared_ptr<DHTNode>> nodes(3);
for(size_t i = 0; i < nodes.size(); ++i) {
for (size_t i = 0; i < nodes.size(); ++i) {
nodes[i].reset(new DHTNode());
nodes[i]->setIPAddress("2001::100"+util::uitos(i+1));
nodes[i]->setPort(6881+i);
nodes[i]->setIPAddress("2001::100" + util::uitos(i + 1));
nodes[i]->setPort(6881 + i);
}
nodes[1]->setIPAddress("non-numerical-name");
@ -86,7 +89,8 @@ void DHTRoutingTableDeserializerTest::testDeserialize6()
s.setLocalNode(localNode);
s.setNodes(nodes);
std::string filename = A2_TEST_OUT_DIR"/aria2_DHTRoutingTableDeserializerTest_testDeserialize6";
std::string filename =
A2_TEST_OUT_DIR "/aria2_DHTRoutingTableDeserializerTest_testDeserialize6";
s.serialize(filename);
DHTRoutingTableDeserializer d(AF_INET6);
@ -96,15 +100,15 @@ void DHTRoutingTableDeserializerTest::testDeserialize6()
DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT_EQUAL((size_t)2, d.getNodes().size());
const std::vector<std::shared_ptr<DHTNode> >& dsnodes = d.getNodes();
const std::vector<std::shared_ptr<DHTNode>>& dsnodes = d.getNodes();
CPPUNIT_ASSERT_EQUAL(std::string("2001::1001"), dsnodes[0]->getIPAddress());
CPPUNIT_ASSERT_EQUAL((uint16_t)6881, dsnodes[0]->getPort());
CPPUNIT_ASSERT(memcmp(nodes[0]->getID(), dsnodes[0]->getID(),
DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT(
memcmp(nodes[0]->getID(), dsnodes[0]->getID(), DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT_EQUAL(std::string("2001::1003"), dsnodes[1]->getIPAddress());
CPPUNIT_ASSERT_EQUAL((uint16_t)6883, dsnodes[1]->getPort());
CPPUNIT_ASSERT(memcmp(nodes[2]->getID(), dsnodes[1]->getID(),
DHT_ID_LENGTH) == 0);
CPPUNIT_ASSERT(
memcmp(nodes[2]->getID(), dsnodes[1]->getID(), DHT_ID_LENGTH) == 0);
}
} // namespace aria2