mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 13:37:40 +03:00
2008-12-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use BDE instead of Dictionary/List/Data. * src/DHTAbstractMessage.cc * src/DHTAbstractMessage.h * src/DHTAnnouncePeerMessage.cc * src/DHTAnnouncePeerMessage.h * src/DHTAnnouncePeerReplyMessage.cc * src/DHTAnnouncePeerReplyMessage.h * src/DHTFindNodeMessage.cc * src/DHTFindNodeMessage.h * src/DHTFindNodeReplyMessage.cc * src/DHTFindNodeReplyMessage.h * src/DHTGetPeersMessage.cc * src/DHTGetPeersMessage.h * src/DHTGetPeersReplyMessage.cc * src/DHTGetPeersReplyMessage.h * src/DHTMessageFactory.h * src/DHTMessageFactoryImpl.cc * src/DHTMessageFactoryImpl.h * src/DHTMessageReceiver.cc * src/DHTMessageTracker.cc * src/DHTMessageTracker.h * src/DHTPingMessage.cc * src/DHTPingMessage.h * src/DHTPingReplyMessage.cc * src/DHTPingReplyMessage.h * src/DHTQueryMessage.cc * src/DHTQueryMessage.h * src/DHTResponseMessage.cc * src/DHTResponseMessage.h * test/DHTAnnouncePeerMessageTest.cc * test/DHTAnnouncePeerReplyMessageTest.cc * test/DHTFindNodeMessageTest.cc * test/DHTFindNodeReplyMessageTest.cc * test/DHTGetPeersMessageTest.cc * test/DHTGetPeersReplyMessageTest.cc * test/DHTMessageFactoryImplTest.cc * test/DHTMessageTrackerTest.cc * test/DHTPingMessageTest.cc * test/DHTPingReplyMessageTest.cc * test/MockDHTMessageFactory.h
This commit is contained in:
parent
057132cd5f
commit
9202fe23c8
40 changed files with 575 additions and 510 deletions
|
@ -1,15 +1,15 @@
|
|||
#include "DHTPingMessage.h"
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
#include "DHTNode.h"
|
||||
#include "DHTUtil.h"
|
||||
#include "BencodeVisitor.h"
|
||||
#include "Dictionary.h"
|
||||
#include "Data.h"
|
||||
#include "Exception.h"
|
||||
#include "Util.h"
|
||||
#include "MockDHTMessageFactory.h"
|
||||
#include "MockDHTMessageDispatcher.h"
|
||||
#include "MockDHTMessage.h"
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "bencode.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -57,18 +57,15 @@ void DHTPingMessageTest::testGetBencodedMessage()
|
|||
|
||||
std::string msgbody = msg.getBencodedMessage();
|
||||
|
||||
SharedHandle<Dictionary> cm(new Dictionary());
|
||||
cm->put("t", new Data(transactionID));
|
||||
cm->put("y", new Data("q"));
|
||||
cm->put("q", new Data("ping"));
|
||||
Dictionary* a = new Dictionary();
|
||||
cm->put("a", a);
|
||||
a->put("id", new Data(localNode->getID(), DHT_ID_LENGTH));
|
||||
bencode::BDE dict = bencode::BDE::dict();
|
||||
dict["t"] = transactionID;
|
||||
dict["y"] = bencode::BDE("q");
|
||||
dict["q"] = bencode::BDE("ping");
|
||||
bencode::BDE aDict = bencode::BDE::dict();
|
||||
aDict["id"] = bencode::BDE(localNode->getID(), DHT_ID_LENGTH);
|
||||
dict["a"] = aDict;
|
||||
|
||||
BencodeVisitor v;
|
||||
cm->accept(&v);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(v.getBencodedData(), msgbody);
|
||||
CPPUNIT_ASSERT_EQUAL(bencode::encode(dict), msgbody);
|
||||
}
|
||||
|
||||
void DHTPingMessageTest::testDoReceivedAction()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue