<div dir="ltr">+1 to it being totally okay to test C with C++ frameworks.<div><br></div><div>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.</div><div><br></div><div><a href="https://github.com/catchorg/Catch2/issues/55">https://github.com/catchorg/Catch2/issues/55</a><br></div><div><br></div><div>Also worth mentioning is that gMock and Catch2 provide matchers that are really handy. I don't know if any of the other frameworks.</div><div><br></div><div>e.g. </div><div><a href="https://github.com/google/googletest/blob/master/googlemock/docs/CheatSheet.md#matchers">https://github.com/google/googletest/blob/master/googlemock/docs/CheatSheet.md#matchers</a></div><div><a href="https://github.com/catchorg/Catch2/blob/master/docs/matchers.md">https://github.com/catchorg/Catch2/blob/master/docs/matchers.md</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 29, 2018 at 11:49 AM, Mateusz Loskot <span dir="ltr"><<a href="mailto:mateusz@loskot.net" target="_blank">mateusz@loskot.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><div data-smartmail="gmail_signature" dir="auto">On Tue, 29 May 2018, 20:26 Kristian Evers, <<a href="mailto:kreve@sdfe.dk" rel="noreferrer" target="_blank">kreve@sdfe.dk</a>> wrote:<br></div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space">
Mateusz,
<div><br>
</div>
<div>That was a good assumption at the time :-) Things are a little bit different now.</div>
<div>It would seem that Catch2 is also good for C code, yes?</div></div></blockquote></div><div dir="auto"><br></div><div dir="auto"><br></div></span><div dir="auto">Yes, a C++ testing framework can test C project should generally be fine. </div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto">(I personally find <span style="font-family:sans-serif">the classical test cases</span> easier to write and follow.)</div><span class="HOEnZb"><font color="#888888"><div dir="auto"><br></div><div dir="auto">Mateusz </div><div dir="auto"><br></div></font></span></div>
<br>______________________________<wbr>_________________<br>
Proj mailing list<br>
<a href="mailto:Proj@lists.maptools.org">Proj@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/proj" rel="noreferrer" target="_blank">http://lists.maptools.org/<wbr>mailman/listinfo/proj</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--<div><a href="http://schwehr.org" target="_blank">http://schwehr.org</a></div></div>
</div>