c++ - Access Google Test fixture member -
i trying mock hardware abstraction layer function, uint32_t hw_epoch()
writing fake, , fake calling mock method, let me verify hw_epoch()
function begin called. considering simplified code below:
#include <stdint.h> #include "gmock/gmock.h" using ::testing::return; class foointerface { public: virtual ~foointerface() {} virtual uint32_t m_hw_epoch() = 0; }; class mockfoo : public foointerface { public: mock_method0(m_hw_epoch, uint32_t()); private: }; // ----- test fixture: class footest : public ::testing::test { public: footest() : foointerfaceptr(&mockfooobj) {} ~footest() {} mockfoo mockfooobj; foointerface* foointerfaceptr; }; // ----- fakes uint32_t hw_epoch() { foointerfaceptr->m_hw_epoch(); // *** how can access foointerfaceptr? return 5; } test_f(footest, constructor) { }
the footest fixture has member foointerfaceptr
, how can access member free function uint32_t hw_epoch()
?
thanks you...
per @πάντα ῥεῖ, not possible to free function. custom action possible solution.
Comments
Post a Comment