Skip to content

Separate definition and declaration#7

Open
vshylienkov wants to merge 1 commit intoapriorit:masterfrom
Luxoft:def_decl
Open

Separate definition and declaration#7
vshylienkov wants to merge 1 commit intoapriorit:masterfrom
Luxoft:def_decl

Conversation

@vshylienkov
Copy link
Copy Markdown

Introduces two sets of macro
MOCK_GLOBAL_FUNC*_DECL - for mock function declaration in a header file
MOCK_GLOBAL_FUNC*_DEF - for mock function definition in a source file

example 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);
}

Introduces two sets of macro
`MOCK_GLOBAL_FUNC*_DECL` - for mock function declaration in a header file
`MOCK_GLOBAL_FUNC*_DEF` - for mock function definition in a source file
@jakakordez
Copy link
Copy Markdown

Hello, what is the status of this? Would greatly appreciate if this was merged as it would ease my development.

@SergiusTheBest
Copy link
Copy Markdown
Member

SergiusTheBest commented Aug 2, 2024

I don't think it makes sense to introduce additional macro. You can use:

int mul00(void);

instead of:

MOCK_GLOBAL_FUNC0_DECL(mul00, int(void))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants