fix test_flags (for windows)

This commit is contained in:
Arvid Norberg 2019-11-18 08:43:23 +01:00 committed by Arvid Norberg
parent 8abd878ed4
commit ad787d2a4f
1 changed files with 10 additions and 3 deletions

View File

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/session.hpp"
#include "libtorrent/torrent_handle.hpp"
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/aux_/path.hpp"
#include "settings.hpp"
using namespace libtorrent;
@ -42,13 +43,19 @@ namespace lt = libtorrent;
namespace {
std::string file(std::string name)
{
return combine_path(parent_path(current_working_directory())
, combine_path("test_torrents", name));
}
void test_add_and_get_flags(torrent_flags_t const flags)
{
session ses(settings());
add_torrent_params p;
p.save_path = ".";
error_code ec;
p.ti = std::make_shared<torrent_info>("../test_torrents/base.torrent",
p.ti = std::make_shared<torrent_info>(file("base.torrent"),
std::ref(ec));
TEST_CHECK(!ec);
p.flags = flags;
@ -63,7 +70,7 @@ void test_set_after_add(torrent_flags_t const flags)
add_torrent_params p;
p.save_path = ".";
error_code ec;
p.ti = std::make_shared<torrent_info>("../test_torrents/base.torrent",
p.ti = std::make_shared<torrent_info>(file("base.torrent"),
std::ref(ec));
TEST_CHECK(!ec);
p.flags = torrent_flags::all & ~flags;
@ -80,7 +87,7 @@ void test_unset_after_add(torrent_flags_t const flags)
add_torrent_params p;
p.save_path = ".";
error_code ec;
p.ti = std::make_shared<torrent_info>("../test_torrents/base.torrent",
p.ti = std::make_shared<torrent_info>(file("base.torrent"),
std::ref(ec));
TEST_CHECK(!ec);
p.flags = flags;