Ignore:
Timestamp:
Aug 10, 2009, 8:04:08 PM (12 years ago)
Author:
charles
Message:

(trunk) remove trailing spaces

File:
1 edited

Legend:

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

    r8685 r8889  
    375375}
    376376
    377 static int 
     377static int
    378378testMerge( void )
    379 { 
    380     tr_benc dest, src; 
    381     int64_t i; 
    382     const char * s; 
     379{
     380    tr_benc dest, src;
     381    int64_t i;
     382    const char * s;
    383383
    384384    /* initial dictionary (default values)  */
    385     tr_bencInitDict( &dest, 10 ); 
    386     tr_bencDictAddInt( &dest, "i1", 1 ); 
    387     tr_bencDictAddInt( &dest, "i2", 2 ); 
     385    tr_bencInitDict( &dest, 10 );
     386    tr_bencDictAddInt( &dest, "i1", 1 );
     387    tr_bencDictAddInt( &dest, "i2", 2 );
    388388    tr_bencDictAddInt( &dest, "i4", -35 ); /* remains untouched */
    389     tr_bencDictAddStr( &dest, "s5", "abc" ); 
    390     tr_bencDictAddStr( &dest, "s6", "def" ); 
     389    tr_bencDictAddStr( &dest, "s5", "abc" );
     390    tr_bencDictAddStr( &dest, "s6", "def" );
    391391    tr_bencDictAddStr( &dest, "s7", "127.0.0.1" ); /* remains untouched */
    392392
    393393    /* new dictionary, will overwrite items in dest  */
    394     tr_bencInitDict( &src, 10 ); 
     394    tr_bencInitDict( &src, 10 );
    395395    tr_bencDictAddInt( &src, "i1", 1 );     /* same value */
    396396    tr_bencDictAddInt( &src, "i2", 4 );     /* new value */
     
    400400    tr_bencDictAddStr( &src, "s8", "ghi" ); /* new key:value */
    401401
    402     tr_bencMergeDicts( &dest, /*const*/ &src ); 
    403 
    404     check( tr_bencDictFindInt( &dest, "i1", &i )); 
    405     check( i == 1); 
    406     check( tr_bencDictFindInt( &dest, "i2", &i )); 
    407     check( i == 4); 
    408     check( tr_bencDictFindInt( &dest, "i3", &i )); 
    409     check( i == 3); 
    410     check( tr_bencDictFindInt( &dest, "i4", &i )); 
    411     check( i == -35); 
    412     check( tr_bencDictFindStr( &dest, "s5", &s )); 
    413     check( strcmp( "abc", s ) == 0 ); 
    414     check( tr_bencDictFindStr( &dest, "s6", &s )); 
    415     check( strcmp( "xyz", s ) == 0 ); 
    416     check( tr_bencDictFindStr( &dest, "s7", &s )); 
    417     check( strcmp( "127.0.0.1", s ) == 0 ); 
    418     check( tr_bencDictFindStr( &dest, "s8", &s )); 
    419     check( strcmp( "ghi", s ) == 0 ); 
    420 
    421     tr_bencFree( &dest ); 
    422     tr_bencFree( &src ); 
    423     return 0; 
    424 } 
     402    tr_bencMergeDicts( &dest, /*const*/ &src );
     403
     404    check( tr_bencDictFindInt( &dest, "i1", &i ));
     405    check( i == 1);
     406    check( tr_bencDictFindInt( &dest, "i2", &i ));
     407    check( i == 4);
     408    check( tr_bencDictFindInt( &dest, "i3", &i ));
     409    check( i == 3);
     410    check( tr_bencDictFindInt( &dest, "i4", &i ));
     411    check( i == -35);
     412    check( tr_bencDictFindStr( &dest, "s5", &s ));
     413    check( strcmp( "abc", s ) == 0 );
     414    check( tr_bencDictFindStr( &dest, "s6", &s ));
     415    check( strcmp( "xyz", s ) == 0 );
     416    check( tr_bencDictFindStr( &dest, "s7", &s ));
     417    check( strcmp( "127.0.0.1", s ) == 0 );
     418    check( tr_bencDictFindStr( &dest, "s8", &s ));
     419    check( strcmp( "ghi", s ) == 0 );
     420
     421    tr_bencFree( &dest );
     422    tr_bencFree( &src );
     423    return 0;
     424}
    425425
    426426static int
Note: See TracChangeset for help on using the changeset viewer.