Hi,
Basically I am trying to test some Qt codes, like the following:
class MyClass: public QObject
{MyClass();};
when I tried to fake MyClass:
FAKE<MyClass>();
Isolator++ complained:
Isolator++ may fail to fake objects that aren't used anywhere in your test project as the compiler optimizes these. Using of FAKE<QObject>(ISOLATOR_FORCE_SYMBOL) may help (for static methods please use FAKE_STATICS(QObject)).
Someone raised a similar issue there.
It seems that this issue is similar to the issue when faking a pure virtual class, so I followed this page, and tested with a simple pure virtual class:
class MyPureClass
{
public:
virtual int GetResult() = 0;
};
I tried to fake it using the following:
FAKE<MyPureClass>(ISOLATOR_FORCE_SYMBOL);
Isolator++ again complained:
Isolator++ may fail to fake objects that aren't used anywhere in your test project as the compiler optimizes these. Using of FAKE<MyPureClass>(ISOLATOR_FORCE_SYMBOL) may help (for static methods please use FAKE_STATICS(MyPureClass)).
I disabled the compiler optimization, in the makefile I have the following:
CC = gcc
CXX = g++
DEFINES = -DGTEST_LANG_CXX11 -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -g -O0 -w -g3 $(QMAKE_INCDIR) -D_REENTRANT -Wall -W -fPIC $(DEFINES)
CXXFLAGS = -pipe -g -O0 -w -g3 $(QMAKE_INCDIR) -std=gnu++11 -D_REENTRANT -Wall -W -fPIC $(DEFINES)
Can you please kindly advise me on this problem?
Thank you in advance