[Proj] Testing framework

Kurt Schwehr 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
valuable.

https://github.com/catchorg/Catch2/issues/55

Also worth mentioning is that gMock and Catch2 provide matchers that are
really handy.  I don't know if any of the other frameworks.

e.g.
https://github.com/google/googletest/blob/master/googlemock/docs/CheatSheet.md#matchers
https://github.com/catchorg/Catch2/blob/master/docs/matchers.md

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:
>
>> Mateusz,
>>
>> 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.)
>
> Mateusz
>
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>



-- 
--
http://schwehr.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20180529/11a9860a/attachment.htm 


More information about the Proj mailing list