1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-23 06:30:38 +00:00

(libT) #1220 'change file and folder names': finish cleaning up the unit test for calling tr_torrentRenamePath() on an incomplete torrent with .part files

This commit is contained in:
Jordan Lee 2013-01-23 22:53:58 +00:00
parent e34be5e573
commit 06d9f20759

View file

@ -465,8 +465,6 @@ static void
create_zero_torrent_partial_contents (tr_torrent * tor, bool incomplete)
{
tr_file_index_t i;
const tr_stat * st;
tr_file_stat * fst;
for (i=0; i<tor->info.fileCount; ++i)
{
@ -493,18 +491,12 @@ create_zero_torrent_partial_contents (tr_torrent * tor, bool incomplete)
assert (path != NULL);
rv = stat (path, &sb);
assert (rv == 0);
fprintf (stderr, "%s:%d file %s size is %zu\n", __FILE__, __LINE__, path, (size_t)sb.st_size);
tr_free (path);
}
sync ();
verify_and_block_until_done (tor);
st = tr_torrentStat (tor);
fprintf (stderr, "%s:%d leftUntilDone %zu\n", __FILE__, __LINE__, (size_t)st->leftUntilDone);
fst = tr_torrentFiles (tor, NULL);
for (i=0; i<3; ++i)
fprintf (stderr, "%s:%d %d %zu\n", __FILE__, __LINE__, (int)i, (size_t)fst[i].bytesCompleted);
assert (st->leftUntilDone == 0);
assert (tr_torrentStat(tor)->leftUntilDone == 0);
if (incomplete)
{
@ -524,9 +516,7 @@ for (i=0; i<3; ++i)
sync ();
verify_and_block_until_done (tor);
st = tr_torrentStat (tor);
assert (st->leftUntilDone == tor->info.pieceSize);
fprintf (stderr, "%s:%d leftUntilDone %zu\n", __FILE__, __LINE__, (size_t)st->leftUntilDone);
assert (tr_torrentStat(tor)->leftUntilDone == tor->info.pieceSize);
}
}
@ -601,12 +591,10 @@ int
main (void)
{
int ret;
const testFunc tests[] = { //test_single_filename_torrent,
//test_multifile_torrent,
const testFunc tests[] = { test_single_filename_torrent,
test_multifile_torrent,
test_partial_file };
verbose = 1;
libtransmission_test_session_init ();
ret = runTests (tests, NUM_TESTS (tests));
libtransmission_test_session_close ();