malsyned / pfstest

Professional Firmware Services Unit Test Framework
Other
1 stars 0 forks source link

Support automocking for varargs #30

Open malsyned opened 6 years ago

malsyned commented 6 years ago

I don't know quite how I would want to handle mocking of varargs yet, but I suspect it would be possible. Perhaps a varargs combinator:

when(mock_func1, arg_that(is_the_int(5)), varargs_that(is_the_string("foo"), is_the_int(4), NULL));

Plus some way to package varargs from a mock.

va_start(__pfstest_ap, __pfstest_mock_arg_0);
[...]
the_varargs(__pfstest_ap)
[...]
va_end(__pfstest_ap);

I haven't tried these or thought through whether they are actually implementable.