Changeset 8809


Ignore:
Timestamp:
Jul 14, 2009, 8:35:48 PM (13 years ago)
Author:
charles
Message:

(trunk libT) add tr_truncd() unit test

File:
1 edited

Legend:

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

    r8695 r8809  
    247247main( void )
    248248{
     249    char buf[32];
    249250    char *in, *out;
    250251    int   len;
    251252    int   i;
    252253    int   l;
     254
     255    /* tr_truncd */
     256    tr_snprintf( buf, sizeof( buf ), "%.2f%%", 99.999 );
     257    check( !strcmp( buf, "100.00%" ) );
     258    tr_snprintf( buf, sizeof( buf ), "%.2f%%", tr_truncd( 99.999, 2 ) );
     259    check( !strcmp( buf, "99.99%" ) );
    253260
    254261    /* base64 */
Note: See TracChangeset for help on using the changeset viewer.