From c681d2a42e06cc2fe9c5e6a5482a596e8747c571 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Tue, 8 Dec 2015 00:34:38 +0100 Subject: [PATCH] Added doxygen for parameterized.h --- include/criterion/internal/parameterized.h | 4 +-- include/criterion/parameterized.h | 41 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/include/criterion/internal/parameterized.h b/include/criterion/internal/parameterized.h index 4fbd511..29a7957 100644 --- a/include/criterion/internal/parameterized.h +++ b/include/criterion/internal/parameterized.h @@ -104,10 +104,10 @@ struct criterion_test_params { static struct criterion_test_params CR_IDENTIFIER_(Category, Name, param)(void) # ifdef __cplusplus -# define cr_make_param_array(Type, Array, ...) \ +# define cr_make_param_array_(Type, Array, ...) \ criterion_test_params(sizeof (Type), (Array), __VA_ARGS__) # else -# define cr_make_param_array(Type, Array, ...) \ +# define cr_make_param_array_(Type, Array, ...) \ (struct criterion_test_params) { .size = sizeof (Type), (void*)(Array), __VA_ARGS__ } # endif diff --git a/include/criterion/parameterized.h b/include/criterion/parameterized.h index 7099009..2a9faff 100644 --- a/include/criterion/parameterized.h +++ b/include/criterion/parameterized.h @@ -28,9 +28,48 @@ # include "assert.h" # include "internal/parameterized.h" +/** + * ParameterizedTest(Type *param, Suite, Name, [Options...]) { Function Body } + * + * Defines a new parameterized test. + * + * A parameterized test only takes one parameter -- to pass multiple parameters, + * use a structure type. + * + * @param Type The type of the parameter. + * @param Suite The name of the test suite containing this test. + * @param Name The name of the test. + * @param Options An optional sequence of designated initializer key/value + * pairs as described in the `criterion_test_extra_data` structure + * (see criterion/types.h). + * Example: .exit_code = 1 + */ # define ParameterizedTest(...) CR_EXPAND(CR_PARAM_TEST_BASE(__VA_ARGS__, .sentinel_ = 0)) -# define ParameterizedTestParameters(Category, Name) CR_PARAM_TEST_PARAMS(Category, Name) +/** + * ParameterizedTestParameters(Suite, Test) { Function Body } + * + * Defines the parameter generator for the associated parameterized test. + * + * @param Suite The name of the test suite containing the test. + * @param Test The name of the test. + * @returns A constructed instance of criterion::parameters, or the result of + * the cr_make_param_array macro. + */ +# define ParameterizedTestParameters(Suite, Name) CR_PARAM_TEST_PARAMS(Suite, Name) + +/** + * cr_make_param_array(Type, Array, Len, [Cleanup]); + * + * Constructs a parameter list used as a return value for a parameter generator. + * + * @param Type The type of the array subscript. + * @param Array The array of parameters. + * @param Len The length of the array. + * @param Cleanup The optional cleanup function for the array. + * @returns The parameter list. + */ +# define cr_make_param_array(...) CR_EXPAND(cr_make_param_array_(__VA_ARGS__)) # ifdef __cplusplus # include