Add test for recent changes in SessionSerializer

pull/97/head
Tatsuhiro Tsujikawa 2013-05-28 22:59:54 +09:00
parent d444a6cc9e
commit 232d31afaf
1 changed files with 6 additions and 1 deletions

View File

@ -59,6 +59,11 @@ void SessionSerializerTest::testSave()
createDownloadResult(error_code::FINISHED, "http://finished"),
createDownloadResult(error_code::FINISHED, "http://force-save")
};
// This URI will be discarded because same URI exists in remaining
// URIs.
drs[1]->fileEntries[0]->getSpentUris().push_back("http://error");
drs[1]->fileEntries[0]->getSpentUris().push_back("http://error2");
drs[3]->option->put(PREF_FORCE_SAVE, A2_V_TRUE);
for(size_t i = 0; i < sizeof(drs)/sizeof(drs[0]); ++i) {
rgman->addDownloadResult(drs[i]);
@ -74,7 +79,7 @@ void SessionSerializerTest::testSave()
std::ifstream ss(filename.c_str(), std::ios::binary);
std::string line;
std::getline(ss, line);
CPPUNIT_ASSERT_EQUAL(std::string("http://error\t"), line);
CPPUNIT_ASSERT_EQUAL(std::string("http://error2\thttp://error\t"), line);
std::getline(ss, line);
CPPUNIT_ASSERT_EQUAL(fmt(" gid=%s", drs[1]->gid->toHex().c_str()), line);
std::getline(ss, line);