Hello Andreas, Great news! For me, cmocka's most important feature is its extensibility. To me, this means that cmocka needn't provide every conceivable assertion, but that it provides the building blocks to make them. For example, I'm thinking of - access to cmocka's diagnostic routines: cm_print_error, _fail, etc. - base functions to build on? As an example, here's how I implemented an assertion for approximate floating-point equality before one was available in cmocka: #define assert_double_equal(got, expected, rtol, atol) assert_double_equal_(got, expected, rtol, atol, __FILE__, __LINE__) void assert_double_equal_(double got, double expected, double rtol, double atol, const char * const file, const int line) { if (fabs(got - expected) < rtol * fabs(expected) || fabs(got - expected) < atol) return; cm_print_error("floating-point values not equal within tolerance: %g != %g (with rtol=%g and atol=%g)\n", got, expected, rtol, atol); _fail(file, line); } Currently, cm_print_error is not in the public header file. It's exported, though, so linking just works. But it feels wrong to use '_fail' in user code. Maybe a user-visible, "official" version would be a good idea? Kind regards Edward } On Mon, Jan 4, 2021 at 11:51 PM Andreas Schneider <asn@cryptomilk.org> wrote:
Hi,
I've started with cmocka 2.0. The biggest change will be that uintmax_t will be used from stdint.h.
Also there will be a lot of new assert functions. If you want to add features it is a good time to do that now.
The plan is not to break the API with 2.0, however the ABI will change but it shouldn't be a problem for a unit testing library.
Cheers
Andreas
_______________________________________________ cmocka-devel mailing list -- cmocka-devel@cmocka.org To unsubscribe send an email to cmocka-devel-leave@cmocka.org