Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
5c7c365d
Commit
5c7c365d
authored
Apr 01, 2018
by
Tanzinul Islam
Browse files
Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116
parents
6d089311
7888184f
Changes
34
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
846 additions
and
209 deletions
+846
-209
.travis.yml
.travis.yml
+0
-2
appveyor.yml
appveyor.yml
+1
-1
googlemock/include/gmock/gmock-actions.h
googlemock/include/gmock/gmock-actions.h
+6
-5
googlemock/include/gmock/gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+587
-83
googlemock/include/gmock/internal/custom/gmock-matchers.h
googlemock/include/gmock/internal/custom/gmock-matchers.h
+3
-4
googlemock/include/gmock/internal/gmock-internal-utils.h
googlemock/include/gmock/internal/gmock-internal-utils.h
+2
-0
googlemock/src/gmock-internal-utils.cc
googlemock/src/gmock-internal-utils.cc
+12
-2
googlemock/src/gmock-matchers.cc
googlemock/src/gmock-matchers.cc
+42
-35
googlemock/src/gmock.cc
googlemock/src/gmock.cc
+2
-2
googlemock/test/gmock-actions_test.cc
googlemock/test/gmock-actions_test.cc
+6
-2
googlemock/test/gmock-internal-utils_test.cc
googlemock/test/gmock-internal-utils_test.cc
+28
-0
googlemock/test/gmock_link_test.h
googlemock/test/gmock_link_test.h
+2
-0
googlemock/test/gmock_output_test_.cc
googlemock/test/gmock_output_test_.cc
+5
-1
googletest/include/gtest/gtest-param-test.h
googletest/include/gtest/gtest-param-test.h
+2
-4
googletest/include/gtest/gtest-param-test.h.pump
googletest/include/gtest/gtest-param-test.h.pump
+2
-4
googletest/include/gtest/gtest-printers.h
googletest/include/gtest/gtest-printers.h
+7
-5
googletest/include/gtest/internal/gtest-death-test-internal.h
...letest/include/gtest/internal/gtest-death-test-internal.h
+12
-8
googletest/include/gtest/internal/gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+74
-15
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+43
-26
googletest/scripts/gen_gtest_pred_impl.py
googletest/scripts/gen_gtest_pred_impl.py
+10
-10
No files found.
.travis.yml
View file @
5c7c365d
...
@@ -40,7 +40,6 @@ matrix:
...
@@ -40,7 +40,6 @@ matrix:
-
os
:
osx
-
os
:
osx
compiler
:
gcc
compiler
:
gcc
env
:
BUILD_TYPE=Debug VERBOSE=1
env
:
BUILD_TYPE=Debug VERBOSE=1
if
:
type != pull_request
-
os
:
osx
-
os
:
osx
compiler
:
gcc
compiler
:
gcc
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
...
@@ -50,7 +49,6 @@ matrix:
...
@@ -50,7 +49,6 @@ matrix:
env
:
BUILD_TYPE=Debug VERBOSE=1
env
:
BUILD_TYPE=Debug VERBOSE=1
if
:
type != pull_request
if
:
type != pull_request
-
os
:
osx
-
os
:
osx
compiler
:
clang
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
if
:
type != pull_request
if
:
type != pull_request
...
...
appveyor.yml
View file @
5c7c365d
...
@@ -87,7 +87,7 @@ test_script:
...
@@ -87,7 +87,7 @@ test_script:
if ($env:generator -eq "MinGW Makefiles") {
if ($env:generator -eq "MinGW Makefiles") {
return # No test available for MinGW
return # No test available for MinGW
}
}
& ctest -C $env:configuration --timeout
3
00 --output-on-failure
& ctest -C $env:configuration --timeout
6
00 --output-on-failure
if ($LastExitCode -ne 0) {
if ($LastExitCode -ne 0) {
throw "Exec: $ErrorMessage"
throw "Exec: $ErrorMessage"
}
}
...
...
googlemock/include/gmock/gmock-actions.h
View file @
5c7c365d
...
@@ -46,9 +46,10 @@
...
@@ -46,9 +46,10 @@
#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_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h.
#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h.
#include <functional>
#include <type_traits>
#include <type_traits>
#endif
#endif
// GTEST_LANG_CXX11
namespace
testing
{
namespace
testing
{
...
@@ -96,7 +97,7 @@ struct BuiltInDefaultValueGetter<T, false> {
...
@@ -96,7 +97,7 @@ struct BuiltInDefaultValueGetter<T, false> {
template
<
typename
T
>
template
<
typename
T
>
class
BuiltInDefaultValue
{
class
BuiltInDefaultValue
{
public:
public:
#if GTEST_
HAS_STD_TYPE_TRAITS_
#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
;
...
@@ -107,7 +108,7 @@ class BuiltInDefaultValue {
...
@@ -107,7 +108,7 @@ class BuiltInDefaultValue {
T
,
::
std
::
is_default_constructible
<
T
>::
value
>::
Get
();
T
,
::
std
::
is_default_constructible
<
T
>::
value
>::
Get
();
}
}
#else // GTEST_
HAS_STD_TYPE_TRAITS_
#else // 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
false
;
return
false
;
...
@@ -117,7 +118,7 @@ class BuiltInDefaultValue {
...
@@ -117,7 +118,7 @@ class BuiltInDefaultValue {
return
BuiltInDefaultValueGetter
<
T
,
false
>::
Get
();
return
BuiltInDefaultValueGetter
<
T
,
false
>::
Get
();
}
}
#endif // GTEST_
HAS_STD_TYPE_TRAITS_
#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
...
...
googlemock/include/gmock/gmock-matchers.h
View file @
5c7c365d
This diff is collapsed.
Click to expand it.
googlemock/include/gmock/internal/custom/gmock-matchers.h
View file @
5c7c365d
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
//
//
// Adds google3 callback support to CallableTraits.
// Adds google3 callback support to CallableTraits.
//
//
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
googlemock/include/gmock/internal/gmock-internal-utils.h
View file @
5c7c365d
...
@@ -117,9 +117,11 @@ struct LinkedPtrLessThan {
...
@@ -117,9 +117,11 @@ struct LinkedPtrLessThan {
// To gcc,
// To gcc,
// wchar_t == signed wchar_t != unsigned wchar_t == unsigned int
// wchar_t == signed wchar_t != unsigned wchar_t == unsigned int
#ifdef __GNUC__
#ifdef __GNUC__
#if !defined(__WCHAR_UNSIGNED__)
// signed/unsigned wchar_t are valid types.
// signed/unsigned wchar_t are valid types.
# define GMOCK_HAS_SIGNED_WCHAR_T_ 1
# define GMOCK_HAS_SIGNED_WCHAR_T_ 1
#endif
#endif
#endif
// In what follows, we use the term "kind" to indicate whether a type
// In what follows, we use the term "kind" to indicate whether a type
// is bool, an integer type (excluding bool), a floating-point type,
// is bool, an integer type (excluding bool), a floating-point type,
...
...
googlemock/src/gmock-internal-utils.cc
View file @
5c7c365d
...
@@ -70,8 +70,8 @@ GTEST_API_ std::string JoinAsTuple(const Strings& fields) {
...
@@ -70,8 +70,8 @@ GTEST_API_ std::string JoinAsTuple(const Strings& fields) {
// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
// treated as one word. For example, both "FooBar123" and
// treated as one word. For example, both "FooBar123" and
// "foo_bar_123" are converted to "foo bar 123".
// "foo_bar_123" are converted to "foo bar 123".
GTEST_API_
string
ConvertIdentifierNameToWords
(
const
char
*
id_name
)
{
GTEST_API_
std
::
string
ConvertIdentifierNameToWords
(
const
char
*
id_name
)
{
string
result
;
std
::
string
result
;
char
prev_char
=
'\0'
;
char
prev_char
=
'\0'
;
for
(
const
char
*
p
=
id_name
;
*
p
!=
'\0'
;
prev_char
=
*
(
p
++
))
{
for
(
const
char
*
p
=
id_name
;
*
p
!=
'\0'
;
prev_char
=
*
(
p
++
))
{
// We don't care about the current locale as the input is
// We don't care about the current locale as the input is
...
@@ -188,5 +188,15 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
...
@@ -188,5 +188,15 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
std
::
cout
<<
::
std
::
flush
;
std
::
cout
<<
::
std
::
flush
;
}
}
void
IllegalDoDefault
(
const
char
*
file
,
int
line
)
{
internal
::
Assert
(
false
,
file
,
line
,
"You are using DoDefault() inside a composite action like "
"DoAll() or WithArgs(). This is not supported for technical "
"reasons. Please instead spell out the default action, or "
"assign the default action to an Action variable and use "
"the variable in various places."
);
}
}
// namespace internal
}
// namespace internal
}
// namespace testing
}
// namespace testing
googlemock/src/gmock-matchers.cc
View file @
5c7c365d
...
@@ -44,60 +44,67 @@
...
@@ -44,60 +44,67 @@
namespace
testing
{
namespace
testing
{
// Constructs a matcher that matches a const string& whose value is
// Constructs a matcher that matches a const
std::
string& whose value is
// equal to s.
// equal to s.
Matcher
<
const
internal
::
string
&>::
Matcher
(
const
internal
::
string
&
s
)
{
Matcher
<
const
std
::
string
&>::
Matcher
(
const
std
::
string
&
s
)
{
*
this
=
Eq
(
s
);
}
*
this
=
Eq
(
s
);
#if GTEST_HAS_GLOBAL_STRING
// Constructs a matcher that matches a const std::string& whose value is
// equal to s.
Matcher
<
const
std
::
string
&>::
Matcher
(
const
::
string
&
s
)
{
*
this
=
Eq
(
static_cast
<
std
::
string
>
(
s
));
}
}
#endif // GTEST_HAS_GLOBAL_STRING
// Constructs a matcher that matches a const string& whose value is
// Constructs a matcher that matches a const
std::
string& whose value is
// equal to s.
// equal to s.
Matcher
<
const
internal
::
string
&>::
Matcher
(
const
char
*
s
)
{
Matcher
<
const
std
::
string
&>::
Matcher
(
const
char
*
s
)
{
*
this
=
Eq
(
internal
::
string
(
s
));
*
this
=
Eq
(
std
::
string
(
s
));
}
}
// Constructs a matcher that matches a string whose value is equal to s.
// Constructs a matcher that matches a std::string whose value is equal to
Matcher
<
internal
::
string
>::
Matcher
(
const
internal
::
string
&
s
)
{
*
this
=
Eq
(
s
);
}
// s.
Matcher
<
std
::
string
>::
Matcher
(
const
std
::
string
&
s
)
{
*
this
=
Eq
(
s
);
}
// Constructs a matcher that matches a string whose value is equal to s.
#if GTEST_HAS_GLOBAL_STRING
Matcher
<
internal
::
string
>::
Matcher
(
const
char
*
s
)
{
// Constructs a matcher that matches a std::string whose value is equal to
*
this
=
Eq
(
internal
::
string
(
s
));
// s.
Matcher
<
std
::
string
>::
Matcher
(
const
::
string
&
s
)
{
*
this
=
Eq
(
static_cast
<
std
::
string
>
(
s
));
}
}
#endif // GTEST_HAS_GLOBAL_STRING
// Constructs a matcher that matches a std::string whose value is equal to
// s.
Matcher
<
std
::
string
>::
Matcher
(
const
char
*
s
)
{
*
this
=
Eq
(
std
::
string
(
s
));
}
#if GTEST_HAS_
STRING_PIECE_
#if GTEST_HAS_
GLOBAL_STRING
// Constructs a matcher that matches a const
S
tring
Piece
& whose value is
// Constructs a matcher that matches a const
::s
tring& whose value is
// equal to s.
// equal to s.
Matcher
<
const
S
tring
Piece
&>::
Matcher
(
const
internal
::
string
&
s
)
{
Matcher
<
const
::
s
tring
&>::
Matcher
(
const
std
::
string
&
s
)
{
*
this
=
Eq
(
s
);
*
this
=
Eq
(
s
tatic_cast
<::
string
>
(
s
)
);
}
}
// Constructs a matcher that matches a const
S
tring
Piece
& whose value is
// Constructs a matcher that matches a const
::s
tring& whose value is
// equal to s.
// equal to s.
Matcher
<
const
StringPiece
&>::
Matcher
(
const
char
*
s
)
{
Matcher
<
const
::
string
&>::
Matcher
(
const
::
string
&
s
)
{
*
this
=
Eq
(
s
);
}
*
this
=
Eq
(
internal
::
string
(
s
));
}
// Constructs a matcher that matches a const
S
tring
Piece
& whose value is
// Constructs a matcher that matches a const
::s
tring& whose value is
// equal to s.
// equal to s.
Matcher
<
const
StringPiece
&>::
Matcher
(
StringPiece
s
)
{
Matcher
<
const
::
string
&>::
Matcher
(
const
char
*
s
)
{
*
this
=
Eq
(
::
string
(
s
));
}
*
this
=
Eq
(
s
.
ToString
());
}
// Constructs a matcher that matches a
S
tring
Piece
whose value is equal to s.
// Constructs a matcher that matches a
::s
tring whose value is equal to s.
Matcher
<
S
tring
Piece
>::
Matcher
(
const
internal
::
string
&
s
)
{
Matcher
<
::
s
tring
>::
Matcher
(
const
std
::
string
&
s
)
{
*
this
=
Eq
(
s
);
*
this
=
Eq
(
s
tatic_cast
<::
string
>
(
s
)
);
}
}
// Constructs a matcher that matches a StringPiece whose value is equal to s.
// Constructs a matcher that matches a ::string whose value is equal to s.
Matcher
<
StringPiece
>::
Matcher
(
const
char
*
s
)
{
Matcher
<::
string
>::
Matcher
(
const
::
string
&
s
)
{
*
this
=
Eq
(
s
);
}
*
this
=
Eq
(
internal
::
string
(
s
));
}
// Constructs a matcher that matches a string whose value is equal to s.
Matcher
<::
string
>::
Matcher
(
const
char
*
s
)
{
*
this
=
Eq
(
::
string
(
s
));
}
#endif // GTEST_HAS_GLOBAL_STRING
// Constructs a matcher that matches a StringPiece whose value is equal to s.
Matcher
<
StringPiece
>::
Matcher
(
StringPiece
s
)
{
*
this
=
Eq
(
s
.
ToString
());
}
#endif // GTEST_HAS_STRING_PIECE_
namespace
internal
{
namespace
internal
{
...
...
googlemock/src/gmock.cc
View file @
5c7c365d
...
@@ -136,8 +136,8 @@ static bool ParseGoogleMockIntFlag(const char* str, const char* flag,
...
@@ -136,8 +136,8 @@ static bool ParseGoogleMockIntFlag(const char* str, const char* flag,
if
(
value_str
==
NULL
)
return
false
;
if
(
value_str
==
NULL
)
return
false
;
// Sets *value to the value of the flag.
// Sets *value to the value of the flag.
*
value
=
atoi
(
value_str
);
return
ParseInt32
(
Message
()
<<
"The value of flag --"
<<
flag
,
return
tr
ue
;
value_str
,
val
ue
)
;
}
}
// The internal implementation of InitGoogleMock().
// The internal implementation of InitGoogleMock().
...
...
googlemock/test/gmock-actions_test.cc
View file @
5c7c365d
...
@@ -107,7 +107,11 @@ TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
...
@@ -107,7 +107,11 @@ TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
EXPECT_EQ
(
0
,
BuiltInDefaultValue
<
signed
wchar_t
>::
Get
());
EXPECT_EQ
(
0
,
BuiltInDefaultValue
<
signed
wchar_t
>::
Get
());
#endif
#endif
#if GMOCK_WCHAR_T_IS_NATIVE_
#if GMOCK_WCHAR_T_IS_NATIVE_
#if !defined(__WCHAR_UNSIGNED__)
EXPECT_EQ
(
0
,
BuiltInDefaultValue
<
wchar_t
>::
Get
());
EXPECT_EQ
(
0
,
BuiltInDefaultValue
<
wchar_t
>::
Get
());
#else
EXPECT_EQ
(
0U
,
BuiltInDefaultValue
<
wchar_t
>::
Get
());
#endif
#endif
#endif
EXPECT_EQ
(
0U
,
BuiltInDefaultValue
<
unsigned
short
>::
Get
());
// NOLINT
EXPECT_EQ
(
0U
,
BuiltInDefaultValue
<
unsigned
short
>::
Get
());
// NOLINT
EXPECT_EQ
(
0
,
BuiltInDefaultValue
<
signed
short
>::
Get
());
// NOLINT
EXPECT_EQ
(
0
,
BuiltInDefaultValue
<
signed
short
>::
Get
());
// NOLINT
...
@@ -214,7 +218,7 @@ class MyNonDefaultConstructible {
...
@@ -214,7 +218,7 @@ class MyNonDefaultConstructible {
int
value_
;
int
value_
;
};
};
#if GTEST_
HAS_STD_TYPE_TRAITS_
#if GTEST_
LANG_CXX11
TEST
(
BuiltInDefaultValueTest
,
ExistsForDefaultConstructibleType
)
{
TEST
(
BuiltInDefaultValueTest
,
ExistsForDefaultConstructibleType
)
{
EXPECT_TRUE
(
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Exists
());
EXPECT_TRUE
(
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Exists
());
...
@@ -224,7 +228,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
...
@@ -224,7 +228,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
EXPECT_EQ
(
42
,
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Get
().
value
());
EXPECT_EQ
(
42
,
BuiltInDefaultValue
<
MyDefaultConstructible
>::
Get
().
value
());
}
}
#endif // GTEST_
HAS_STD_TYPE_TRAITS_
#endif // GTEST_
LANG_CXX11
TEST
(
BuiltInDefaultValueTest
,
DoesNotExistForNonDefaultConstructibleType
)
{
TEST
(
BuiltInDefaultValueTest
,
DoesNotExistForNonDefaultConstructibleType
)
{
EXPECT_FALSE
(
BuiltInDefaultValue
<
MyNonDefaultConstructible
>::
Exists
());
EXPECT_FALSE
(
BuiltInDefaultValue
<
MyNonDefaultConstructible
>::
Exists
());
...
...
googlemock/test/gmock-internal-utils_test.cc
View file @
5c7c365d
...
@@ -44,7 +44,15 @@
...
@@ -44,7 +44,15 @@
#include "gmock/internal/gmock-port.h"
#include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#include "gtest/gtest-spi.h"
#include "gtest/gtest-spi.h"
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
#if GTEST_OS_CYGWIN
#if GTEST_OS_CYGWIN
# include <sys/types.h> // For ssize_t. NOLINT
# include <sys/types.h> // For ssize_t. NOLINT
...
@@ -61,6 +69,26 @@ namespace internal {
...
@@ -61,6 +69,26 @@ namespace internal {
namespace
{
namespace
{
TEST
(
JoinAsTupleTest
,
JoinsEmptyTuple
)
{
EXPECT_EQ
(
""
,
JoinAsTuple
(
Strings
()));
}
TEST
(
JoinAsTupleTest
,
JoinsOneTuple
)
{
const
char
*
fields
[]
=
{
"1"
};
EXPECT_EQ
(
"1"
,
JoinAsTuple
(
Strings
(
fields
,
fields
+
1
)));
}
TEST
(
JoinAsTupleTest
,
JoinsTwoTuple
)
{
const
char
*
fields
[]
=
{
"1"
,
"a"
};
EXPECT_EQ
(
"(1, a)"
,
JoinAsTuple
(
Strings
(
fields
,
fields
+
2
)));
}
TEST
(
JoinAsTupleTest
,
JoinsTenTuple
)
{
const
char
*
fields
[]
=
{
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
};
EXPECT_EQ
(
"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)"
,
JoinAsTuple
(
Strings
(
fields
,
fields
+
10
)));
}
TEST
(
ConvertIdentifierNameToWordsTest
,
WorksWhenNameContainsNoWord
)
{
TEST
(
ConvertIdentifierNameToWordsTest
,
WorksWhenNameContainsNoWord
)
{
EXPECT_EQ
(
""
,
ConvertIdentifierNameToWords
(
""
));
EXPECT_EQ
(
""
,
ConvertIdentifierNameToWords
(
""
));
EXPECT_EQ
(
""
,
ConvertIdentifierNameToWords
(
"_"
));
EXPECT_EQ
(
""
,
ConvertIdentifierNameToWords
(
"_"
));
...
...
googlemock/test/gmock_link_test.h
View file @
5c7c365d
...
@@ -90,8 +90,10 @@
...
@@ -90,8 +90,10 @@
// Field
// Field
// Property
// Property
// ResultOf(function)
// ResultOf(function)
// ResultOf(callback)
// Pointee
// Pointee
// Truly(predicate)
// Truly(predicate)
// AddressSatisfies
// AllOf
// AllOf
// AnyOf
// AnyOf
// Not
// Not
...
...
googlemock/test/gmock_output_test_.cc
View file @
5c7c365d
...
@@ -47,6 +47,7 @@ using testing::NaggyMock;
...
@@ -47,6 +47,7 @@ using testing::NaggyMock;
using
testing
::
Ref
;
using
testing
::
Ref
;
using
testing
::
Return
;
using
testing
::
Return
;
using
testing
::
Sequence
;
using
testing
::
Sequence
;
using
testing
::
Value
;
class
MockFoo
{
class
MockFoo
{
public:
public:
...
@@ -268,6 +269,10 @@ TEST_F(GMockOutputTest, CatchesLeakedMocks) {
...
@@ -268,6 +269,10 @@ TEST_F(GMockOutputTest, CatchesLeakedMocks) {
// Both foo1 and foo2 are deliberately leaked.
// Both foo1 and foo2 are deliberately leaked.
}
}
MATCHER_P2
(
IsPair
,
first
,
second
,
""
)
{
return
Value
(
arg
.
first
,
first
)
&&
Value
(
arg
.
second
,
second
);
}
void
TestCatchesLeakedMocksInAdHocTests
()
{
void
TestCatchesLeakedMocksInAdHocTests
()
{
MockFoo
*
foo
=
new
MockFoo
;
MockFoo
*
foo
=
new
MockFoo
;
...
@@ -280,7 +285,6 @@ void TestCatchesLeakedMocksInAdHocTests() {
...
@@ -280,7 +285,6 @@ void TestCatchesLeakedMocksInAdHocTests() {
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleMock
(
&
argc
,
argv
);
testing
::
InitGoogleMock
(
&
argc
,
argv
);
// Ensures that the tests pass no matter what value of
// Ensures that the tests pass no matter what value of
// --gmock_catch_leaked_mocks and --gmock_verbose the user specifies.
// --gmock_catch_leaked_mocks and --gmock_verbose the user specifies.
testing
::
GMOCK_FLAG
(
catch_leaked_mocks
)
=
true
;
testing
::
GMOCK_FLAG
(
catch_leaked_mocks
)
=
true
;
...
...
googletest/include/gtest/gtest-param-test.h
View file @
5c7c365d
...
@@ -1371,8 +1371,6 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
...
@@ -1371,8 +1371,6 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
}
}
# endif // GTEST_HAS_COMBINE
# endif // GTEST_HAS_COMBINE
# define TEST_P(test_case_name, test_name) \
# define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \
: public test_case_name { \
...
@@ -1386,8 +1384,8 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
...
@@ -1386,8 +1384,8 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
#test_case_name, \
#test_case_name, \
::testing::internal::CodeLocation(\
::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestPattern(\
__FILE__, __LINE__))->AddTestPattern(\
#
test_case_name, \
GTEST_STRINGIFY_(
test_case_name
)
, \
#
test_name, \
GTEST_STRINGIFY_(
test_name
)
, \
new ::testing::internal::TestMetaFactory< \
new ::testing::internal::TestMetaFactory< \
GTEST_TEST_CLASS_NAME_(\
GTEST_TEST_CLASS_NAME_(\
test_case_name, test_name)>()); \
test_case_name, test_name)>()); \
...
...
googletest/include/gtest/gtest-param-test.h.pump
View file @
5c7c365d
...
@@ -436,8 +436,6 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
...
@@ -436,8 +436,6 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
]]
]]
# endif // GTEST_HAS_COMBINE
# endif // GTEST_HAS_COMBINE
# define TEST_P(test_case_name, test_name) \
# define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \
: public test_case_name { \
...
@@ -451,8 +449,8 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
...
@@ -451,8 +449,8 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
#test_case_name, \
#test_case_name, \
::testing::internal::CodeLocation(\
::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestPattern(\
__FILE__, __LINE__))->AddTestPattern(\
#
test_case_name, \
GTEST_STRINGIFY_(
test_case_name
)
, \
#
test_name, \
GTEST_STRINGIFY_(
test_name
)
, \
new ::testing::internal::TestMetaFactory< \
new ::testing::internal::TestMetaFactory< \
GTEST_TEST_CLASS_NAME_(\
GTEST_TEST_CLASS_NAME_(\
test_case_name, test_name)>()); \
test_case_name, test_name)>()); \
...
...
googletest/include/gtest/gtest-printers.h
View file @
5c7c365d
...
@@ -509,17 +509,19 @@ void PrintTo(const T& value, ::std::ostream* os) {
...
@@ -509,17 +509,19 @@ void PrintTo(const T& value, ::std::ostream* os) {
// function pointers so that the `*os << p` in the object pointer overload
// function pointers so that the `*os << p` in the object pointer overload
// doesn't cause that warning either.
// doesn't cause that warning either.
DefaultPrintTo
(
DefaultPrintTo
(
WrapPrinterType
<
WrapPrinterType
<
(
sizeof
(
IsContainerTest
<
T
>
(
0
))
==
sizeof
(
IsContainer
))
&&
!
IsRecursiveContainer
<
T
>::
value
(
sizeof
(
IsContainerTest
<
T
>
(
0
))
==
sizeof
(
IsContainer
))
&&
?
kPrintContainer
:
!
is_pointer
<
T
>::
value
!
IsRecursiveContainer
<
T
>::
value
?
kPrintOther
?
kPrintContainer
:
!
is_pointer
<
T
>::
value
?
kPrintOther
#if GTEST_LANG_CXX11
#if GTEST_LANG_CXX11
:
std
::
is_function
<
typename
std
::
remove_pointer
<
T
>::
type
>::
value
:
std
::
is_function
<
typename
std
::
remove_pointer
<
T
>::
type
>::
value
#else
#else
:
!
internal
::
ImplicitlyConvertible
<
T
,
const
void
*>::
value
:
!
internal
::
ImplicitlyConvertible
<
T
,
const
void
*>::
value
#endif
#endif
?
kPrintFunctionPointer
?
kPrintFunctionPointer
:
kPrintPointer
>
(),
:
kPrintPointer
>
(),
value
,
os
);
value
,
os
);
}
}
...
...
googletest/include/gtest/internal/gtest-death-test-internal.h
View file @
5c7c365d
...
@@ -217,14 +217,18 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
...
@@ -217,14 +217,18 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
// can be streamed.
// can be streamed.
// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
// NDEBUG mode. In this case we need the statements to be executed, the regex is
// NDEBUG mode. In this case we need the statements to be executed and the macro
// ignored, and the macro must accept a streamed message even though the message
// must accept a streamed message even though the message is never printed.
// is never printed.
// The regex object is not evaluated, but it is used to prevent "unused"
# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
// warnings and to avoid an expression that doesn't compile in debug mode.
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
#define GTEST_EXECUTE_STATEMENT_(statement, regex) \
if (::testing::internal::AlwaysTrue()) { \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
if (::testing::internal::AlwaysTrue()) { \
} else \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} else if (!::testing::internal::AlwaysTrue()) { \
const ::testing::internal::RE& gtest_regex = (regex); \
static_cast<void>(gtest_regex); \
} else \
::testing::Message()
::testing::Message()
// A class representing the parsed contents of the
// A class representing the parsed contents of the
...
...
googletest/include/gtest/internal/gtest-internal.h
View file @
5c7c365d
...
@@ -75,6 +75,9 @@
...
@@ -75,6 +75,9 @@
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
// Stringifies its argument.
#define GTEST_STRINGIFY_(name) #name
class
ProtocolMessage
;
class
ProtocolMessage
;
namespace
proto2
{
class
Message
;
}
namespace
proto2
{
class
Message
;
}
...
@@ -872,8 +875,11 @@ struct IsAProtocolMessage
...
@@ -872,8 +875,11 @@ struct IsAProtocolMessage
// a container class by checking the type of IsContainerTest<C>(0).
// a container class by checking the type of IsContainerTest<C>(0).
// The value of the expression is insignificant.
// The value of the expression is insignificant.
//
//
// Note that we look for both C::iterator and C::const_iterator. The
// In C++11 mode we check the existence of a const_iterator and that an
// reason is that C++ injects the name of a class as a member of the
// iterator is properly implemented for the container.
//
// For pre-C++11 that we look for both C::iterator and C::const_iterator.
// The reason is that C++ injects the name of a class as a member of the
// class itself (e.g. you can refer to class iterator as either
// class itself (e.g. you can refer to class iterator as either
// 'iterator' or 'iterator::iterator'). If we look for C::iterator
// 'iterator' or 'iterator::iterator'). If we look for C::iterator
// only, for example, we would mistakenly think that a class named
// only, for example, we would mistakenly think that a class named
...
@@ -883,40 +889,94 @@ struct IsAProtocolMessage
...
@@ -883,40 +889,94 @@ struct IsAProtocolMessage
// IsContainerTest(typename C::const_iterator*) and
// IsContainerTest(typename C::const_iterator*) and
// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
typedef
int
IsContainer
;
typedef
int
IsContainer
;
#if GTEST_LANG_CXX11
template
<
class
C
,
class
Iterator
=
decltype
(
::
std
::
declval
<
const
C
&
>().
begin
()),
class
=
decltype
(
::
std
::
declval
<
const
C
&>
().
end
()),
class
=
decltype
(
++::
std
::
declval
<
Iterator
&>
()),
class
=
decltype
(
*::
std
::
declval
<
Iterator
>
()),
class
=
typename
C
::
const_iterator
>
IsContainer
IsContainerTest
(
int
/* dummy */
)
{
return
0
;
}
#else
template
<
class
C
>
template
<
class
C
>
IsContainer
IsContainerTest
(
int
/* dummy */
,
IsContainer
IsContainerTest
(
int
/* dummy */
,
typename
C
::
iterator
*
/* it */
=
NULL
,
typename
C
::
iterator
*
/* it */
=
NULL
,
typename
C
::
const_iterator
*
/* const_it */
=
NULL
)
{
typename
C
::
const_iterator
*
/* const_it */
=
NULL
)
{
return
0
;
return
0
;
}
}
#endif // GTEST_LANG_CXX11
typedef
char
IsNotContainer
;
typedef
char
IsNotContainer
;
template
<
class
C
>
template
<
class
C
>
IsNotContainer
IsContainerTest
(
long
/* dummy */
)
{
return
'\0'
;
}
IsNotContainer
IsContainerTest
(
long
/* dummy */
)
{
return
'\0'
;
}
template
<
typename
C
,
bool
=
// Trait to detect whether a type T is a hash table.
sizeof
(
IsContainerTest
<
C
>(
0
))
==
sizeof
(
IsContainer
)
// The heuristic used is that the type contains an inner type `hasher` and does
>
// not contain an inner type `reverse_iterator`.
// If the container is iterable in reverse, then order might actually matter.
template
<
typename
T
>
struct
IsHashTable
{
private:
template
<
typename
U
>
static
char
test
(
typename
U
::
hasher
*
,
typename
U
::
reverse_iterator
*
);
template
<
typename
U
>
static
int
test
(
typename
U
::
hasher
*
,
...);
template
<
typename
U
>
static
char
test
(...);
public:
static
const
bool
value
=
sizeof
(
test
<
T
>
(
0
,
0
))
==
sizeof
(
int
);
};
template
<
typename
T
>
const
bool
IsHashTable
<
T
>::
value
;
template
<
typename
T
>
struct
VoidT
{
typedef
void
value_type
;
};
template
<
typename
T
,
typename
=
void
>
struct
HasValueType
:
false_type
{};
template
<
typename
T
>
struct
HasValueType
<
T
,
VoidT
<
typename
T
::
value_type
>
>
:
true_type
{
};
template
<
typename
C
,
bool
=
sizeof
(
IsContainerTest
<
C
>(
0
))
==
sizeof
(
IsContainer
),
bool
=
HasValueType
<
C
>::
value
>
struct
IsRecursiveContainerImpl
;
struct
IsRecursiveContainerImpl
;
template
<
typename
C
,
bool
HV
>
struct
IsRecursiveContainerImpl
<
C
,
false
,
HV
>
:
public
false_type
{};
// Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to
// obey the same inconsistencies as the IsContainerTest, namely check if
// something is a container is relying on only const_iterator in C++11 and
// is relying on both const_iterator and iterator otherwise
template
<
typename
C
>
template
<
typename
C
>
struct
IsRecursiveContainerImpl
<
C
,
false
>
:
public
false_type
{};
struct
IsRecursiveContainerImpl
<
C
,
true
,
false
>
:
public
false_type
{};
template
<
typename
C
>
template
<
typename
C
>
struct
IsRecursiveContainerImpl
<
C
,
true
>
{
struct
IsRecursiveContainerImpl
<
C
,
true
,
true
>
{
typedef
#if GTEST_LANG_CXX11
typename
IteratorTraits
<
typename
C
::
iterator
>::
value_type
typedef
typename
IteratorTraits
<
typename
C
::
const_iterator
>::
value_type
value_type
;
value_type
;
#else
typedef
typename
IteratorTraits
<
typename
C
::
iterator
>::
value_type
value_type
;
#endif
typedef
is_same
<
value_type
,
C
>
type
;
typedef
is_same
<
value_type
,
C
>
type
;
};
};
// IsRecursiveContainer<Type> is a unary compile-time predicate that
// IsRecursiveContainer<Type> is a unary compile-time predicate that
// evaluates whether C is a recursive container type. A recursive container
// evaluates whether C is a recursive container type. A recursive container
// type is a container type whose value_type is equal to the container type
// type is a container type whose value_type is equal to the container type
// itself. An example for a recursive container type is
// itself. An example for a recursive container type is
// boost::filesystem::path, whose iterator has a value_type that is equal to
// boost::filesystem::path, whose iterator has a value_type that is equal to
// boost::filesystem::path.
// boost::filesystem::path.
template
<
typename
C
>
template
<
typename
C
>
struct
IsRecursiveContainer
:
public
IsRecursiveContainerImpl
<
C
>::
type
{};
struct
IsRecursiveContainer
:
public
IsRecursiveContainerImpl
<
C
>::
type
{};
// EnableIf<condition>::type is void when 'Cond' is true, and
// EnableIf<condition>::type is void when 'Cond' is true, and
...
@@ -1215,4 +1275,3 @@ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
...
@@ -1215,4 +1275,3 @@ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
googletest/include/gtest/internal/gtest-port.h
View file @
5c7c365d
...
@@ -363,14 +363,14 @@
...
@@ -363,14 +363,14 @@
#if GTEST_STDLIB_CXX11
#if GTEST_STDLIB_CXX11
# define GTEST_HAS_STD_BEGIN_AND_END_ 1
# define GTEST_HAS_STD_BEGIN_AND_END_ 1
# define GTEST_HAS_STD_FORWARD_LIST_ 1
# define GTEST_HAS_STD_FORWARD_LIST_ 1
# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824) // works only with VS2015U2 and better
# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824)
// works only with VS2015U2 and better
# define GTEST_HAS_STD_FUNCTION_ 1
# define GTEST_HAS_STD_FUNCTION_ 1
# endif
# endif
# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
# define GTEST_HAS_STD_MOVE_ 1
# define GTEST_HAS_STD_MOVE_ 1
# define GTEST_HAS_STD_SHARED_PTR_ 1
# define GTEST_HAS_STD_TYPE_TRAITS_ 1
# define GTEST_HAS_STD_UNIQUE_PTR_ 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_MAP_ 1
# define GTEST_HAS_UNORDERED_SET_ 1
# define GTEST_HAS_UNORDERED_SET_ 1
#endif
#endif
...
@@ -519,7 +519,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
...
@@ -519,7 +519,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
# define GTEST_HAS_STD_STRING 1
# define GTEST_HAS_STD_STRING 1
#elif !GTEST_HAS_STD_STRING
#elif !GTEST_HAS_STD_STRING
// The user told us that ::std::string isn't available.
// The user told us that ::std::string isn't available.
# error "
Google Test cannot be used where
::std::string isn't available."
# error "::std::string isn't available."
#endif // !defined(GTEST_HAS_STD_STRING)
#endif // !defined(GTEST_HAS_STD_STRING)
#ifndef GTEST_HAS_GLOBAL_STRING
#ifndef GTEST_HAS_GLOBAL_STRING
...
@@ -889,6 +889,12 @@ using ::std::tuple_size;
...
@@ -889,6 +889,12 @@ using ::std::tuple_size;
# 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)
...
@@ -906,15 +912,16 @@ using ::std::tuple_size;
...
@@ -906,15 +912,16 @@ using ::std::tuple_size;
# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
#endif
#endif
// 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 &)
void operator=(type const &)
GTEST_CXX11_EQUALS_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 &)
;
\
type(type const &)
GTEST_CXX11_EQUALS_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
...
@@ -975,13 +982,13 @@ using ::std::tuple_size;
...
@@ -975,13 +982,13 @@ using ::std::tuple_size;
# endif
# endif
#elif __GNUC__ >= 4 || defined(__clang__)
#elif __GNUC__ >= 4 || defined(__clang__)
# define GTEST_API_ __attribute__((visibility ("default")))
# define GTEST_API_ __attribute__((visibility ("default")))
#endif // _MSC_VER
#endif
// _MSC_VER
#endif // GTEST_API_
#endif
// GTEST_API_
#ifndef GTEST_API_
#ifndef GTEST_API_
# define GTEST_API_
# define GTEST_API_
#endif // GTEST_API_
#endif
// GTEST_API_
#ifndef GTEST_DEFAULT_DEATH_TEST_STYLE
#ifndef GTEST_DEFAULT_DEATH_TEST_STYLE
# define GTEST_DEFAULT_DEATH_TEST_STYLE "fast"
# define GTEST_DEFAULT_DEATH_TEST_STYLE "fast"
...
@@ -995,10 +1002,12 @@ using ::std::tuple_size;
...
@@ -995,10 +1002,12 @@ using ::std::tuple_size;
#endif
#endif
// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
#if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
#if !defined(GTEST_HAS_CXXABI_H_)
# define GTEST_HAS_CXXABI_H_ 1
# if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
#else
# define GTEST_HAS_CXXABI_H_ 1
# define GTEST_HAS_CXXABI_H_ 0
# else
# define GTEST_HAS_CXXABI_H_ 0
# endif
#endif
#endif
// A function level attribute to disable checking for use of uninitialized
// A function level attribute to disable checking for use of uninitialized
...
@@ -1425,6 +1434,8 @@ template <typename T>
...
@@ -1425,6 +1434,8 @@ template <typename T>
const
T
&
move
(
const
T
&
t
)
{
const
T
&
move
(
const
T
&
t
)
{
return
t
;
return
t
;
}
}
template
<
typename
T
>
GTEST_ADD_REFERENCE_
(
T
)
forward
(
GTEST_ADD_REFERENCE_
(
T
)
t
)
{
return
t
;
}
template
<
typename
T
>
template
<
typename
T
>
struct
RvalueRef
{
struct
RvalueRef
{
...
@@ -1537,14 +1548,18 @@ GTEST_API_ size_t GetFileSize(FILE* file);
...
@@ -1537,14 +1548,18 @@ GTEST_API_ size_t GetFileSize(FILE* file);
GTEST_API_
std
::
string
ReadEntireFile
(
FILE
*
file
);
GTEST_API_
std
::
string
ReadEntireFile
(
FILE
*
file
);
// All command line arguments.
// All command line arguments.
GTEST_API_
const
::
std
::
vector
<
testing
::
internal
::
string
>
&
GetArgvs
();
GTEST_API_
std
::
vector
<
std
::
string
>
GetArgvs
();
#if GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
const
::
std
::
vector
<
testing
::
internal
::
string
>&
GetInjectableArgvs
();
std
::
vector
<
std
::
string
>
GetInjectableArgvs
();
void
SetInjectableArgvs
(
const
::
std
::
vector
<
testing
::
internal
::
string
>*
// Deprecated: pass the args vector by value instead.
new_argvs
);
void
SetInjectableArgvs
(
const
std
::
vector
<
std
::
string
>*
new_argvs
);
void
SetInjectableArgvs
(
const
std
::
vector
<
std
::
string
>&
new_argvs
);
#if GTEST_HAS_GLOBAL_STRING
void
SetInjectableArgvs
(
const
std
::
vector
<
::
string
>&
new_argvs
);
#endif // GTEST_HAS_GLOBAL_STRING
void
ClearInjectableArgvs
();
#endif // GTEST_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
...
@@ -2325,6 +2340,7 @@ struct is_same : public false_type {};
...
@@ -2325,6 +2340,7 @@ struct is_same : public false_type {};
template
<
typename
T
>
template
<
typename
T
>
struct
is_same
<
T
,
T
>
:
public
true_type
{};
struct
is_same
<
T
,
T
>
:
public
true_type
{};
template
<
typename
T
>
template
<
typename
T
>
struct
is_pointer
:
public
false_type
{};
struct
is_pointer
:
public
false_type
{};
...
@@ -2336,6 +2352,7 @@ struct IteratorTraits {
...
@@ -2336,6 +2352,7 @@ struct IteratorTraits {
typedef
typename
Iterator
::
value_type
value_type
;
typedef
typename
Iterator
::
value_type
value_type
;
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
IteratorTraits
<
T
*>
{
struct
IteratorTraits
<
T
*>
{
typedef
T
value_type
;
typedef
T
value_type
;
...
@@ -2631,15 +2648,15 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
...
@@ -2631,15 +2648,15 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
# define GTEST_DECLARE_int32_(name) \
# define GTEST_DECLARE_int32_(name) \
GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
#define GTEST_DECLARE_string_(name) \
#
define GTEST_DECLARE_string_(name) \
GTEST_API_ extern ::std::string GTEST_FLAG(name)
GTEST_API_ extern ::std::string GTEST_FLAG(name)
// Macros for defining flags.
// Macros for defining flags.
#define GTEST_DEFINE_bool_(name, default_val, doc) \
#
define GTEST_DEFINE_bool_(name, default_val, doc) \
GTEST_API_ bool GTEST_FLAG(name) = (default_val)
GTEST_API_ bool GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_int32_(name, default_val, doc) \
#
define GTEST_DEFINE_int32_(name, default_val, doc) \
GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_string_(name, default_val, doc) \
#
define GTEST_DEFINE_string_(name, default_val, doc) \
GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
#endif // !defined(GTEST_DECLARE_bool_)
#endif // !defined(GTEST_DECLARE_bool_)
...
@@ -2662,10 +2679,10 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value);
...
@@ -2662,10 +2679,10 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value);
// corresponding to the given Google Test flag.
// corresponding to the given Google Test flag.
bool
BoolFromGTestEnv
(
const
char
*
flag
,
bool
default_val
);
bool
BoolFromGTestEnv
(
const
char
*
flag
,
bool
default_val
);
GTEST_API_
Int32
Int32FromGTestEnv
(
const
char
*
flag
,
Int32
default_val
);
GTEST_API_
Int32
Int32FromGTestEnv
(
const
char
*
flag
,
Int32
default_val
);
std
::
string
StringFromGTestEnv
(
const
char
*
flag
,
const
char
*
default_val
);
std
::
string
OutputFlagAlsoCheckEnvVar
();
const
char
*
StringFromGTestEnv
(
const
char
*
flag
,
const
char
*
default_val
);
}
// namespace internal
}
// namespace internal
}
// namespace testing
}
// namespace testing
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
googletest/scripts/gen_gtest_pred_impl.py
View file @
5c7c365d
...
@@ -115,10 +115,9 @@ def HeaderPreamble(n):
...
@@ -115,10 +115,9 @@ def HeaderPreamble(n):
#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
// Makes sure this header is not included before gtest.h.
#include "gtest/gtest.h"
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
# error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
namespace testing {
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
// This header implements a family of generic predicate assertion
// This header implements a family of generic predicate assertion
// macros:
// macros:
...
@@ -295,16 +294,17 @@ def HeaderPostamble():
...
@@ -295,16 +294,17 @@ def HeaderPostamble():
return
"""
return
"""
} // namespace testing
#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
"""
"""
def
GenerateFile
(
path
,
content
):
def
GenerateFile
(
path
,
content
):
"""Given a file path and a content string
, overwrites it with the
"""Given a file path and a content string
given content.
"""
overwrites it with the
given content.
"""
print
'Updating file %s . . .'
%
path
print
'Updating file %s . . .'
%
path
f
=
file
(
path
,
'w+'
)
f
=
file
(
path
,
'w+'
)
print
>>
f
,
content
,
print
>>
f
,
content
,
f
.
close
()
f
.
close
()
...
@@ -314,8 +314,8 @@ def GenerateFile(path, content):
...
@@ -314,8 +314,8 @@ def GenerateFile(path, content):
def
GenerateHeader
(
n
):
def
GenerateHeader
(
n
):
"""Given the maximum arity n, updates the header file that implements
"""Given the maximum arity n, updates the header file that implements
the predicate assertions.
"""
the predicate assertions.
"""
GenerateFile
(
HEADER
,
GenerateFile
(
HEADER
,
HeaderPreamble
(
n
)
HeaderPreamble
(
n
)
+
''
.
join
([
ImplementationForArity
(
i
)
for
i
in
OneTo
(
n
)])
+
''
.
join
([
ImplementationForArity
(
i
)
for
i
in
OneTo
(
n
)])
...
...
Prev
1
2
Next
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