mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 13:37:40 +03:00
Rewritten DHTRoutingTableDeserializer using stdio instead of stream.
This commit is contained in:
parent
5eb338ad87
commit
f141cd4228
4 changed files with 49 additions and 65 deletions
|
@ -54,11 +54,13 @@ void DHTRoutingTableDeserializerTest::testDeserialize()
|
|||
s.setLocalNode(localNode);
|
||||
s.setNodes(nodes);
|
||||
|
||||
std::stringstream ss;
|
||||
s.serialize(ss);
|
||||
std::string filename = A2_TEST_OUT_DIR"/aria2_DHTRoutingTableDeserializerTest_testDeserialize";
|
||||
std::ofstream outfile(filename.c_str(), std::ios::binary);
|
||||
s.serialize(outfile);
|
||||
outfile.close();
|
||||
|
||||
DHTRoutingTableDeserializer d(AF_INET);
|
||||
d.deserialize(ss);
|
||||
d.deserialize(filename);
|
||||
|
||||
CPPUNIT_ASSERT(memcmp(localNode->getID(), d.getLocalNode()->getID(),
|
||||
DHT_ID_LENGTH) == 0);
|
||||
|
@ -93,11 +95,13 @@ void DHTRoutingTableDeserializerTest::testDeserialize6()
|
|||
s.setLocalNode(localNode);
|
||||
s.setNodes(nodes);
|
||||
|
||||
std::stringstream ss;
|
||||
s.serialize(ss);
|
||||
std::string filename = A2_TEST_OUT_DIR"/aria2_DHTRoutingTableDeserializerTest_testDeserialize6";
|
||||
std::ofstream outfile(filename.c_str(), std::ios::binary);
|
||||
s.serialize(outfile);
|
||||
outfile.close();
|
||||
|
||||
DHTRoutingTableDeserializer d(AF_INET6);
|
||||
d.deserialize(ss);
|
||||
d.deserialize(filename);
|
||||
|
||||
CPPUNIT_ASSERT(memcmp(localNode->getID(), d.getLocalNode()->getID(),
|
||||
DHT_ID_LENGTH) == 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue