7 /****************************************************************************/
8 int main( int argc, char **argv )
10 enum lfds610_test_operation
18 assert( argv != NULL );
20 if( argc == 1 or argc >= 4 )
23 if( operation == UNKNOWN )
25 if( 0 == strcmp(*(argv+1), "test") )
29 // TRD : sscanf() may fail, but iterations is initialised to 1, so it's okay
31 sscanf( *(argv+2), "%u", &iterations );
34 if( 0 == strcmp(*(argv+1), "benchmark") )
36 operation = BENCHMARK;
38 // TRD : sscanf() may fail, but iterations is initialised to 1, so it's okay
40 sscanf( *(argv+2), "%u", &iterations );
48 printf( "test [test|benchmark] [iterations]\n"
49 " test : run the test suite\n"
50 " benchmark : run the benchmark suite\n"
51 " iterations : optional, default is 1\n" );
55 for( loop = 1 ; loop < iterations+1 ; loop++ )
58 "Test Iteration %02u\n"
59 "=================\n", loop );
61 test_lfds610_abstraction();
62 test_lfds610_freelist();
64 test_lfds610_ringbuffer();
71 for( loop = 1 ; loop < iterations+1 ; loop++ )
74 "Benchmark Iteration %02u\n"
75 "========================\n", loop );
77 benchmark_lfds610_freelist();
78 benchmark_lfds610_queue();
79 benchmark_lfds610_ringbuffer();
80 benchmark_lfds610_stack();
85 return( EXIT_SUCCESS );