[Proj] Testing framework
schwehr at gmail.com
Tue May 29 14:05:49 EST 2018
+1 to it being totally okay to test C with C++ frameworks.
One thing to keep in mind with Catch2... it doesn't have a default mocking
setup. It looks like it's not too big of a deal if FakeIt works (never
looked at it). Having mocking available makes triggering error conditions
in lower level functionality much easier for higher level calls. That
certainly shouldn't be a deal breaker, but mocking and faking can be pretty
Also worth mentioning is that gMock and Catch2 provide matchers that are
really handy. I don't know if any of the other frameworks.
On Tue, May 29, 2018 at 11:49 AM, Mateusz Loskot <mateusz at loskot.net> wrote:
> On Tue, 29 May 2018, 20:26 Kristian Evers, <kreve at sdfe.dk> wrote:
>> That was a good assumption at the time :-) Things are a little bit
>> different now.
>> It would seem that Catch2 is also good for C code, yes?
> Yes, a C++ testing framework can test C project should generally be fine.
> There may be need to for manual resetting of globals, static memory to
> ensure one test case does not affect another. The interrupts and signal
> handling, if used by target code, may need to some consideration as well.
> One general and stylistic comment about Catch, since it supports two modes
> of tests classic test cases and BDD style, it may be a good idea to stick
> to one of those, not mixing them.
> (I personally find the classical test cases easier to write and follow.)
> Proj mailing list
> Proj at lists.maptools.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Proj