ref:mock non-virtual methods 源代码 class A{ public: int Funtion1(B& obj) { //do something std::string str = “mock non-virtual methods using templates”; auto rst = obj.Function2(str); //do something } } class B{ public: int Funtion2(std::string _str){ puts(_str.c_str()...
Mocking Non-virtual Methods {#MockingNonVirtualMethods} gMock can mock non-virtual functions to be used in Hi-perf dependency injection. In this case, instead of sharing a common base class with the real class, your mock class will beunrelatedto the real class, but contain methods wi...
virtual ~Turtle() {}; virtual void PenUp() = 0; virtual void PenDown() = 0; virtual void Forward(int distance) = 0; virtual void Turn(int degrees) = 0; virtual void GoTo(int x, int y) = 0; virtual int GetX() const = 0; virtual int GetY() const = 0; };MockTurtle类:#inc...
// methods are protected or private in the base class. MOCK_METHOD0(Resume, void()); MOCK_METHOD0(GetTimeOut, int()); //virtual int Add(char x); //virtual int Add(int times, char x); // virtual int Add(int x); MOCK_METHOD1(Add, int(char x)); //MOCK_METHOD1(Add, int(...
virtual bool TakesNonConstReference(int& n) = 0; // NOLINT virtual std::string TakesConstReference(const int& n) = 0; virtual bool TakesConst(const int x) = 0; virtual int OverloadedOnArgumentNumber() = 0; virtual int OverloadedOnArgumentNumber(int n) = 0; virtual int OverloadedOnArgum...
In this case, instead of sharing a common base class with the real class, your mock class will be unrelated to the real class, but contain methods with the same signatures. The syntax for mocking non-virtual methods is the same as mocking virtual methods (just don't add override):...
In this case, instead of sharing a common base class with the real class, your mock class will be unrelated to the real class, but contain methods with the same signatures. The syntax for mocking non-virtual methods is the same as mocking virtual methods (just don't add override...
1. mock non-virtual methods(6) 2. Sqlite3 设置插入触发器(4) 3. X Macro(3) 4. 从Spark1.6到Spark2.1,Logging该何去何从(1) 推荐排行榜 1. X Macro(4) 2. 从Spark1.6到Spark2.1,Logging该何去何从(1) 最新评论 1. Re:X Macro 学到了 --风与月 2. Re:X Macro 项目代码有这...