user1613735
user1613735

Reputation:

Limitations of using a C unit testing framework for testing embedded C++ code

I would like to try using a unit testing framework for testing the code that I write in C, C++ or sometimes IEC languages too.

So my question is - is there some big limitation using C-written unit test Framework for testing C++ code that would restrain me from using it?


Background info: I tried a variety of frameworks available as opensource - that are written in C / C++. And finally I concluded that 'embedded unit' - written in C and 'CppTest' - written in C++ were the candidates (mainly because the testing has to be performed on an embedded platform). But before selecting the winner I fell into this very Basic question . And to my knowledge I find no big limitations. Except that: In C++ Unit testing framework:I can make the testClass a friend of testable class and test its private attributes/ functions (which is not really important for me). sorry if this is a silly question - i just started exploring the world of testing.

Upvotes: 0

Views: 722

Answers (1)

Steve Townsend
Steve Townsend

Reputation: 54178

One example is that you will be hard pushed to test expected C++ exceptions generated by your code under test using a strict C framework. I am sure there are other holes in this approach, but it depends on your C++ code.

Unless you have a really good reason, CppTest seems like the logical choice of your two candidates. I've linked in comments to a question that might cover options you have missed.

Upvotes: 3

Related Questions