Files | |
file | unit.h |
Unit test applet definitions shared for unit test. | |
file | unit.c |
Unit test applet - shouldn't output much of anything unless there's a problem. | |
file | unit.h |
Unit test applet definitions shared for unit test. | |
Defines | |
#define | Test_Error(test) |
Unit test check. | |
#define | UNIT_TEST(Test_Name) |
Perform and profile a unit test, checking options for disabling it. | |
#define | Test_Named(name, test) { if ( !(test) ) { error_count++; puts( ppFileLine("Failed: " name ppTokStr(test) "\n" ) ); throwassert(#test); } } |
Named unit test - give a descriptive failure for a unit check. | |
Functions | |
int | arg_find (const char *sz, size_t len) |
Get index of CLI argument. | |
int | arg_count (void) |
Get count of arguments passed to main. | |
const char * | arg_get (int index) |
Get an argument that was passed to main. |
path | Specify the directory to iterate (no ending '/', no "*.*") | |
szmatch | An optional wildcard string (may be NULL) to match using 'strwild()' to filter results | |
callback | User provided callback | |
instance | Instance data to pass to user callback |
#define Test_Error | ( | test | ) |
Value:
{ \ if ( !(test) ) \ { \ error_count++; \ puts( ppFileLine("Failed: " ppTokStr(test) "\n" ) ); \ ppDebRel(throwassert(#test);,fgetc(stdin);)\ }\ }
test | Condition that must return true Give details about test failures when something bad happens |
#define Test_Named | ( | name, | |||
test | ) | { if ( !(test) ) { error_count++; puts( ppFileLine("Failed: " name ppTokStr(test) "\n" ) ); throwassert(#test); } } |
int arg_count | ( | void | ) |
int arg_find | ( | const char * | sz, | |
size_t | len | |||
) |
Get index of CLI argument.
sz | Argument string to look for (case sensitive) |
Definition at line 110 of file unit.c.
00111 { 00112 int curr; 00113 for ( curr = 1; curr < mArgc; ++curr ) 00114 { 00115 if ( 0 == len ) 00116 { 00117 if( !cstrcmp(char)( mArgv[curr], sz ) ) 00118 return curr; 00119 } 00120 else 00121 { 00122 if ( !cstrncmp(char)( mArgv[curr], sz, len ) ) 00123 return curr; 00124 } 00125 } 00126 return 0; 00127 }
const char* arg_get | ( | int | index | ) |