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 $
11 #include "transmission.h"
12 #include "peer-msgs.h"
15 #include "libtransmission-test.h"
22 uint8_t infohash
[SHA_DIGEST_LENGTH
];
23 struct tr_address addr
;
24 tr_piece_index_t pieceCount
= 1313;
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
)
32 tr_address_from_string (&addr
, "80.4.4.200");
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
]);
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
]);