added test to make sure trackers are saved and restored from resume files

This commit is contained in:
Arvid Norberg 2009-11-20 17:23:09 +00:00
parent 0880b74e6d
commit 233071cfe0
1 changed files with 13 additions and 4 deletions

View File

@ -348,7 +348,7 @@ void test_transfer(bool test_disk_full = false, bool test_allowed_fast = false)
torrent_status st2 = tor2.status();
std::cerr << "\033[0m" << int(st2.progress * 100) << "% " << std::endl;
TEST_CHECK(st2.state == torrent_status::finished);
test_sleep(1000);
test_sleep(100);
}
tor2.pause();
@ -361,6 +361,11 @@ void test_transfer(bool test_disk_full = false, bool test_allowed_fast = false)
a = ses2.wait_for_alert(seconds(10));
}
std::vector<announce_entry> tr;
tr.push_back(announce_entry("http://test.com/announce"));
tor2.replace_trackers(tr);
tr.clear();
tor2.save_resume_data();
std::vector<char> resume_data;
@ -384,7 +389,7 @@ void test_transfer(bool test_disk_full = false, bool test_allowed_fast = false)
std::cerr << "removed" << std::endl;
test_sleep(1000);
test_sleep(100);
std::cout << "re-adding" << std::endl;
add_torrent_params p;
@ -397,7 +402,11 @@ void test_transfer(bool test_disk_full = false, bool test_allowed_fast = false)
std::cout << "resetting priorities" << std::endl;
tor2.resume();
test_sleep(1000);
tr = tor2.trackers();
TEST_CHECK(std::find_if(tr.begin(), tr.end()
, boost::bind(&announce_entry::url, _1) == "http://test.com/announce") != tr.end());
test_sleep(100);
for (int i = 0; i < 5; ++i)
{
@ -410,7 +419,7 @@ void test_transfer(bool test_disk_full = false, bool test_allowed_fast = false)
TEST_CHECK(st1.state == torrent_status::seeding);
TEST_CHECK(st2.state == torrent_status::finished);
test_sleep(1000);
test_sleep(100);
}
TEST_CHECK(!tor2.is_seed());