MCPcopy Create free account
hub / github.com/arvidn/libtorrent / run_test

Function run_test

simulation/test_checking.cpp:55–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54template <typename Setup, typename Test>
55void run_test(Setup const& setup, Test const& test)
56{
57 // this is a seeding torrent
58 lt::add_torrent_params atp = create_torrent(0, true);
59
60 sim::default_config network_cfg;
61 sim::simulation sim{network_cfg};
62 auto ios = std::make_unique<sim::asio::io_context>(
63 sim, lt::make_address_v4("50.0.0.1"));
64 lt::session_proxy zombie;
65
66 // setup settings pack to use for the session (customization point)
67 lt::settings_pack pack = settings();
68 setup(atp, pack);
69
70 auto ses = std::make_shared<lt::session>(pack, *ios);
71
72 ses->async_add_torrent(atp);
73
74 print_alerts(*ses);
75
76 sim::timer t(sim, lt::seconds(6), [&](boost::system::error_code const&)
77 {
78 test(*ses);
79
80 // shut down
81 zombie = ses->abort();
82 ses.reset();
83 });
84
85 sim.run();
86}
87
88template <typename SetupTorrent, typename SetupFiles, typename Test>
89void run_force_recheck_test(SetupTorrent const& setup1, SetupFiles const& setup2, Test const& test)

Callers 1

TORRENT_TESTFunction · 0.70

Calls 8

testFunction · 0.85
create_torrentFunction · 0.70
print_alertsFunction · 0.70
settingsFunction · 0.50
async_add_torrentMethod · 0.45
abortMethod · 0.45
resetMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected