Fixed erroneous indirection logic for passed data
This commit is contained in:
parent
582fa18389
commit
1d908327d8
4 changed files with 6 additions and 6 deletions
|
@ -42,7 +42,7 @@
|
|||
criterion_test_params(sizeof (Type), (Array), (Length))
|
||||
# else
|
||||
# define cr_make_param_array(Type, Array, Length) \
|
||||
(struct criterion_test_params) { sizeof (Type), (void**)(Array), (Length) }
|
||||
(struct criterion_test_params) { sizeof (Type), (void*)(Array), (Length) }
|
||||
# endif
|
||||
|
||||
#endif /* !CRITERION_PARAMETERIZED_H_ */
|
||||
|
|
|
@ -40,11 +40,11 @@ enum criterion_test_kind {
|
|||
|
||||
struct criterion_test_params {
|
||||
size_t size;
|
||||
void **params;
|
||||
void *params;
|
||||
size_t length;
|
||||
|
||||
# ifdef __cplusplus
|
||||
constexpr criterion_test_params(size_t size, void **params, size_t length)
|
||||
constexpr criterion_test_params(size_t size, void *params, size_t length)
|
||||
: size(size)
|
||||
, params(params)
|
||||
, length(length)
|
||||
|
|
|
@ -8,6 +8,6 @@ ParameterizedTestParameters(params, str) {
|
|||
return cr_make_param_array(const char *, strings, sizeof (strings) / sizeof (const char *));
|
||||
}
|
||||
|
||||
ParameterizedTest(const char *str, params, str) {
|
||||
cr_assert(0, "Parameter: %s", str);
|
||||
ParameterizedTest(const char **str, params, str) {
|
||||
cr_assert(0, "Parameter: %s", *str);
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ static void run_test_param(struct criterion_global_stats *stats,
|
|||
|
||||
struct criterion_test_params params = test->data->param_();
|
||||
for (size_t i = 0; i < params.length; ++i) {
|
||||
struct test_single_param param = { params.size, params.params[i] };
|
||||
struct test_single_param param = { params.size, (char *) params.params + i * params.size };
|
||||
|
||||
run_test(stats, suite_stats, test, suite, ¶m);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue