Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduces two sets of macro
MOCK_GLOBAL_FUNC*_DECL
- for mock function declaration in a header fileMOCK_GLOBAL_FUNC*_DEF
- for mock function definition in a source fileexample of usage
mocs.hpp
MOCK_GLOBAL_FUNC0_DECL(mul00, int(void))
mocs.cpp
#include "mocs.hpp"
MOCK_GLOBAL_FUNC0_DEF(mul00, int(void))
in testing
#include "mocs.hpp"
#include "gtest/gtest.h"
using namespace testing;
TEST(new_style, zero)
{
const int expected_value = 2;
EXPECT_GLOBAL_CALL(mul00, mul00()).Times(1).WillRepeatedly(Return(expected_value));
int r = mul00();
EXPECT_EQ(r, expected_value);
}