2008-12-02 17:10:54 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "transmission.h"
|
|
|
|
#include "peer-msgs.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
2012-08-18 16:07:05 +00:00
|
|
|
#include "libtransmission-test.h"
|
2008-12-02 17:10:54 +00:00
|
|
|
|
|
|
|
int
|
2012-12-05 17:29:46 +00:00
|
|
|
main (void)
|
2008-12-02 17:10:54 +00:00
|
|
|
{
|
2011-03-07 14:33:45 +00:00
|
|
|
#if 0
|
2008-12-02 17:10:54 +00:00
|
|
|
uint32_t i;
|
|
|
|
uint8_t infohash[SHA_DIGEST_LENGTH];
|
|
|
|
struct tr_address addr;
|
|
|
|
tr_piece_index_t pieceCount = 1313;
|
|
|
|
size_t numwant;
|
|
|
|
size_t numgot;
|
|
|
|
tr_piece_index_t pieces[] = { 1059, 431, 808, 1217, 287, 376, 1188, 353, 508 };
|
|
|
|
tr_piece_index_t buf[16];
|
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
for (i = 0; i < SHA_DIGEST_LENGTH; ++i)
|
2008-12-02 17:10:54 +00:00
|
|
|
infohash[i] = 0xaa;
|
2012-12-05 17:29:46 +00:00
|
|
|
tr_address_from_string (&addr, "80.4.4.200");
|
2008-12-02 17:10:54 +00:00
|
|
|
|
|
|
|
numwant = 7;
|
2012-12-05 17:29:46 +00:00
|
|
|
numgot = tr_generateAllowedSet (buf, numwant, pieceCount, infohash, &addr);
|
|
|
|
check (numgot == numwant);
|
|
|
|
for (i=0; i<numgot; ++i)
|
|
|
|
check (buf[i] == pieces[i]);
|
2008-12-02 17:10:54 +00:00
|
|
|
|
|
|
|
numwant = 9;
|
2012-12-05 17:29:46 +00:00
|
|
|
numgot = tr_generateAllowedSet (buf, numwant, pieceCount, infohash, &addr);
|
|
|
|
check (numgot == numwant);
|
|
|
|
for (i=0; i<numgot; ++i)
|
|
|
|
check (buf[i] == pieces[i]);
|
2011-03-07 14:33:45 +00:00
|
|
|
#endif
|
2008-12-02 17:10:54 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|