summaryrefslogtreecommitdiff
path: root/test/BtNotInterestedMessageTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-12-27 18:39:47 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-12-27 18:40:08 +0900
commitb1132d6b10cd3791b9529d7031d723fd0e2d8215 (patch)
tree9ce465b42bf09372118335c7c619bb2b41869eaf /test/BtNotInterestedMessageTest.cc
parent4abad2f64c9ff80144a61c5a9c2bea144852b883 (diff)
make clang-format using clang-format-3.6
Diffstat (limited to 'test/BtNotInterestedMessageTest.cc')
-rw-r--r--test/BtNotInterestedMessageTest.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/test/BtNotInterestedMessageTest.cc b/test/BtNotInterestedMessageTest.cc
index 15f90276..1f3bbac5 100644
--- a/test/BtNotInterestedMessageTest.cc
+++ b/test/BtNotInterestedMessageTest.cc
@@ -11,7 +11,7 @@
namespace aria2 {
-class BtNotInterestedMessageTest:public CppUnit::TestFixture {
+class BtNotInterestedMessageTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(BtNotInterestedMessageTest);
CPPUNIT_TEST(testCreate);
@@ -20,6 +20,7 @@ class BtNotInterestedMessageTest:public CppUnit::TestFixture {
CPPUNIT_TEST(testOnSendComplete);
CPPUNIT_TEST(testToString);
CPPUNIT_TEST_SUITE_END();
+
public:
void testCreate();
void testCreateMessage();
@@ -28,14 +29,14 @@ public:
void testToString();
};
-
CPPUNIT_TEST_SUITE_REGISTRATION(BtNotInterestedMessageTest);
-void BtNotInterestedMessageTest::testCreate() {
+void BtNotInterestedMessageTest::testCreate()
+{
unsigned char msg[5];
bittorrent::createPeerMessageString(msg, sizeof(msg), 1, 3);
- std::shared_ptr<BtNotInterestedMessage> pm
- (BtNotInterestedMessage::create(&msg[4], 1));
+ std::shared_ptr<BtNotInterestedMessage> pm(
+ BtNotInterestedMessage::create(&msg[4], 1));
CPPUNIT_ASSERT_EQUAL((uint8_t)3, pm->getId());
// case: payload size is wrong
@@ -44,7 +45,8 @@ void BtNotInterestedMessageTest::testCreate() {
bittorrent::createPeerMessageString(msg, sizeof(msg), 2, 3);
BtNotInterestedMessage::create(&msg[4], 2);
CPPUNIT_FAIL("exception must be thrown.");
- } catch(...) {
+ }
+ catch (...) {
}
// case: id is wrong
try {
@@ -52,20 +54,23 @@ void BtNotInterestedMessageTest::testCreate() {
bittorrent::createPeerMessageString(msg, sizeof(msg), 1, 4);
BtNotInterestedMessage::create(&msg[4], 1);
CPPUNIT_FAIL("exception must be thrown.");
- } catch(...) {
+ }
+ catch (...) {
}
}
-void BtNotInterestedMessageTest::testCreateMessage() {
+void BtNotInterestedMessageTest::testCreateMessage()
+{
BtNotInterestedMessage msg;
unsigned char data[5];
bittorrent::createPeerMessageString(data, sizeof(data), 1, 3);
unsigned char* rawmsg = msg.createMessage();
CPPUNIT_ASSERT(memcmp(rawmsg, data, 5) == 0);
- delete [] rawmsg;
+ delete[] rawmsg;
}
-void BtNotInterestedMessageTest::testDoReceivedAction() {
+void BtNotInterestedMessageTest::testDoReceivedAction()
+{
std::shared_ptr<Peer> peer(new Peer("host", 6969));
peer->allocateSessionResource(1_k, 1_m);
peer->peerInterested(true);
@@ -86,7 +91,8 @@ void BtNotInterestedMessageTest::testDoReceivedAction() {
CPPUNIT_ASSERT_EQUAL(1, peerStorage->getNumChokeExecuted());
}
-void BtNotInterestedMessageTest::testOnSendComplete() {
+void BtNotInterestedMessageTest::testOnSendComplete()
+{
std::shared_ptr<Peer> peer(new Peer("host", 6969));
peer->allocateSessionResource(1_k, 1_m);
peer->amInterested(true);
@@ -98,7 +104,8 @@ void BtNotInterestedMessageTest::testOnSendComplete() {
CPPUNIT_ASSERT(!peer->amInterested());
}
-void BtNotInterestedMessageTest::testToString() {
+void BtNotInterestedMessageTest::testToString()
+{
BtNotInterestedMessage msg;
CPPUNIT_ASSERT_EQUAL(std::string("not interested"), msg.toString());
}