MCPcopy Create free account
hub / github.com/aria2/aria2 / testCreatePingReplyMessage

Method testCreatePingReplyMessage

test/DHTMessageFactoryImplTest.cc:112–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void DHTMessageFactoryImplTest::testCreatePingReplyMessage()
113{
114 Dict dict;
115 dict.put("t", String::g(transactionID, DHT_TRANSACTION_ID_LENGTH));
116 dict.put("y", "r");
117 auto rDict = Dict::g();
118 rDict->put("id", String::g(remoteNodeID, DHT_ID_LENGTH));
119 dict.put("r", std::move(rDict));
120
121 auto r = factory->createResponseMessage(
122 "ping", &dict, remoteNode_->getIPAddress(), remoteNode_->getPort());
123 auto m = dynamic_cast<DHTPingReplyMessage*>(r.get());
124
125 CPPUNIT_ASSERT(*localNode == *m->getLocalNode());
126 CPPUNIT_ASSERT(*remoteNode_ == *m->getRemoteNode());
127 CPPUNIT_ASSERT_EQUAL(util::toHex(transactionID, DHT_TRANSACTION_ID_LENGTH),
128 util::toHex(m->getTransactionID()));
129}
130
131void DHTMessageFactoryImplTest::testCreateFindNodeMessage()
132{

Callers

nothing calls this directly

Calls 6

toHexFunction · 0.85
getRemoteNodeMethod · 0.80
putMethod · 0.45
createResponseMessageMethod · 0.45
getPortMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected