(trunk libT) add tr_truncd() unit test

This commit is contained in:
Charles Kerr
2009-07-14 20:35:48 +00:00
parent e5ff7d8f3e
commit 202e593f8d
+7
View File
@@ -246,11 +246,18 @@ test_memmem( void )
int
main( void )
{
char buf[32];
char *in, *out;
int len;
int i;
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 */
out = tr_base64_encode( "YOYO!", -1, &len );
check( out );