diff options
Diffstat (limited to 'Source/charon/tester.h')
-rw-r--r-- | Source/charon/tester.h | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/Source/charon/tester.h b/Source/charon/tester.h index 18cac3aef..380007645 100644 --- a/Source/charon/tester.h +++ b/Source/charon/tester.h @@ -24,15 +24,66 @@ #define TESTER_H_ #include <stdio.h> +#include <freeswan.h> +#include <pluto/constants.h> +#include <pluto/defs.h> #include "types.h" +/** + * @brief Specifies a test + */ +typedef struct test_s test_t; - +/** + * @brief A tester object to perform tests + */ typedef struct tester_s tester_t; +struct test_s{ + void (*test_function) (tester_t * tester); + char * test_name; +}; + struct tester_s { - status_t (*test_all) (tester_t *tester); + + /** + * @brief Tests all testcases of specific tester object + * + * @param tester tester object + * @param pointer to a list of tests to perform. + * the last list item has to be NULL. + * @return SUCCESSFUL if succeeded, FAILED otherwise + */ + status_t (*test_all) (tester_t *tester,test_t **tests); + + /** + * @brief is called in a testcase to check a specific situation + * + * Log-Values to the tester output are protected from multiple access + * + * @param this tester object + * @param to_be_true assert which has to be true + * @param Name of the assertion + */ + void (*assert_true) (tester_t *tester, bool to_be_true, char *assert_name); + + /** + * @brief run a specific test case + * + * @param this tester object + * @param test_function implements the test case + * @param Name of the Test + */ + void (*run_test) (tester_t *this, void (*test_function) (tester_t * tester), char * test_name); + + /** + * @brief Destroys a tester object + * + * @param tester tester object + * @param Name of the Test + * @return SUCCESSFUL if succeeded, FAILED otherwise + */ status_t (*destroy) (tester_t *tester); }; |