#define _TR_TESTING_ #ifndef _TR_TEST_TORRENT_CONTEXT_HPP_ #define _TR_TEST_TORRENT_CONTEXT_HPP_ #include #include #include const auto torrent_url = "http://sout.no/torrent.torrent"; const std::string torrent_id = "c0b0a90089710812fe8c37385a4cc2978eabf3e8"; class TorrentStatus { public: bool paused = false; bool is_seeding = false; bool announcing_to_dht = true; int state = 0; int priority = 0; std::string name = "Arch"; std::string save_path = ""; }; class TestTorrent { public: TestTorrent(const libtorrent::add_torrent_params ¶ms); TestTorrent() {} operator bool() const { return is_valid(); }; bool is_valid() const; libtorrent::sha1_hash info_hash() const; TorrentStatus &status(int type = 0); int query_name = 1; int query_save_path = 2; bool valid = true; int upload_limit_ = 0; int upload_limit() const; void set_download_limit(int limit); void set_upload_limit(int limit); int download_limit_ = 0; int download_limit() const; void pause(int flags = 0); void resume(); libtorrent::sha1_hash hash_; TorrentStatus status_; }; const nlohmann::json torrent_json = { {"info_hash", torrent_id}, {"paused", false}, {"seeding", false}, {"state", 0}, {"priority", 0}, {"up_limit", 0}, {"down_limit", 0}, {"name", "Arch"}}; #endif