(trunk libT) add more tests to verify r8214
This commit is contained in:
parent
35564b76a4
commit
b3813000e9
|
@ -403,12 +403,11 @@ tr_torrentInitFilePieces( tr_torrent * tor )
|
||||||
/* build the array of first-file hints to give calculatePiecePriority */
|
/* build the array of first-file hints to give calculatePiecePriority */
|
||||||
firstFiles = tr_new( int, inf->pieceCount );
|
firstFiles = tr_new( int, inf->pieceCount );
|
||||||
for( p=f=0; p<inf->pieceCount; ++p ) {
|
for( p=f=0; p<inf->pieceCount; ++p ) {
|
||||||
if( inf->files[f].lastPiece < p )
|
while( inf->files[f].lastPiece < p )
|
||||||
++f;
|
++f;
|
||||||
firstFiles[p] = f;
|
firstFiles[p] = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* test to confirm the first-file hints are correct */
|
/* test to confirm the first-file hints are correct */
|
||||||
for( p=0; p<inf->pieceCount; ++p ) {
|
for( p=0; p<inf->pieceCount; ++p ) {
|
||||||
|
@ -417,6 +416,10 @@ tr_torrentInitFilePieces( tr_torrent * tor )
|
||||||
assert( inf->files[f].lastPiece >= p );
|
assert( inf->files[f].lastPiece >= p );
|
||||||
if( f > 0 )
|
if( f > 0 )
|
||||||
assert( inf->files[f-1].lastPiece < p );
|
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
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue