Changeset 5997
- Timestamp:
- Jun 2, 2008, 3:52:16 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/utils-test.c
r5860 r5997 4 4 #include "utils.h" 5 5 6 #define VERBOSE 1 7 #define NUM_LOOPS 1 8 #define SPEED_TEST 0 9 10 #if SPEED_TEST 11 #undef VERBOSE 6 12 #define VERBOSE 0 13 #undef NUM_LOOPS 14 #define NUM_LOOPS 200 15 #endif 7 16 8 17 int test = 0; … … 20 29 } 21 30 31 static int 32 test_bitfields( void ) 33 { 34 int i; 35 int bitcount = 5000000; 36 tr_bitfield * field = tr_bitfieldNew( bitcount ); 37 38 /* make every seventh one true */ 39 for( i=0; i<bitcount; ++i ) 40 if( !( i % 7 ) ) 41 tr_bitfieldAdd( field, i ); 42 43 /* check to see if `has' has the right bits */ 44 for( i=0; i<bitcount; ++i ) 45 check( tr_bitfieldHas( field, i ) == (!(i%7)) ); 46 47 tr_bitfieldFree( field ); 48 return 0; 49 } 50 51 22 52 23 53 int … … 26 56 char *in, *out; 27 57 int len; 58 int i; 59 int l; 28 60 29 61 /* base64 */ … … 40 72 tr_free( out ); 41 73 74 /* simple bitfield tests */ 75 for( l=0; l<NUM_LOOPS; ++l ) 76 if(( i = test_bitfields( ))) 77 return i; 78 42 79 return 0; 43 80 }
Note: See TracChangeset
for help on using the changeset viewer.