File: peer-msgs-test.c

package info (click to toggle)
transmission 3.00-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 33,160 kB
  • sloc: ansic: 81,055; objc: 18,449; cpp: 16,303; sh: 4,470; javascript: 4,281; makefile: 1,081; xml: 139
file content (47 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * This file Copyright (C) 2013-2014 Mnemosyne LLC
 *
 * It may be used under the GNU GPL versions 2 or 3
 * or any future license endorsed by Mnemosyne LLC.
 *
 */

#include <memory.h>
#include <stdio.h>

#include "transmission.h"
#include "peer-msgs.h"
#include "utils.h"

#include "libtransmission-test.h"

int main(void)
{
#if 0

    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];

    memset(infohash, 0xaa, SHA_DIGEST_LENGTH);

    tr_address_from_string(&addr, "80.4.4.200");

    numwant = 7;
    numgot = tr_generateAllowedSet(buf, numwant, pieceCount, infohash, &addr);
    check_uint(numgot, ==, numwant);
    check_mem(buf, ==, pieces, numgot);

    numwant = 9;
    numgot = tr_generateAllowedSet(buf, numwant, pieceCount, infohash, &addr);
    check_uint(numgot, ==, numwant);
    check_mem(buf, ==, pieces, numgot);

#endif

    return 0;
}