source: trunk/libtransmission/clients-test.c @ 6201

Last change on this file since 6201 was 6201, checked in by charles, 14 years ago

#1032: recognize bitlord/bitcomet in the inspector's peers column

File size: 1.1 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include "transmission.h"
5#include "clients.h"
6
7#define VERBOSE 0
8
9#define check(A) { \
10    ++test; \
11    if (A) { \
12        if( VERBOSE ) \
13            fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
14    } else { \
15        if( VERBOSE ) \
16            fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \
17        return test; \
18    } \
19}
20
21#define TEST_CLIENT(A,B) \
22  tr_clientForId( buf, sizeof( buf ), A ); \
23  check( !strcmp( buf, B ) );
24
25int
26main( void )
27{
28    int test = 0;
29    char buf[128];
30
31    TEST_CLIENT( "-FC1013-", "FileCroc 1.0.1.3" );
32    TEST_CLIENT( "-MR1100-", "Miro 1.1.0.0" );
33    TEST_CLIENT( "-TR0006-", "Transmission 0.6" );
34    TEST_CLIENT( "-TR0072-", "Transmission 0.72" );
35    TEST_CLIENT( "-TR111Z-", "Transmission 1.11+" );
36
37    TEST_CLIENT( "\x65\x78\x62\x63\x00\x38\x7A\x44\x63\x10\x2D\x6E\x9A\xD6\x72\x3B\x33\x9F\x35\xA9", "BitComet 0.56" );
38    TEST_CLIENT( "\x65\x78\x62\x63\x00\x38\x4C\x4F\x52\x44\x32\x00\x04\x8E\xCE\xD5\x7B\xD7\x10\x28", "BitLord 0.56" );
39
40    /* cleanup */
41    return 0;
42}
Note: See TracBrowser for help on using the repository browser.