fix simulation tests to make them not use deprecated functions

This commit is contained in:
arvidn 2017-07-26 14:56:17 -07:00 committed by Arvid Norberg
parent 83ca755d1b
commit e19736f925
20 changed files with 111 additions and 111 deletions

View File

@ -182,7 +182,7 @@ script:
# simulation # simulation
- cd simulation - cd simulation
- 'if [[ "$sim" == "1" ]]; then - 'if [[ "$sim" == "1" ]]; then
bjam -j2 crypto=built-in warnings-as-errors=on debug-iterators=on picker-debugging=on invariant-checks=full $toolset; bjam -j2 crypto=built-in warnings-as-errors=on debug-iterators=on picker-debugging=on invariant-checks=full $toolset deprecated-functions=off;
fi' fi'
- cd .. - cd ..

View File

@ -89,7 +89,7 @@ build_script:
# simulations # simulations
- cd %ROOT_DIRECTORY%\simulation - cd %ROOT_DIRECTORY%\simulation
- if defined sim ( - if defined sim (
b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% debug-iterators=on picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=built-in testing.execute=off b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% debug-iterators=on picker-debugging=on invariant-checks=full variant=%variant% deprecated-functions=off %linkflags% %include% link=shared crypto=built-in testing.execute=off
) )
test_script: test_script:

View File

