transmission 2.83
[tomato.git] / release / src-rt-6.x.4708 / router / transmission / libtransmission / peer-msgs-test.c
blob204538f3dcd5023f7c2c839f02c04f74f649ac77
1 /*
2 * This file Copyright (C) 2013-2014 Mnemosyne LLC
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
7 * $Id: peer-msgs-test.c 14241 2014-01-21 03:10:30Z jordan $
8 */
10 #include <stdio.h>
11 #include "transmission.h"
12 #include "peer-msgs.h"
13 #include "utils.h"
15 #include "libtransmission-test.h"
17 int
18 main (void)
20 #if 0
21 uint32_t i;
22 uint8_t infohash[SHA_DIGEST_LENGTH];
23 struct tr_address addr;
24 tr_piece_index_t pieceCount = 1313;
25 size_t numwant;
26 size_t numgot;
27 tr_piece_index_t pieces[] = { 1059, 431, 808, 1217, 287, 376, 1188, 353, 508 };
28 tr_piece_index_t buf[16];
30 for (i = 0; i < SHA_DIGEST_LENGTH; ++i)
31 infohash[i] = 0xaa;
32 tr_address_from_string (&addr, "80.4.4.200");
34 numwant = 7;
35 numgot = tr_generateAllowedSet (buf, numwant, pieceCount, infohash, &addr);
36 check (numgot == numwant);
37 for (i=0; i<numgot; ++i)
38 check (buf[i] == pieces[i]);
40 numwant = 9;
41 numgot = tr_generateAllowedSet (buf, numwant, pieceCount, infohash, &addr);
42 check (numgot == numwant);
43 for (i=0; i<numgot; ++i)
44 check (buf[i] == pieces[i]);
45 #endif
47 return 0;