Skip to content

Additional macro definitions for mocking global functions with gmock

License

Notifications You must be signed in to change notification settings

Grivus/gmock_global

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gmock_global

This header-only library implements gmock functionality for global functions. Like for the class methods in original gmock you wrote MOCK_METHOD#N for mocking some method, you can now write MOCK_GLOBAL_FUNC#N and mock some function from global scope.

USING

Syntaxis is most similar to gmock. For example, to mock function multiply with two double arguments and double result you have to write declaration:

MOCK_GLOBAL_FUNC2(multiply, double(double, double));

You can check call count of such function using EXPECT_GLOBAL_CALL macro, same as you used EXPECT_CALL macro for classes:

EXPECT_GLOBAL_CALL(multiply, multiply(1, 2));

The .Times(...) and other methods will be work too.

SAMPLES

For the samples see repo

About

Additional macro definitions for mocking global functions with gmock

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages