try to make test_resume more reliable

This commit is contained in:
Arvid Norberg 2015-01-19 03:14:35 +00:00
parent 431fa2ac55
commit ba8b7d8854
1 changed files with 9 additions and 4 deletions

View File

@ -43,6 +43,8 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace libtorrent;
ptime g_start_time;
boost::shared_ptr<torrent_info> generate_torrent()
{
file_storage fs;
@ -67,6 +69,7 @@ boost::shared_ptr<torrent_info> generate_torrent()
std::vector<char> generate_resume_data(torrent_info* ti)
{
g_start_time = libtorrent::time_now();
entry rd;
rd["file-format"] = "libtorrent resume file";
@ -156,10 +159,12 @@ torrent_status test_resume_flags(int flags)
void default_tests(torrent_status const& s)
{
TEST_EQUAL(s.last_scrape, 1349);
TEST_EQUAL(s.time_since_download, 1350);
TEST_EQUAL(s.time_since_upload, 1351);
TEST_EQUAL(s.active_time, 1339);
int offset = total_seconds(libtorrent::time_now() - g_start_time);
TEST_EQUAL(s.last_scrape, 1349 + offset);
TEST_EQUAL(s.time_since_download, 1350 + offset);
TEST_EQUAL(s.time_since_upload, 1351 + offset);
TEST_EQUAL(s.active_time, 1339 + offset);
TEST_EQUAL(s.finished_time, 1352);
TEST_EQUAL(s.seeding_time, 1340);
TEST_EQUAL(s.added_time, 1347);