You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a FakeObj.h file to DECLARE the fakes and a FakeObj.c file to DEFINE the fakes. Then I can include the fakes in multiple different files each representing a different test suite. A further complication is my testing code uses gtest and therefore C++ while fff uses C. I ran into some linker issues about not being able to find the _reset functions of the fakes. This was caused by C/C++ name mangling of the functions. The solution to this was to add a extern "C" wrapper to the header file like so
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_FAKE_VALUE_FUNC(func_a);
DECLARE_FAKE_VOID_FUNC(func_b);
// List of fakes used by these unit tests
#define FFF_FAKES_LIST(FUNC) \
FUNC(func_a) \
FUNC(func_b)
#ifdef __cplusplus
}
#endif
I would advocate adding this information to the readme in the "How do I reuse a fake across multiple test-suites?" section.
The text was updated successfully, but these errors were encountered:
I am using a FakeObj.h file to DECLARE the fakes and a FakeObj.c file to DEFINE the fakes. Then I can include the fakes in multiple different files each representing a different test suite. A further complication is my testing code uses gtest and therefore C++ while fff uses C. I ran into some linker issues about not being able to find the _reset functions of the fakes. This was caused by C/C++ name mangling of the functions. The solution to this was to add a
extern "C"
wrapper to the header file like soI would advocate adding this information to the readme in the "How do I reuse a fake across multiple test-suites?" section.
The text was updated successfully, but these errors were encountered: