Using Google Test to Unit Test C Code

While the Google Test framework is designed for C++ it can be used to create a framework for C unit testing. Reference the Google Test documentation for more details on the capabilities of Google Test.

The Framework

These framework files are included in any C unit test project.
•A header file to define macros to interface from C++ to C – gtest_c.h
•A header file to provide C interfaces to the Google Test comparison functions – Gtest_helper.h.
•A helper file to interface Google Test comparison function to C – Gtest_helper.cc