source: trunk/libtransmission/peer-msgs-test.c

Last change on this file was 14241, checked in by jordan, 7 years ago

Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text

  • Property svn:keywords set to Date Rev Author Id
File size: 1.2 KB
Line 
1/*
2 * This file Copyright (C) 2013-2014 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: peer-msgs-test.c 14241 2014-01-21 03:10:30Z mikedld $
8 */
9
10#include <stdio.h>
11#include "transmission.h"
12#include "peer-msgs.h"
13#include "utils.h"
14
15#include "libtransmission-test.h"
16
17int
18main (void)
19{
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];
29
30    for (i = 0; i < SHA_DIGEST_LENGTH; ++i)
31        infohash[i] = 0xaa;
32    tr_address_from_string (&addr, "80.4.4.200");
33
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]);
39
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
46
47    return 0;
48}
49
Note: See TracBrowser for help on using the repository browser.