(trunk libT) add more tests to verify r8214

This commit is contained in:
Charles Kerr 2009-04-11 15:48:58 +00:00
parent 35564b76a4
commit b3813000e9
1 changed files with 5 additions and 2 deletions

View File

@ -403,12 +403,11 @@ tr_torrentInitFilePieces( tr_torrent * tor )
/* build the array of first-file hints to give calculatePiecePriority */
firstFiles = tr_new( int, inf->pieceCount );
for( p=f=0; p<inf->pieceCount; ++p ) {
if( inf->files[f].lastPiece < p )
while( inf->files[f].lastPiece < p )
++f;
firstFiles[p] = f;
}
#if 0
/* test to confirm the first-file hints are correct */
for( p=0; p<inf->pieceCount; ++p ) {
@ -417,6 +416,10 @@ tr_torrentInitFilePieces( tr_torrent * tor )
assert( inf->files[f].lastPiece >= p );
if( f > 0 )
assert( inf->files[f-1].lastPiece < p );
for( f=0; f<inf->fileCount; ++f )
if( pieceHasFile( p, &inf->files[f] ) )
break;
assert( (int)f == firstFiles[p] );
}
#endif