converted use of deprecated functions in the tests

This commit is contained in:
Arvid Norberg 2012-03-19 04:02:13 +00:00
parent 62fef3cba0
commit 26805c944c
8 changed files with 29 additions and 29 deletions

View File

@ -336,23 +336,23 @@ setup_transfer(session* ses1, session* ses2, session* ses3
// file pool will complain if two torrents are trying to
// use the same files
add_torrent_params param;
param.paused = false;
param.auto_managed = false;
param.flags &= ~add_torrent_params::flag_paused;
param.flags &= ~add_torrent_params::flag_auto_managed;
if (p) param = *p;
param.ti = clone_ptr(t);
param.save_path = "./tmp1" + suffix;
param.seed_mode = true;
param.flags |= add_torrent_params::flag_seed_mode;
error_code ec;
torrent_handle tor1 = ses1->add_torrent(param, ec);
tor1.super_seeding(super_seeding);
param.seed_mode = false;
// the downloader cannot use seed_mode
param.flags &= ~add_torrent_params::flag_seed_mode;
TEST_CHECK(!ses1->get_torrents().empty());
torrent_handle tor2;
torrent_handle tor3;
// the downloader cannot use seed_mode
param.seed_mode = false;
if (ses3)
{
param.ti = clone_ptr(t);

View File

@ -201,8 +201,8 @@ void test_reject_fast()
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000), "0.0.0.0", 0);
error_code ec;
add_torrent_params p;
p.paused = false;
p.auto_managed = false;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.ti = t;
p.save_path = "./tmp1_fast";
@ -265,8 +265,8 @@ void test_respect_suggest()
error_code ec;
add_torrent_params p;
p.paused = false;
p.auto_managed = false;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.ti = t;
p.save_path = "./tmp1_fast";

View File

@ -727,25 +727,25 @@ int test_main()
add_torrent_params p;
p.save_path = ".";
error_code ec;
const char* magnet_uri = "magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
p.url = "magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
"&tr=http://1&tr=http://2&tr=http://3&dn=foo&dht=127.0.0.1:43";
torrent_handle t = add_magnet_uri(*s, magnet_uri, p, ec);
torrent_handle t = s->add_torrent(p, ec);
TEST_CHECK(!ec);
if (ec) fprintf(stderr, "%s\n", ec.message().c_str());
const char* magnet_uri2 = "magnet:"
p.url = "magnet:"
"?tr=http://1&tr=http://2&tr=http://3&dn=foo&dht=127.0.0.1:43"
"&xt=urn:btih:c352cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd";
torrent_handle t2 = add_magnet_uri(*s, magnet_uri2, p, ec);
torrent_handle t2 = s->add_torrent(p, ec);
TEST_CHECK(!ec);
if (ec) fprintf(stderr, "%s\n", ec.message().c_str());
const char* magnet_uri3 = "magnet:"
p.url = "magnet:"
"?tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80"
"&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80"
"&tr=udp%3A%2F%2Ftracker.ccc.de%3A80"
"&xt=urn:btih:a38d02c287893842a32825aa866e00828a318f07&dn=Ubuntu+11.04+%28Final%29";
torrent_handle t3 = add_magnet_uri(*s, magnet_uri3, p, ec);
torrent_handle t3 = s->add_torrent(p, ec);
TEST_CHECK(!ec);
if (ec) fprintf(stderr, "%s\n", ec.message().c_str());

View File

@ -88,7 +88,7 @@ void test_swarm(bool super_seeding = false, bool strict = false, bool seed_mode
torrent_handle tor3;
add_torrent_params p;
p.seed_mode = seed_mode;
p.flags |= add_torrent_params::flag_seed_mode;
// test using piece sizes smaller than 16kB
boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, true
, false, true, "_swarm", 32 * 1024, 0, super_seeding, &p);

View File

@ -42,8 +42,8 @@ int test_main()
t->add_tracker(tracker_url, 1);
add_torrent_params addp;
addp.paused = false;
addp.auto_managed = false;
addp.flags &= ~add_torrent_params::flag_paused;
addp.flags &= ~add_torrent_params::flag_auto_managed;
addp.ti = t;
addp.save_path = "./tmp1_tracker";
torrent_handle h = s->add_torrent(addp);
@ -107,8 +107,8 @@ int test_main()
prev_udp_announces = g_udp_tracker_requests;
prev_http_announces = g_http_tracker_requests;
addp.paused = false;
addp.auto_managed = false;
addp.flags &= ~add_torrent_params::flag_paused;
addp.flags &= ~add_torrent_params::flag_auto_managed;
addp.ti = t;
addp.save_path = "./tmp2_tracker";
h = s->add_torrent(addp);

View File

@ -57,7 +57,7 @@ int test_main()
atp.save_path = "./";
error_code ec;
torrent_handle tor1 = ses1.add_torrent(atp, ec);
atp.tracker_url = "http://test.non-existent.com/announce";
atp.trackers.push_back("http://test.non-existent.com/announce");
torrent_handle tor2 = ses2.add_torrent(atp, ec);
tor2.connect_peer(tcp::endpoint(address_v4::from_string("127.0.0.1"), ses1.listen_port()));

View File

@ -327,8 +327,8 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
}
add_torrent_params addp(&test_storage_constructor);
addp.paused = false;
addp.auto_managed = false;
addp.flags &= ~add_torrent_params::flag_paused;
addp.flags &= ~add_torrent_params::flag_auto_managed;
wait_for_listen(ses1, "ses1");
wait_for_listen(ses2, "ses1");
@ -505,8 +505,8 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
std::cout << "re-adding" << std::endl;
add_torrent_params p;
p.paused = false;
p.auto_managed = false;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.ti = t;
p.save_path = "tmp2_transfer_moved";
p.resume_data = &resume_data;

View File

@ -81,8 +81,8 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file
}
add_torrent_params p;
p.auto_managed = false;
p.paused = false;
p.flags &= ~add_torrent_params::flag_paused;
p.flags &= ~add_torrent_params::flag_auto_managed;
p.ti = torrent_file;
p.save_path = "tmp2_web_seed";
p.storage_mode = storage_mode_compact;