ecoli_test - Man Page
Name
ecoli_test — Test
— Helpers for unit tests.
Synopsis
Data Structures
struct ec_test
Macros
#define EC_TEST_REGISTER(t)
#define EC_TEST_ERR(fmt, ...)
#define EC_TEST_CHECK(cond, fmt, ...)
#define EC_TEST_CHECK_PARSE(node, args...)
#define EC_TEST_CHECK_COMPLETE(node, args...)
#define EC_TEST_CHECK_COMPLETE_PARTIAL(node, args...)
Typedefs
typedef int ec_test_t(void)
Functions
int ec_test_register (struct ec_test *test)
int ec_test_all (void)
int ec_test_one (const char *name)
int ec_test_check_parse (struct ec_node *node, int expected,...)
int ec_test_check_complete (struct ec_node *node, enum ec_comp_type type,...)
Detailed Description
Helpers for unit tests.
Macro Definition Documentation
#define EC_TEST_REGISTER( t)
Value:
static void ec_test_init_##t(void); \ static void __attribute__((constructor, used)) \ ec_test_init_##t(void) \ { \ if (ec_test_register(&t) < 0) \ fprintf(stderr, "cannot register test %s\n", \ t.name); \ }
Register a test case.
- Parameters
t A pointer to a ec_test structure describing the test to be registered.
Definition at line 32 of file ecoli_test.h.
#define EC_TEST_ERR( fmt, ...)
Value:
EC_LOG(EC_LOG_ERR, "%s:%d: error: " fmt "\n", \ __FILE__, __LINE__, ##__VA_ARGS__); \
Fail a test with a message.
Definition at line 105 of file ecoli_test.h.
#define EC_TEST_CHECK( cond, fmt, ...)
Value:
({ \ int ret_ = 0; \ if (!(cond)) { \ EC_TEST_ERR("(" #cond ") is wrong. " fmt \ ##__VA_ARGS__); \ ret_ = -1; \ } \ ret_; \ })
Verify a condition or fail a test with a message.
Definition at line 114 of file ecoli_test.h.
#define EC_TEST_CHECK_PARSE( node, args...)
Value:
({ \ int ret_ = ec_test_check_parse(node, args, EC_VA_END); \ if (ret_) \ EC_TEST_ERR("parse test failed"); \ ret_; \ })
node, input, [expected1, expected2, ...]
Definition at line 129 of file ecoli_test.h.
#define EC_TEST_CHECK_COMPLETE( node, args...)
Value:
({ \ int ret_ = ec_test_check_complete(node, EC_COMP_FULL, args); \ if (ret_) \ EC_TEST_ERR("complete test failed"); \ ret_; \ })
Definition at line 141 of file ecoli_test.h.
#define EC_TEST_CHECK_COMPLETE_PARTIAL( node, args...)
Value:
({ \ int ret_ = ec_test_check_complete(node, EC_COMP_PARTIAL, args); \ if (ret_) \ EC_TEST_ERR("complete test failed"); \ ret_; \ })
Definition at line 149 of file ecoli_test.h.
Typedef Documentation
typedef int ec_test_t(void)
Type of test function. Return 0 on success, -1 on error.
Definition at line 47 of file ecoli_test.h.
Function Documentation
int ec_test_register (struct ec_test * test)
Register a test case.
int ec_test_all (void )
Run all tests.
int ec_test_one (const char * name)
Run one test.
int ec_test_check_parse (struct ec_node * node, int expected, ...)
expected == -1 means no match
Author
Generated automatically by Doxygen for Libecoli from the source code.
Referenced By
The man pages ec_test_all(3), EC_TEST_CHECK(3), EC_TEST_CHECK_COMPLETE(3), EC_TEST_CHECK_COMPLETE_PARTIAL(3), ec_test_check_parse(3), EC_TEST_CHECK_PARSE(3), EC_TEST_ERR(3), ec_test_one(3), ec_test_register(3), EC_TEST_REGISTER(3) and ec_test_t(3) are aliases of ecoli_test(3).