meekrosoft / fff

A testing micro framework for creating function test doubles
Other
749 stars 163 forks source link

Mocking static methods of the class #128

Open jkrajniak opened 10 months ago

jkrajniak commented 10 months ago

Hi,

Is there any way to mock static methods of the class. I've tried but it fails. Basically

FAKE_VOID_FUNC(BaselineCalib::setModel)

where setModel is a static method of BaselineCalib class. Now it returns with the error

tests/fff.h:154:36: error: qualified name does not name a class before '{' token
  154 |     typedef struct FUNCNAME##_Fake { \
jakub-dudarewicz commented 9 months ago

Hi, just passing by. FFF is supposed to be used for C, not C++. For C++ better use GoogleTest, CppUTest, etc.

jkrajniak commented 9 months ago

True, although I have a project that mixes C and C++ (with extern C) and then the standard mocking is almost impossible...

jakub-dudarewicz commented 9 months ago

I haven't yet been in that situation, I guess using FFF for C and Google Mock for C++ is out of the question?