Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
e26a3fa1
Commit
e26a3fa1
authored
Dec 17, 2018
by
Abseil Team
Committed by
Mark Barolak
Dec 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Googletest export
Unifdef c++11-related macros from googletest now that it requires C++11. PiperOrigin-RevId: 225905601
parent
9ab640ce
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
30 additions
and
654 deletions
+30
-654
.gitignore
.gitignore
+0
-56
gmock-actions.h
googlemock/include/gmock/gmock-actions.h
+7
-43
gmock-generated-function-mockers.h
googlemock/include/gmock/gmock-generated-function-mockers.h
+1
-4
gmock-generated-function-mockers.h.pump
...ock/include/gmock/gmock-generated-function-mockers.h.pump
+1
-4
gmock-generated-nice-strict.h
googlemock/include/gmock/gmock-generated-nice-strict.h
+0
-240
gmock-generated-nice-strict.h.pump
googlemock/include/gmock/gmock-generated-nice-strict.h.pump
+0
-22
gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+1
-62
gmock-internal-utils.h
googlemock/include/gmock/internal/gmock-internal-utils.h
+0
-2
gmock-actions_test.cc
googlemock/test/gmock-actions_test.cc
+0
-12
gmock-function-mocker_test.cc
googlemock/test/gmock-function-mocker_test.cc
+0
-2
gmock-generated-function-mockers_test.cc
googlemock/test/gmock-generated-function-mockers_test.cc
+0
-2
gmock-generated-matchers_test.cc
googlemock/test/gmock-generated-matchers_test.cc
+0
-4
gmock-internal-utils_test.cc
googlemock/test/gmock-internal-utils_test.cc
+0
-8
gmock-matchers_test.cc
googlemock/test/gmock-matchers_test.cc
+2
-42
gmock-nice-strict_test.cc
googlemock/test/gmock-nice-strict_test.cc
+7
-20
gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+8
-113
googletest-printers-test.cc
googletest/test/googletest-printers-test.cc
+3
-18
No files found.
.gitignore
deleted
100644 → 0
View file @
9ab640ce
# Ignore CI build directory
build/
xcuserdata
cmake-build-debug/
.idea/
bazel-bin
bazel-genfiles
bazel-googletest
bazel-out
bazel-testlogs
# python
*.pyc
# Visual Studio files
*.sdf
*.opensdf
*.VC.opendb
*.suo
*.user
_ReSharper.Caches/
Win32-Debug/
Win32-Release/
x64-Debug/
x64-Release/
# Ignore autoconf / automake files
Makefile.in
aclocal.m4
configure
build-aux/
autom4te.cache/
googletest/m4/libtool.m4
googletest/m4/ltoptions.m4
googletest/m4/ltsugar.m4
googletest/m4/ltversion.m4
googletest/m4/lt~obsolete.m4
# Ignore generated directories.
googlemock/fused-src/
googletest/fused-src/
# macOS files
.DS_Store
googletest/.DS_Store
googletest/xcode/.DS_Store
# Ignore cmake generated directories and files.
CMakeFiles
CTestTestfile.cmake
Makefile
cmake_install.cmake
googlemock/CMakeFiles
googlemock/CTestTestfile.cmake
googlemock/Makefile
googlemock/cmake_install.cmake
googlemock/gtest
googlemock/include/gmock/gmock-actions.h
View file @
e26a3fa1
...
@@ -42,18 +42,15 @@
...
@@ -42,18 +42,15 @@
#endif
#endif
#include <algorithm>
#include <algorithm>
#include <functional>
#include <memory>
#include <memory>
#include <string>
#include <string>
#include <type_traits>
#include <utility>
#include <utility>
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-port.h"
#include "gmock/internal/gmock-port.h"
#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h.
#include <functional>
#include <type_traits>
#endif // GTEST_LANG_CXX11
#ifdef _MSC_VER
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(push)
# pragma warning(disable:4100)
# pragma warning(disable:4100)
...
@@ -105,7 +102,6 @@ struct BuiltInDefaultValueGetter<T, false> {
...
@@ -105,7 +102,6 @@ struct BuiltInDefaultValueGetter<T, false> {
template
<
typename
T
>
template
<
typename
T
>
class
BuiltInDefaultValue
{
class
BuiltInDefaultValue
{
public
:
public
:
#if GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value.
// This function returns true iff type T has a built-in default value.
static
bool
Exists
()
{
static
bool
Exists
()
{
return
::
std
::
is_default_constructible
<
T
>::
value
;
return
::
std
::
is_default_constructible
<
T
>::
value
;
...
@@ -115,18 +111,6 @@ class BuiltInDefaultValue {
...
@@ -115,18 +111,6 @@ class BuiltInDefaultValue {
return
BuiltInDefaultValueGetter
<
return
BuiltInDefaultValueGetter
<
T
,
::
std
::
is_default_constructible
<
T
>::
value
>::
Get
();
T
,
::
std
::
is_default_constructible
<
T
>::
value
>::
Get
();
}
}
#else // GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value.
static
bool
Exists
()
{
return
false
;
}
static
T
Get
()
{
return
BuiltInDefaultValueGetter
<
T
,
false
>::
Get
();
}
#endif // GTEST_LANG_CXX11
};
};
// This partial specialization says that we use the same built-in
// This partial specialization says that we use the same built-in
...
@@ -366,7 +350,6 @@ class Action {
...
@@ -366,7 +350,6 @@ class Action {
// STL containers.
// STL containers.
Action
()
{}
Action
()
{}
#if GTEST_LANG_CXX11
// Construct an Action from a specified callable.
// Construct an Action from a specified callable.
// This cannot take std::function directly, because then Action would not be
// This cannot take std::function directly, because then Action would not be
// directly constructible from lambda (it would require two conversions).
// directly constructible from lambda (it would require two conversions).
...
@@ -374,7 +357,6 @@ class Action {
...
@@ -374,7 +357,6 @@ class Action {
typename
=
typename
::
std
::
enable_if
<
typename
=
typename
::
std
::
enable_if
<
::
std
::
is_constructible
<::
std
::
function
<
F
>
,
G
>::
value
>::
type
>
::
std
::
is_constructible
<::
std
::
function
<
F
>
,
G
>::
value
>::
type
>
Action
(
G
&&
fun
)
:
fun_
(
::
std
::
forward
<
G
>
(
fun
))
{}
// NOLINT
Action
(
G
&&
fun
)
:
fun_
(
::
std
::
forward
<
G
>
(
fun
))
{}
// NOLINT
#endif
// Constructs an Action from its implementation.
// Constructs an Action from its implementation.
explicit
Action
(
ActionInterface
<
F
>*
impl
)
:
impl_
(
impl
)
{}
explicit
Action
(
ActionInterface
<
F
>*
impl
)
:
impl_
(
impl
)
{}
...
@@ -388,11 +370,7 @@ class Action {
...
@@ -388,11 +370,7 @@ class Action {
// Returns true iff this is the DoDefault() action.
// Returns true iff this is the DoDefault() action.
bool
IsDoDefault
()
const
{
bool
IsDoDefault
()
const
{
#if GTEST_LANG_CXX11
return
impl_
==
nullptr
&&
fun_
==
nullptr
;
return
impl_
==
nullptr
&&
fun_
==
nullptr
;
#else
return
impl_
==
NULL
;
#endif
}
}
// Performs the action. Note that this method is const even though
// Performs the action. Note that this method is const even though
...
@@ -405,11 +383,9 @@ class Action {
...
@@ -405,11 +383,9 @@ class Action {
if
(
IsDoDefault
())
{
if
(
IsDoDefault
())
{
internal
::
IllegalDoDefault
(
__FILE__
,
__LINE__
);
internal
::
IllegalDoDefault
(
__FILE__
,
__LINE__
);
}
}
#if GTEST_LANG_CXX11
if
(
fun_
!=
nullptr
)
{
if
(
fun_
!=
nullptr
)
{
return
internal
::
Apply
(
fun_
,
::
std
::
move
(
args
));
return
internal
::
Apply
(
fun_
,
::
std
::
move
(
args
));
}
}
#endif
return
impl_
->
Perform
(
args
);
return
impl_
->
Perform
(
args
);
}
}
...
@@ -420,16 +396,12 @@ class Action {
...
@@ -420,16 +396,12 @@ class Action {
template
<
typename
G
>
template
<
typename
G
>
friend
class
Action
;
friend
class
Action
;
// In C++11, Action can be implemented either as a generic functor (through
// Action can be implemented either as a generic functor (via std::function),
// std::function), or legacy ActionInterface. In C++98, only ActionInterface
// or legacy ActionInterface. The invariant is that at most one of fun_ and
// is available. The invariants are as follows:
// impl_ may be nonnull; both are null iff this is the default action.
// * in C++98, impl_ is null iff this is the default action
// FIXME: Fold the ActionInterface into std::function.
// * in C++11, at most one of fun_ & impl_ may be nonnull; both are null iff
// this is the default action
#if GTEST_LANG_CXX11
::
std
::
function
<
F
>
fun_
;
::
std
::
function
<
F
>
fun_
;
#endif
::
std
::
shared_ptr
<
ActionInterface
<
F
>>
impl_
;
std
::
shared_ptr
<
ActionInterface
<
F
>>
impl_
;
};
};
// The PolymorphicAction class template makes it easy to implement a
// The PolymorphicAction class template makes it easy to implement a
...
@@ -662,13 +634,7 @@ class ReturnNullAction {
...
@@ -662,13 +634,7 @@ class ReturnNullAction {
// pointer type on compile time.
// pointer type on compile time.
template
<
typename
Result
,
typename
ArgumentTuple
>
template
<
typename
Result
,
typename
ArgumentTuple
>
static
Result
Perform
(
const
ArgumentTuple
&
)
{
static
Result
Perform
(
const
ArgumentTuple
&
)
{
#if GTEST_LANG_CXX11
return
nullptr
;
return
nullptr
;
#else
GTEST_COMPILE_ASSERT_
(
internal
::
is_pointer
<
Result
>::
value
,
ReturnNull_can_be_used_to_return_a_pointer_only
);
return
NULL
;
#endif // GTEST_LANG_CXX11
}
}
};
};
...
@@ -1108,9 +1074,7 @@ template <typename To>
...
@@ -1108,9 +1074,7 @@ template <typename To>
template
<
typename
From
>
template
<
typename
From
>
Action
<
To
>::
Action
(
const
Action
<
From
>&
from
)
Action
<
To
>::
Action
(
const
Action
<
From
>&
from
)
:
:
#if GTEST_LANG_CXX11
fun_
(
from
.
fun_
),
fun_
(
from
.
fun_
),
#endif
impl_
(
from
.
impl_
==
nullptr
impl_
(
from
.
impl_
==
nullptr
?
nullptr
?
nullptr
:
new
internal
::
ActionAdaptor
<
To
,
From
>
(
from
))
{
:
new
internal
::
ActionAdaptor
<
To
,
From
>
(
from
))
{
...
...
googlemock/include/gmock/gmock-generated-function-mockers.h
View file @
e26a3fa1
...
@@ -41,15 +41,12 @@
...
@@ -41,15 +41,12 @@
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#include <functional>
#include <utility>
#include <utility>
#include "gmock/gmock-spec-builders.h"
#include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-internal-utils.h"
#if GTEST_HAS_STD_FUNCTION_
# include <functional>
#endif
namespace
testing
{
namespace
testing
{
namespace
internal
{
namespace
internal
{
// Removes the given pointer; this is a helper for the expectation setter method
// Removes the given pointer; this is a helper for the expectation setter method
...
...
googlemock/include/gmock/gmock-generated-function-mockers.h.pump
View file @
e26a3fa1
...
@@ -42,15 +42,12 @@ $var n = 10 $$ The maximum arity we support.
...
@@ -42,15 +42,12 @@ $var n = 10 $$ The maximum arity we support.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#include <functional>
#include <utility>
#include <utility>
#include "gmock/gmock-spec-builders.h"
#include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-internal-utils.h"
#if GTEST_HAS_STD_FUNCTION_
# include <functional>
#endif
namespace
testing
{
namespace
testing
{
namespace
internal
{
namespace
internal
{
...
...
googlemock/include/gmock/gmock-generated-nice-strict.h
View file @
e26a3fa1
...
@@ -80,7 +80,6 @@ class NiceMock : public MockClass {
...
@@ -80,7 +80,6 @@ class NiceMock : public MockClass {
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// tests rely on the fact that current implementation reexports protected
...
@@ -101,85 +100,6 @@ class NiceMock : public MockClass {
...
@@ -101,85 +100,6 @@ class NiceMock : public MockClass {
::
testing
::
Mock
::
AllowUninterestingCalls
(
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template
<
typename
A1
>
explicit
NiceMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
)
:
MockClass
(
a1
,
a2
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
)
:
MockClass
(
a1
,
a2
,
a3
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
,
const
A10
&
a10
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
,
a10
)
{
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
#endif // GTEST_LANG_CXX11
~
NiceMock
()
{
// NOLINT
~
NiceMock
()
{
// NOLINT
::
testing
::
Mock
::
UnregisterCallReaction
(
::
testing
::
Mock
::
UnregisterCallReaction
(
...
@@ -198,7 +118,6 @@ class NaggyMock : public MockClass {
...
@@ -198,7 +118,6 @@ class NaggyMock : public MockClass {
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// tests rely on the fact that current implementation reexports protected
...
@@ -219,85 +138,6 @@ class NaggyMock : public MockClass {
...
@@ -219,85 +138,6 @@ class NaggyMock : public MockClass {
::
testing
::
Mock
::
WarnUninterestingCalls
(
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template
<
typename
A1
>
explicit
NaggyMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
)
:
MockClass
(
a1
,
a2
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
)
:
MockClass
(
a1
,
a2
,
a3
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
>
NaggyMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
,
const
A10
&
a10
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
,
a10
)
{
::
testing
::
Mock
::
WarnUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
#endif // GTEST_LANG_CXX11
~
NaggyMock
()
{
// NOLINT
~
NaggyMock
()
{
// NOLINT
::
testing
::
Mock
::
UnregisterCallReaction
(
::
testing
::
Mock
::
UnregisterCallReaction
(
...
@@ -316,7 +156,6 @@ class StrictMock : public MockClass {
...
@@ -316,7 +156,6 @@ class StrictMock : public MockClass {
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// tests rely on the fact that current implementation reexports protected
...
@@ -337,85 +176,6 @@ class StrictMock : public MockClass {
...
@@ -337,85 +176,6 @@ class StrictMock : public MockClass {
::
testing
::
Mock
::
FailUninterestingCalls
(
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template
<
typename
A1
>
explicit
StrictMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
)
:
MockClass
(
a1
,
a2
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
)
:
MockClass
(
a1
,
a2
,
a3
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
,
typename
A7
,
typename
A8
,
typename
A9
,
typename
A10
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
,
const
A10
&
a10
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
,
a10
)
{
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
#endif // GTEST_LANG_CXX11
~
StrictMock
()
{
// NOLINT
~
StrictMock
()
{
// NOLINT
::
testing
::
Mock
::
UnregisterCallReaction
(
::
testing
::
Mock
::
UnregisterCallReaction
(
...
...
googlemock/include/gmock/gmock-generated-nice-strict.h.pump
View file @
e26a3fa1
...
@@ -92,7 +92,6 @@ class $clazz : public MockClass {
...
@@ -92,7 +92,6 @@ class $clazz : public MockClass {
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// tests rely on the fact that current implementation reexports protected
...
@@ -113,27 +112,6 @@ class $clazz : public MockClass {
...
@@ -113,27 +112,6 @@ class $clazz : public MockClass {
::
testing
::
Mock
::
$
method
(
::
testing
::
Mock
::
$
method
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template
<
typename
A1
>
explicit
$
clazz
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
::
testing
::
Mock
::
$
method
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
$
range
i
2.
.
n
$
for
i
[[
$
range
j
1.
.
i
template
<
$
for
j
,
[[
typename
A
$
j
]]
>
$
clazz
(
$
for
j
,
[[
const
A
$
j
&
a
$
j
]])
:
MockClass
(
$
for
j
,
[[
a
$
j
]])
{
::
testing
::
Mock
::
$
method
(
internal
::
ImplicitCast_
<
MockClass
*>
(
this
));
}
]]
#endif // GTEST_LANG_CXX11
~
$
clazz
()
{
// NOLINT
~
$
clazz
()
{
// NOLINT
::
testing
::
Mock
::
UnregisterCallReaction
(
::
testing
::
Mock
::
UnregisterCallReaction
(
...
...
googlemock/include/gmock/gmock-matchers.h
View file @
e26a3fa1
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
#include <math.h>
#include <math.h>
#include <algorithm>
#include <algorithm>
#include <initializer_list>
#include <iterator>
#include <iterator>
#include <limits>
#include <limits>
#include <memory>
#include <memory>
...
@@ -57,10 +58,6 @@
...
@@ -57,10 +58,6 @@
#include "gmock/internal/gmock-port.h"
#include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#if GTEST_HAS_STD_INITIALIZER_LIST_
# include <initializer_list> // NOLINT -- must be after gtest.h
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4251
5046
/* class A needs to have dll-interface to be used by clients of
4251
5046
/* class A needs to have dll-interface to be used by clients of
class B */
class B */
...
@@ -194,7 +191,6 @@ class MatcherCastImpl<T, Matcher<U> > {
...
@@ -194,7 +191,6 @@ class MatcherCastImpl<T, Matcher<U> > {
// We delegate the matching logic to the source matcher.
// We delegate the matching logic to the source matcher.
bool
MatchAndExplain
(
T
x
,
MatchResultListener
*
listener
)
const
override
{
bool
MatchAndExplain
(
T
x
,
MatchResultListener
*
listener
)
const
override
{
#if GTEST_LANG_CXX11
using
FromType
=
typename
std
::
remove_cv
<
typename
std
::
remove_pointer
<
using
FromType
=
typename
std
::
remove_cv
<
typename
std
::
remove_pointer
<
typename
std
::
remove_reference
<
T
>::
type
>::
type
>::
type
;
typename
std
::
remove_reference
<
T
>::
type
>::
type
>::
type
;
using
ToType
=
typename
std
::
remove_cv
<
typename
std
::
remove_pointer
<
using
ToType
=
typename
std
::
remove_cv
<
typename
std
::
remove_pointer
<
...
@@ -208,7 +204,6 @@ class MatcherCastImpl<T, Matcher<U> > {
...
@@ -208,7 +204,6 @@ class MatcherCastImpl<T, Matcher<U> > {
std
::
is_same
<
FromType
,
ToType
>::
value
||
std
::
is_same
<
FromType
,
ToType
>::
value
||
!
std
::
is_base_of
<
FromType
,
ToType
>::
value
,
!
std
::
is_base_of
<
FromType
,
ToType
>::
value
,
"Can't implicitly convert from <base> to <derived>"
);
"Can't implicitly convert from <base> to <derived>"
);
#endif // GTEST_LANG_CXX11
return
source_matcher_
.
MatchAndExplain
(
static_cast
<
U
>
(
x
),
listener
);
return
source_matcher_
.
MatchAndExplain
(
static_cast
<
U
>
(
x
),
listener
);
}
}
...
@@ -524,11 +519,7 @@ class IsNullMatcher {
...
@@ -524,11 +519,7 @@ class IsNullMatcher {
template
<
typename
Pointer
>
template
<
typename
Pointer
>
bool
MatchAndExplain
(
const
Pointer
&
p
,
bool
MatchAndExplain
(
const
Pointer
&
p
,
MatchResultListener
*
/* listener */
)
const
{
MatchResultListener
*
/* listener */
)
const
{
#if GTEST_LANG_CXX11
return
p
==
nullptr
;
return
p
==
nullptr
;
#else // GTEST_LANG_CXX11
return
GetRawPointer
(
p
)
==
NULL
;
#endif // GTEST_LANG_CXX11
}
}
void
DescribeTo
(
::
std
::
ostream
*
os
)
const
{
*
os
<<
"is NULL"
;
}
void
DescribeTo
(
::
std
::
ostream
*
os
)
const
{
*
os
<<
"is NULL"
;
}
...
@@ -544,11 +535,7 @@ class NotNullMatcher {
...
@@ -544,11 +535,7 @@ class NotNullMatcher {
template
<
typename
Pointer
>
template
<
typename
Pointer
>
bool
MatchAndExplain
(
const
Pointer
&
p
,
bool
MatchAndExplain
(
const
Pointer
&
p
,
MatchResultListener
*
/* listener */
)
const
{
MatchResultListener
*
/* listener */
)
const
{
#if GTEST_LANG_CXX11
return
p
!=
nullptr
;
return
p
!=
nullptr
;
#else // GTEST_LANG_CXX11
return
GetRawPointer
(
p
)
!=
NULL
;
#endif // GTEST_LANG_CXX11
}
}
void
DescribeTo
(
::
std
::
ostream
*
os
)
const
{
*
os
<<
"isn't NULL"
;
}
void
DescribeTo
(
::
std
::
ostream
*
os
)
const
{
*
os
<<
"isn't NULL"
;
}
...
@@ -1845,14 +1832,8 @@ struct CallableTraits {
...
@@ -1845,14 +1832,8 @@ struct CallableTraits {
static
void
CheckIsValid
(
Functor
/* functor */
)
{}
static
void
CheckIsValid
(
Functor
/* functor */
)
{}
#if GTEST_LANG_CXX11
template
<
typename
T
>
template
<
typename
T
>
static
auto
Invoke
(
Functor
f
,
T
arg
)
->
decltype
(
f
(
arg
))
{
return
f
(
arg
);
}
static
auto
Invoke
(
Functor
f
,
T
arg
)
->
decltype
(
f
(
arg
))
{
return
f
(
arg
);
}
#else
typedef
typename
Functor
::
result_type
ResultType
;
template
<
typename
T
>
static
ResultType
Invoke
(
Functor
f
,
T
arg
)
{
return
f
(
arg
);
}
#endif
};
};
// Specialization for function pointers.
// Specialization for function pointers.
...
@@ -1891,12 +1872,8 @@ class ResultOfMatcher {
...
@@ -1891,12 +1872,8 @@ class ResultOfMatcher {
template
<
typename
T
>
template
<
typename
T
>
class
Impl
:
public
MatcherInterface
<
T
>
{
class
Impl
:
public
MatcherInterface
<
T
>
{
#if GTEST_LANG_CXX11
using
ResultType
=
decltype
(
CallableTraits
<
Callable
>::
template
Invoke
<
T
>
(
using
ResultType
=
decltype
(
CallableTraits
<
Callable
>::
template
Invoke
<
T
>
(
std
::
declval
<
CallableStorageType
>
(),
std
::
declval
<
T
>
()));
std
::
declval
<
CallableStorageType
>
(),
std
::
declval
<
T
>
()));
#else
typedef
typename
CallableTraits
<
Callable
>::
ResultType
ResultType
;
#endif
public
:
public
:
template
<
typename
M
>
template
<
typename
M
>
...
@@ -2027,13 +2004,9 @@ class BeginEndDistanceIsMatcher {
...
@@ -2027,13 +2004,9 @@ class BeginEndDistanceIsMatcher {
bool
MatchAndExplain
(
Container
container
,
bool
MatchAndExplain
(
Container
container
,
MatchResultListener
*
listener
)
const
override
{
MatchResultListener
*
listener
)
const
override
{
#if GTEST_HAS_STD_BEGIN_AND_END_
using
std
::
begin
;
using
std
::
begin
;
using
std
::
end
;
using
std
::
end
;
DistanceType
distance
=
std
::
distance
(
begin
(
container
),
end
(
container
));
DistanceType
distance
=
std
::
distance
(
begin
(
container
),
end
(
container
));
#else
DistanceType
distance
=
std
::
distance
(
container
.
begin
(),
container
.
end
());
#endif
StringMatchResultListener
distance_listener
;
StringMatchResultListener
distance_listener
;
const
bool
result
=
const
bool
result
=
distance_matcher_
.
MatchAndExplain
(
distance
,
&
distance_listener
);
distance_matcher_
.
MatchAndExplain
(
distance
,
&
distance_listener
);
...
@@ -2497,7 +2470,6 @@ struct Rank1 {};
...
@@ -2497,7 +2470,6 @@ struct Rank1 {};
struct
Rank0
:
Rank1
{};
struct
Rank0
:
Rank1
{};
namespace
pair_getters
{
namespace
pair_getters
{
#if GTEST_LANG_CXX11
using
std
::
get
;
using
std
::
get
;
template
<
typename
T
>
template
<
typename
T
>
auto
First
(
T
&
x
,
Rank1
)
->
decltype
(
get
<
0
>
(
x
))
{
// NOLINT
auto
First
(
T
&
x
,
Rank1
)
->
decltype
(
get
<
0
>
(
x
))
{
// NOLINT
...
@@ -2516,25 +2488,6 @@ template <typename T>
...
@@ -2516,25 +2488,6 @@ template <typename T>
auto
Second
(
T
&
x
,
Rank0
)
->
decltype
((
x
.
second
))
{
// NOLINT
auto
Second
(
T
&
x
,
Rank0
)
->
decltype
((
x
.
second
))
{
// NOLINT
return
x
.
second
;
return
x
.
second
;
}
}
#else
template
<
typename
T
>
typename
T
::
first_type
&
First
(
T
&
x
,
Rank0
)
{
// NOLINT
return
x
.
first
;
}
template
<
typename
T
>
const
typename
T
::
first_type
&
First
(
const
T
&
x
,
Rank0
)
{
return
x
.
first
;
}
template
<
typename
T
>
typename
T
::
second_type
&
Second
(
T
&
x
,
Rank0
)
{
// NOLINT
return
x
.
second
;
}
template
<
typename
T
>
const
typename
T
::
second_type
&
Second
(
const
T
&
x
,
Rank0
)
{
return
x
.
second
;
}
#endif // GTEST_LANG_CXX11
}
// namespace pair_getters
}
// namespace pair_getters
// Implements Key(inner_matcher) for the given argument pair type.
// Implements Key(inner_matcher) for the given argument pair type.
...
@@ -3547,13 +3500,11 @@ ElementsAreArray(const Container& container) {
...
@@ -3547,13 +3500,11 @@ ElementsAreArray(const Container& container) {
return
ElementsAreArray
(
container
.
begin
(),
container
.
end
());
return
ElementsAreArray
(
container
.
begin
(),
container
.
end
());
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
template
<
typename
T
>
template
<
typename
T
>
inline
internal
::
ElementsAreArrayMatcher
<
T
>
inline
internal
::
ElementsAreArrayMatcher
<
T
>
ElementsAreArray
(
::
std
::
initializer_list
<
T
>
xs
)
{
ElementsAreArray
(
::
std
::
initializer_list
<
T
>
xs
)
{
return
ElementsAreArray
(
xs
.
begin
(),
xs
.
end
());
return
ElementsAreArray
(
xs
.
begin
(),
xs
.
end
());
}
}
#endif
// UnorderedElementsAreArray(iterator_first, iterator_last)
// UnorderedElementsAreArray(iterator_first, iterator_last)
// UnorderedElementsAreArray(pointer, count)
// UnorderedElementsAreArray(pointer, count)
...
@@ -3596,13 +3547,11 @@ UnorderedElementsAreArray(const Container& container) {
...
@@ -3596,13 +3547,11 @@ UnorderedElementsAreArray(const Container& container) {
return
UnorderedElementsAreArray
(
container
.
begin
(),
container
.
end
());
return
UnorderedElementsAreArray
(
container
.
begin
(),
container
.
end
());
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
template
<
typename
T
>
template
<
typename
T
>
inline
internal
::
UnorderedElementsAreArrayMatcher
<
T
>
inline
internal
::
UnorderedElementsAreArrayMatcher
<
T
>
UnorderedElementsAreArray
(
::
std
::
initializer_list
<
T
>
xs
)
{
UnorderedElementsAreArray
(
::
std
::
initializer_list
<
T
>
xs
)
{
return
UnorderedElementsAreArray
(
xs
.
begin
(),
xs
.
end
());
return
UnorderedElementsAreArray
(
xs
.
begin
(),
xs
.
end
());
}
}
#endif
// _ is a matcher that matches anything of any type.
// _ is a matcher that matches anything of any type.
//
//
...
@@ -3790,7 +3739,6 @@ Property(const std::string& property_name,
...
@@ -3790,7 +3739,6 @@ Property(const std::string& property_name,
property_name
,
property
,
MatcherCast
<
const
PropertyType
&>
(
matcher
)));
property_name
,
property
,
MatcherCast
<
const
PropertyType
&>
(
matcher
)));
}
}
#if GTEST_LANG_CXX11
// The same as above but for reference-qualified member functions.
// The same as above but for reference-qualified member functions.
template
<
typename
Class
,
typename
PropertyType
,
typename
PropertyMatcher
>
template
<
typename
Class
,
typename
PropertyType
,
typename
PropertyMatcher
>
inline
PolymorphicMatcher
<
internal
::
PropertyMatcher
<
inline
PolymorphicMatcher
<
internal
::
PropertyMatcher
<
...
@@ -3815,7 +3763,6 @@ Property(const std::string& property_name,
...
@@ -3815,7 +3763,6 @@ Property(const std::string& property_name,
PropertyType
(
Class
::*
)()
const
&>
(
PropertyType
(
Class
::*
)()
const
&>
(
property_name
,
property
,
MatcherCast
<
const
PropertyType
&>
(
matcher
)));
property_name
,
property
,
MatcherCast
<
const
PropertyType
&>
(
matcher
)));
}
}
#endif
// Creates a matcher that matches an object iff the result of applying
// Creates a matcher that matches an object iff the result of applying
// a callable to x matches 'matcher'.
// a callable to x matches 'matcher'.
...
@@ -4107,7 +4054,6 @@ Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
...
@@ -4107,7 +4054,6 @@ Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
tuple_matcher
,
rhs
);
tuple_matcher
,
rhs
);
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
// Supports the Pointwise(m, {a, b, c}) syntax.
// Supports the Pointwise(m, {a, b, c}) syntax.
template
<
typename
TupleMatcher
,
typename
T
>
template
<
typename
TupleMatcher
,
typename
T
>
...
@@ -4116,7 +4062,6 @@ inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise(
...
@@ -4116,7 +4062,6 @@ inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise(
return
Pointwise
(
tuple_matcher
,
std
::
vector
<
T
>
(
rhs
));
return
Pointwise
(
tuple_matcher
,
std
::
vector
<
T
>
(
rhs
));
}
}
#endif // GTEST_HAS_STD_INITIALIZER_LIST_
// UnorderedPointwise(pair_matcher, rhs) matches an STL-style
// UnorderedPointwise(pair_matcher, rhs) matches an STL-style
// container or a native array that contains the same number of
// container or a native array that contains the same number of
...
@@ -4161,7 +4106,6 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
...
@@ -4161,7 +4106,6 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
return
UnorderedElementsAreArray
(
matchers
);
return
UnorderedElementsAreArray
(
matchers
);
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
// Supports the UnorderedPointwise(m, {a, b, c}) syntax.
// Supports the UnorderedPointwise(m, {a, b, c}) syntax.
template
<
typename
Tuple2Matcher
,
typename
T
>
template
<
typename
Tuple2Matcher
,
typename
T
>
...
@@ -4172,7 +4116,6 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
...
@@ -4172,7 +4116,6 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
return
UnorderedPointwise
(
tuple2_matcher
,
std
::
vector
<
T
>
(
rhs
));
return
UnorderedPointwise
(
tuple2_matcher
,
std
::
vector
<
T
>
(
rhs
));
}
}
#endif // GTEST_HAS_STD_INITIALIZER_LIST_
// Matches an STL-style container or a native array that contains at
// Matches an STL-style container or a native array that contains at
// least one element matching the given value or matcher.
// least one element matching the given value or matcher.
...
@@ -4252,13 +4195,11 @@ IsSupersetOf(const Container& container) {
...
@@ -4252,13 +4195,11 @@ IsSupersetOf(const Container& container) {
return
IsSupersetOf
(
container
.
begin
(),
container
.
end
());
return
IsSupersetOf
(
container
.
begin
(),
container
.
end
());
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
template
<
typename
T
>
template
<
typename
T
>
inline
internal
::
UnorderedElementsAreArrayMatcher
<
T
>
IsSupersetOf
(
inline
internal
::
UnorderedElementsAreArrayMatcher
<
T
>
IsSupersetOf
(
::
std
::
initializer_list
<
T
>
xs
)
{
::
std
::
initializer_list
<
T
>
xs
)
{
return
IsSupersetOf
(
xs
.
begin
(),
xs
.
end
());
return
IsSupersetOf
(
xs
.
begin
(),
xs
.
end
());
}
}
#endif
// IsSubsetOf(iterator_first, iterator_last)
// IsSubsetOf(iterator_first, iterator_last)
// IsSubsetOf(pointer, count)
// IsSubsetOf(pointer, count)
...
@@ -4311,13 +4252,11 @@ IsSubsetOf(const Container& container) {
...
@@ -4311,13 +4252,11 @@ IsSubsetOf(const Container& container) {
return
IsSubsetOf
(
container
.
begin
(),
container
.
end
());
return
IsSubsetOf
(
container
.
begin
(),
container
.
end
());
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
template
<
typename
T
>
template
<
typename
T
>
inline
internal
::
UnorderedElementsAreArrayMatcher
<
T
>
IsSubsetOf
(
inline
internal
::
UnorderedElementsAreArrayMatcher
<
T
>
IsSubsetOf
(
::
std
::
initializer_list
<
T
>
xs
)
{
::
std
::
initializer_list
<
T
>
xs
)
{
return
IsSubsetOf
(
xs
.
begin
(),
xs
.
end
());
return
IsSubsetOf
(
xs
.
begin
(),
xs
.
end
());
}
}
#endif
// Matches an STL-style container or a native array that contains only
// Matches an STL-style container or a native array that contains only
// elements matching the given value or matcher.
// elements matching the given value or matcher.
...
...
googlemock/include/gmock/internal/gmock-internal-utils.h
View file @
e26a3fa1
...
@@ -528,7 +528,6 @@ struct BooleanConstant {};
...
@@ -528,7 +528,6 @@ struct BooleanConstant {};
// reduce code size.
// reduce code size.
GTEST_API_
void
IllegalDoDefault
(
const
char
*
file
,
int
line
);
GTEST_API_
void
IllegalDoDefault
(
const
char
*
file
,
int
line
);
#if GTEST_LANG_CXX11
// Helper types for Apply() below.
// Helper types for Apply() below.
template
<
size_t
...
Is
>
struct
int_pack
{
typedef
int_pack
type
;
};
template
<
size_t
...
Is
>
struct
int_pack
{
typedef
int_pack
type
;
};
...
@@ -554,7 +553,6 @@ auto Apply(F&& f, Tuple&& args)
...
@@ -554,7 +553,6 @@ auto Apply(F&& f, Tuple&& args)
return
ApplyImpl
(
std
::
forward
<
F
>
(
f
),
std
::
forward
<
Tuple
>
(
args
),
return
ApplyImpl
(
std
::
forward
<
F
>
(
f
),
std
::
forward
<
Tuple
>
(
args
),
make_int_pack
<
std
::
tuple_size
<
Tuple
>::
value
>
());
make_int_pack
<
std
::
tuple_size
<
Tuple
>::
value
>
());
}
}
#endif
#ifdef _MSC_VER
#ifdef _MSC_VER
...
...
googlemock/test/gmock-actions_test.cc
View file @
e26a3fa1
...
@@ -220,7 +220,6 @@ class MyNonDefaultConstructible {
...
@@ -220,7 +220,6 @@ class MyNonDefaultConstructible {
int
value_
;
int
value_
;
};
};
#if GTEST_LANG_CXX11
TEST
(
BuiltInDefaultValueTest
,
ExistsForDefaultConstructibleType
)
{
TEST
(
BuiltInDefaultValueTest
,
ExistsForDefaultConstructibleType
)
{
EXPECT_TRUE
(
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Exists
());
EXPECT_TRUE
(
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Exists
());
...
@@ -230,7 +229,6 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
...
@@ -230,7 +229,6 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
EXPECT_EQ
(
42
,
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Get
().
value
());
EXPECT_EQ
(
42
,
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Get
().
value
());
}
}
#endif // GTEST_LANG_CXX11
TEST
(
BuiltInDefaultValueTest
,
DoesNotExistForNonDefaultConstructibleType
)
{
TEST
(
BuiltInDefaultValueTest
,
DoesNotExistForNonDefaultConstructibleType
)
{
EXPECT_FALSE
(
BuiltInDefaultValue
<
MyNonDefaultConstructible
>::
Exists
());
EXPECT_FALSE
(
BuiltInDefaultValue
<
MyNonDefaultConstructible
>::
Exists
());
...
@@ -300,7 +298,6 @@ TEST(DefaultValueDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
...
@@ -300,7 +298,6 @@ TEST(DefaultValueDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
},
""
);
},
""
);
}
}
#if GTEST_HAS_STD_UNIQUE_PTR_
TEST
(
DefaultValueTest
,
GetWorksForMoveOnlyIfSet
)
{
TEST
(
DefaultValueTest
,
GetWorksForMoveOnlyIfSet
)
{
EXPECT_TRUE
(
DefaultValue
<
std
::
unique_ptr
<
int
>>::
Exists
());
EXPECT_TRUE
(
DefaultValue
<
std
::
unique_ptr
<
int
>>::
Exists
());
EXPECT_TRUE
(
DefaultValue
<
std
::
unique_ptr
<
int
>>::
Get
()
==
nullptr
);
EXPECT_TRUE
(
DefaultValue
<
std
::
unique_ptr
<
int
>>::
Get
()
==
nullptr
);
...
@@ -311,7 +308,6 @@ TEST(DefaultValueTest, GetWorksForMoveOnlyIfSet) {
...
@@ -311,7 +308,6 @@ TEST(DefaultValueTest, GetWorksForMoveOnlyIfSet) {
std
::
unique_ptr
<
int
>
i
=
DefaultValue
<
std
::
unique_ptr
<
int
>>::
Get
();
std
::
unique_ptr
<
int
>
i
=
DefaultValue
<
std
::
unique_ptr
<
int
>>::
Get
();
EXPECT_EQ
(
42
,
*
i
);
EXPECT_EQ
(
42
,
*
i
);
}
}
#endif // GTEST_HAS_STD_UNIQUE_PTR_
// Tests that DefaultValue<void>::Get() returns void.
// Tests that DefaultValue<void>::Get() returns void.
TEST
(
DefaultValueTest
,
GetWorksForVoid
)
{
TEST
(
DefaultValueTest
,
GetWorksForVoid
)
{
...
@@ -643,7 +639,6 @@ TEST(ReturnNullTest, WorksInPointerReturningFunction) {
...
@@ -643,7 +639,6 @@ TEST(ReturnNullTest, WorksInPointerReturningFunction) {
EXPECT_TRUE
(
a2
.
Perform
(
std
::
make_tuple
(
true
))
==
nullptr
);
EXPECT_TRUE
(
a2
.
Perform
(
std
::
make_tuple
(
true
))
==
nullptr
);
}
}
#if GTEST_HAS_STD_UNIQUE_PTR_
// Tests that ReturnNull() returns NULL for shared_ptr and unique_ptr returning
// Tests that ReturnNull() returns NULL for shared_ptr and unique_ptr returning
// functions.
// functions.
TEST
(
ReturnNullTest
,
WorksInSmartPointerReturningFunction
)
{
TEST
(
ReturnNullTest
,
WorksInSmartPointerReturningFunction
)
{
...
@@ -653,7 +648,6 @@ TEST(ReturnNullTest, WorksInSmartPointerReturningFunction) {
...
@@ -653,7 +648,6 @@ TEST(ReturnNullTest, WorksInSmartPointerReturningFunction) {
const
Action
<
std
::
shared_ptr
<
int
>
(
std
::
string
)
>
a2
=
ReturnNull
();
const
Action
<
std
::
shared_ptr
<
int
>
(
std
::
string
)
>
a2
=
ReturnNull
();
EXPECT_TRUE
(
a2
.
Perform
(
std
::
make_tuple
(
"foo"
))
==
nullptr
);
EXPECT_TRUE
(
a2
.
Perform
(
std
::
make_tuple
(
"foo"
))
==
nullptr
);
}
}
#endif // GTEST_HAS_STD_UNIQUE_PTR_
// Tests that ReturnRef(v) works for reference types.
// Tests that ReturnRef(v) works for reference types.
TEST
(
ReturnRefTest
,
WorksForReference
)
{
TEST
(
ReturnRefTest
,
WorksForReference
)
{
...
@@ -706,14 +700,12 @@ class MockClass {
...
@@ -706,14 +700,12 @@ class MockClass {
MOCK_METHOD1
(
IntFunc
,
int
(
bool
flag
));
// NOLINT
MOCK_METHOD1
(
IntFunc
,
int
(
bool
flag
));
// NOLINT
MOCK_METHOD0
(
Foo
,
MyNonDefaultConstructible
());
MOCK_METHOD0
(
Foo
,
MyNonDefaultConstructible
());
#if GTEST_HAS_STD_UNIQUE_PTR_
MOCK_METHOD0
(
MakeUnique
,
std
::
unique_ptr
<
int
>
());
MOCK_METHOD0
(
MakeUnique
,
std
::
unique_ptr
<
int
>
());
MOCK_METHOD0
(
MakeUniqueBase
,
std
::
unique_ptr
<
Base
>
());
MOCK_METHOD0
(
MakeUniqueBase
,
std
::
unique_ptr
<
Base
>
());
MOCK_METHOD0
(
MakeVectorUnique
,
std
::
vector
<
std
::
unique_ptr
<
int
>>
());
MOCK_METHOD0
(
MakeVectorUnique
,
std
::
vector
<
std
::
unique_ptr
<
int
>>
());
MOCK_METHOD1
(
TakeUnique
,
int
(
std
::
unique_ptr
<
int
>
));
MOCK_METHOD1
(
TakeUnique
,
int
(
std
::
unique_ptr
<
int
>
));
MOCK_METHOD2
(
TakeUnique
,
MOCK_METHOD2
(
TakeUnique
,
int
(
const
std
::
unique_ptr
<
int
>&
,
std
::
unique_ptr
<
int
>
));
int
(
const
std
::
unique_ptr
<
int
>&
,
std
::
unique_ptr
<
int
>
));
#endif
private
:
private
:
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MockClass
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MockClass
);
...
@@ -1265,7 +1257,6 @@ TEST(ByRefTest, PrintsCorrectly) {
...
@@ -1265,7 +1257,6 @@ TEST(ByRefTest, PrintsCorrectly) {
EXPECT_EQ
(
expected
.
str
(),
actual
.
str
());
EXPECT_EQ
(
expected
.
str
(),
actual
.
str
());
}
}
#if GTEST_HAS_STD_UNIQUE_PTR_
std
::
unique_ptr
<
int
>
UniquePtrSource
()
{
std
::
unique_ptr
<
int
>
UniquePtrSource
()
{
return
std
::
unique_ptr
<
int
>
(
new
int
(
19
));
return
std
::
unique_ptr
<
int
>
(
new
int
(
19
));
...
@@ -1378,9 +1369,7 @@ TEST(MockMethodTest, CanTakeMoveOnlyValue) {
...
@@ -1378,9 +1369,7 @@ TEST(MockMethodTest, CanTakeMoveOnlyValue) {
EXPECT_EQ
(
42
,
*
saved
);
EXPECT_EQ
(
42
,
*
saved
);
}
}
#endif // GTEST_HAS_STD_UNIQUE_PTR_
#if GTEST_LANG_CXX11
// Tests for std::function based action.
// Tests for std::function based action.
int
Add
(
int
val
,
int
&
ref
,
int
*
ptr
)
{
// NOLINT
int
Add
(
int
val
,
int
&
ref
,
int
*
ptr
)
{
// NOLINT
...
@@ -1476,7 +1465,6 @@ TEST(MoveOnlyArgumentsTest, ReturningActions) {
...
@@ -1476,7 +1465,6 @@ TEST(MoveOnlyArgumentsTest, ReturningActions) {
EXPECT_EQ
(
x
,
3
);
EXPECT_EQ
(
x
,
3
);
}
}
#endif // GTEST_LANG_CXX11
}
// Unnamed namespace
}
// Unnamed namespace
...
...
googlemock/test/gmock-function-mocker_test.cc
View file @
e26a3fa1
...
@@ -598,7 +598,6 @@ TEST(MockMethodMockFunctionTest, WorksFor10Arguments) {
...
@@ -598,7 +598,6 @@ TEST(MockMethodMockFunctionTest, WorksFor10Arguments) {
EXPECT_EQ
(
2
,
foo
.
Call
(
true
,
'a'
,
0
,
0
,
0
,
0
,
0
,
'b'
,
1
,
false
));
EXPECT_EQ
(
2
,
foo
.
Call
(
true
,
'a'
,
0
,
0
,
0
,
0
,
0
,
'b'
,
1
,
false
));
}
}
#if GTEST_HAS_STD_FUNCTION_
TEST
(
MockMethodMockFunctionTest
,
AsStdFunction
)
{
TEST
(
MockMethodMockFunctionTest
,
AsStdFunction
)
{
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
)
{
...
@@ -630,7 +629,6 @@ TEST(MockMethodMockFunctionTest, AsStdFunctionWithReferenceParameter) {
...
@@ -630,7 +629,6 @@ TEST(MockMethodMockFunctionTest, AsStdFunctionWithReferenceParameter) {
EXPECT_EQ
(
-
1
,
call
(
foo
.
AsStdFunction
(),
i
));
EXPECT_EQ
(
-
1
,
call
(
foo
.
AsStdFunction
(),
i
));
}
}
#endif // GTEST_HAS_STD_FUNCTION_
struct
MockMethodSizes0
{
struct
MockMethodSizes0
{
MOCK_METHOD
(
void
,
func
,
());
MOCK_METHOD
(
void
,
func
,
());
...
...
googlemock/test/gmock-generated-function-mockers_test.cc
View file @
e26a3fa1
...
@@ -582,7 +582,6 @@ TEST(MockFunctionTest, WorksFor10Arguments) {
...
@@ -582,7 +582,6 @@ TEST(MockFunctionTest, WorksFor10Arguments) {
EXPECT_EQ
(
2
,
foo
.
Call
(
true
,
'a'
,
0
,
0
,
0
,
0
,
0
,
'b'
,
1
,
false
));
EXPECT_EQ
(
2
,
foo
.
Call
(
true
,
'a'
,
0
,
0
,
0
,
0
,
0
,
'b'
,
1
,
false
));
}
}
#if GTEST_HAS_STD_FUNCTION_
TEST
(
MockFunctionTest
,
AsStdFunction
)
{
TEST
(
MockFunctionTest
,
AsStdFunction
)
{
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
)
{
...
@@ -614,7 +613,6 @@ TEST(MockFunctionTest, AsStdFunctionWithReferenceParameter) {
...
@@ -614,7 +613,6 @@ TEST(MockFunctionTest, AsStdFunctionWithReferenceParameter) {
EXPECT_EQ
(
-
1
,
call
(
foo
.
AsStdFunction
(),
i
));
EXPECT_EQ
(
-
1
,
call
(
foo
.
AsStdFunction
(),
i
));
}
}
#endif // GTEST_HAS_STD_FUNCTION_
struct
MockMethodSizes0
{
struct
MockMethodSizes0
{
MOCK_METHOD0
(
func
,
void
());
MOCK_METHOD0
(
func
,
void
());
...
...
googlemock/test/gmock-generated-matchers_test.cc
View file @
e26a3fa1
...
@@ -489,7 +489,6 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithVector) {
...
@@ -489,7 +489,6 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithVector) {
EXPECT_THAT
(
test_vector
,
Not
(
ElementsAreArray
(
expected
)));
EXPECT_THAT
(
test_vector
,
Not
(
ElementsAreArray
(
expected
)));
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
ElementsAreArrayTest
,
TakesInitializerList
)
{
TEST
(
ElementsAreArrayTest
,
TakesInitializerList
)
{
const
int
a
[
5
]
=
{
1
,
2
,
3
,
4
,
5
};
const
int
a
[
5
]
=
{
1
,
2
,
3
,
4
,
5
};
...
@@ -525,7 +524,6 @@ TEST(ElementsAreArrayTest,
...
@@ -525,7 +524,6 @@ TEST(ElementsAreArrayTest,
{
Eq
(
1
),
Ne
(
-
2
),
Ge
(
3
),
Le
(
4
),
Eq
(
6
)
})));
{
Eq
(
1
),
Ne
(
-
2
),
Ge
(
3
),
Le
(
4
),
Eq
(
6
)
})));
}
}
#endif // GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
ElementsAreArrayTest
,
CanBeCreatedWithMatcherVector
)
{
TEST
(
ElementsAreArrayTest
,
CanBeCreatedWithMatcherVector
)
{
const
int
a
[]
=
{
1
,
2
,
3
};
const
int
a
[]
=
{
1
,
2
,
3
};
...
@@ -1139,7 +1137,6 @@ TEST(AnyOfTest, DoesNotCallAnyOfUnqualified) {
...
@@ -1139,7 +1137,6 @@ TEST(AnyOfTest, DoesNotCallAnyOfUnqualified) {
}
// namespace adl_test
}
// namespace adl_test
#if GTEST_LANG_CXX11
TEST
(
AllOfTest
,
WorksOnMoveOnlyType
)
{
TEST
(
AllOfTest
,
WorksOnMoveOnlyType
)
{
std
::
unique_ptr
<
int
>
p
(
new
int
(
3
));
std
::
unique_ptr
<
int
>
p
(
new
int
(
3
));
...
@@ -1177,7 +1174,6 @@ TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
...
@@ -1177,7 +1174,6 @@ TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
EXPECT_THAT
(
p
,
Not
(
UniquePointee
(
2
)));
EXPECT_THAT
(
p
,
Not
(
UniquePointee
(
2
)));
}
}
#endif // GTEST_LASNG_CXX11
}
// namespace
}
// namespace
...
...
googlemock/test/gmock-internal-utils_test.cc
View file @
e26a3fa1
...
@@ -123,13 +123,9 @@ TEST(ConvertIdentifierNameToWordsTest, WorksWhenNameIsMixture) {
...
@@ -123,13 +123,9 @@ TEST(ConvertIdentifierNameToWordsTest, WorksWhenNameIsMixture) {
}
}
TEST
(
PointeeOfTest
,
WorksForSmartPointers
)
{
TEST
(
PointeeOfTest
,
WorksForSmartPointers
)
{
#if GTEST_HAS_STD_UNIQUE_PTR_
CompileAssertTypesEqual
<
int
,
PointeeOf
<
std
::
unique_ptr
<
int
>
>::
type
>
();
CompileAssertTypesEqual
<
int
,
PointeeOf
<
std
::
unique_ptr
<
int
>
>::
type
>
();
#endif // GTEST_HAS_STD_UNIQUE_PTR_
#if GTEST_HAS_STD_SHARED_PTR_
CompileAssertTypesEqual
<
std
::
string
,
CompileAssertTypesEqual
<
std
::
string
,
PointeeOf
<
std
::
shared_ptr
<
std
::
string
>
>::
type
>
();
PointeeOf
<
std
::
shared_ptr
<
std
::
string
>
>::
type
>
();
#endif // GTEST_HAS_STD_SHARED_PTR_
}
}
TEST
(
PointeeOfTest
,
WorksForRawPointers
)
{
TEST
(
PointeeOfTest
,
WorksForRawPointers
)
{
...
@@ -139,16 +135,12 @@ TEST(PointeeOfTest, WorksForRawPointers) {
...
@@ -139,16 +135,12 @@ TEST(PointeeOfTest, WorksForRawPointers) {
}
}
TEST
(
GetRawPointerTest
,
WorksForSmartPointers
)
{
TEST
(
GetRawPointerTest
,
WorksForSmartPointers
)
{
#if GTEST_HAS_STD_UNIQUE_PTR_
const
char
*
const
raw_p1
=
new
const
char
(
'a'
);
// NOLINT
const
char
*
const
raw_p1
=
new
const
char
(
'a'
);
// NOLINT
const
std
::
unique_ptr
<
const
char
>
p1
(
raw_p1
);
const
std
::
unique_ptr
<
const
char
>
p1
(
raw_p1
);
EXPECT_EQ
(
raw_p1
,
GetRawPointer
(
p1
));
EXPECT_EQ
(
raw_p1
,
GetRawPointer
(
p1
));
#endif // GTEST_HAS_STD_UNIQUE_PTR_
#if GTEST_HAS_STD_SHARED_PTR_
double
*
const
raw_p2
=
new
double
(
2.5
);
// NOLINT
double
*
const
raw_p2
=
new
double
(
2.5
);
// NOLINT
const
std
::
shared_ptr
<
double
>
p2
(
raw_p2
);
const
std
::
shared_ptr
<
double
>
p2
(
raw_p2
);
EXPECT_EQ
(
raw_p2
,
GetRawPointer
(
p2
));
EXPECT_EQ
(
raw_p2
,
GetRawPointer
(
p2
));
#endif // GTEST_HAS_STD_SHARED_PTR_
}
}
TEST
(
GetRawPointerTest
,
WorksForRawPointers
)
{
TEST
(
GetRawPointerTest
,
WorksForRawPointers
)
{
...
...
googlemock/test/gmock-matchers_test.cc
View file @
e26a3fa1
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include <string.h>
#include <string.h>
#include <time.h>
#include <time.h>
#include <deque>
#include <deque>
#include <forward_list>
#include <functional>
#include <functional>
#include <iostream>
#include <iostream>
#include <iterator>
#include <iterator>
...
@@ -56,20 +57,13 @@
...
@@ -56,20 +57,13 @@
#include <set>
#include <set>
#include <sstream>
#include <sstream>
#include <string>
#include <string>
#include <type_traits>
#include <utility>
#include <utility>
#include <vector>
#include <vector>
#include "gmock/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#include "gtest/gtest-spi.h"
#include "gtest/gtest-spi.h"
#if GTEST_HAS_STD_FORWARD_LIST_
# include <forward_list> // NOLINT
#endif
#if GTEST_LANG_CXX11
# include <type_traits>
#endif
namespace
testing
{
namespace
testing
{
namespace
gmock_matchers_test
{
namespace
gmock_matchers_test
{
namespace
{
namespace
{
...
@@ -1189,14 +1183,12 @@ TEST(IsNullTest, MatchesNullPointer) {
...
@@ -1189,14 +1183,12 @@ TEST(IsNullTest, MatchesNullPointer) {
#endif
#endif
}
}
#if GTEST_LANG_CXX11
TEST
(
IsNullTest
,
StdFunction
)
{
TEST
(
IsNullTest
,
StdFunction
)
{
const
Matcher
<
std
::
function
<
void
()
>>
m
=
IsNull
();
const
Matcher
<
std
::
function
<
void
()
>>
m
=
IsNull
();
EXPECT_TRUE
(
m
.
Matches
(
std
::
function
<
void
()
>
()));
EXPECT_TRUE
(
m
.
Matches
(
std
::
function
<
void
()
>
()));
EXPECT_FALSE
(
m
.
Matches
([]{}));
EXPECT_FALSE
(
m
.
Matches
([]{}));
}
}
#endif // GTEST_LANG_CXX11
// Tests that IsNull() describes itself properly.
// Tests that IsNull() describes itself properly.
TEST
(
IsNullTest
,
CanDescribeSelf
)
{
TEST
(
IsNullTest
,
CanDescribeSelf
)
{
...
@@ -1237,14 +1229,12 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) {
...
@@ -1237,14 +1229,12 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) {
EXPECT_TRUE
(
m
.
Matches
(
non_null_p
));
EXPECT_TRUE
(
m
.
Matches
(
non_null_p
));
}
}
#if GTEST_LANG_CXX11
TEST
(
NotNullTest
,
StdFunction
)
{
TEST
(
NotNullTest
,
StdFunction
)
{
const
Matcher
<
std
::
function
<
void
()
>>
m
=
NotNull
();
const
Matcher
<
std
::
function
<
void
()
>>
m
=
NotNull
();
EXPECT_TRUE
(
m
.
Matches
([]{}));
EXPECT_TRUE
(
m
.
Matches
([]{}));
EXPECT_FALSE
(
m
.
Matches
(
std
::
function
<
void
()
>
()));
EXPECT_FALSE
(
m
.
Matches
(
std
::
function
<
void
()
>
()));
}
}
#endif // GTEST_LANG_CXX11
// Tests that NotNull() describes itself properly.
// Tests that NotNull() describes itself properly.
TEST
(
NotNullTest
,
CanDescribeSelf
)
{
TEST
(
NotNullTest
,
CanDescribeSelf
)
{
...
@@ -1527,7 +1517,6 @@ TEST(KeyTest, MatchesCorrectly) {
...
@@ -1527,7 +1517,6 @@ TEST(KeyTest, MatchesCorrectly) {
EXPECT_THAT
(
p
,
Not
(
Key
(
Lt
(
25
))));
EXPECT_THAT
(
p
,
Not
(
Key
(
Lt
(
25
))));
}
}
#if GTEST_LANG_CXX11
template
<
size_t
I
>
template
<
size_t
I
>
struct
Tag
{};
struct
Tag
{};
...
@@ -1554,7 +1543,6 @@ TEST(PairTest, MatchesPairWithGetCorrectly) {
...
@@ -1554,7 +1543,6 @@ TEST(PairTest, MatchesPairWithGetCorrectly) {
std
::
vector
<
PairWithGet
>
v
=
{{
11
,
"Foo"
},
{
29
,
"gMockIsBestMock"
}};
std
::
vector
<
PairWithGet
>
v
=
{{
11
,
"Foo"
},
{
29
,
"gMockIsBestMock"
}};
EXPECT_THAT
(
v
,
Contains
(
Key
(
29
)));
EXPECT_THAT
(
v
,
Contains
(
Key
(
29
)));
}
}
#endif // GTEST_LANG_CXX11
TEST
(
KeyTest
,
SafelyCastsInnerMatcher
)
{
TEST
(
KeyTest
,
SafelyCastsInnerMatcher
)
{
Matcher
<
int
>
is_positive
=
Gt
(
0
);
Matcher
<
int
>
is_positive
=
Gt
(
0
);
...
@@ -1699,7 +1687,6 @@ TEST(ContainsTest, WorksWithMoveOnly) {
...
@@ -1699,7 +1687,6 @@ TEST(ContainsTest, WorksWithMoveOnly) {
helper
.
Call
(
MakeUniquePtrs
({
1
,
2
}));
helper
.
Call
(
MakeUniquePtrs
({
1
,
2
}));
}
}
#if GTEST_LANG_CXX11
TEST
(
PairTest
,
UseGetInsteadOfMembers
)
{
TEST
(
PairTest
,
UseGetInsteadOfMembers
)
{
PairWithGet
pair
{
7
,
"ABC"
};
PairWithGet
pair
{
7
,
"ABC"
};
EXPECT_THAT
(
pair
,
Pair
(
7
,
"ABC"
));
EXPECT_THAT
(
pair
,
Pair
(
7
,
"ABC"
));
...
@@ -1709,7 +1696,6 @@ TEST(PairTest, UseGetInsteadOfMembers) {
...
@@ -1709,7 +1696,6 @@ TEST(PairTest, UseGetInsteadOfMembers) {
std
::
vector
<
PairWithGet
>
v
=
{{
11
,
"Foo"
},
{
29
,
"gMockIsBestMock"
}};
std
::
vector
<
PairWithGet
>
v
=
{{
11
,
"Foo"
},
{
29
,
"gMockIsBestMock"
}};
EXPECT_THAT
(
v
,
ElementsAre
(
Pair
(
11
,
string
(
"Foo"
)),
Pair
(
Ge
(
10
),
Not
(
""
))));
EXPECT_THAT
(
v
,
ElementsAre
(
Pair
(
11
,
string
(
"Foo"
)),
Pair
(
Ge
(
10
),
Not
(
""
))));
}
}
#endif // GTEST_LANG_CXX11
// Tests StartsWith(s).
// Tests StartsWith(s).
...
@@ -2680,7 +2666,6 @@ static void AnyOfMatches(int num, const Matcher<int>& m) {
...
@@ -2680,7 +2666,6 @@ static void AnyOfMatches(int num, const Matcher<int>& m) {
EXPECT_FALSE
(
m
.
Matches
(
num
+
1
));
EXPECT_FALSE
(
m
.
Matches
(
num
+
1
));
}
}
#if GTEST_LANG_CXX11
static
void
AnyOfStringMatches
(
int
num
,
const
Matcher
<
std
::
string
>&
m
)
{
static
void
AnyOfStringMatches
(
int
num
,
const
Matcher
<
std
::
string
>&
m
)
{
SCOPED_TRACE
(
Describe
(
m
));
SCOPED_TRACE
(
Describe
(
m
));
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
0
)));
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
0
)));
...
@@ -2690,7 +2675,6 @@ static void AnyOfStringMatches(int num, const Matcher<std::string>& m) {
...
@@ -2690,7 +2675,6 @@ static void AnyOfStringMatches(int num, const Matcher<std::string>& m) {
}
}
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
num
+
1
)));
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
num
+
1
)));
}
}
#endif
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
// least one of the given matchers.
// least one of the given matchers.
...
@@ -2735,7 +2719,6 @@ TEST(AnyOfTest, MatchesWhenAnyMatches) {
...
@@ -2735,7 +2719,6 @@ TEST(AnyOfTest, MatchesWhenAnyMatches) {
AnyOfMatches
(
10
,
AnyOf
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
));
AnyOfMatches
(
10
,
AnyOf
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
));
}
}
#if GTEST_LANG_CXX11
// Tests the variadic version of the AnyOfMatcher.
// Tests the variadic version of the AnyOfMatcher.
TEST
(
AnyOfTest
,
VariadicMatchesWhenAnyMatches
)
{
TEST
(
AnyOfTest
,
VariadicMatchesWhenAnyMatches
)
{
// Also make sure AnyOf is defined in the right namespace and does not depend
// Also make sure AnyOf is defined in the right namespace and does not depend
...
@@ -2784,7 +2767,6 @@ TEST(ElementsAreTest, HugeMatcherUnordered) {
...
@@ -2784,7 +2767,6 @@ TEST(ElementsAreTest, HugeMatcherUnordered) {
Eq
(
3
),
Eq
(
9
),
Eq
(
12
),
Eq
(
11
),
Ne
(
122
)));
Eq
(
3
),
Eq
(
9
),
Eq
(
12
),
Eq
(
11
),
Ne
(
122
)));
}
}
#endif // GTEST_LANG_CXX11
// Tests that AnyOf(m1, ..., mn) describes itself properly.
// Tests that AnyOf(m1, ..., mn) describes itself properly.
TEST
(
AnyOfTest
,
CanDescribeSelf
)
{
TEST
(
AnyOfTest
,
CanDescribeSelf
)
{
...
@@ -4155,9 +4137,7 @@ class AClass {
...
@@ -4155,9 +4137,7 @@ class AClass {
// A getter that returns a reference to const.
// A getter that returns a reference to const.
const
std
::
string
&
s
()
const
{
return
s_
;
}
const
std
::
string
&
s
()
const
{
return
s_
;
}
#if GTEST_LANG_CXX11
const
std
::
string
&
s_ref
()
const
&
{
return
s_
;
}
const
std
::
string
&
s_ref
()
const
&
{
return
s_
;
}
#endif
void
set_s
(
const
std
::
string
&
new_s
)
{
s_
=
new_s
;
}
void
set_s
(
const
std
::
string
&
new_s
)
{
s_
=
new_s
;
}
...
@@ -4214,7 +4194,6 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
...
@@ -4214,7 +4194,6 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
EXPECT_FALSE
(
m_with_name
.
Matches
(
a
));
EXPECT_FALSE
(
m_with_name
.
Matches
(
a
));
}
}
#if GTEST_LANG_CXX11
// Tests that Property(&Foo::property, ...) works when property() is
// Tests that Property(&Foo::property, ...) works when property() is
// ref-qualified.
// ref-qualified.
TEST
(
PropertyTest
,
WorksForRefQualifiedProperty
)
{
TEST
(
PropertyTest
,
WorksForRefQualifiedProperty
)
{
...
@@ -4231,7 +4210,6 @@ TEST(PropertyTest, WorksForRefQualifiedProperty) {
...
@@ -4231,7 +4210,6 @@ TEST(PropertyTest, WorksForRefQualifiedProperty) {
EXPECT_FALSE
(
m
.
Matches
(
a
));
EXPECT_FALSE
(
m
.
Matches
(
a
));
EXPECT_FALSE
(
m_with_name
.
Matches
(
a
));
EXPECT_FALSE
(
m_with_name
.
Matches
(
a
));
}
}
#endif
// Tests that Property(&Foo::property, ...) works when property()
// Tests that Property(&Foo::property, ...) works when property()
// returns a reference to non-const.
// returns a reference to non-const.
...
@@ -4594,7 +4572,6 @@ TEST(ResultOfTest, WorksForPolymorphicFunctors) {
...
@@ -4594,7 +4572,6 @@ TEST(ResultOfTest, WorksForPolymorphicFunctors) {
EXPECT_FALSE
(
matcher_string
.
Matches
(
"shrt"
));
EXPECT_FALSE
(
matcher_string
.
Matches
(
"shrt"
));
}
}
#if GTEST_LANG_CXX11
TEST
(
ResultOfTest
,
WorksForPolymorphicFunctorsIgnoringResultType
)
{
TEST
(
ResultOfTest
,
WorksForPolymorphicFunctorsIgnoringResultType
)
{
Matcher
<
int
*>
matcher
=
ResultOf
(
PolymorphicFunctor
(),
"good ptr"
);
Matcher
<
int
*>
matcher
=
ResultOf
(
PolymorphicFunctor
(),
"good ptr"
);
...
@@ -4609,7 +4586,6 @@ TEST(ResultOfTest, WorksForLambdas) {
...
@@ -4609,7 +4586,6 @@ TEST(ResultOfTest, WorksForLambdas) {
EXPECT_TRUE
(
matcher
.
Matches
(
3
));
EXPECT_TRUE
(
matcher
.
Matches
(
3
));
EXPECT_FALSE
(
matcher
.
Matches
(
1
));
EXPECT_FALSE
(
matcher
.
Matches
(
1
));
}
}
#endif
const
int
*
ReferencingFunction
(
const
int
&
n
)
{
return
&
n
;
}
const
int
*
ReferencingFunction
(
const
int
&
n
)
{
return
&
n
;
}
...
@@ -4800,7 +4776,6 @@ TEST(IsTrueTest, IsTrueIsFalse) {
...
@@ -4800,7 +4776,6 @@ TEST(IsTrueTest, IsTrueIsFalse) {
EXPECT_THAT
(
&
a
,
Not
(
IsFalse
()));
EXPECT_THAT
(
&
a
,
Not
(
IsFalse
()));
EXPECT_THAT
(
false
,
Not
(
IsTrue
()));
EXPECT_THAT
(
false
,
Not
(
IsTrue
()));
EXPECT_THAT
(
true
,
Not
(
IsFalse
()));
EXPECT_THAT
(
true
,
Not
(
IsFalse
()));
#if GTEST_LANG_CXX11
EXPECT_THAT
(
std
::
true_type
(),
IsTrue
());
EXPECT_THAT
(
std
::
true_type
(),
IsTrue
());
EXPECT_THAT
(
std
::
true_type
(),
Not
(
IsFalse
()));
EXPECT_THAT
(
std
::
true_type
(),
Not
(
IsFalse
()));
EXPECT_THAT
(
std
::
false_type
(),
IsFalse
());
EXPECT_THAT
(
std
::
false_type
(),
IsFalse
());
...
@@ -4813,7 +4788,6 @@ TEST(IsTrueTest, IsTrueIsFalse) {
...
@@ -4813,7 +4788,6 @@ TEST(IsTrueTest, IsTrueIsFalse) {
EXPECT_THAT
(
null_unique
,
IsFalse
());
EXPECT_THAT
(
null_unique
,
IsFalse
());
EXPECT_THAT
(
nonnull_unique
,
IsTrue
());
EXPECT_THAT
(
nonnull_unique
,
IsTrue
());
EXPECT_THAT
(
nonnull_unique
,
Not
(
IsFalse
()));
EXPECT_THAT
(
nonnull_unique
,
Not
(
IsFalse
()));
#endif // GTEST_LANG_CXX11
}
}
TEST
(
SizeIsTest
,
ImplementsSizeIs
)
{
TEST
(
SizeIsTest
,
ImplementsSizeIs
)
{
...
@@ -5313,7 +5287,6 @@ TEST(StreamlikeTest, Iteration) {
...
@@ -5313,7 +5287,6 @@ TEST(StreamlikeTest, Iteration) {
}
}
}
}
#if GTEST_HAS_STD_FORWARD_LIST_
TEST
(
BeginEndDistanceIsTest
,
WorksWithForwardList
)
{
TEST
(
BeginEndDistanceIsTest
,
WorksWithForwardList
)
{
std
::
forward_list
<
int
>
container
;
std
::
forward_list
<
int
>
container
;
EXPECT_THAT
(
container
,
BeginEndDistanceIs
(
0
));
EXPECT_THAT
(
container
,
BeginEndDistanceIs
(
0
));
...
@@ -5325,7 +5298,6 @@ TEST(BeginEndDistanceIsTest, WorksWithForwardList) {
...
@@ -5325,7 +5298,6 @@ TEST(BeginEndDistanceIsTest, WorksWithForwardList) {
EXPECT_THAT
(
container
,
Not
(
BeginEndDistanceIs
(
0
)));
EXPECT_THAT
(
container
,
Not
(
BeginEndDistanceIs
(
0
)));
EXPECT_THAT
(
container
,
BeginEndDistanceIs
(
2
));
EXPECT_THAT
(
container
,
BeginEndDistanceIs
(
2
));
}
}
#endif // GTEST_HAS_STD_FORWARD_LIST_
TEST
(
BeginEndDistanceIsTest
,
WorksWithNonStdList
)
{
TEST
(
BeginEndDistanceIsTest
,
WorksWithNonStdList
)
{
const
int
a
[
5
]
=
{
1
,
2
,
3
,
4
,
5
};
const
int
a
[
5
]
=
{
1
,
2
,
3
,
4
,
5
};
...
@@ -5507,13 +5479,11 @@ TEST(IsSupersetOfTest, MatchAndExplain) {
...
@@ -5507,13 +5479,11 @@ TEST(IsSupersetOfTest, MatchAndExplain) {
" - element #2 is matched by matcher #0"
));
" - element #2 is matched by matcher #0"
));
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
IsSupersetOfTest
,
WorksForRhsInitializerList
)
{
TEST
(
IsSupersetOfTest
,
WorksForRhsInitializerList
)
{
const
int
numbers
[]
=
{
1
,
3
,
6
,
2
,
4
,
5
};
const
int
numbers
[]
=
{
1
,
3
,
6
,
2
,
4
,
5
};
EXPECT_THAT
(
numbers
,
IsSupersetOf
({
1
,
2
}));
EXPECT_THAT
(
numbers
,
IsSupersetOf
({
1
,
2
}));
EXPECT_THAT
(
numbers
,
Not
(
IsSupersetOf
({
3
,
0
})));
EXPECT_THAT
(
numbers
,
Not
(
IsSupersetOf
({
3
,
0
})));
}
}
#endif
TEST
(
IsSupersetOfTest
,
WorksWithMoveOnly
)
{
TEST
(
IsSupersetOfTest
,
WorksWithMoveOnly
)
{
ContainerHelper
helper
;
ContainerHelper
helper
;
...
@@ -5637,13 +5607,11 @@ TEST(IsSubsetOfTest, MatchAndExplain) {
...
@@ -5637,13 +5607,11 @@ TEST(IsSubsetOfTest, MatchAndExplain) {
" - element #1 is matched by matcher #2"
));
" - element #1 is matched by matcher #2"
));
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
IsSubsetOfTest
,
WorksForRhsInitializerList
)
{
TEST
(
IsSubsetOfTest
,
WorksForRhsInitializerList
)
{
const
int
numbers
[]
=
{
1
,
2
,
3
};
const
int
numbers
[]
=
{
1
,
2
,
3
};
EXPECT_THAT
(
numbers
,
IsSubsetOf
({
1
,
2
,
3
,
4
}));
EXPECT_THAT
(
numbers
,
IsSubsetOf
({
1
,
2
,
3
,
4
}));
EXPECT_THAT
(
numbers
,
Not
(
IsSubsetOf
({
1
,
2
})));
EXPECT_THAT
(
numbers
,
Not
(
IsSubsetOf
({
1
,
2
})));
}
}
#endif
TEST
(
IsSubsetOfTest
,
WorksWithMoveOnly
)
{
TEST
(
IsSubsetOfTest
,
WorksWithMoveOnly
)
{
ContainerHelper
helper
;
ContainerHelper
helper
;
...
@@ -5762,7 +5730,6 @@ TEST(UnorderedElementsAreArrayTest, TakesStlContainer) {
...
@@ -5762,7 +5730,6 @@ TEST(UnorderedElementsAreArrayTest, TakesStlContainer) {
EXPECT_THAT
(
actual
,
Not
(
UnorderedElementsAreArray
(
expected
)));
EXPECT_THAT
(
actual
,
Not
(
UnorderedElementsAreArray
(
expected
)));
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
UnorderedElementsAreArrayTest
,
TakesInitializerList
)
{
TEST
(
UnorderedElementsAreArrayTest
,
TakesInitializerList
)
{
const
int
a
[
5
]
=
{
2
,
1
,
4
,
5
,
3
};
const
int
a
[
5
]
=
{
2
,
1
,
4
,
5
,
3
};
...
@@ -5796,7 +5763,6 @@ TEST(UnorderedElementsAreArrayTest,
...
@@ -5796,7 +5763,6 @@ TEST(UnorderedElementsAreArrayTest,
{
Eq
(
1
),
Ne
(
-
2
),
Ge
(
3
),
Le
(
4
),
Eq
(
6
)})));
{
Eq
(
1
),
Ne
(
-
2
),
Ge
(
3
),
Le
(
4
),
Eq
(
6
)})));
}
}
#endif // GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
UnorderedElementsAreArrayTest
,
WorksWithMoveOnly
)
{
TEST
(
UnorderedElementsAreArrayTest
,
WorksWithMoveOnly
)
{
ContainerHelper
helper
;
ContainerHelper
helper
;
...
@@ -6501,7 +6467,6 @@ TEST(PointwiseTest, WorksForVectorOfBool) {
...
@@ -6501,7 +6467,6 @@ TEST(PointwiseTest, WorksForVectorOfBool) {
EXPECT_THAT
(
lhs
,
Not
(
Pointwise
(
Eq
(),
rhs
)));
EXPECT_THAT
(
lhs
,
Not
(
Pointwise
(
Eq
(),
rhs
)));
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
PointwiseTest
,
WorksForRhsInitializerList
)
{
TEST
(
PointwiseTest
,
WorksForRhsInitializerList
)
{
const
vector
<
int
>
lhs
{
2
,
4
,
6
};
const
vector
<
int
>
lhs
{
2
,
4
,
6
};
...
@@ -6509,7 +6474,6 @@ TEST(PointwiseTest, WorksForRhsInitializerList) {
...
@@ -6509,7 +6474,6 @@ TEST(PointwiseTest, WorksForRhsInitializerList) {
EXPECT_THAT
(
lhs
,
Not
(
Pointwise
(
Lt
(),
{
3
,
3
,
7
})));
EXPECT_THAT
(
lhs
,
Not
(
Pointwise
(
Lt
(),
{
3
,
3
,
7
})));
}
}
#endif // GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
PointwiseTest
,
RejectsWrongSize
)
{
TEST
(
PointwiseTest
,
RejectsWrongSize
)
{
const
double
lhs
[
2
]
=
{
1
,
2
};
const
double
lhs
[
2
]
=
{
1
,
2
};
...
@@ -6623,7 +6587,6 @@ TEST(UnorderedPointwiseTest, WorksForRhsNativeArray) {
...
@@ -6623,7 +6587,6 @@ TEST(UnorderedPointwiseTest, WorksForRhsNativeArray) {
EXPECT_THAT
(
lhs
,
Not
(
UnorderedPointwise
(
Lt
(),
rhs
)));
EXPECT_THAT
(
lhs
,
Not
(
UnorderedPointwise
(
Lt
(),
rhs
)));
}
}
#if GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
UnorderedPointwiseTest
,
WorksForRhsInitializerList
)
{
TEST
(
UnorderedPointwiseTest
,
WorksForRhsInitializerList
)
{
const
vector
<
int
>
lhs
{
2
,
4
,
6
};
const
vector
<
int
>
lhs
{
2
,
4
,
6
};
...
@@ -6631,7 +6594,6 @@ TEST(UnorderedPointwiseTest, WorksForRhsInitializerList) {
...
@@ -6631,7 +6594,6 @@ TEST(UnorderedPointwiseTest, WorksForRhsInitializerList) {
EXPECT_THAT
(
lhs
,
Not
(
UnorderedPointwise
(
Lt
(),
{
1
,
1
,
7
})));
EXPECT_THAT
(
lhs
,
Not
(
UnorderedPointwise
(
Lt
(),
{
1
,
1
,
7
})));
}
}
#endif // GTEST_HAS_STD_INITIALIZER_LIST_
TEST
(
UnorderedPointwiseTest
,
RejectsWrongSize
)
{
TEST
(
UnorderedPointwiseTest
,
RejectsWrongSize
)
{
const
double
lhs
[
2
]
=
{
1
,
2
};
const
double
lhs
[
2
]
=
{
1
,
2
};
...
@@ -6824,7 +6786,6 @@ TEST(AnyWithTest, TestBadCastType) {
...
@@ -6824,7 +6786,6 @@ TEST(AnyWithTest, TestBadCastType) {
EXPECT_FALSE
(
m
.
Matches
(
SampleAnyType
(
1
)));
EXPECT_FALSE
(
m
.
Matches
(
SampleAnyType
(
1
)));
}
}
#if GTEST_LANG_CXX11
TEST
(
AnyWithTest
,
TestUseInContainers
)
{
TEST
(
AnyWithTest
,
TestUseInContainers
)
{
std
::
vector
<
SampleAnyType
>
a
;
std
::
vector
<
SampleAnyType
>
a
;
a
.
emplace_back
(
1
);
a
.
emplace_back
(
1
);
...
@@ -6841,7 +6802,6 @@ TEST(AnyWithTest, TestUseInContainers) {
...
@@ -6841,7 +6802,6 @@ TEST(AnyWithTest, TestUseInContainers) {
AnyWith
<
std
::
string
>
(
"merhaba"
),
AnyWith
<
std
::
string
>
(
"merhaba"
),
AnyWith
<
std
::
string
>
(
"salut"
)}));
AnyWith
<
std
::
string
>
(
"salut"
)}));
}
}
#endif // GTEST_LANG_CXX11
TEST
(
AnyWithTest
,
TestCompare
)
{
TEST
(
AnyWithTest
,
TestCompare
)
{
EXPECT_THAT
(
SampleAnyType
(
1
),
AnyWith
<
int
>
(
Gt
(
0
)));
EXPECT_THAT
(
SampleAnyType
(
1
),
AnyWith
<
int
>
(
Gt
(
0
)));
}
}
...
...
googlemock/test/gmock-nice-strict_test.cc
View file @
e26a3fa1
...
@@ -114,23 +114,22 @@ class MockBar {
...
@@ -114,23 +114,22 @@ class MockBar {
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MockBar
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MockBar
);
};
};
#if GTEST_GTEST_LANG_CXX11
class
MockBaz
{
class
MockBaz
{
public
:
public
:
class
MoveOnly
{
class
MoveOnly
{
public
:
MoveOnly
()
=
default
;
MoveOnly
()
=
default
;
MoveOnly
(
const
MoveOnly
&
)
=
delete
;
MoveOnly
(
const
MoveOnly
&
)
=
delete
;
operator
=
(
const
MoveOnly
&
)
=
delete
;
MoveOnly
&
operator
=
(
const
MoveOnly
&
)
=
delete
;
MoveOnly
(
MoveOnly
&&
)
=
default
;
MoveOnly
(
MoveOnly
&&
)
=
default
;
operator
=
(
MoveOnly
&&
)
=
default
;
MoveOnly
&
operator
=
(
MoveOnly
&&
)
=
default
;
};
};
MockBaz
(
MoveOnly
)
{}
MockBaz
(
MoveOnly
)
{}
}
};
#endif // GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if GTEST_HAS_STREAM_REDIRECTION
#if GTEST_HAS_STREAM_REDIRECTION
...
@@ -292,14 +291,10 @@ TEST(NiceMockTest, AllowLeak) {
...
@@ -292,14 +291,10 @@ TEST(NiceMockTest, AllowLeak) {
leaked
->
DoThis
();
leaked
->
DoThis
();
}
}
#if GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
TEST
(
NiceMockTest
,
MoveOnlyConstructor
)
{
TEST
(
NiceMockTest
,
MoveOnlyConstructor
)
{
NiceMock
<
MockBaz
>
nice_baz
(
MockBaz
::
MoveOnly
()
);
NiceMock
<
MockBaz
>
nice_baz
(
MockBaz
::
MoveOnly
{}
);
}
}
#endif // GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
// Tests that NiceMock<Mock> compiles where Mock is a user-defined
// Tests that NiceMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to work around an
// class (as opposed to ::testing::Mock). We had to work around an
...
@@ -407,14 +402,10 @@ TEST(NaggyMockTest, AllowLeak) {
...
@@ -407,14 +402,10 @@ TEST(NaggyMockTest, AllowLeak) {
leaked
->
DoThis
();
leaked
->
DoThis
();
}
}
#if GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
TEST
(
NaggyMockTest
,
MoveOnlyConstructor
)
{
TEST
(
NaggyMockTest
,
MoveOnlyConstructor
)
{
NaggyMock
<
MockBaz
>
naggy_baz
(
MockBaz
::
MoveOnly
()
);
NaggyMock
<
MockBaz
>
naggy_baz
(
MockBaz
::
MoveOnly
{}
);
}
}
#endif // GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
// Tests that NaggyMock<Mock> compiles where Mock is a user-defined
// Tests that NaggyMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to work around an
// class (as opposed to ::testing::Mock). We had to work around an
...
@@ -503,14 +494,10 @@ TEST(StrictMockTest, AllowLeak) {
...
@@ -503,14 +494,10 @@ TEST(StrictMockTest, AllowLeak) {
leaked
->
DoThis
();
leaked
->
DoThis
();
}
}
#if GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
TEST
(
StrictMockTest
,
MoveOnlyConstructor
)
{
TEST
(
StrictMockTest
,
MoveOnlyConstructor
)
{
StrictMock
<
MockBaz
>
strict_baz
(
MockBaz
::
MoveOnly
()
);
StrictMock
<
MockBaz
>
strict_baz
(
MockBaz
::
MoveOnly
{}
);
}
}
#endif // GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
// Tests that StrictMock<Mock> compiles where Mock is a user-defined
// Tests that StrictMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to work around an
// class (as opposed to ::testing::Mock). We had to work around an
...
...
googletest/include/gtest/internal/gtest-port.h
View file @
e26a3fa1
...
@@ -92,8 +92,6 @@
...
@@ -92,8 +92,6 @@
// - Define it to 1/0 to indicate whether the
// - Define it to 1/0 to indicate whether the
// platform supports I/O stream redirection using
// platform supports I/O stream redirection using
// dup() and dup2().
// dup() and dup2().
// GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test
// is building in C++11/C++98 mode.
// GTEST_LINKED_AS_SHARED_LIBRARY
// GTEST_LINKED_AS_SHARED_LIBRARY
// - Define to 1 when compiling tests that use
// - Define to 1 when compiling tests that use
// Google Test as a shared library (known as
// Google Test as a shared library (known as
...
@@ -332,44 +330,6 @@
...
@@ -332,44 +330,6 @@
GTEST_DISABLE_MSC_WARNINGS_POP_()
GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif
#endif
#define GTEST_LANG_CXX11 1
// Distinct from C++11 language support, some environments don't provide
// proper C++11 library support. Notably, it's possible to build in
// C++11 mode when targeting Mac OS X 10.6, which has an old libstdc++
// with no C++11 support.
//
// libstdc++ has sufficient C++11 support as of GCC 4.6.0, __GLIBCXX__
// 20110325, but maintenance releases in the 4.4 and 4.5 series followed
// this date, so check for those versions by their date stamps.
// https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
#if GTEST_LANG_CXX11 && \
(!defined(__GLIBCXX__) || ( \
__GLIBCXX__ >= 20110325ul &&
/* GCC >= 4.6.0 */
\
/* Blacklist of patch releases of older branches: */
\
__GLIBCXX__ != 20110416ul &&
/* GCC 4.4.6 */
\
__GLIBCXX__ != 20120313ul &&
/* GCC 4.4.7 */
\
__GLIBCXX__ != 20110428ul &&
/* GCC 4.5.3 */
\
__GLIBCXX__ != 20120702ul))
/* GCC 4.5.4 */
# define GTEST_STDLIB_CXX11 1
#endif
// Only use C++11 library features if the library provides them.
#if GTEST_STDLIB_CXX11
# define GTEST_HAS_STD_BEGIN_AND_END_ 1
# define GTEST_HAS_STD_FORWARD_LIST_ 1
# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824)
// works only with VS2015U2 and better
# define GTEST_HAS_STD_FUNCTION_ 1
# endif
# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
# define GTEST_HAS_STD_MOVE_ 1
# define GTEST_HAS_STD_UNIQUE_PTR_ 1
# define GTEST_HAS_STD_SHARED_PTR_ 1
# define GTEST_HAS_UNORDERED_MAP_ 1
# define GTEST_HAS_UNORDERED_SET_ 1
#endif
// Brings in definitions for functions used in the testing::internal::posix
// Brings in definitions for functions used in the testing::internal::posix
// namespace (read, write, close, chdir, isatty, stat). We do not currently
// namespace (read, write, close, chdir, isatty, stat). We do not currently
// use them on Windows Mobile.
// use them on Windows Mobile.
...
@@ -712,12 +672,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
...
@@ -712,12 +672,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
# define GTEST_ATTRIBUTE_UNUSED_
# define GTEST_ATTRIBUTE_UNUSED_
#endif
#endif
#if GTEST_LANG_CXX11
# define GTEST_CXX11_EQUALS_DELETE_ = delete
#else // GTEST_LANG_CXX11
# define GTEST_CXX11_EQUALS_DELETE_
#endif // GTEST_LANG_CXX11
// Use this annotation before a function that takes a printf format string.
// Use this annotation before a function that takes a printf format string.
#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
# if defined(__MINGW_PRINTF_FORMAT)
# if defined(__MINGW_PRINTF_FORMAT)
...
@@ -739,12 +693,12 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
...
@@ -739,12 +693,12 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// A macro to disallow operator=
// A macro to disallow operator=
// This should be used in the private: declarations for a class.
// This should be used in the private: declarations for a class.
#define GTEST_DISALLOW_ASSIGN_(type) \
#define GTEST_DISALLOW_ASSIGN_(type) \
void operator=(type const &)
GTEST_CXX11_EQUALS_DELETE_
void operator=(type const &)
= delete
// A macro to disallow copy constructor and operator=
// A macro to disallow copy constructor and operator=
// This should be used in the private: declarations for a class.
// This should be used in the private: declarations for a class.
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
type(type const &)
GTEST_CXX11_EQUALS_DELETE_
; \
type(type const &)
= delete
; \
GTEST_DISALLOW_ASSIGN_(type)
GTEST_DISALLOW_ASSIGN_(type)
// Tell the compiler to warn about unused return values for functions declared
// Tell the compiler to warn about unused return values for functions declared
...
@@ -893,75 +847,16 @@ namespace internal {
...
@@ -893,75 +847,16 @@ namespace internal {
// Secret object, which is what we want.
// Secret object, which is what we want.
class
Secret
;
class
Secret
;
// The GTEST_COMPILE_ASSERT_
macro can be used to verify that a compile tim
e
// The GTEST_COMPILE_ASSERT_
is a legacy macro used to verify that a compil
e
//
expression is true. For example, you could use it to verify the
//
time expression is true (in new code, use static_assert instead). For
// size of a static array:
//
example, you could use it to verify the
size of a static array:
//
//
// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
// names_incorrect_size);
// names_incorrect_size);
//
//
// or to make sure a struct is smaller than a certain size:
// The second argument to the macro must be a valid C++ identifier. If the
//
// expression is false, compiler will issue an error containing this identifier.
// GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
#define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
//
// The second argument to the macro is the name of the variable. If
// the expression is false, most compilers will issue a warning/error
// containing the name of the variable.
#if GTEST_LANG_CXX11
# define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
#else // !GTEST_LANG_CXX11
template
<
bool
>
struct
CompileAssert
{
};
# define GTEST_COMPILE_ASSERT_(expr, msg) \
typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
#endif // !GTEST_LANG_CXX11
// Implementation details of GTEST_COMPILE_ASSERT_:
//
// (In C++11, we simply use static_assert instead of the following)
//
// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
// elements (and thus is invalid) when the expression is false.
//
// - The simpler definition
//
// #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
//
// does not work, as gcc supports variable-length arrays whose sizes
// are determined at run-time (this is gcc's extension and not part
// of the C++ standard). As a result, gcc fails to reject the
// following code with the simple definition:
//
// int foo;
// GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
// // not a compile-time constant.
//
// - By using the type CompileAssert<(bool(expr))>, we ensures that
// expr is a compile-time constant. (Template arguments must be
// determined at compile-time.)
//
// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
//
// CompileAssert<bool(expr)>
//
// instead, these compilers will refuse to compile
//
// GTEST_COMPILE_ASSERT_(5 > 0, some_message);
//
// (They seem to think the ">" in "5 > 0" marks the end of the
// template argument list.)
//
// - The array size is (bool(expr) ? 1 : -1), instead of simply
//
// ((expr) ? 1 : -1).
//
// This is to avoid running into a bug in MS VC 7.1, which
// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
//
//
...
...
googletest/test/googletest-printers-test.cc
View file @
e26a3fa1
...
@@ -37,29 +37,20 @@
...
@@ -37,29 +37,20 @@
#include <string.h>
#include <string.h>
#include <algorithm>
#include <algorithm>
#include <deque>
#include <deque>
#include <forward_list>
#include <list>
#include <list>
#include <map>
#include <map>
#include <set>
#include <set>
#include <sstream>
#include <sstream>
#include <string>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <utility>
#include <vector>
#include <vector>
#include "gtest/gtest-printers.h"
#include "gtest/gtest-printers.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#if GTEST_HAS_UNORDERED_MAP_
# include <unordered_map> // NOLINT
#endif // GTEST_HAS_UNORDERED_MAP_
#if GTEST_HAS_UNORDERED_SET_
# include <unordered_set> // NOLINT
#endif // GTEST_HAS_UNORDERED_SET_
#if GTEST_HAS_STD_FORWARD_LIST_
# include <forward_list> // NOLINT
#endif // GTEST_HAS_STD_FORWARD_LIST_
// Some user-defined types for testing the universal value printer.
// Some user-defined types for testing the universal value printer.
// An anonymous enum type.
// An anonymous enum type.
...
@@ -814,7 +805,6 @@ TEST(PrintStlContainerTest, NonEmptyDeque) {
...
@@ -814,7 +805,6 @@ TEST(PrintStlContainerTest, NonEmptyDeque) {
EXPECT_EQ
(
"{ 1, 3 }"
,
Print
(
non_empty
));
EXPECT_EQ
(
"{ 1, 3 }"
,
Print
(
non_empty
));
}
}
#if GTEST_HAS_UNORDERED_MAP_
TEST
(
PrintStlContainerTest
,
OneElementHashMap
)
{
TEST
(
PrintStlContainerTest
,
OneElementHashMap
)
{
::
std
::
unordered_map
<
int
,
char
>
map1
;
::
std
::
unordered_map
<
int
,
char
>
map1
;
...
@@ -834,9 +824,7 @@ TEST(PrintStlContainerTest, HashMultiMap) {
...
@@ -834,9 +824,7 @@ TEST(PrintStlContainerTest, HashMultiMap) {
<<
" where Print(map1) returns
\"
"
<<
result
<<
"
\"
."
;
<<
" where Print(map1) returns
\"
"
<<
result
<<
"
\"
."
;
}
}
#endif // GTEST_HAS_UNORDERED_MAP_
#if GTEST_HAS_UNORDERED_SET_
TEST
(
PrintStlContainerTest
,
HashSet
)
{
TEST
(
PrintStlContainerTest
,
HashSet
)
{
::
std
::
unordered_set
<
int
>
set1
;
::
std
::
unordered_set
<
int
>
set1
;
...
@@ -873,7 +861,6 @@ TEST(PrintStlContainerTest, HashMultiSet) {
...
@@ -873,7 +861,6 @@ TEST(PrintStlContainerTest, HashMultiSet) {
EXPECT_TRUE
(
std
::
equal
(
a
,
a
+
kSize
,
numbers
.
begin
()));
EXPECT_TRUE
(
std
::
equal
(
a
,
a
+
kSize
,
numbers
.
begin
()));
}
}
#endif // GTEST_HAS_UNORDERED_SET_
TEST
(
PrintStlContainerTest
,
List
)
{
TEST
(
PrintStlContainerTest
,
List
)
{
const
std
::
string
a
[]
=
{
"hello"
,
"world"
};
const
std
::
string
a
[]
=
{
"hello"
,
"world"
};
...
@@ -915,14 +902,12 @@ TEST(PrintStlContainerTest, MultiSet) {
...
@@ -915,14 +902,12 @@ TEST(PrintStlContainerTest, MultiSet) {
EXPECT_EQ
(
"{ 1, 1, 1, 2, 5 }"
,
Print
(
set1
));
EXPECT_EQ
(
"{ 1, 1, 1, 2, 5 }"
,
Print
(
set1
));
}
}
#if GTEST_HAS_STD_FORWARD_LIST_
TEST
(
PrintStlContainerTest
,
SinglyLinkedList
)
{
TEST
(
PrintStlContainerTest
,
SinglyLinkedList
)
{
int
a
[]
=
{
9
,
2
,
8
};
int
a
[]
=
{
9
,
2
,
8
};
const
std
::
forward_list
<
int
>
ints
(
a
,
a
+
3
);
const
std
::
forward_list
<
int
>
ints
(
a
,
a
+
3
);
EXPECT_EQ
(
"{ 9, 2, 8 }"
,
Print
(
ints
));
EXPECT_EQ
(
"{ 9, 2, 8 }"
,
Print
(
ints
));
}
}
#endif // GTEST_HAS_STD_FORWARD_LIST_
TEST
(
PrintStlContainerTest
,
Pair
)
{
TEST
(
PrintStlContainerTest
,
Pair
)
{
pair
<
const
bool
,
int
>
p
(
true
,
5
);
pair
<
const
bool
,
int
>
p
(
true
,
5
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment