[clug] Unit testing C and C++

Ben Davies bdcrux at gmail.com
Fri Jun 21 01:18:07 MDT 2013


On 21 June 2013 15:12, Hal Ashburner <hal at ashburner.info> wrote:
> Anyone doing much unit testing of C and/or C++?
> What are you using. Your own thing? Boost unit test? Google test, Cppunit,
> CUTE? Something else?
> Any comments on it all?

I've been using Google test recently, although only some basic
features. Most (all?) of the assertions are handled by macros.

There is a small amount of mucking about as having the test features
as a shared isn't recommended by the developers. Instead they have an
approach of generating a static lib and linking with that. There was
some problem with the shared lib approach (I've got a link to the info
somewhere - I think....).

The only real problem I encountered (ages ago now) was a problem where
the gtest macros didn't handle capturing an exception of some sort.
Some recent exception capturing just worked though. Other than that,
it has worked without complaint.


Other random stuff off the top of my head:
I profiled one of the unittest exes with Valgrind some years ago. I
recall something about unfreed mem in the Gtest code, but can't recall
the details :(

I've not tried any of the other test frameworks. IIRC, there were a
few suggestions when I raised a similar question on the list (again
several years ago).

cheers,


Ben


More information about the linux mailing list