win-pvdrivers

view liblfds.6/test/src/main.c @ 1025:aa2e51f67f7c

Fix hibernate under Win8. Change debugprints.
author James Harper <james.harper@bendigoit.com.au>
date Tue Feb 19 15:14:53 2013 +1100 (2013-02-19)
parents 6300617040e0
children
line source
1 #include "internal.h"
7 /****************************************************************************/
8 int main( int argc, char **argv )
9 {
10 enum test_operation
11 operation = UNKNOWN;
13 unsigned int
14 loop,
15 iterations = 1;
17 assert( argc >= 1 );
18 assert( argv != NULL );
20 if( argc == 1 or argc >= 4 )
21 operation = HELP;
23 if( operation == UNKNOWN )
24 {
25 if( 0 == strcmp(*(argv+1), "test") )
26 {
27 operation = TEST;
29 // TRD : sscanf() may fail, but iterations is initialised to 1, so it's okay
30 if( argc == 3 )
31 sscanf( *(argv+2), "%u", &iterations );
32 }
34 if( 0 == strcmp(*(argv+1), "benchmark") )
35 operation = BENCHMARK;
36 }
38 switch( operation )
39 {
40 case UNKNOWN:
41 case HELP:
42 printf( "test [test|benchmark] [iterations]\n"
43 " test : run the test suite\n"
44 " benchmark : run the benchmark suite\n"
45 " iterations : optional, only applies to tests, default is 1\n" );
46 break;
48 case TEST:
49 for( loop = 1 ; loop < iterations+1 ; loop++ )
50 {
51 printf( "\n"
52 "Test Iteration %02u\n"
53 "=================\n", loop );
55 test_abstraction();
56 test_freelist();
57 test_queue();
58 test_ringbuffer();
59 test_slist();
60 test_stack();
61 }
62 break;
64 case BENCHMARK:
65 benchmark_freelist();
66 benchmark_queue();
67 benchmark_ringbuffer();
68 benchmark_stack();
69 break;
70 }
72 return( EXIT_SUCCESS );
73 }