| 53 | |
| 54 | template <typename Setup, typename Test> |
| 55 | void 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 | |
| 88 | template <typename SetupTorrent, typename SetupFiles, typename Test> |
| 89 | void run_force_recheck_test(SetupTorrent const& setup1, SetupFiles const& setup2, Test const& test) |
no test coverage detected