Yes. Since C++ code can call C code, you can use Google Test (or
another C++ testing framework) to test C code.
One potential problem with testing C code is that unit testing
(testing each component in isolation) can be harder, since C doesn't
directly support polymorphism. (In an OO language, you can use
polymorphism to replace components that aren't being tested in a
particular test with fake or mock objects.) There are a few
techniques to work around this in C, but if the API calls you're
testing are relatively small and relatively isolated from each other,
it may not even be an issue.
--
Josh Kelley
You probably want to make sure your C header files say something like
the following, in order to link properly.
#if __cplusplus
extern "C" {
#endif
your header file contents
#if __cplusplus
}
#endif
--
--
C. Keith Ray
Web: http://industriallogic.com
Twitter: @CKeithRay, @IndustrialLogic
Amplify Your Agility
Coaching | Training | Assessment | eLearning
--
---
You received this message because you are subscribed to the Google Groups "Google C++ Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframe...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.