kumailxp / CppFreeMock

Based on gmock, can mock global function, member function, class static function without changing source code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CppFreeMock

Based on gmock, can mock global function, member function, class static function without change source code.

Here is the document and design notes host on OneNote.

Hello world:

string func() {
    return "Non mocked.";
}

TEST(HelloWorld, First) {
    EXPECT_CALL(*MOCKER(func), MOCK_FUNCTION()).Times(Exactly(1))
        .WillOnce(Return("Hello world."));
    EXPECT_EQ("Hello world.", func());
}

Here is the prototype when I try to solve this problem.

About

Based on gmock, can mock global function, member function, class static function without changing source code.

License:Apache License 2.0


Languages

Language:C++ 90.7%Language:Makefile 5.9%Language:C 3.3%