mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk libT) add tr_truncd() unit test
This commit is contained in:
parent
e5ff7d8f3e
commit
202e593f8d
1 changed files with 7 additions and 0 deletions
|
@ -246,11 +246,18 @@ test_memmem( void )
|
||||||
int
|
int
|
||||||
main( void )
|
main( void )
|
||||||
{
|
{
|
||||||
|
char buf[32];
|
||||||
char *in, *out;
|
char *in, *out;
|
||||||
int len;
|
int len;
|
||||||
int i;
|
int i;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
|
/* tr_truncd */
|
||||||
|
tr_snprintf( buf, sizeof( buf ), "%.2f%%", 99.999 );
|
||||||
|
check( !strcmp( buf, "100.00%" ) );
|
||||||
|
tr_snprintf( buf, sizeof( buf ), "%.2f%%", tr_truncd( 99.999, 2 ) );
|
||||||
|
check( !strcmp( buf, "99.99%" ) );
|
||||||
|
|
||||||
/* base64 */
|
/* base64 */
|
||||||
out = tr_base64_encode( "YOYO!", -1, &len );
|
out = tr_base64_encode( "YOYO!", -1, &len );
|
||||||
check( out );
|
check( out );
|
||||||
|
|
Loading…
Reference in a new issue