win-pvdrivers

view liblfds.6/test/src/misc.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 void internal_display_test_name( char *test_name )
9 {
10 assert( test_name != NULL );
12 printf( "%s...", test_name );
13 fflush( stdout );
15 return;
16 }
22 /****************************************************************************/
23 void internal_display_test_result( unsigned int number_name_dvs_pairs, ... )
24 {
25 va_list
26 va;
28 int
29 passed_flag = RAISED;
31 unsigned int
32 loop;
34 char
35 *name;
37 enum data_structure_validity
38 dvs;
40 // TRD : number_name_dvs_pairs can be any value in its range
42 va_start( va, number_name_dvs_pairs );
44 for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ )
45 {
46 name = va_arg( va, char * );
47 dvs = va_arg( va, enum data_structure_validity );
49 if( dvs != VALIDITY_VALID )
50 {
51 passed_flag = LOWERED;
52 break;
53 }
54 }
56 va_end( va );
58 if( passed_flag == RAISED )
59 puts( "passed" );
61 if( passed_flag == LOWERED )
62 {
63 printf( "failed (" );
65 va_start( va, number_name_dvs_pairs );
67 for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ )
68 {
69 name = va_arg( va, char * );
70 dvs = va_arg( va, enum data_structure_validity );
72 printf( "%s ", name );
73 internal_display_data_structure_validity( dvs );
75 if( loop+1 < number_name_dvs_pairs )
76 printf( ", " );
77 }
79 va_end( va );
81 printf( ")\n" );
82 }
84 return;
85 }
91 /****************************************************************************/
92 void internal_display_data_structure_validity( enum data_structure_validity dvs )
93 {
94 char
95 *string = NULL;
97 switch( dvs )
98 {
99 case VALIDITY_VALID:
100 string = "valid";
101 break;
103 case VALIDITY_INVALID_LOOP:
104 string = "invalid - loop detected";
105 break;
107 case VALIDITY_INVALID_MISSING_ELEMENTS:
108 string = "invalid - missing elements";
109 break;
111 case VALIDITY_INVALID_ADDITIONAL_ELEMENTS:
112 string = "invalid - additional elements";
113 break;
115 case VALIDITY_INVALID_TEST_DATA:
116 string = "invalid - invalid test data";
117 break;
118 }
120 printf( "%s", string );
122 return;
123 }