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

Last change on this file since 8050 was 7783, checked in by charles, 13 years ago

(trunk libT) fix some code that the newly-added gcc warnings didn't like

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