I have a class I wish to Mock using Google Mock. My class has BOTH non-virtual and virtual methods. I've been reading through the Google Mock ForDummies and the Google Mock CookBook. The examples and explanations provided by these resources mention classes with either ALL virtual functions, or NO virtual functions, but not one with both. So I have two questions:
(1) Is it possible to mock a class with mixed virtual/non-virtual types?
(2) What method should be used (if question 1 is true) to mock this class, (If question 1 is false) what could be used instead?
A bit of code if it helps:
class Time_Device : public Time_Device_Interface
{
private:
...
bool read32_irig_data( uint32_t *data_read, uint32_t reg_address);
bool thread_monitor_irig_changed( irig_callback_t callback );
public:
...
virtual bool set_time( struct time_sample const &time );
virtual bool get_time( struct time_sample *time );
virtual bool register_is_connected_notification(
irig_callback_t callback );
};
A wee bit o'background:
I'm trying to use Google Mock with Google Test because I need to mimic hardware returns in a lot of my methods in order to test coverage, etc. I've been able to successfully use Google Test alone to test some of my methods without Mocking them.
I'm developing using Visual Studio 2010, CMake
I'm new to both Google Test and Google Mock
I cannot change the production code.