@ -222,8 +222,8 @@ void setup_swarm(int num_nodes
lt::settings_pack pack = settings(); lt::settings_pack pack = settings();
lt::add_torrent_params p; lt::add_torrent_params p;
p.flags &= ~lt::add_torrent_params::flag_paused; p.flags &= ~lt::torrent_flags::paused;
p.flags &= ~lt::add_torrent_params::flag_auto_managed; p.flags &= ~lt::torrent_flags::auto_managed;
setup_swarm(num_nodes, type, sim, pack, p, new_session setup_swarm(num_nodes, type, sim, pack, p, new_session
, add_torrent, on_alert, terminate); , add_torrent, on_alert, terminate);

View File

@ -101,8 +101,8 @@ TORRENT_TEST(dont_count_slow_torrents)
for (int i = 0; i < num_torrents; ++i) for (int i = 0; i < num_torrents; ++i)
{ {
lt::add_torrent_params params = create_torrent(i, false); lt::add_torrent_params params = create_torrent(i, false);
params.flags |= lt::add_torrent_params::flag_auto_managed; params.flags |= lt::torrent_flags::auto_managed;
params.flags |= lt::add_torrent_params::flag_paused; params.flags |= lt::torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
} }
}, },
@ -139,8 +139,8 @@ TORRENT_TEST(dont_count_slow_torrents)
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(h.status().auto_managed); TEST_CHECK(h.status().flags & torrent_flags::auto_managed);
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
} }
}); });
} }
@ -160,8 +160,8 @@ TORRENT_TEST(count_slow_torrents)
for (int i = 0; i < num_torrents; ++i) for (int i = 0; i < num_torrents; ++i)
{ {
lt::add_torrent_params params = create_torrent(i, false); lt::add_torrent_params params = create_torrent(i, false);
params.flags |= add_torrent_params::flag_auto_managed; params.flags |= torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
} }
}, },
@ -189,8 +189,8 @@ TORRENT_TEST(count_slow_torrents)
num_started = 0; num_started = 0;
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(h.status().auto_managed); TEST_CHECK(h.status().flags & torrent_flags::auto_managed);
num_started += !h.status().paused; num_started += !(h.status().flags & torrent_flags::paused);
} }
TEST_EQUAL(num_started, 1); TEST_EQUAL(num_started, 1);
}); });
@ -212,8 +212,8 @@ TORRENT_TEST(force_stopped_download)
{ {
lt::add_torrent_params params = create_torrent(i, false); lt::add_torrent_params params = create_torrent(i, false);
// torrents are paused and not auto-managed // torrents are paused and not auto-managed
params.flags &= ~add_torrent_params::flag_auto_managed; params.flags &= ~torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
} }
}, },
@ -238,8 +238,8 @@ TORRENT_TEST(force_stopped_download)
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(!h.status().auto_managed); TEST_CHECK(!(h.status().flags & torrent_flags::auto_managed));
TEST_CHECK(h.status().paused); TEST_CHECK(h.status().flags & torrent_flags::paused);
} }
}); });
} }
@ -260,8 +260,8 @@ TORRENT_TEST(force_started)
{ {
lt::add_torrent_params params = create_torrent(i, false); lt::add_torrent_params params = create_torrent(i, false);
// torrents are started and not auto-managed // torrents are started and not auto-managed
params.flags &= ~add_torrent_params::flag_auto_managed; params.flags &= ~torrent_flags::auto_managed;
params.flags &= ~add_torrent_params::flag_paused; params.flags &= ~torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
} }
}, },
@ -286,8 +286,8 @@ TORRENT_TEST(force_started)
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(!h.status().auto_managed); TEST_CHECK(!(h.status().flags & torrent_flags::auto_managed));
TEST_CHECK(!h.status().paused); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
} }
}); });
} }
@ -310,8 +310,8 @@ TORRENT_TEST(seed_limit)
{ {
lt::add_torrent_params params = create_torrent(i, true); lt::add_torrent_params params = create_torrent(i, true);
// torrents are paused and auto-managed // torrents are paused and auto-managed
params.flags |= add_torrent_params::flag_auto_managed; params.flags |= torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
} }
}, },
@ -373,9 +373,9 @@ TORRENT_TEST(seed_limit)
num_started = 0; num_started = 0;
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(h.status().auto_managed); TEST_CHECK(h.status().flags & torrent_flags::auto_managed);
TEST_CHECK(h.status().is_seeding); TEST_CHECK(h.status().is_seeding);
num_started += !h.status().paused; num_started += !(h.status().flags & torrent_flags::paused);
} }
TEST_EQUAL(num_started, 3); TEST_EQUAL(num_started, 3);
}); });
@ -399,8 +399,8 @@ TORRENT_TEST(download_limit)
{ {
lt::add_torrent_params params = create_torrent(i, false); lt::add_torrent_params params = create_torrent(i, false);
// torrents are paused and auto-managed // torrents are paused and auto-managed
params.flags |= add_torrent_params::flag_auto_managed; params.flags |= torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
} }
}, },
@ -462,9 +462,9 @@ TORRENT_TEST(download_limit)
num_started = 0; num_started = 0;
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(h.status().auto_managed); TEST_CHECK(h.status().flags & torrent_flags::auto_managed);
TEST_CHECK(!h.status().is_finished); TEST_CHECK(!h.status().is_finished);
num_started += !h.status().paused; num_started += !(h.status().flags & torrent_flags::paused);
} }
TEST_EQUAL(num_started, 3); TEST_EQUAL(num_started, 3);
}); });
@ -495,8 +495,8 @@ TORRENT_TEST(checking_announce)
{ {
lt::add_torrent_params params = create_torrent(i, true); lt::add_torrent_params params = create_torrent(i, true);
// torrents are paused and auto-managed // torrents are paused and auto-managed
params.flags |= add_torrent_params::flag_auto_managed; params.flags |= torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
// we need this to get the tracker_announce_alert // we need this to get the tracker_announce_alert
params.trackers.push_back("http://10.10.0.2/announce"); params.trackers.push_back("http://10.10.0.2/announce");
ses.async_add_torrent(params); ses.async_add_torrent(params);
@ -524,8 +524,8 @@ TORRENT_TEST(checking_announce)
int num_started = 0; int num_started = 0;
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(h.status().auto_managed); TEST_CHECK(h.status().flags & torrent_flags::auto_managed);
num_started += !h.status().paused; num_started += !(h.status().flags & torrent_flags::paused);
} }
TEST_EQUAL(num_started, 1); TEST_EQUAL(num_started, 1);
}); });
@ -548,8 +548,8 @@ TORRENT_TEST(paused_checking)
{ {
lt::add_torrent_params params = create_torrent(i, true); lt::add_torrent_params params = create_torrent(i, true);
// torrents are paused and auto-managed // torrents are paused and auto-managed
params.flags &= ~add_torrent_params::flag_auto_managed; params.flags &= ~torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
} }
}, },
@ -578,8 +578,8 @@ TORRENT_TEST(paused_checking)
// that, because they should never have been checked (because they // that, because they should never have been checked (because they
// were force stopped) // were force stopped)
TEST_CHECK(!h.status().is_seeding); TEST_CHECK(!h.status().is_seeding);
TEST_CHECK(!h.status().auto_managed); TEST_CHECK(!(h.status().flags & torrent_flags::auto_managed));
TEST_CHECK(h.status().paused); TEST_CHECK(h.status().flags & torrent_flags::paused);
} }
}); });
} }
@ -595,8 +595,8 @@ TORRENT_TEST(stop_when_ready)
// add torrents // add torrents
lt::add_torrent_params params = create_torrent(0, true); lt::add_torrent_params params = create_torrent(0, true);
// torrents are started and auto-managed // torrents are started and auto-managed
params.flags |= add_torrent_params::flag_auto_managed; params.flags |= torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_stop_when_ready; params.flags |= torrent_flags::stop_when_ready;
// we need this to get the tracker_announce_alert // we need this to get the tracker_announce_alert
params.trackers.push_back("http://10.10.0.2/announce"); params.trackers.push_back("http://10.10.0.2/announce");
ses.async_add_torrent(params); ses.async_add_torrent(params);
@ -640,8 +640,8 @@ TORRENT_TEST(stop_when_ready)
// donw, because we set the stop_when_ready flag). Force stopped // donw, because we set the stop_when_ready flag). Force stopped
// means not auto-managed and paused. // means not auto-managed and paused.
torrent_status st = h.status(); torrent_status st = h.status();
TEST_CHECK(!st.auto_managed); TEST_CHECK(!(st.flags & torrent_flags::auto_managed));
TEST_EQUAL(st.paused, true); TEST_CHECK(st.flags & torrent_flags::paused);
// it should be seeding. If it's not seeding it may not have had its // it should be seeding. If it's not seeding it may not have had its
// files checked. // files checked.
TEST_EQUAL(st.state, torrent_status::seeding); TEST_EQUAL(st.state, torrent_status::seeding);
@ -666,8 +666,8 @@ TORRENT_TEST(resume_reject_when_paused)
// the torrent is not auto managed and paused. Once the resume data // the torrent is not auto managed and paused. Once the resume data
// check completes, it will stay paused but the state_changed_alert // check completes, it will stay paused but the state_changed_alert
// will be posted, when it goes to check the files // will be posted, when it goes to check the files
params.flags &= ~add_torrent_params::flag_auto_managed; params.flags &= ~torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
}, },
@ -705,8 +705,8 @@ TORRENT_TEST(resume_reject_when_paused)
// the torrent should have been force-stopped. Force stopped means // the torrent should have been force-stopped. Force stopped means
// not auto-managed and paused. // not auto-managed and paused.
torrent_status st = h.status(); torrent_status st = h.status();
TEST_CHECK(!st.auto_managed); TEST_CHECK(!(st.flags & torrent_flags::auto_managed));
TEST_EQUAL(st.paused, true); TEST_CHECK(st.flags & torrent_flags::paused);
// it should be checking files, because the resume data should have // it should be checking files, because the resume data should have
// failed validation. // failed validation.
TEST_EQUAL(st.state, torrent_status::checking_files); TEST_EQUAL(st.state, torrent_status::checking_files);
@ -737,8 +737,8 @@ TORRENT_TEST(no_resume_when_paused)
lt::add_torrent_params params = create_torrent(0, true); lt::add_torrent_params params = create_torrent(0, true);
// the torrent is not auto managed and paused. // the torrent is not auto managed and paused.
params.flags &= ~add_torrent_params::flag_auto_managed; params.flags &= ~torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
}, },
@ -778,8 +778,8 @@ TORRENT_TEST(no_resume_when_paused)
// the torrent should have been force-stopped. Force stopped means // the torrent should have been force-stopped. Force stopped means
// not auto-managed and paused. // not auto-managed and paused.
torrent_status st = h.status(); torrent_status st = h.status();
TEST_CHECK(!st.auto_managed); TEST_CHECK(!(st.flags & torrent_flags::auto_managed));
TEST_EQUAL(st.paused, true); TEST_CHECK(st.flags & torrent_flags::paused);
// it should be checking files, because the resume data should have // it should be checking files, because the resume data should have
// failed validation. // failed validation.
TEST_EQUAL(st.state, torrent_status::checking_files); TEST_EQUAL(st.state, torrent_status::checking_files);
@ -851,8 +851,8 @@ TORRENT_TEST(pause_completed_torrents)
[](lt::session& ses) { [](lt::session& ses) {
// add torrent // add torrent
lt::add_torrent_params params = create_torrent(0, true); lt::add_torrent_params params = create_torrent(0, true);
params.flags |= add_torrent_params::flag_auto_managed; params.flags |= torrent_flags::auto_managed;
params.flags |= add_torrent_params::flag_paused; params.flags |= torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
}, },
@ -902,8 +902,8 @@ TORRENT_TEST(pause_completed_torrents)
num_paused = 0; num_paused = 0;
for (torrent_handle const& h : ses.get_torrents()) for (torrent_handle const& h : ses.get_torrents())
{ {
TEST_CHECK(h.status().auto_managed); TEST_CHECK(h.status().flags & torrent_flags::auto_managed);
num_paused += h.status().paused; num_paused += bool(h.status().flags & torrent_flags::paused);
} }
TEST_EQUAL(num_paused, 1); TEST_EQUAL(num_paused, 1);
}); });

View File

@ -80,7 +80,7 @@ TORRENT_TEST(cache_after_checking)
{ {
run_test( run_test(
[](lt::add_torrent_params& atp, lt::settings_pack& p) { [](lt::add_torrent_params& atp, lt::settings_pack& p) {
atp.flags |= lt::add_torrent_params::flag_auto_managed; atp.flags |= lt::torrent_flags::auto_managed;
p.set_int(lt::settings_pack::cache_size, 100); p.set_int(lt::settings_pack::cache_size, 100);
}, },
[](lt::session& ses) { [](lt::session& ses) {
@ -98,7 +98,7 @@ TORRENT_TEST(checking_no_cache)
{ {
run_test( run_test(
[](lt::add_torrent_params& atp, lt::settings_pack& p) { [](lt::add_torrent_params& atp, lt::settings_pack& p) {
atp.flags |= lt::add_torrent_params::flag_auto_managed; atp.flags |= lt::torrent_flags::auto_managed;
p.set_int(lt::settings_pack::cache_size, 0); p.set_int(lt::settings_pack::cache_size, 0);
}, },
[](lt::session& ses) { [](lt::session& ses) {
@ -116,7 +116,7 @@ TORRENT_TEST(checking_limit_volatile)
{ {
run_test( run_test(
[](lt::add_torrent_params& atp, lt::settings_pack& p) { [](lt::add_torrent_params& atp, lt::settings_pack& p) {
atp.flags |= lt::add_torrent_params::flag_auto_managed; atp.flags |= lt::torrent_flags::auto_managed;
p.set_int(lt::settings_pack::cache_size, 300); p.set_int(lt::settings_pack::cache_size, 300);
p.set_int(lt::settings_pack::cache_size_volatile, 2); p.set_int(lt::settings_pack::cache_size_volatile, 2);
}, },
@ -136,7 +136,7 @@ TORRENT_TEST(checking_volatile_limit_cache_size)
{ {
run_test( run_test(
[](lt::add_torrent_params& atp, lt::settings_pack& p) { [](lt::add_torrent_params& atp, lt::settings_pack& p) {
atp.flags |= lt::add_torrent_params::flag_auto_managed; atp.flags |= lt::torrent_flags::auto_managed;
p.set_int(lt::settings_pack::cache_size, 10); p.set_int(lt::settings_pack::cache_size, 10);
p.set_int(lt::settings_pack::cache_size_volatile, 300); p.set_int(lt::settings_pack::cache_size_volatile, 300);
}, },

View File

@ -115,8 +115,8 @@ void run_test(HandleAlerts const& on_alert, Test const& test)
// the first peer is a downloader, the second peer is a seed // the first peer is a downloader, the second peer is a seed
lt::add_torrent_params params = create_torrent(1); lt::add_torrent_params params = create_torrent(1);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
params.save_path = save_path(0); params.save_path = save_path(0);
ses[0]->async_add_torrent(params); ses[0]->async_add_torrent(params);

View File

@ -66,8 +66,8 @@ void run_fake_peer_test(
fake_peer p1(sim, "60.0.0.0"); fake_peer p1(sim, "60.0.0.0");
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
ses->async_add_torrent(params); ses->async_add_torrent(params);
// the alert notification function is called from within libtorrent's // the alert notification function is called from within libtorrent's

View File

@ -120,8 +120,8 @@ TORRENT_TEST(apply_ip_filter)
add_ip_filter(ses); add_ip_filter(ses);
lt::add_torrent_params params = create_torrent(0, false); lt::add_torrent_params params = create_torrent(0, false);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
}, },
@ -149,8 +149,8 @@ TORRENT_TEST(update_ip_filter)
[](lt::session& ses) [](lt::session& ses)
{ {
lt::add_torrent_params params = create_torrent(0, false); lt::add_torrent_params params = create_torrent(0, false);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
ses.async_add_torrent(params); ses.async_add_torrent(params);
}, },
@ -182,11 +182,11 @@ TORRENT_TEST(apply_ip_filter_to_torrent)
add_ip_filter(ses); add_ip_filter(ses);
lt::add_torrent_params params = create_torrent(0, false); lt::add_torrent_params params = create_torrent(0, false);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
// disable the IP filter! // disable the IP filter!
params.flags &= ~lt::add_torrent_params::flag_apply_ip_filter; params.flags &= ~lt::torrent_flags::apply_ip_filter;
ses.async_add_torrent(params); ses.async_add_torrent(params);
}, },
@ -217,8 +217,8 @@ TORRENT_TEST(ip_filter_trackers)
add_ip_filter(ses); add_ip_filter(ses);
lt::add_torrent_params params = create_torrent(0, false); lt::add_torrent_params params = create_torrent(0, false);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
params.trackers = { params.trackers = {
"http://60.0.0.0:6881/announce" "http://60.0.0.0:6881/announce"
, "http://60.0.0.1:6881/announce" , "http://60.0.0.1:6881/announce"

View File

@ -90,7 +90,7 @@ void run_metadata_test(int flags)
lt::add_torrent_params default_add_torrent; lt::add_torrent_params default_add_torrent;
if (flags & upload_only) if (flags & upload_only)
{ {
default_add_torrent.flags |= add_torrent_params::flag_upload_mode; default_add_torrent.flags |= torrent_flags::upload_mode;
} }
setup_swarm(2, (flags & reverse) ? swarm_test::upload : swarm_test::download setup_swarm(2, (flags & reverse) ? swarm_test::upload : swarm_test::download
@ -103,7 +103,7 @@ void run_metadata_test(int flags)
parse_magnet_uri(lt::make_magnet_uri(*params.ti), params, ec); parse_magnet_uri(lt::make_magnet_uri(*params.ti), params, ec);
TEST_CHECK(!ec); TEST_CHECK(!ec);
params.ti.reset(); params.ti.reset();
params.flags &= ~add_torrent_params::flag_upload_mode; params.flags &= ~torrent_flags::upload_mode;
} }
// on alert // on alert
, [&](lt::alert const* a, lt::session& ses) { , [&](lt::alert const* a, lt::session& ses) {

View File

@ -72,8 +72,8 @@ TORRENT_TEST(optimistic_unchoke)
lt::time_point start_time(lt::clock_type::now()); lt::time_point start_time(lt::clock_type::now());
lt::add_torrent_params atp = create_torrent(0); lt::add_torrent_params atp = create_torrent(0);
atp.flags &= ~add_torrent_params::flag_auto_managed; atp.flags &= ~torrent_flags::auto_managed;
atp.flags &= ~add_torrent_params::flag_paused; atp.flags &= ~torrent_flags::paused;
lt::settings_pack pack = settings(); lt::settings_pack pack = settings();
// only allow an optimistic unchoke slot // only allow an optimistic unchoke slot

View File

@ -77,8 +77,8 @@ void run_test(Setup const& setup, Torrent const& torrent
// add torrent // add torrent
lt::add_torrent_params params = create_torrent(0, false); lt::add_torrent_params params = create_torrent(0, false);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
ses->async_add_torrent(std::move(params)); ses->async_add_torrent(std::move(params));
lt::torrent_handle h; lt::torrent_handle h;
@ -132,7 +132,7 @@ TORRENT_TEST(torrent_paused_disconnect)
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) { [](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
check_disconnected(test_peers, {{true, true, true}}); check_disconnected(test_peers, {{true, true, true}});
TEST_EQUAL(h.status().paused, true); TEST_CHECK(h.status().flags & torrent_flags::paused);
}); });
} }
@ -156,7 +156,7 @@ TORRENT_TEST(session_paused_disconnect)
check_disconnected(test_peers, {{true, true, true}}); check_disconnected(test_peers, {{true, true, true}});
// the torrent isn't paused, the session is // the torrent isn't paused, the session is
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
}); });
} }
@ -176,7 +176,7 @@ TORRENT_TEST(paused_session_add_torrent)
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
// the torrent isn't paused, the session is // the torrent isn't paused, the session is
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
}); });
} }
@ -196,7 +196,7 @@ TORRENT_TEST(paused_torrent_add_peers)
}, },
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, true); TEST_CHECK(h.status().flags & torrent_flags::paused);
}); });
} }
@ -208,12 +208,12 @@ TORRENT_TEST(torrent_paused_alert)
[](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>&) {}, [](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>&) {},
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
h.pause(); h.pause();
}, },
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, true); TEST_CHECK(h.status().flags & torrent_flags::paused);
std::vector<lt::alert*> alerts; std::vector<lt::alert*> alerts;
ses.pop_alerts(&alerts); ses.pop_alerts(&alerts);
@ -243,12 +243,12 @@ TORRENT_TEST(session_paused_alert)
[](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>&) {}, [](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>&) {},
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
ses.pause(); ses.pause();
}, },
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
std::vector<lt::alert*> alerts; std::vector<lt::alert*> alerts;
ses.pop_alerts(&alerts); ses.pop_alerts(&alerts);
@ -277,17 +277,17 @@ TORRENT_TEST(session_pause_resume)
run_test( run_test(
[](lt::session&) {}, [](lt::session&) {},
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
ses.pause(); ses.pause();
}, },
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
ses.resume(); ses.resume();
}, },
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
std::vector<lt::alert*> alerts; std::vector<lt::alert*> alerts;
ses.pop_alerts(&alerts); ses.pop_alerts(&alerts);
@ -316,19 +316,19 @@ TORRENT_TEST(session_pause_resume_connect)
run_test( run_test(
[](lt::session&) {}, [](lt::session&) {},
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
ses.pause(); ses.pause();
add_fake_peers(h, 3); add_fake_peers(h, 3);
}, },
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) { [](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
check_accepted(test_peers, {{false, false, false}}); check_accepted(test_peers, {{false, false, false}});
ses.resume(); ses.resume();
}, },
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) { [](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
TEST_EQUAL(h.status().paused, false); TEST_CHECK(!(h.status().flags & torrent_flags::paused));
check_accepted(test_peers, {{true, true, true}}); check_accepted(test_peers, {{true, true, true}});
}); });

View File

@ -79,8 +79,8 @@ void test_transfer(int enc_policy, int level, bool prefer_rc4)
sim::simulation sim{cfg}; sim::simulation sim{cfg};
lt::add_torrent_params default_add_torrent; lt::add_torrent_params default_add_torrent;
default_add_torrent.flags &= ~lt::add_torrent_params::flag_paused; default_add_torrent.flags &= ~lt::torrent_flags::paused;
default_add_torrent.flags &= ~lt::add_torrent_params::flag_auto_managed; default_add_torrent.flags &= ~lt::torrent_flags::auto_managed;
setup_swarm(2, swarm_test::download, sim, default_settings, default_add_torrent setup_swarm(2, swarm_test::download, sim, default_settings, default_add_torrent
// add session // add session
, [](lt::settings_pack& pack) { , [](lt::settings_pack& pack) {
@ -165,8 +165,8 @@ TORRENT_TEST(disabled_failing)
sim::simulation sim{cfg}; sim::simulation sim{cfg};
lt::add_torrent_params default_add_torrent; lt::add_torrent_params default_add_torrent;
default_add_torrent.flags &= ~lt::add_torrent_params::flag_paused; default_add_torrent.flags &= ~lt::torrent_flags::paused;
default_add_torrent.flags &= ~lt::add_torrent_params::flag_auto_managed; default_add_torrent.flags &= ~lt::torrent_flags::auto_managed;
setup_swarm(2, swarm_test::download, sim, default_settings, default_add_torrent setup_swarm(2, swarm_test::download, sim, default_settings, default_add_torrent
// add session // add session
, [](lt::settings_pack& pack) { , [](lt::settings_pack& pack) {

View File

@ -52,7 +52,7 @@ TORRENT_TEST(seed_and_suggest_mode)
} }
// add torrent // add torrent
, [](lt::add_torrent_params& params) { , [](lt::add_torrent_params& params) {
params.flags |= add_torrent_params::flag_seed_mode; params.flags |= torrent_flags::seed_mode;
} }
// on alert // on alert
, [&](lt::alert const* a, lt::session&) , [&](lt::alert const* a, lt::session&)
@ -75,7 +75,7 @@ TORRENT_TEST(seed_and_suggest_mode)
}); });
printf("save-resume: %s\n", write_resume_data(resume_data).to_string().c_str()); printf("save-resume: %s\n", write_resume_data(resume_data).to_string().c_str());
TEST_CHECK(resume_data.flags & add_torrent_params::flag_seed_mode); TEST_CHECK(resume_data.flags & torrent_flags::seed_mode);
// there should not be any pieces in a seed-mode torrent // there should not be any pieces in a seed-mode torrent
auto const pieces = resume_data.have_pieces; auto const pieces = resume_data.have_pieces;

View File

@ -53,7 +53,7 @@ TORRENT_TEST(seed_mode)
} }
// add torrent // add torrent
, [](lt::add_torrent_params& params) { , [](lt::add_torrent_params& params) {
params.flags |= add_torrent_params::flag_seed_mode; params.flags |= torrent_flags::seed_mode;
} }
// on alert // on alert
, [](lt::alert const* a, lt::session& ses) {} , [](lt::alert const* a, lt::session& ses) {}

