"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googlemock/test/gmock-function-mocker_test.cc" between
googletest-release-1.10.0.tar.gz and googletest-release-1.11.0.tar.gz

About: GoogleTest is Google's (unit) testing and mocking framework for C++ tests.

gmock-function-mocker_test.cc  (googletest-release-1.10.0):gmock-function-mocker_test.cc  (googletest-release-1.11.0)
skipping to change at line 33 skipping to change at line 33
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file tests the function mocker classes. // This file tests the function mocker classes.
#include "gmock/gmock-generated-function-mockers.h" #include "gmock/gmock-function-mocker.h"
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
// MSDN says the header file to be included for STDMETHOD is BaseTyps.h but // MSDN says the header file to be included for STDMETHOD is BaseTyps.h but
// we are getting compiler errors if we use basetyps.h, hence including // we are getting compiler errors if we use basetyps.h, hence including
// objbase.h for definition of STDMETHOD. // objbase.h for definition of STDMETHOD.
# include <objbase.h> # include <objbase.h>
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#include <functional>
#include <map> #include <map>
#include <string> #include <string>
#include <type_traits>
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace testing { namespace testing {
namespace gmock_function_mocker_test { namespace gmock_function_mocker_test {
using testing::_; using testing::_;
using testing::A; using testing::A;
using testing::An; using testing::An;
using testing::AnyNumber; using testing::AnyNumber;
skipping to change at line 103 skipping to change at line 106
virtual int OverloadedOnArgumentType(int n) = 0; virtual int OverloadedOnArgumentType(int n) = 0;
virtual char OverloadedOnArgumentType(char c) = 0; virtual char OverloadedOnArgumentType(char c) = 0;
virtual int OverloadedOnConstness() = 0; virtual int OverloadedOnConstness() = 0;
virtual char OverloadedOnConstness() const = 0; virtual char OverloadedOnConstness() const = 0;
virtual int TypeWithHole(int (*func)()) = 0; virtual int TypeWithHole(int (*func)()) = 0;
virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0; virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0;
virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable<int>&) = 0; virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable<int>&) = 0;
virtual int (*ReturnsFunctionPointer1(int))(bool) = 0;
using fn_ptr = int (*)(bool);
virtual fn_ptr ReturnsFunctionPointer2(int) = 0;
virtual int RefQualifiedConstRef() const& = 0;
virtual int RefQualifiedConstRefRef() const&& = 0;
virtual int RefQualifiedRef() & = 0;
virtual int RefQualifiedRefRef() && = 0;
virtual int RefQualifiedOverloaded() const& = 0;
virtual int RefQualifiedOverloaded() const&& = 0;
virtual int RefQualifiedOverloaded() & = 0;
virtual int RefQualifiedOverloaded() && = 0;
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
STDMETHOD_(int, CTNullary)() = 0; STDMETHOD_(int, CTNullary)() = 0;
STDMETHOD_(bool, CTUnary)(int x) = 0; STDMETHOD_(bool, CTUnary)(int x) = 0;
STDMETHOD_(int, CTDecimal) STDMETHOD_(int, CTDecimal)
(bool b, char c, short d, int e, long f, // NOLINT (bool b, char c, short d, int e, long f, // NOLINT
float g, double h, unsigned i, char* j, const std::string& k) = 0; float g, double h, unsigned i, char* j, const std::string& k) = 0;
STDMETHOD_(char, CTConst)(int x) const = 0; STDMETHOD_(char, CTConst)(int x) const = 0;
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
}; };
skipping to change at line 161 skipping to change at line 178
MOCK_METHOD(char, OverloadedOnArgumentType, (char)); // NOLINT MOCK_METHOD(char, OverloadedOnArgumentType, (char)); // NOLINT
MOCK_METHOD(int, OverloadedOnConstness, (), (override)); // NOLINT MOCK_METHOD(int, OverloadedOnConstness, (), (override)); // NOLINT
MOCK_METHOD(char, OverloadedOnConstness, (), (override, const)); // NOLINT MOCK_METHOD(char, OverloadedOnConstness, (), (override, const)); // NOLINT
MOCK_METHOD(int, TypeWithHole, (int (*)()), ()); // NOLINT MOCK_METHOD(int, TypeWithHole, (int (*)()), ()); // NOLINT
MOCK_METHOD(int, TypeWithComma, ((const std::map<int, std::string>&))); MOCK_METHOD(int, TypeWithComma, ((const std::map<int, std::string>&)));
MOCK_METHOD(int, TypeWithTemplatedCopyCtor, MOCK_METHOD(int, TypeWithTemplatedCopyCtor,
(const TemplatedCopyable<int>&)); // NOLINT (const TemplatedCopyable<int>&)); // NOLINT
MOCK_METHOD(int (*)(bool), ReturnsFunctionPointer1, (int), ());
MOCK_METHOD(fn_ptr, ReturnsFunctionPointer2, (int), ());
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE))); MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE)));
MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE))); MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE)));
MOCK_METHOD(int, CTDecimal, MOCK_METHOD(int, CTDecimal,
(bool b, char c, short d, int e, long f, float g, double h, (bool b, char c, short d, int e, long f, float g, double h,
unsigned i, char* j, const std::string& k), unsigned i, char* j, const std::string& k),
(Calltype(STDMETHODCALLTYPE))); (Calltype(STDMETHODCALLTYPE)));
MOCK_METHOD(char, CTConst, (int), (const, Calltype(STDMETHODCALLTYPE))); MOCK_METHOD(char, CTConst, (int), (const, Calltype(STDMETHODCALLTYPE)));
MOCK_METHOD((std::map<int, std::string>), CTReturnTypeWithComma, (), MOCK_METHOD((std::map<int, std::string>), CTReturnTypeWithComma, (),
(Calltype(STDMETHODCALLTYPE))); (Calltype(STDMETHODCALLTYPE)));
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
// Test reference qualified functions.
MOCK_METHOD(int, RefQualifiedConstRef, (), (const, ref(&), override));
MOCK_METHOD(int, RefQualifiedConstRefRef, (), (const, ref(&&), override));
MOCK_METHOD(int, RefQualifiedRef, (), (ref(&), override));
MOCK_METHOD(int, RefQualifiedRefRef, (), (ref(&&), override));
MOCK_METHOD(int, RefQualifiedOverloaded, (), (const, ref(&), override));
MOCK_METHOD(int, RefQualifiedOverloaded, (), (const, ref(&&), override));
MOCK_METHOD(int, RefQualifiedOverloaded, (), (ref(&), override));
MOCK_METHOD(int, RefQualifiedOverloaded, (), (ref(&&), override));
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo); GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
}; };
class LegacyMockFoo : public FooInterface {
public:
LegacyMockFoo() {}
// Makes sure that a mock function parameter can be named.
MOCK_METHOD1(VoidReturning, void(int n)); // NOLINT
MOCK_METHOD0(Nullary, int()); // NOLINT
// Makes sure that a mock function parameter can be unnamed.
MOCK_METHOD1(Unary, bool(int)); // NOLINT
MOCK_METHOD2(Binary, long(short, int)); // NOLINT
MOCK_METHOD10(Decimal, int(bool, char, short, int, long, float, // NOLINT
double, unsigned, char*, const std::string& str));
MOCK_METHOD1(TakesNonConstReference, bool(int&)); // NOLINT
MOCK_METHOD1(TakesConstReference, std::string(const int&));
MOCK_METHOD1(TakesConst, bool(const int)); // NOLINT
// Tests that the function return type can contain unprotected comma.
MOCK_METHOD0(ReturnTypeWithComma, std::map<int, std::string>());
MOCK_CONST_METHOD1(ReturnTypeWithComma,
std::map<int, std::string>(int)); // NOLINT
MOCK_METHOD0(OverloadedOnArgumentNumber, int()); // NOLINT
MOCK_METHOD1(OverloadedOnArgumentNumber, int(int)); // NOLINT
MOCK_METHOD1(OverloadedOnArgumentType, int(int)); // NOLINT
MOCK_METHOD1(OverloadedOnArgumentType, char(char)); // NOLINT
MOCK_METHOD0(OverloadedOnConstness, int()); // NOLINT
MOCK_CONST_METHOD0(OverloadedOnConstness, char()); // NOLINT
MOCK_METHOD1(TypeWithHole, int(int (*)())); // NOLINT
MOCK_METHOD1(TypeWithComma,
int(const std::map<int, std::string>&)); // NOLINT
MOCK_METHOD1(TypeWithTemplatedCopyCtor,
int(const TemplatedCopyable<int>&)); // NOLINT
MOCK_METHOD1(ReturnsFunctionPointer1, int (*(int))(bool));
MOCK_METHOD1(ReturnsFunctionPointer2, fn_ptr(int));
#if GTEST_OS_WINDOWS
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int());
MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTUnary, bool(int)); // NOLINT
MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal,
int(bool b, char c, short d, int e, // NOLINT
long f, float g, double h, // NOLINT
unsigned i, char* j, const std::string& k));
MOCK_CONST_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTConst,
char(int)); // NOLINT
// Tests that the function return type can contain unprotected comma.
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTReturnTypeWithComma,
std::map<int, std::string>());
#endif // GTEST_OS_WINDOWS
// We can't mock these with the old macros, but we need to define them to make
// it concrete.
int RefQualifiedConstRef() const& override { return 0; }
int RefQualifiedConstRefRef() const&& override { return 0; }
int RefQualifiedRef() & override { return 0; }
int RefQualifiedRefRef() && override { return 0; }
int RefQualifiedOverloaded() const& override { return 0; }
int RefQualifiedOverloaded() const&& override { return 0; }
int RefQualifiedOverloaded() & override { return 0; }
int RefQualifiedOverloaded() && override { return 0; }
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockFoo);
};
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(pop) # pragma warning(pop)
#endif #endif
class MockMethodFunctionMockerTest : public testing::Test { template <class T>
class FunctionMockerTest : public testing::Test {
protected: protected:
MockMethodFunctionMockerTest() : foo_(&mock_foo_) {} FunctionMockerTest() : foo_(&mock_foo_) {}
FooInterface* const foo_; FooInterface* const foo_;
MockFoo mock_foo_; T mock_foo_;
}; };
using FunctionMockerTestTypes = ::testing::Types<MockFoo, LegacyMockFoo>;
TYPED_TEST_SUITE(FunctionMockerTest, FunctionMockerTestTypes);
// Tests mocking a void-returning function. // Tests mocking a void-returning function.
TEST_F(MockMethodFunctionMockerTest, MocksVoidFunction) { TYPED_TEST(FunctionMockerTest, MocksVoidFunction) {
EXPECT_CALL(mock_foo_, VoidReturning(Lt(100))); EXPECT_CALL(this->mock_foo_, VoidReturning(Lt(100)));
foo_->VoidReturning(0); this->foo_->VoidReturning(0);
} }
// Tests mocking a nullary function. // Tests mocking a nullary function.
TEST_F(MockMethodFunctionMockerTest, MocksNullaryFunction) { TYPED_TEST(FunctionMockerTest, MocksNullaryFunction) {
EXPECT_CALL(mock_foo_, Nullary()) EXPECT_CALL(this->mock_foo_, Nullary())
.WillOnce(DoDefault()) .WillOnce(DoDefault())
.WillOnce(Return(1)); .WillOnce(Return(1));
EXPECT_EQ(0, foo_->Nullary()); EXPECT_EQ(0, this->foo_->Nullary());
EXPECT_EQ(1, foo_->Nullary()); EXPECT_EQ(1, this->foo_->Nullary());
} }
// Tests mocking a unary function. // Tests mocking a unary function.
TEST_F(MockMethodFunctionMockerTest, MocksUnaryFunction) { TYPED_TEST(FunctionMockerTest, MocksUnaryFunction) {
EXPECT_CALL(mock_foo_, Unary(Eq(2))) EXPECT_CALL(this->mock_foo_, Unary(Eq(2))).Times(2).WillOnce(Return(true));
.Times(2)
.WillOnce(Return(true));
EXPECT_TRUE(foo_->Unary(2)); EXPECT_TRUE(this->foo_->Unary(2));
EXPECT_FALSE(foo_->Unary(2)); EXPECT_FALSE(this->foo_->Unary(2));
} }
// Tests mocking a binary function. // Tests mocking a binary function.
TEST_F(MockMethodFunctionMockerTest, MocksBinaryFunction) { TYPED_TEST(FunctionMockerTest, MocksBinaryFunction) {
EXPECT_CALL(mock_foo_, Binary(2, _)) EXPECT_CALL(this->mock_foo_, Binary(2, _)).WillOnce(Return(3));
.WillOnce(Return(3));
EXPECT_EQ(3, foo_->Binary(2, 1)); EXPECT_EQ(3, this->foo_->Binary(2, 1));
} }
// Tests mocking a decimal function. // Tests mocking a decimal function.
TEST_F(MockMethodFunctionMockerTest, MocksDecimalFunction) { TYPED_TEST(FunctionMockerTest, MocksDecimalFunction) {
EXPECT_CALL(mock_foo_, Decimal(true, 'a', 0, 0, 1L, A<float>(), EXPECT_CALL(this->mock_foo_,
Lt(100), 5U, NULL, "hi")) Decimal(true, 'a', 0, 0, 1L, A<float>(), Lt(100), 5U, NULL, "hi"))
.WillOnce(Return(5)); .WillOnce(Return(5));
EXPECT_EQ(5, foo_->Decimal(true, 'a', 0, 0, 1, 0, 0, 5, nullptr, "hi")); EXPECT_EQ(5, this->foo_->Decimal(true, 'a', 0, 0, 1, 0, 0, 5, nullptr, "hi"));
} }
// Tests mocking a function that takes a non-const reference. // Tests mocking a function that takes a non-const reference.
TEST_F(MockMethodFunctionMockerTest, TYPED_TEST(FunctionMockerTest, MocksFunctionWithNonConstReferenceArgument) {
MocksFunctionWithNonConstReferenceArgument) {
int a = 0; int a = 0;
EXPECT_CALL(mock_foo_, TakesNonConstReference(Ref(a))) EXPECT_CALL(this->mock_foo_, TakesNonConstReference(Ref(a)))
.WillOnce(Return(true)); .WillOnce(Return(true));
EXPECT_TRUE(foo_->TakesNonConstReference(a)); EXPECT_TRUE(this->foo_->TakesNonConstReference(a));
} }
// Tests mocking a function that takes a const reference. // Tests mocking a function that takes a const reference.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionWithConstReferenceArgument) { TYPED_TEST(FunctionMockerTest, MocksFunctionWithConstReferenceArgument) {
int a = 0; int a = 0;
EXPECT_CALL(mock_foo_, TakesConstReference(Ref(a))) EXPECT_CALL(this->mock_foo_, TakesConstReference(Ref(a)))
.WillOnce(Return("Hello")); .WillOnce(Return("Hello"));
EXPECT_EQ("Hello", foo_->TakesConstReference(a)); EXPECT_EQ("Hello", this->foo_->TakesConstReference(a));
} }
// Tests mocking a function that takes a const variable. // Tests mocking a function that takes a const variable.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionWithConstArgument) { TYPED_TEST(FunctionMockerTest, MocksFunctionWithConstArgument) {
EXPECT_CALL(mock_foo_, TakesConst(Lt(10))) EXPECT_CALL(this->mock_foo_, TakesConst(Lt(10))).WillOnce(DoDefault());
.WillOnce(DoDefault());
EXPECT_FALSE(foo_->TakesConst(5)); EXPECT_FALSE(this->foo_->TakesConst(5));
} }
// Tests mocking functions overloaded on the number of arguments. // Tests mocking functions overloaded on the number of arguments.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionsOverloadedOnArgumentNumber) { TYPED_TEST(FunctionMockerTest, MocksFunctionsOverloadedOnArgumentNumber) {
EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber()) EXPECT_CALL(this->mock_foo_, OverloadedOnArgumentNumber())
.WillOnce(Return(1)); .WillOnce(Return(1));
EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber(_)) EXPECT_CALL(this->mock_foo_, OverloadedOnArgumentNumber(_))
.WillOnce(Return(2)); .WillOnce(Return(2));
EXPECT_EQ(2, foo_->OverloadedOnArgumentNumber(1)); EXPECT_EQ(2, this->foo_->OverloadedOnArgumentNumber(1));
EXPECT_EQ(1, foo_->OverloadedOnArgumentNumber()); EXPECT_EQ(1, this->foo_->OverloadedOnArgumentNumber());
} }
// Tests mocking functions overloaded on the types of argument. // Tests mocking functions overloaded on the types of argument.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionsOverloadedOnArgumentType) { TYPED_TEST(FunctionMockerTest, MocksFunctionsOverloadedOnArgumentType) {
EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(An<int>())) EXPECT_CALL(this->mock_foo_, OverloadedOnArgumentType(An<int>()))
.WillOnce(Return(1)); .WillOnce(Return(1));
EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(TypedEq<char>('a'))) EXPECT_CALL(this->mock_foo_, OverloadedOnArgumentType(TypedEq<char>('a')))
.WillOnce(Return('b')); .WillOnce(Return('b'));
EXPECT_EQ(1, foo_->OverloadedOnArgumentType(0)); EXPECT_EQ(1, this->foo_->OverloadedOnArgumentType(0));
EXPECT_EQ('b', foo_->OverloadedOnArgumentType('a')); EXPECT_EQ('b', this->foo_->OverloadedOnArgumentType('a'));
} }
// Tests mocking functions overloaded on the const-ness of this object. // Tests mocking functions overloaded on the const-ness of this object.
TEST_F(MockMethodFunctionMockerTest, TYPED_TEST(FunctionMockerTest, MocksFunctionsOverloadedOnConstnessOfThis) {
MocksFunctionsOverloadedOnConstnessOfThis) { EXPECT_CALL(this->mock_foo_, OverloadedOnConstness());
EXPECT_CALL(mock_foo_, OverloadedOnConstness()); EXPECT_CALL(Const(this->mock_foo_), OverloadedOnConstness())
EXPECT_CALL(Const(mock_foo_), OverloadedOnConstness())
.WillOnce(Return('a')); .WillOnce(Return('a'));
EXPECT_EQ(0, foo_->OverloadedOnConstness()); EXPECT_EQ(0, this->foo_->OverloadedOnConstness());
EXPECT_EQ('a', Const(*foo_).OverloadedOnConstness()); EXPECT_EQ('a', Const(*this->foo_).OverloadedOnConstness());
} }
TEST_F(MockMethodFunctionMockerTest, MocksReturnTypeWithComma) { TYPED_TEST(FunctionMockerTest, MocksReturnTypeWithComma) {
const std::map<int, std::string> a_map; const std::map<int, std::string> a_map;
EXPECT_CALL(mock_foo_, ReturnTypeWithComma()) EXPECT_CALL(this->mock_foo_, ReturnTypeWithComma()).WillOnce(Return(a_map));
.WillOnce(Return(a_map)); EXPECT_CALL(this->mock_foo_, ReturnTypeWithComma(42)).WillOnce(Return(a_map));
EXPECT_CALL(mock_foo_, ReturnTypeWithComma(42))
.WillOnce(Return(a_map));
EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma()); EXPECT_EQ(a_map, this->mock_foo_.ReturnTypeWithComma());
EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42)); EXPECT_EQ(a_map, this->mock_foo_.ReturnTypeWithComma(42));
} }
TEST_F(MockMethodFunctionMockerTest, MocksTypeWithTemplatedCopyCtor) { TYPED_TEST(FunctionMockerTest, MocksTypeWithTemplatedCopyCtor) {
EXPECT_CALL(mock_foo_, TypeWithTemplatedCopyCtor(_)).WillOnce(Return(true)); EXPECT_CALL(this->mock_foo_, TypeWithTemplatedCopyCtor(_))
EXPECT_TRUE(foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>())); .WillOnce(Return(true));
EXPECT_TRUE(this->foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>()));
} }
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
// Tests mocking a nullary function with calltype. // Tests mocking a nullary function with calltype.
TEST_F(MockMethodFunctionMockerTest, MocksNullaryFunctionWithCallType) { TYPED_TEST(FunctionMockerTest, MocksNullaryFunctionWithCallType) {
EXPECT_CALL(mock_foo_, CTNullary()) EXPECT_CALL(this->mock_foo_, CTNullary())
.WillOnce(Return(-1)) .WillOnce(Return(-1))
.WillOnce(Return(0)); .WillOnce(Return(0));
EXPECT_EQ(-1, foo_->CTNullary()); EXPECT_EQ(-1, this->foo_->CTNullary());
EXPECT_EQ(0, foo_->CTNullary()); EXPECT_EQ(0, this->foo_->CTNullary());
} }
// Tests mocking a unary function with calltype. // Tests mocking a unary function with calltype.
TEST_F(MockMethodFunctionMockerTest, MocksUnaryFunctionWithCallType) { TYPED_TEST(FunctionMockerTest, MocksUnaryFunctionWithCallType) {
EXPECT_CALL(mock_foo_, CTUnary(Eq(2))) EXPECT_CALL(this->mock_foo_, CTUnary(Eq(2)))
.Times(2) .Times(2)
.WillOnce(Return(true)) .WillOnce(Return(true))
.WillOnce(Return(false)); .WillOnce(Return(false));
EXPECT_TRUE(foo_->CTUnary(2)); EXPECT_TRUE(this->foo_->CTUnary(2));
EXPECT_FALSE(foo_->CTUnary(2)); EXPECT_FALSE(this->foo_->CTUnary(2));
} }
// Tests mocking a decimal function with calltype. // Tests mocking a decimal function with calltype.
TEST_F(MockMethodFunctionMockerTest, MocksDecimalFunctionWithCallType) { TYPED_TEST(FunctionMockerTest, MocksDecimalFunctionWithCallType) {
EXPECT_CALL(mock_foo_, CTDecimal(true, 'a', 0, 0, 1L, A<float>(), EXPECT_CALL(this->mock_foo_, CTDecimal(true, 'a', 0, 0, 1L, A<float>(),
Lt(100), 5U, NULL, "hi")) Lt(100), 5U, NULL, "hi"))
.WillOnce(Return(10)); .WillOnce(Return(10));
EXPECT_EQ(10, foo_->CTDecimal(true, 'a', 0, 0, 1, 0, 0, 5, NULL, "hi")); EXPECT_EQ(10, this->foo_->CTDecimal(true, 'a', 0, 0, 1, 0, 0, 5, NULL, "hi"));
} }
// Tests mocking functions overloaded on the const-ness of this object. // Tests mocking functions overloaded on the const-ness of this object.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionsConstFunctionWithCallType) { TYPED_TEST(FunctionMockerTest, MocksFunctionsConstFunctionWithCallType) {
EXPECT_CALL(Const(mock_foo_), CTConst(_)) EXPECT_CALL(Const(this->mock_foo_), CTConst(_)).WillOnce(Return('a'));
.WillOnce(Return('a'));
EXPECT_EQ('a', Const(*foo_).CTConst(0)); EXPECT_EQ('a', Const(*this->foo_).CTConst(0));
} }
TEST_F(MockMethodFunctionMockerTest, MocksReturnTypeWithCommaAndCallType) { TYPED_TEST(FunctionMockerTest, MocksReturnTypeWithCommaAndCallType) {
const std::map<int, std::string> a_map; const std::map<int, std::string> a_map;
EXPECT_CALL(mock_foo_, CTReturnTypeWithComma()) EXPECT_CALL(this->mock_foo_, CTReturnTypeWithComma()).WillOnce(Return(a_map));
.WillOnce(Return(a_map));
EXPECT_EQ(a_map, mock_foo_.CTReturnTypeWithComma()); EXPECT_EQ(a_map, this->mock_foo_.CTReturnTypeWithComma());
} }
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
TEST(FunctionMockerTest, RefQualified) {
MockFoo mock_foo;
EXPECT_CALL(mock_foo, RefQualifiedConstRef).WillOnce(Return(1));
EXPECT_CALL(std::move(mock_foo), // NOLINT
RefQualifiedConstRefRef)
.WillOnce(Return(2));
EXPECT_CALL(mock_foo, RefQualifiedRef).WillOnce(Return(3));
EXPECT_CALL(std::move(mock_foo), // NOLINT
RefQualifiedRefRef)
.WillOnce(Return(4));
EXPECT_CALL(static_cast<const MockFoo&>(mock_foo), RefQualifiedOverloaded())
.WillOnce(Return(5));
EXPECT_CALL(static_cast<const MockFoo&&>(mock_foo), RefQualifiedOverloaded())
.WillOnce(Return(6));
EXPECT_CALL(static_cast<MockFoo&>(mock_foo), RefQualifiedOverloaded())
.WillOnce(Return(7));
EXPECT_CALL(static_cast<MockFoo&&>(mock_foo), RefQualifiedOverloaded())
.WillOnce(Return(8));
EXPECT_EQ(mock_foo.RefQualifiedConstRef(), 1);
EXPECT_EQ(std::move(mock_foo).RefQualifiedConstRefRef(), 2); // NOLINT
EXPECT_EQ(mock_foo.RefQualifiedRef(), 3);
EXPECT_EQ(std::move(mock_foo).RefQualifiedRefRef(), 4); // NOLINT
EXPECT_EQ(std::cref(mock_foo).get().RefQualifiedOverloaded(), 5);
EXPECT_EQ(std::move(std::cref(mock_foo).get()) // NOLINT
.RefQualifiedOverloaded(),
6);
EXPECT_EQ(mock_foo.RefQualifiedOverloaded(), 7);
EXPECT_EQ(std::move(mock_foo).RefQualifiedOverloaded(), 8); // NOLINT
}
class MockB { class MockB {
public: public:
MockB() {} MockB() {}
MOCK_METHOD(void, DoB, ()); MOCK_METHOD(void, DoB, ());
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB); GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB);
}; };
class LegacyMockB {
public:
LegacyMockB() {}
MOCK_METHOD0(DoB, void());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockB);
};
template <typename T>
class ExpectCallTest : public ::testing::Test {};
using ExpectCallTestTypes = ::testing::Types<MockB, LegacyMockB>;
TYPED_TEST_SUITE(ExpectCallTest, ExpectCallTestTypes);
// Tests that functions with no EXPECT_CALL() rules can be called any // Tests that functions with no EXPECT_CALL() rules can be called any
// number of times. // number of times.
TEST(MockMethodExpectCallTest, UnmentionedFunctionCanBeCalledAnyNumberOfTimes) { TYPED_TEST(ExpectCallTest, UnmentionedFunctionCanBeCalledAnyNumberOfTimes) {
{ { TypeParam b; }
MockB b;
}
{ {
MockB b; TypeParam b;
b.DoB(); b.DoB();
} }
{ {
MockB b; TypeParam b;
b.DoB(); b.DoB();
b.DoB(); b.DoB();
} }
} }
// Tests mocking template interfaces. // Tests mocking template interfaces.
template <typename T> template <typename T>
class StackInterface { class StackInterface {
public: public:
skipping to change at line 418 skipping to change at line 563
MOCK_METHOD(const T&, GetTop, (), (const)); MOCK_METHOD(const T&, GetTop, (), (const));
// Tests that the function return type can contain unprotected comma. // Tests that the function return type can contain unprotected comma.
MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (), ()); MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (), ());
MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (int), (const)); MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (int), (const));
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStack); GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStack);
}; };
template <typename T>
class LegacyMockStack : public StackInterface<T> {
public:
LegacyMockStack() {}
MOCK_METHOD1_T(Push, void(const T& elem));
MOCK_METHOD0_T(Pop, void());
MOCK_CONST_METHOD0_T(GetSize, int()); // NOLINT
MOCK_CONST_METHOD0_T(GetTop, const T&());
// Tests that the function return type can contain unprotected comma.
MOCK_METHOD0_T(ReturnTypeWithComma, std::map<int, int>());
MOCK_CONST_METHOD1_T(ReturnTypeWithComma, std::map<int, int>(int)); // NOLINT
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockStack);
};
template <typename T>
class TemplateMockTest : public ::testing::Test {};
using TemplateMockTestTypes =
::testing::Types<MockStack<int>, LegacyMockStack<int>>;
TYPED_TEST_SUITE(TemplateMockTest, TemplateMockTestTypes);
// Tests that template mock works. // Tests that template mock works.
TEST(MockMethodTemplateMockTest, Works) { TYPED_TEST(TemplateMockTest, Works) {
MockStack<int> mock; TypeParam mock;
EXPECT_CALL(mock, GetSize()) EXPECT_CALL(mock, GetSize())
.WillOnce(Return(0)) .WillOnce(Return(0))
.WillOnce(Return(1)) .WillOnce(Return(1))
.WillOnce(Return(0)); .WillOnce(Return(0));
EXPECT_CALL(mock, Push(_)); EXPECT_CALL(mock, Push(_));
int n = 5; int n = 5;
EXPECT_CALL(mock, GetTop()) EXPECT_CALL(mock, GetTop())
.WillOnce(ReturnRef(n)); .WillOnce(ReturnRef(n));
EXPECT_CALL(mock, Pop()) EXPECT_CALL(mock, Pop())
.Times(AnyNumber()); .Times(AnyNumber());
EXPECT_EQ(0, mock.GetSize()); EXPECT_EQ(0, mock.GetSize());
mock.Push(5); mock.Push(5);
EXPECT_EQ(1, mock.GetSize()); EXPECT_EQ(1, mock.GetSize());
EXPECT_EQ(5, mock.GetTop()); EXPECT_EQ(5, mock.GetTop());
mock.Pop(); mock.Pop();
EXPECT_EQ(0, mock.GetSize()); EXPECT_EQ(0, mock.GetSize());
} }
TEST(MockMethodTemplateMockTest, MethodWithCommaInReturnTypeWorks) { TYPED_TEST(TemplateMockTest, MethodWithCommaInReturnTypeWorks) {
MockStack<int> mock; TypeParam mock;
const std::map<int, int> a_map; const std::map<int, int> a_map;
EXPECT_CALL(mock, ReturnTypeWithComma()) EXPECT_CALL(mock, ReturnTypeWithComma())
.WillOnce(Return(a_map)); .WillOnce(Return(a_map));
EXPECT_CALL(mock, ReturnTypeWithComma(1)) EXPECT_CALL(mock, ReturnTypeWithComma(1))
.WillOnce(Return(a_map)); .WillOnce(Return(a_map));
EXPECT_EQ(a_map, mock.ReturnTypeWithComma()); EXPECT_EQ(a_map, mock.ReturnTypeWithComma());
EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1)); EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1));
} }
skipping to change at line 486 skipping to change at line 655
(Calltype(STDMETHODCALLTYPE), override)); (Calltype(STDMETHODCALLTYPE), override));
MOCK_METHOD(void, Pop, (), (Calltype(STDMETHODCALLTYPE), override)); MOCK_METHOD(void, Pop, (), (Calltype(STDMETHODCALLTYPE), override));
MOCK_METHOD(int, GetSize, (), (Calltype(STDMETHODCALLTYPE), override, const)); MOCK_METHOD(int, GetSize, (), (Calltype(STDMETHODCALLTYPE), override, const));
MOCK_METHOD(const T&, GetTop, (), MOCK_METHOD(const T&, GetTop, (),
(Calltype(STDMETHODCALLTYPE), override, const)); (Calltype(STDMETHODCALLTYPE), override, const));
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType); GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType);
}; };
template <typename T>
class LegacyMockStackWithCallType : public StackInterfaceWithCallType<T> {
public:
LegacyMockStackWithCallType() {}
MOCK_METHOD1_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Push, void(const T& elem));
MOCK_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Pop, void());
MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetSize, int());
MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTop, const T&());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockStackWithCallType);
};
template <typename T>
class TemplateMockTestWithCallType : public ::testing::Test {};
using TemplateMockTestWithCallTypeTypes =
::testing::Types<MockStackWithCallType<int>,
LegacyMockStackWithCallType<int>>;
TYPED_TEST_SUITE(TemplateMockTestWithCallType,
TemplateMockTestWithCallTypeTypes);
// Tests that template mock with calltype works. // Tests that template mock with calltype works.
TEST(MockMethodTemplateMockTestWithCallType, Works) { TYPED_TEST(TemplateMockTestWithCallType, Works) {
MockStackWithCallType<int> mock; TypeParam mock;
EXPECT_CALL(mock, GetSize()) EXPECT_CALL(mock, GetSize())
.WillOnce(Return(0)) .WillOnce(Return(0))
.WillOnce(Return(1)) .WillOnce(Return(1))
.WillOnce(Return(0)); .WillOnce(Return(0));
EXPECT_CALL(mock, Push(_)); EXPECT_CALL(mock, Push(_));
int n = 5; int n = 5;
EXPECT_CALL(mock, GetTop()) EXPECT_CALL(mock, GetTop())
.WillOnce(ReturnRef(n)); .WillOnce(ReturnRef(n));
EXPECT_CALL(mock, Pop()) EXPECT_CALL(mock, Pop())
skipping to change at line 515 skipping to change at line 706
mock.Pop(); mock.Pop();
EXPECT_EQ(0, mock.GetSize()); EXPECT_EQ(0, mock.GetSize());
} }
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#define MY_MOCK_METHODS1_ \ #define MY_MOCK_METHODS1_ \
MOCK_METHOD(void, Overloaded, ()); \ MOCK_METHOD(void, Overloaded, ()); \
MOCK_METHOD(int, Overloaded, (int), (const)); \ MOCK_METHOD(int, Overloaded, (int), (const)); \
MOCK_METHOD(bool, Overloaded, (bool f, int n)) MOCK_METHOD(bool, Overloaded, (bool f, int n))
#define LEGACY_MY_MOCK_METHODS1_ \
MOCK_METHOD0(Overloaded, void()); \
MOCK_CONST_METHOD1(Overloaded, int(int n)); \
MOCK_METHOD2(Overloaded, bool(bool f, int n))
class MockOverloadedOnArgNumber { class MockOverloadedOnArgNumber {
public: public:
MockOverloadedOnArgNumber() {} MockOverloadedOnArgNumber() {}
MY_MOCK_METHODS1_; MY_MOCK_METHODS1_;
private: private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnArgNumber); GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnArgNumber);
}; };
TEST(MockMethodOverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) { class LegacyMockOverloadedOnArgNumber {
MockOverloadedOnArgNumber mock; public:
LegacyMockOverloadedOnArgNumber() {}
LEGACY_MY_MOCK_METHODS1_;
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockOverloadedOnArgNumber);
};
template <typename T>
class OverloadedMockMethodTest : public ::testing::Test {};
using OverloadedMockMethodTestTypes =
::testing::Types<MockOverloadedOnArgNumber,
LegacyMockOverloadedOnArgNumber>;
TYPED_TEST_SUITE(OverloadedMockMethodTest, OverloadedMockMethodTestTypes);
TYPED_TEST(OverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) {
TypeParam mock;
EXPECT_CALL(mock, Overloaded()); EXPECT_CALL(mock, Overloaded());
EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2)); EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
EXPECT_CALL(mock, Overloaded(true, 1)).WillOnce(Return(true)); EXPECT_CALL(mock, Overloaded(true, 1)).WillOnce(Return(true));
mock.Overloaded(); mock.Overloaded();
EXPECT_EQ(2, mock.Overloaded(1)); EXPECT_EQ(2, mock.Overloaded(1));
EXPECT_TRUE(mock.Overloaded(true, 1)); EXPECT_TRUE(mock.Overloaded(true, 1));
} }
#define MY_MOCK_METHODS2_ \ #define MY_MOCK_METHODS2_ \
skipping to change at line 634 skipping to change at line 847
TEST(MockMethodMockFunctionTest, AsStdFunctionWithReferenceParameter) { TEST(MockMethodMockFunctionTest, AsStdFunctionWithReferenceParameter) {
MockFunction<int(int &)> foo; MockFunction<int(int &)> foo;
auto call = [](const std::function<int(int& )> &f, int &i) { auto call = [](const std::function<int(int& )> &f, int &i) {
return f(i); return f(i);
}; };
int i = 42; int i = 42;
EXPECT_CALL(foo, Call(i)).WillOnce(Return(-1)); EXPECT_CALL(foo, Call(i)).WillOnce(Return(-1));
EXPECT_EQ(-1, call(foo.AsStdFunction(), i)); EXPECT_EQ(-1, call(foo.AsStdFunction(), i));
} }
namespace {
template <typename Expected, typename F>
static constexpr bool IsMockFunctionTemplateArgumentDeducedTo(
const internal::MockFunction<F>&) {
return std::is_same<F, Expected>::value;
}
} // namespace
template <typename F>
class MockMethodMockFunctionSignatureTest : public Test {};
using MockMethodMockFunctionSignatureTypes =
Types<void(), int(), void(int), int(int), int(bool, int),
int(bool, char, int, int, int, int, int, char, int, bool)>;
TYPED_TEST_SUITE(MockMethodMockFunctionSignatureTest,
MockMethodMockFunctionSignatureTypes);
TYPED_TEST(MockMethodMockFunctionSignatureTest,
IsMockFunctionTemplateArgumentDeducedForRawSignature) {
using Argument = TypeParam;
MockFunction<Argument> foo;
EXPECT_TRUE(IsMockFunctionTemplateArgumentDeducedTo<TypeParam>(foo));
}
TYPED_TEST(MockMethodMockFunctionSignatureTest,
IsMockFunctionTemplateArgumentDeducedForStdFunction) {
using Argument = std::function<TypeParam>;
MockFunction<Argument> foo;
EXPECT_TRUE(IsMockFunctionTemplateArgumentDeducedTo<TypeParam>(foo));
}
TYPED_TEST(
MockMethodMockFunctionSignatureTest,
IsMockFunctionCallMethodSignatureTheSameForRawSignatureAndStdFunction) {
using ForRawSignature = decltype(&MockFunction<TypeParam>::Call);
using ForStdFunction =
decltype(&MockFunction<std::function<TypeParam>>::Call);
EXPECT_TRUE((std::is_same<ForRawSignature, ForStdFunction>::value));
}
template <typename F>
struct AlternateCallable {
};
TYPED_TEST(MockMethodMockFunctionSignatureTest,
IsMockFunctionTemplateArgumentDeducedForAlternateCallable) {
using Argument = AlternateCallable<TypeParam>;
MockFunction<Argument> foo;
EXPECT_TRUE(IsMockFunctionTemplateArgumentDeducedTo<TypeParam>(foo));
}
TYPED_TEST(
MockMethodMockFunctionSignatureTest,
IsMockFunctionCallMethodSignatureTheSameForAlternateCallable) {
using ForRawSignature = decltype(&MockFunction<TypeParam>::Call);
using ForStdFunction =
decltype(&MockFunction<std::function<TypeParam>>::Call);
EXPECT_TRUE((std::is_same<ForRawSignature, ForStdFunction>::value));
}
struct MockMethodSizes0 { struct MockMethodSizes0 {
MOCK_METHOD(void, func, ()); MOCK_METHOD(void, func, ());
}; };
struct MockMethodSizes1 { struct MockMethodSizes1 {
MOCK_METHOD(void, func, (int)); MOCK_METHOD(void, func, (int));
}; };
struct MockMethodSizes2 { struct MockMethodSizes2 {
MOCK_METHOD(void, func, (int, int)); MOCK_METHOD(void, func, (int, int));
}; };
struct MockMethodSizes3 { struct MockMethodSizes3 {
MOCK_METHOD(void, func, (int, int, int)); MOCK_METHOD(void, func, (int, int, int));
}; };
struct MockMethodSizes4 { struct MockMethodSizes4 {
MOCK_METHOD(void, func, (int, int, int, int)); MOCK_METHOD(void, func, (int, int, int, int));
}; };
struct LegacyMockMethodSizes0 {
MOCK_METHOD0(func, void());
};
struct LegacyMockMethodSizes1 {
MOCK_METHOD1(func, void(int));
};
struct LegacyMockMethodSizes2 {
MOCK_METHOD2(func, void(int, int));
};
struct LegacyMockMethodSizes3 {
MOCK_METHOD3(func, void(int, int, int));
};
struct LegacyMockMethodSizes4 {
MOCK_METHOD4(func, void(int, int, int, int));
};
TEST(MockMethodMockFunctionTest, MockMethodSizeOverhead) { TEST(MockMethodMockFunctionTest, MockMethodSizeOverhead) {
EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes1)); EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes1));
EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes2)); EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes2));
EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes3)); EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes3));
EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes4)); EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes4));
EXPECT_EQ(sizeof(LegacyMockMethodSizes0), sizeof(LegacyMockMethodSizes1));
EXPECT_EQ(sizeof(LegacyMockMethodSizes0), sizeof(LegacyMockMethodSizes2));
EXPECT_EQ(sizeof(LegacyMockMethodSizes0), sizeof(LegacyMockMethodSizes3));
EXPECT_EQ(sizeof(LegacyMockMethodSizes0), sizeof(LegacyMockMethodSizes4));
EXPECT_EQ(sizeof(LegacyMockMethodSizes0), sizeof(MockMethodSizes0));
}
void hasTwoParams(int, int);
void MaybeThrows();
void DoesntThrow() noexcept;
struct MockMethodNoexceptSpecifier {
MOCK_METHOD(void, func1, (), (noexcept));
MOCK_METHOD(void, func2, (), (noexcept(true)));
MOCK_METHOD(void, func3, (), (noexcept(false)));
MOCK_METHOD(void, func4, (), (noexcept(noexcept(MaybeThrows()))));
MOCK_METHOD(void, func5, (), (noexcept(noexcept(DoesntThrow()))));
MOCK_METHOD(void, func6, (), (noexcept(noexcept(DoesntThrow())), const));
MOCK_METHOD(void, func7, (), (const, noexcept(noexcept(DoesntThrow()))));
// Put commas in the noexcept expression
MOCK_METHOD(void, func8, (), (noexcept(noexcept(hasTwoParams(1, 2))), const));
};
TEST(MockMethodMockFunctionTest, NoexceptSpecifierPreserved) {
EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func1()));
EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func2()));
EXPECT_FALSE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func3()));
EXPECT_FALSE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func4()));
EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func5()));
EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func6()));
EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func7()));
EXPECT_EQ(noexcept(std::declval<MockMethodNoexceptSpecifier>().func8()),
noexcept(hasTwoParams(1, 2)));
} }
} // namespace gmock_function_mocker_test } // namespace gmock_function_mocker_test
} // namespace testing } // namespace testing
 End of changes. 66 change blocks. 
96 lines changed or deleted 421 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)