1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00
transmission/libtransmission/session-test.c
Jordan Lee 4b9626bb83 Licensing changes:
1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed

2. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)

3. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
2014-01-19 01:09:44 +00:00

49 lines
929 B
C

/*
* This file Copyright (C) 2013-2014 Mnemosyne LLC
*
* It may be used under the GNU Public License v2 or v3 licenses,
* or any future license endorsed by Mnemosyne LLC.
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "transmission.h"
#include "session.h"
#include "utils.h"
#include "version.h"
#undef VERBOSE
#include "libtransmission-test.h"
static int
testPeerId (void)
{
int i;
uint8_t peer_id[PEER_ID_LEN+1];
for (i = 0; i < 100000; ++i)
{
int j;
int val = 0;
tr_peerIdInit (peer_id);
check (strlen ((char*)peer_id) == PEER_ID_LEN);
check (!memcmp (peer_id, PEERID_PREFIX, 8));
for (j = 8; j < PEER_ID_LEN; ++j)
{
char tmp[2] = { peer_id[j], '\0' };
val += strtoul (tmp, NULL, 36);
}
check ((val % 36) == 0);
}
return 0;
}
MAIN_SINGLE_TEST (testPeerId)