View File

@ -82,8 +82,8 @@ void run_test(Setup const& setup
}); });
lt::add_torrent_params params = create_torrent(1); lt::add_torrent_params params = create_torrent(1);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
params.save_path = save_path(0); params.save_path = save_path(0);
ses->async_add_torrent(params); ses->async_add_torrent(params);

View File

@ -44,7 +44,7 @@ TORRENT_TEST(super_seeding)
, [](lt::settings_pack&) {} , [](lt::settings_pack&) {}
// add torrent // add torrent
, [](lt::add_torrent_params& params) { , [](lt::add_torrent_params& params) {
params.flags |= add_torrent_params::flag_super_seeding; params.flags |= torrent_flags::super_seeding;
} }
// on alert // on alert
, [](lt::alert const*, lt::session&) {} , [](lt::alert const*, lt::session&) {}
@ -62,7 +62,7 @@ TORRENT_TEST(strict_super_seeding)
} }
// add torrent // add torrent
, [](lt::add_torrent_params& params) { , [](lt::add_torrent_params& params) {
params.flags |= add_torrent_params::flag_super_seeding; params.flags |= torrent_flags::super_seeding;
} }
// on alert // on alert
, [](lt::alert const*, lt::session&) {} , [](lt::alert const*, lt::session&) {}

View File

@ -57,7 +57,7 @@ TORRENT_TEST(seed_mode)
, [](lt::settings_pack&) {} , [](lt::settings_pack&) {}
// add torrent // add torrent
, [](lt::add_torrent_params& params) { , [](lt::add_torrent_params& params) {
params.flags |= add_torrent_params::flag_seed_mode; params.flags |= torrent_flags::seed_mode;
} }
// on alert // on alert
, [](lt::alert const*, lt::session&) {} , [](lt::alert const*, lt::session&) {}
@ -84,7 +84,7 @@ TORRENT_TEST(seed_mode_disable_hash_checks)
} }
// add torrent // add torrent
, [](lt::add_torrent_params& params) { , [](lt::add_torrent_params& params) {
params.flags |= add_torrent_params::flag_seed_mode; params.flags |= torrent_flags::seed_mode;
// just to make sure the disable_hash_checks really work, we // just to make sure the disable_hash_checks really work, we
// shouldn't be verifying anything from the storage // shouldn't be verifying anything from the storage
params.storage = disabled_storage_constructor; params.storage = disabled_storage_constructor;
@ -562,8 +562,8 @@ TORRENT_TEST(block_uploaded_alert)
} }
else if (auto at = lt::alert_cast<lt::block_uploaded_alert>(a)) else if (auto at = lt::alert_cast<lt::block_uploaded_alert>(a))
{ {
TEST_EQUAL(blocks[at->piece_index][at->block_index], false); TEST_EQUAL(blocks[static_cast<int>(at->piece_index)][at->block_index], false);
blocks[at->piece_index][at->block_index] = true; blocks[static_cast<int>(at->piece_index)][at->block_index] = true;
} }
} }
// terminate // terminate

View File

@ -131,8 +131,8 @@ void run_test(
// the first peer is a downloader, the second peer is a seed // the first peer is a downloader, the second peer is a seed
lt::add_torrent_params params = create_torrent(1); lt::add_torrent_params params = create_torrent(1);
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
params.save_path = save_path(0); params.save_path = save_path(0);
ses[0]->async_add_torrent(params); ses[0]->async_add_torrent(params);

View File

@ -61,7 +61,7 @@ TORRENT_TEST(utp)
} }
// add torrent // add torrent
, [](lt::add_torrent_params& params) { , [](lt::add_torrent_params& params) {
params.flags |= add_torrent_params::flag_seed_mode; params.flags |= torrent_flags::seed_mode;
} }
// on alert // on alert
, [&](lt::alert const*, lt::session& ses) { , [&](lt::alert const*, lt::session& ses) {

View File

@ -93,8 +93,8 @@ add_torrent_params create_torrent(file_storage& fs, bool const pad_files = false
bencode(out, tor); bencode(out, tor);
add_torrent_params ret; add_torrent_params ret;
ret.ti = std::make_shared<torrent_info>(tmp, from_span); ret.ti = std::make_shared<torrent_info>(tmp, from_span);
ret.flags &= ~lt::add_torrent_params::flag_auto_managed; ret.flags &= ~lt::torrent_flags::auto_managed;
ret.flags &= ~lt::add_torrent_params::flag_paused; ret.flags &= ~lt::torrent_flags::paused;
ret.save_path = "."; ret.save_path = ".";
return ret; return ret;
} }
@ -502,8 +502,8 @@ TORRENT_TEST(urlseed_timeout)
fs.add_file("timeout_test", 0x8000); fs.add_file("timeout_test", 0x8000);
lt::add_torrent_params params = ::create_torrent(fs); lt::add_torrent_params params = ::create_torrent(fs);
params.url_seeds.push_back("http://2.2.2.2:8080/"); params.url_seeds.push_back("http://2.2.2.2:8080/");
params.flags &= ~lt::add_torrent_params::flag_auto_managed; params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::add_torrent_params::flag_paused; params.flags &= ~lt::torrent_flags::paused;
params.save_path = "."; params.save_path = ".";
ses.async_add_torrent(params); ses.async_add_torrent(params);
}, },