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

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

run libT, cli, daemon, gtk through the source-code formatter "uncrustify" as promised/threatened

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