Changeset 13569


Ignore:
Timestamp:
Oct 14, 2012, 6:56:37 PM (9 years ago)
Author:
jordan
Message:

retrofit some of the tests to use the more expressive test API

Location:
trunk/libtransmission
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bencode-test.c

    r13442 r13569  
    3030    tr_snprintf( (char*)buf, sizeof( buf ), "i64e" );
    3131    err = tr_bencParseInt( buf, buf + 4, &end, &val );
    32     check( err == 0 );
    33     check( val == 64 );
    34     check( end == buf + 4 );
     32    check_int_eq( 0, err );
     33    check_int_eq( 64, val );
     34    check( (buf + 4) ==  end );
    3535
    3636    /* missing 'e' */
     
    3838    val = 888;
    3939    err = tr_bencParseInt( buf, buf + 3, &end, &val );
    40     check( err == EILSEQ );
    41     check( val == 888 );
     40    check_int_eq( EILSEQ, err );
     41    check_int_eq( 888, val );
    4242    check( end == NULL );
    4343
    4444    /* empty buffer */
    4545    err = tr_bencParseInt( buf, buf + 0, &end, &val );
    46     check( err == EILSEQ );
    47     check( val == 888 );
     46    check_int_eq( EILSEQ, err );
     47    check_int_eq( 888, val );
    4848    check( end == NULL );
    4949
     
    5151    tr_snprintf( (char*)buf, sizeof( buf ), "i6z4e" );
    5252    err = tr_bencParseInt( buf, buf + 5, &end, &val );
    53     check( err == EILSEQ );
    54     check( val == 888 );
     53    check_int_eq( EILSEQ, err );
     54    check_int_eq( 888, val );
    5555    check( end == NULL );
    5656
     
    5858    tr_snprintf( (char*)buf, sizeof( buf ), "i-3e" );
    5959    err = tr_bencParseInt( buf, buf + 4, &end, &val );
    60     check( err == 0 );
    61     check( val == -3 );
    62     check( end == buf + 4 );
     60    check_int_eq( 0, err );
     61    check_int_eq( -3, val );
     62    check( (buf + 4) == end );
    6363
    6464    /* zero */
    6565    tr_snprintf( (char*)buf, sizeof( buf ), "i0e" );
    6666    err = tr_bencParseInt( buf, buf + 4, &end, &val );
    67     check( err == 0 );
    68     check( val == 0 );
    69     check( end == buf + 3 );
     67    check_int_eq( 0, err );
     68    check_int_eq( 0, val );
     69    check( (buf + 3) == end );
    7070
    7171    /* no leading zeroes allowed */
     
    7474    tr_snprintf( (char*)buf, sizeof( buf ), "i04e" );
    7575    err = tr_bencParseInt( buf, buf + 4, &end, &val );
    76     check( err == EILSEQ );
    77     check( val == 0 );
    78     check( end == NULL );
     76    check_int_eq( EILSEQ, err );
     77    check_int_eq( 0, val );
     78    check( NULL == end );
    7979
    8080    return 0;
     
    9393    tr_snprintf( (char*)buf, sizeof( buf ), "4:boat" );
    9494    err = tr_bencParseStr( buf, buf + 6, &end, &str, &len );
    95     check( err == 0 );
     95    check_int_eq (0, err);
     96    check_int_eq (4, len);
    9697    check( !strncmp( (char*)str, "boat", len ) );
    97     check( len == 4 );
    9898    check( end == buf + 6 );
    9999    str = NULL;
     
    103103    /* string goes past end of buffer */
    104104    err = tr_bencParseStr( buf, buf + 5, &end, &str, &len );
    105     check( err == EILSEQ );
     105    check_int_eq (EILSEQ, err);
     106    check_int_eq (0, len);
    106107    check( str == NULL );
    107108    check( end == NULL );
     
    111112    tr_snprintf( (char*)buf, sizeof( buf ), "0:" );
    112113    err = tr_bencParseStr( buf, buf + 2, &end, &str, &len );
    113     check( err == 0 );
     114    check_int_eq (0, err);
     115    check_int_eq (0, len);
    114116    check( !*str );
    115     check( !len );
    116117    check( end == buf + 2 );
    117118    str = NULL;
     
    122123    tr_snprintf( (char*)buf, sizeof( buf ), "3:boat" );
    123124    err = tr_bencParseStr( buf, buf + 6, &end, &str, &len );
    124     check( err == 0 );
     125    check_int_eq (0, err);
     126    check_int_eq (3, len);
    125127    check( !strncmp( (char*)str, "boa", len ) );
    126     check( len == 3 );
    127128    check( end == buf + 5 );
    128129    str = NULL;
     
    157158        check( end == (const uint8_t*)str + len );
    158159        saved = tr_bencToStr( &val, TR_FMT_BENC, &savedLen );
    159         check( !strcmp( saved, str ) );
    160         check( len == (size_t)savedLen );
     160        check_streq (str, saved);
     161        check_int_eq (savedLen, len);
    161162        tr_free( saved );
    162163        tr_bencFree( &val );
     
    182183    check( !err );
    183184    check( tr_bencGetInt( &val, &i ) );
    184     check( i == 64 );
     185    check_int_eq (64, i);
    185186    check( end == buf + 4 );
    186187    tr_bencFree( &val );
     
    192193    check( val.val.l.count == 3 );
    193194    check( tr_bencGetInt( &val.val.l.vals[0], &i ) );
    194     check( i == 64 );
     195    check_int_eq (64, i);
    195196    check( tr_bencGetInt( &val.val.l.vals[1], &i ) );
    196     check( i == 32 );
     197    check_int_eq (32, i);
    197198    check( tr_bencGetInt( &val.val.l.vals[2], &i ) );
    198     check( i == 16 );
     199    check_int_eq (16, i);
    199200    saved = tr_bencToStr( &val, TR_FMT_BENC, &len );
    200     check( !strcmp( saved, (char*)buf ) );
     201    check_streq ((char*)buf, saved);
    201202    tr_free( saved );
    202203    tr_bencFree( &val );
     
    214215    check( end == buf + 2 );
    215216    saved = tr_bencToStr( &val, TR_FMT_BENC, &len );
    216     check( !strcmp( saved, "le" ) );
     217    check_streq( "le", saved );
    217218    tr_free( saved );
    218219    tr_bencFree( &val );
     
    257258    check( ( child2 = tr_bencListChild( child, 0 ) ) );
    258259    saved = tr_bencToStr( &val, TR_FMT_BENC, &len );
    259     check( !strcmp( saved, "lld1:ai64e1:bi32eeee" ) );
     260    check_streq( "lld1:ai64e1:bi32eeee", saved );
    260261    tr_free( saved );
    261262    tr_bencFree( &val );
     
    268269    check( end == buf + 2 );
    269270    saved = tr_bencToStr( &val, TR_FMT_BENC, &len );
    270     check( !strcmp( saved, "le" ) );
     271    check_streq( "le", saved );
    271272    tr_free( saved );
    272273    tr_bencFree( &val );
     
    315316    fprintf( stderr, "want: %s\n", expected );
    316317#endif
    317     check( !strcmp( serialized, expected ) );
     318    check_streq (expected, serialized);
    318319    tr_bencFree( &top );
    319320    evbuffer_free( buf );
     
    385386
    386387    check( tr_bencDictFindInt( &dest, "i1", &i ));
    387     check( i == 1);
     388    check_int_eq (1, i);
    388389    check( tr_bencDictFindInt( &dest, "i2", &i ));
    389     check( i == 4);
     390    check_int_eq (4, i);
    390391    check( tr_bencDictFindInt( &dest, "i3", &i ));
    391     check( i == 3);
     392    check_int_eq (3, i);
    392393    check( tr_bencDictFindInt( &dest, "i4", &i ));
    393     check( i == -35);
     394    check_int_eq (-35, i);
    394395    check( tr_bencDictFindStr( &dest, "s5", &s ));
    395     check( strcmp( "abc", s ) == 0 );
     396    check_streq ("abc", s);
    396397    check( tr_bencDictFindStr( &dest, "s6", &s ));
    397     check( strcmp( "xyz", s ) == 0 );
     398    check_streq ("xyz", s);
    398399    check( tr_bencDictFindStr( &dest, "s7", &s ));
    399     check( strcmp( "127.0.0.1", s ) == 0 );
     400    check_streq ("127.0.0.1", s);
    400401    check( tr_bencDictFindStr( &dest, "s8", &s ));
    401     check( strcmp( "ghi", s ) == 0 );
     402    check_streq ("ghi", s);
    402403
    403404    tr_bencFree( &dest );
     
    429430    check( end == in + ( depth * 2 ) );
    430431    saved = tr_bencToStr( &val, TR_FMT_BENC, &len );
    431     check( !strcmp( saved, (char*)in ) );
     432    check_streq ((char*)in, saved);
    432433    tr_free( in );
    433434    tr_free( saved );
     
    496497    check( tr_bencIsDict( &top2 ) );
    497498    check( tr_bencDictFindInt( &top, "this-is-an-int", &intVal ) );
    498     check( intVal == 1234 );
     499    check_int_eq (1234, intVal);
    499500    check( tr_bencDictFindBool( &top, "this-is-a-bool", &boolVal ) );
    500501    check( boolVal == true );
    501502    check( tr_bencDictFindStr( &top, "this-is-a-string", &strVal ) );
    502     check( !strcmp( strVal, "this-is-a-string" ) );
     503    check_streq ("this-is-a-string", strVal);
    503504    check( tr_bencDictFindReal( &top, "this-is-a-real", &realVal ) );
    504     check( (int)(realVal*100) == 50 );
     505    check_int_eq (50, (int)(realVal*100));
    505506
    506507    tr_bencFree( &top2 );
  • trunk/libtransmission/history-test.c

    r13442 r13569  
    1616
    1717    tr_historyAdd( &h, 10000, 1 );
    18     check( (int)tr_historyGet( &h, 12000, 1000 ) == 0 );
    19     check( (int)tr_historyGet( &h, 12000, 3000 ) == 1 );
    20     check( (int)tr_historyGet( &h, 12000, 5000 ) == 1 );
     18    check_int_eq( 0, (int)tr_historyGet( &h, 12000, 1000 ) );
     19    check_int_eq( 1, (int)tr_historyGet( &h, 12000, 3000 ) );
     20    check_int_eq( 1, (int)tr_historyGet( &h, 12000, 5000 ) );
    2121    tr_historyAdd( &h, 20000, 1 );
    22     check( (int)tr_historyGet( &h, 22000,  1000 ) == 0 );
    23     check( (int)tr_historyGet( &h, 22000,  3000 ) == 1 );
    24     check( (int)tr_historyGet( &h, 22000, 15000 ) == 2 );
    25     check( (int)tr_historyGet( &h, 22000, 20000 ) == 2 );
     22    check_int_eq( 0, (int)tr_historyGet( &h, 22000,  1000 ) );
     23    check_int_eq( 1, (int)tr_historyGet( &h, 22000,  3000 ) );
     24    check_int_eq( 2, (int)tr_historyGet( &h, 22000, 15000 ) );
     25    check_int_eq( 2, (int)tr_historyGet( &h, 22000, 20000 ) );
    2626
    2727    return 0;
  • trunk/libtransmission/json-test.c

    r13442 r13569  
    2424    check( tr_bencIsDict( &top ) );
    2525    check( tr_bencDictFindStr( &top, "key", &str ) );
    26     check( !strcmp( str, "Letöltések" ) );
     26    check_streq( "Letöltések", str );
    2727    if( !err )
    2828        tr_bencFree( &top );
     
    3333    check( tr_bencIsDict( &top ) );
    3434    check( tr_bencDictFindStr( &top, "key", &str ) );
    35     check( !strcmp( str, "\\" ) );
     35    check_streq( "\\", str );
    3636    if( !err )
    3737        tr_bencFree( &top );
     
    5050    check( tr_bencIsDict( &top ) );
    5151    check( tr_bencDictFindStr( &top, "key", &str ) );
    52     check( !strcmp( str, "Letöltések" ) );
     52    check_streq( "Letöltések", str );
    5353    json = tr_bencToStr( &top, TR_FMT_JSON, NULL );
    5454    if( !err )
     
    6161    check( tr_bencIsDict( &top ) );
    6262    check( tr_bencDictFindStr( &top, "key", &str ) );
    63     check( !strcmp( str, "Letöltések" ) );
     63    check_streq( "Letöltések", str );
    6464    if( !err )
    6565        tr_bencFree( &top );
     
    9595    check( tr_bencIsDict( headers ) );
    9696    check( tr_bencDictFindStr( headers, "type", &str ) );
    97     check( !strcmp( str, "request" ) );
     97    check_streq( "request", str );
    9898    check( tr_bencDictFindInt( headers, "tag", &i ) );
    99     check( i == 666 );
     99    check_int_eq( 666, i );
    100100    check( ( body = tr_bencDictFind( &top, "body" ) ) );
    101101    check( tr_bencDictFindStr( body, "name", &str ) );
    102     check( !strcmp( str, "torrent-info" ) );
     102    check_streq( "torrent-info", str );
    103103    check( ( args = tr_bencDictFind( body, "arguments" ) ) );
    104104    check( tr_bencIsDict( args ) );
    105105    check( ( ids = tr_bencDictFind( args, "ids" ) ) );
    106106    check( tr_bencIsList( ids ) );
    107     check( tr_bencListSize( ids ) == 2 );
     107    check_int_eq( 2, tr_bencListSize( ids ) );
    108108    check( tr_bencGetInt( tr_bencListChild( ids, 0 ), &i ) );
    109     check( i == 7 );
     109    check_int_eq( 7, i );
    110110    check( tr_bencGetInt( tr_bencListChild( ids, 1 ), &i ) );
    111     check( i == 10 );
     111    check_int_eq( 10, i );
    112112
    113113    tr_bencFree( &top );
     
    145145    check( !err );
    146146    check( tr_bencDictFindStr( &top, "errorString", &str ) );
    147     check( !strcmp( str, "torrent not registered with this tracker 6UHsVW'*C" ) );
     147    check_streq( "torrent not registered with this tracker 6UHsVW'*C", str );
    148148
    149149    tr_bencFree( &top );
  • trunk/libtransmission/magnet-test.c

    r13442 r13569  
    2626    info = tr_magnetParse( uri );
    2727    check( info != NULL );
    28     check( info->trackerCount == 2 );
    29     check( !strcmp( info->trackers[0], "http://tracker.openbittorrent.com/announce" ) );
    30     check( !strcmp( info->trackers[1], "http://tracker.opentracker.org/announce" ) );
    31     check( info->webseedCount == 1 );
    32     check( !strcmp( info->webseeds[0], "http://server.webseed.org/path/to/file" ) );
    33     check( !strcmp( info->displayName, "Display Name" ) );
     28    check_int_eq( 2, info->trackerCount );
     29    check_streq( info->trackers[0], "http://tracker.openbittorrent.com/announce" );
     30    check_streq( info->trackers[1], "http://tracker.opentracker.org/announce" );
     31    check_int_eq( 1, info->webseedCount );
     32    check_streq( "http://server.webseed.org/path/to/file", info->webseeds[0] );
     33    check_streq( "Display Name", info->displayName );
    3434    for( i=0; i<20; ++i )
    3535        check( info->hash[i] == dec[i] );
     
    4646    info = tr_magnetParse( uri );
    4747    check( info != NULL );
    48     check( info->trackerCount == 2 );
    49     check( !strcmp( info->trackers[0], "http://tracker.openbittorrent.com/announce" ) );
    50     check( !strcmp( info->trackers[1], "http://tracker.opentracker.org/announce" ) );
    51     check( info->webseedCount == 1 );
    52     check( !strcmp( info->webseeds[0], "http://server.webseed.org/path/to/file" ) );
    53     check( !strcmp( info->displayName, "Display Name" ) );
     48    check_int_eq( 2, info->trackerCount );
     49    check_streq( "http://tracker.openbittorrent.com/announce", info->trackers[0] );
     50    check_streq( "http://tracker.opentracker.org/announce", info->trackers[1] );
     51    check_int_eq( 1, info->webseedCount );
     52    check_streq( "http://server.webseed.org/path/to/file", info->webseeds[0] );
     53    check_streq( "Display Name", info->displayName );
    5454    for( i=0; i<20; ++i )
    5555        check( info->hash[i] == dec[i] );
  • trunk/libtransmission/rpc-test.c

    r13442 r13569  
    1919    check( tr_bencIsInt( &top ) );
    2020    check( tr_bencGetInt( &top, &i ) );
    21     check( i == 12 );
     21    check_int_eq ( 12, i );
    2222    tr_bencFree( &top );
    2323
     
    2525    check( tr_bencIsInt( &top ) );
    2626    check( tr_bencGetInt( &top, &i ) );
    27     check( i == 1 );
     27    check_int_eq ( 1, i );
    2828    tr_bencFree( &top );
    2929
     
    3232    check( tr_bencListSize( &top ) == 2 );
    3333    check( tr_bencGetInt( tr_bencListChild( &top, 0 ), &i ) );
    34     check( i == 6 );
     34    check_int_eq ( 6, i );
    3535    check( tr_bencGetInt( tr_bencListChild( &top, 1 ), &i ) );
    36     check( i == 7 );
     36    check_int_eq ( 7, i );
    3737    tr_bencFree( &top );
    3838
     
    4040    check( tr_bencIsString( &top ) );
    4141    check( tr_bencGetStr( &top, &str ) );
    42     check( !strcmp( str, "asdf" ) );
     42    check_streq( "asdf", str );
    4343    tr_bencFree( &top );
    4444
     
    4747    check( tr_bencListSize( &top ) == 4 );
    4848    check( tr_bencGetInt( tr_bencListChild( &top, 0 ), &i ) );
    49     check( i == 1 );
     49    check_int_eq( 1, i );
    5050    check( tr_bencGetInt( tr_bencListChild( &top, 1 ), &i ) );
    51     check( i == 3 );
     51    check_int_eq( 3, i );
    5252    check( tr_bencGetInt( tr_bencListChild( &top, 2 ), &i ) );
    53     check( i == 4 );
     53    check_int_eq( 4, i );
    5454    check( tr_bencGetInt( tr_bencListChild( &top, 3 ), &i ) );
    55     check( i == 5 );
     55    check_int_eq( 5, i );
    5656    tr_bencFree( &top );
    5757
  • trunk/libtransmission/utils-test.c

    r13442 r13569  
    3232    /* base64 */
    3333    out = tr_base64_encode( "YOYO!", -1, &len );
    34     check( out );
    35     check( !strcmp( out, "WU9ZTyE=" ) );
    36     check( len == 8 );
     34    check_streq ("WU9ZTyE=", out);
     35    check_int_eq (8, len);
    3736    in = tr_base64_decode( out, -1, &len );
    38     check( in );
    39     check( !strcmp( in, "YOYO!" ) );
    40     check( len == 5 );
     37    check_streq ("YOYO!", in);
     38    check_int_eq (5, len);
    4139    tr_free( in );
    4240    tr_free( out );
    4341    out = tr_base64_encode( NULL, 0, &len );
    4442    check( out == NULL );
    45     check( len == 0 );
     43    check_int_eq (0, len);
    4644
    4745    return 0;
     
    156154    expected = "Hello %s foo %.*f";
    157155    out = tr_strip_positional_args( in );
    158     check( out != NULL );
    159     check( !strcmp( out, expected ) );
     156    check_streq (expected, out);
    160157
    161158    in = "Hello %1$'d foo %2$'f";
    162159    expected = "Hello %d foo %f";
    163160    out = tr_strip_positional_args( in );
    164     check( out != NULL );
    165     check( !strcmp( out, expected ) );
     161    check_streq (expected, out);
    166162
    167163    return 0;
     
    177173    out = tr_strstrip( in );
    178174    check( in == out );
    179     check( !strcmp( in, "test" ) );
     175    check_streq ("test", out);
    180176    tr_free( in );
    181177
     
    184180    out = tr_strstrip( in );
    185181    check( in == out );
    186     check( !strcmp( in, "test test" ) );
     182    check_streq ("test test", out);
    187183    tr_free( in );
    188184
     
    191187    out = tr_strstrip( in );
    192188    check( in == out );
    193     check( !strcmp( in, "test" ) );
     189    check_streq ("test", out);
    194190    tr_free( in );
    195191
     
    203199
    204200    out = tr_buildPath( "foo", "bar", NULL );
    205     check( !strcmp( out, "foo" TR_PATH_DELIMITER_STR "bar" ) );
     201    check_streq ("foo" TR_PATH_DELIMITER_STR "bar", out);
    206202    tr_free( out );
    207203
    208204    out = tr_buildPath( "", "foo", "bar", NULL );
    209     check( !strcmp( out, TR_PATH_DELIMITER_STR "foo" TR_PATH_DELIMITER_STR "bar" ) );
     205    check_streq (TR_PATH_DELIMITER_STR "foo" TR_PATH_DELIMITER_STR "bar", out);
    210206    tr_free( out );
    211207
     
    221217    in = "hello world";
    222218    out = tr_utf8clean( in, -1 );
    223     check( out != NULL );
    224     check( !strcmp( out, in ) );
     219    check_streq (in, out);
    225220    tr_free( out );
    226221
    227222    in = "hello world";
    228223    out = tr_utf8clean( in, 5 );
    229     check( out != NULL );
    230     check( !strcmp( out, "hello" ) );
     224    check_streq ("hello", out);
    231225    tr_free( out );
    232226
     
    244238    check( out != NULL );
    245239    check( tr_utf8_validate( out, -1, NULL ) );
    246     check ( !strcmp( in, out ) );
     240    check_streq (in, out);
    247241    tr_free( out );
    248242
     
    258252
    259253    numbers = tr_parseNumberRange( "1-10,13,16-19", -1, &count );
    260     check( count == 15 );
    261     check( numbers != NULL );
    262     check( numbers[0] == 1 );
    263     check( numbers[5] == 6 );
    264     check( numbers[9] == 10 );
    265     check( numbers[10] == 13 );
    266     check( numbers[11] == 16 );
    267     check( numbers[14] == 19 );
     254    check_int_eq( 15, count );
     255    check_int_eq( 1, numbers[0] );
     256    check_int_eq( 6, numbers[5] );
     257    check_int_eq( 10, numbers[9] );
     258    check_int_eq( 13, numbers[10] );
     259    check_int_eq( 16, numbers[11] );
     260    check_int_eq( 19, numbers[14] );
    268261    tr_free( numbers );
    269262
     
    272265    check( numbers != NULL );
    273266    for( i=0; i<count; ++i )
    274         check( numbers[i] == i+1 );
     267        check_int_eq (i+1, numbers[i]);
    275268    tr_free( numbers );
    276269
    277270    numbers = tr_parseNumberRange( "1-Hello", -1, &count );
    278     check( count == 0 );
     271    check_int_eq (0, count);
    279272    check( numbers == NULL );
    280273
    281274    numbers = tr_parseNumberRange( "1-", -1, &count );
    282     check( count == 0 );
     275    check_int_eq (0, count);
    283276    check( numbers == NULL );
    284277
    285278    numbers = tr_parseNumberRange( "Hello", -1, &count );
    286     check( count == 0 );
     279    check_int_eq (0, count);
    287280    check( numbers == NULL );
    288281
     
    320313            fprintf( stderr, "which is off the end.\n" );
    321314#endif
    322         check( pos == expected_pos[i-1] );
    323         check( exact == expected_exact[i-1] );
     315        check_int_eq( expected_pos[i-1], pos );
     316        check_int_eq( expected_exact[i-1], exact );
    324317    }
    325318
     
    351344    tr_hex_to_sha1( sha1, hex1 );
    352345    tr_sha1_to_hex( hex2, sha1 );
    353     check( !strcmp( hex1, hex2 ) );
     346    check_streq (hex1, hex2);
    354347
    355348    return 0;
     
    365358    tr_removeElementFromArray( array, 5u, sizeof( int ), n-- );
    366359    for( i=0; i<n; ++i )
    367         check( array[i] == ( i<5 ? i : i+1 ) );
     360        check_int_eq( ( i<5 ? i : i+1 ), array[i] );
    368361
    369362    tr_removeElementFromArray( array, 0u, sizeof( int ), n-- );
    370363    for( i=0; i<n; ++i )
    371         check( array[i] == ( i<4 ? i+1 : i+2 ) );
     364        check_int_eq( ( i<4 ? i+1 : i+2 ), array[i] );
    372365
    373366    tr_removeElementFromArray( array, n-1, sizeof( int ), n ); n--;
    374367    for( i=0; i<n; ++i )
    375         check( array[i] == ( i<4 ? i+1 : i+2 ) );
     368        check_int_eq( ( i<4 ? i+1 : i+2 ), array[i] );
    376369
    377370    return 0;
     
    390383    url = "http://1";
    391384    check( !tr_urlParse( url, -1, &scheme, &host, &port, &path ) );
    392     check( !strcmp( scheme, "http" ) );
    393     check( !strcmp( host, "1" ) );
    394     check( !strcmp( path, "/" ) );
    395     check( port == 80 );
     385    check_streq ("http", scheme);
     386    check_streq ("1", host);
     387    check_streq ("/", path);
     388    check_int_eq (80, port);
    396389    tr_free( scheme );
    397390    tr_free( path );
     
    400393    url = "http://www.some-tracker.org/some/path";
    401394    check( !tr_urlParse( url, -1, &scheme, &host, &port, &path ) );
    402     check( !strcmp( scheme, "http" ) );
    403     check( !strcmp( host, "www.some-tracker.org" ) );
    404     check( !strcmp( path, "/some/path" ) );
    405     check( port == 80 );
     395    check_streq ("http", scheme);
     396    check_streq ("www.some-tracker.org", host);
     397    check_streq ("/some/path", path);
     398    check_int_eq (80, port);
    406399    tr_free( scheme );
    407400    tr_free( path );
     
    410403    url = "http://www.some-tracker.org:80/some/path";
    411404    check( !tr_urlParse( url, -1, &scheme, &host, &port, &path ) );
    412     check( !strcmp( scheme, "http" ) );
    413     check( !strcmp( host, "www.some-tracker.org" ) );
    414     check( !strcmp( path, "/some/path" ) );
    415     check( port == 80 );
     405    check_streq ("http", scheme);
     406    check_streq ("www.some-tracker.org", host);
     407    check_streq ("/some/path", path);
     408    check_int_eq (80, port);
    416409    tr_free( scheme );
    417410    tr_free( path );
     
    420413    url = "http%3A%2F%2Fwww.example.com%2F~user%2F%3Ftest%3D1%26test1%3D2";
    421414    str = tr_http_unescape( url, strlen( url ) );
    422     check( !strcmp( str, "http://www.example.com/~user/?test=1&test1=2" ) );
     415    check_streq ("http://www.example.com/~user/?test=1&test1=2", str);
    423416    tr_free( str );
    424417
     
    433426
    434427    tr_snprintf( buf, sizeof( buf ), "%.2f%%", 99.999 );
     428    check_streq("100.00%", buf);
    435429    check( !strcmp( buf, "100.00%" ) );
    436430
    437431    tr_snprintf( buf, sizeof( buf ), "%.2f%%", tr_truncd( 99.999, 2 ) );
    438     check( !strcmp( buf, "99.99%" ) );
     432    check_streq("99.99%", buf);
    439433
    440434    tr_snprintf( buf, sizeof( buf ), "%.4f", tr_truncd( 403650.656250, 4 ) );
    441     check( !strcmp( buf, "403650.6562" ) );
     435    check_streq("403650.6562", buf);
    442436
    443437    tr_snprintf( buf, sizeof( buf ), "%.2f", tr_truncd( 2.15, 2 ) );
    444     check( !strcmp( buf, "2.15" ) );
     438    check_streq( "2.15", buf );
    445439
    446440    tr_snprintf( buf, sizeof( buf ), "%.2f", tr_truncd( 2.05, 2 ) );
    447     check( !strcmp( buf, "2.05" ) );
     441    check_streq( "2.05", buf );
    448442
    449443    tr_snprintf( buf, sizeof( buf ), "%.2f", tr_truncd( 3.3333, 2 ) );
    450     check( !strcmp( buf, "3.33" ) );
     444    check_streq( "3.33", buf );
    451445
    452446    tr_snprintf( buf, sizeof( buf ), "%.0f", tr_truncd( 3.3333, 0 ) );
    453     check( !strcmp( buf, "3" ) );
     447    check_streq( "3", buf );
    454448
    455449    tr_snprintf( buf, sizeof( buf ), "%.2f", tr_truncd( nan, 2 ) );
Note: See TracChangeset for help on using the changeset viewer.