Go to the source code of this file.
Classes |
struct | tagVTEST_TEST |
struct | tagVTEST_TEST_SUITE |
Defines |
#define | VTEST_DEFINE_LAST_SUITE(name, setUp, tearDown) |
#define | VTEST_DEFINE_SUITE(name, setUp, tearDown, nextsuite) |
#define | VTEST_END_SUITE |
#define | VTEST_TEST_REPEATED(tname, test_fun, repeat_count) { (tname), (VTEST_ACTION) (test_fun), (int) (repeat_count) }, |
#define | VTEST_TEST(tname, test_fun) { (tname), (VTEST_ACTION) (test_fun), 1 }, |
#define | VTEST_TESTN(test_fun) { #test_fun, (VTEST_ACTION) (test_fun), 1 }, |
#define | VCHECK(cond) { if (!(cond)) { VFAIL( #cond, __FILE__,__LINE__); } while(0); |
#define | VASSERT(cond) { if (!(cond)) { VFAIL( #cond, __FILE__,__LINE__); return; } } while(0); |
#define | VASSERT_RET(cond, ret) { if (!(cond)) { VFAIL( #cond, __FILE__,__LINE__); return (ret); } } while(0); |
#define | VTEST_SUITE_DECLARE_GET(name) extern VTEST_TEST_SUITE *get_vtest_##name (); |
#define | VTEST_SUITE_GET(name) (VTEST_TEST_SUITE *)get_vtest_##name () |
Typedefs |
typedef void(* | VTEST_ACTION )(void) |
typedef struct tagVTEST_TEST | VTEST_TEST |
typedef struct tagVTEST_TEST_SUITE | VTEST_TEST_SUITE |
Functions |
void | VFAIL (const char *cond, const char *file, int line) |
Define Documentation
#define VASSERT |
( |
|
cond | ) |
{ if (!(cond)) { VFAIL( #cond, __FILE__,__LINE__); return; } } while(0); |
Assert the condition, failure of condtion will signal test failure,and return from function (this assumes that curernt function is void).
- Examples:
- example.c.
Definition at line 129 of file vtest.h.
#define VASSERT_RET |
( |
|
cond, |
|
|
|
ret |
|
) |
| { if (!(cond)) { VFAIL( #cond, __FILE__,__LINE__); return (ret); } } while(0); |
Assert the condition, failure of condtion will signal test failure, and return with will be called (this assumes that curernt function is void).
Definition at line 136 of file vtest.h.
#define VCHECK |
( |
|
cond | ) |
{ if (!(cond)) { VFAIL( #cond, __FILE__,__LINE__); } while(0); |
Check the condition, failure of condtion will signal test failure, but test execution will continue.
Definition at line 123 of file vtest.h.
#define VTEST_DEFINE_LAST_SUITE |
( |
|
name, |
|
|
|
setUp, |
|
|
|
tearDown |
|
) |
| |
Value:Start declaration of a test suite that is the last one out of a chain of tests.
- Parameters:
-
name | name of test (not string) |
setUp | function is called before start of suite |
tearDown | function is called after completion of suite |
- Examples:
- example.c.
Definition at line 37 of file vtest.h.
#define VTEST_DEFINE_SUITE |
( |
|
name, |
|
|
|
setUp, |
|
|
|
tearDown, |
|
|
|
nextsuite |
|
) |
| |
Value:Start declaration of a test suite
- Parameters:
-
name | name of test (not string) |
setUp | function is called before start of suite |
tearDown | function is called after completion of suite |
nextsuite | the next test suite to follow after this one (not string) |
- Examples:
- example.c.
Definition at line 58 of file vtest.h.
Value:{ 0, 0, 0 } \
};\
test.test_cases = (VTEST_TEST *) test_cases;\
test.next_suite = next_suite;\
test.setUp = argSetUp;\
test.tearDown = argTearDown;\
test.name = suitename;\
\
return &test;\
}
declarations ends definition of a test suite
- Examples:
- example.c.
Definition at line 78 of file vtest.h.
#define VTEST_SUITE_DECLARE_GET |
( |
|
name | ) |
extern VTEST_TEST_SUITE *get_vtest_##name (); |
calls function that creates forward declaration for the test suite structure accessor.
Definition at line 142 of file vtest.h.
calls function that returns the test suite structure for a given test.
- Examples:
- example.c.
Definition at line 149 of file vtest.h.
define a new test
- Parameters:
-
tname | test name |
test_fun | test function of type VTEST_ACTION |
Definition at line 104 of file vtest.h.
#define VTEST_TEST_REPEATED |
( |
|
tname, |
|
|
|
test_fun, |
|
|
|
repeat_count |
|
) |
| { (tname), (VTEST_ACTION) (test_fun), (int) (repeat_count) }, |
define a test that is repeated for a number of times
- Parameters:
-
tname | test name |
test_fun | test function of type VTEST_ACTION |
repeat_count | number of times that test is repeated |
- Examples:
- example.c.
Definition at line 96 of file vtest.h.
#define VTEST_TESTN |
( |
|
test_fun | ) |
{ #test_fun, (VTEST_ACTION) (test_fun), 1 }, |
define a new test
- Parameters:
-
test_fun | - the function is also the name of the test |
Definition at line 112 of file vtest.h.
Typedef Documentation
Function Documentation
void VFAIL |
( |
const char * |
cond, |
|
|
const char * |
file, |
|
|
int |
line |
|
) |
| |
call to this function will signal test failure.
Definition at line 58 of file vtest.c.