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
a325ad2d
"include/git@developer.sourcefind.cn:yangql/googletest.git" did not exist on "d478a1f46d51ac2baa3f3b3896139897f24dc2d1"
Unverified
Commit
a325ad2d
authored
Mar 14, 2018
by
Gennadiy Civil
Committed by
GitHub
Mar 14, 2018
Browse files
Merge pull request #1504 from gennadiycivil/master
Merges
parents
f35fe6de
262aaf2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
72 deletions
+24
-72
googlemock/include/gmock/gmock-actions.h
googlemock/include/gmock/gmock-actions.h
+6
-5
googlemock/test/gmock-actions_test.cc
googlemock/test/gmock-actions_test.cc
+2
-2
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+6
-6
googletest/test/gtest-printers_test.cc
googletest/test/gtest-printers_test.cc
+10
-59
No files found.
googlemock/include/gmock/gmock-actions.h
View file @
a325ad2d
...
@@ -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/test/gmock-actions_test.cc
View file @
a325ad2d
...
@@ -218,7 +218,7 @@ class MyNonDefaultConstructible {
...
@@ -218,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
());
...
@@ -228,7 +228,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
...
@@ -228,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
());
...
...
googletest/include/gtest/internal/gtest-port.h
View file @
a325ad2d
...
@@ -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
...
@@ -982,13 +982,13 @@ using ::std::tuple_size;
...
@@ -982,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"
...
...
googletest/test/gtest-printers_test.cc
View file @
a325ad2d
...
@@ -50,18 +50,13 @@
...
@@ -50,18 +50,13 @@
#include "gtest/gtest.h"
#include "gtest/gtest.h"
// hash_map and hash_set are available under Visual C++, or on Linux.
#if GTEST_HAS_UNORDERED_MAP_
#if GTEST_HAS_UNORDERED_MAP_
# include <unordered_map> // NOLINT
# include <unordered_map> // NOLINT
#elif GTEST_HAS_HASH_MAP_
#endif // GTEST_HAS_UNORDERED_MAP_
# include <hash_map> // NOLINT
#endif // GTEST_HAS_HASH_MAP_
#if GTEST_HAS_UNORDERED_SET_
#if GTEST_HAS_UNORDERED_SET_
# include <unordered_set> // NOLINT
# include <unordered_set> // NOLINT
#elif GTEST_HAS_HASH_SET_
#endif // GTEST_HAS_UNORDERED_SET_
# include <hash_set> // NOLINT
#endif // GTEST_HAS_HASH_SET_
#if GTEST_HAS_STD_FORWARD_LIST_
#if GTEST_HAS_STD_FORWARD_LIST_
# include <forward_list> // NOLINT
# include <forward_list> // NOLINT
...
@@ -240,50 +235,6 @@ using ::testing::internal::UniversalTersePrint;
...
@@ -240,50 +235,6 @@ using ::testing::internal::UniversalTersePrint;
using
::
testing
::
internal
::
UniversalTersePrintTupleFieldsToStrings
;
using
::
testing
::
internal
::
UniversalTersePrintTupleFieldsToStrings
;
#endif
#endif
// The hash_* classes are not part of the C++ standard. STLport
// defines them in namespace std. MSVC defines them in ::stdext. GCC
// defines them in ::.
#if GTEST_HAS_UNORDERED_MAP_
#define GTEST_HAS_HASH_MAP_ 1
template
<
class
Key
,
class
T
>
using
hash_map
=
::
std
::
unordered_map
<
Key
,
T
>
;
template
<
class
Key
,
class
T
>
using
hash_multimap
=
::
std
::
unordered_multimap
<
Key
,
T
>
;
#elif GTEST_HAS_HASH_MAP_
#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
using
::
std
::
hash_map
;
using
::
std
::
hash_multimap
;
#elif _MSC_VER
using
::
stdext
::
hash_map
;
using
::
stdext
::
hash_multimap
;
#endif
#endif
#if GTEST_HAS_UNORDERED_SET_
#define GTEST_HAS_HASH_SET_ 1
template
<
class
Key
>
using
hash_set
=
::
std
::
unordered_set
<
Key
>
;
template
<
class
Key
>
using
hash_multiset
=
::
std
::
unordered_multiset
<
Key
>
;
#elif GTEST_HAS_HASH_SET_
#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
using
::
std
::
hash_map
;
using
::
std
::
hash_multimap
;
#elif _MSC_VER
using
::
stdext
::
hash_map
;
using
::
stdext
::
hash_multimap
;
#endif
#endif
// Prints a value to a string using the universal value printer. This
// Prints a value to a string using the universal value printer. This
// is a helper for testing UniversalPrinter<T>::Print() for various types.
// is a helper for testing UniversalPrinter<T>::Print() for various types.
template
<
typename
T
>
template
<
typename
T
>
...
@@ -868,16 +819,16 @@ TEST(PrintStlContainerTest, NonEmptyDeque) {
...
@@ -868,16 +819,16 @@ TEST(PrintStlContainerTest, NonEmptyDeque) {
EXPECT_EQ
(
"{ 1, 3 }"
,
Print
(
non_empty
));
EXPECT_EQ
(
"{ 1, 3 }"
,
Print
(
non_empty
));
}
}
#if GTEST_HAS_
HASH
_MAP_
#if GTEST_HAS_
UNORDERED
_MAP_
TEST
(
PrintStlContainerTest
,
OneElementHashMap
)
{
TEST
(
PrintStlContainerTest
,
OneElementHashMap
)
{
hash
_map
<
int
,
char
>
map1
;
::
std
::
unordered
_map
<
int
,
char
>
map1
;
map1
[
1
]
=
'a'
;
map1
[
1
]
=
'a'
;
EXPECT_EQ
(
"{ (1, 'a' (97, 0x61)) }"
,
Print
(
map1
));
EXPECT_EQ
(
"{ (1, 'a' (97, 0x61)) }"
,
Print
(
map1
));
}
}
TEST
(
PrintStlContainerTest
,
HashMultiMap
)
{
TEST
(
PrintStlContainerTest
,
HashMultiMap
)
{
hash
_multimap
<
int
,
bool
>
map1
;
::
std
::
unordered
_multimap
<
int
,
bool
>
map1
;
map1
.
insert
(
make_pair
(
5
,
true
));
map1
.
insert
(
make_pair
(
5
,
true
));
map1
.
insert
(
make_pair
(
5
,
false
));
map1
.
insert
(
make_pair
(
5
,
false
));
...
@@ -888,12 +839,12 @@ TEST(PrintStlContainerTest, HashMultiMap) {
...
@@ -888,12 +839,12 @@ TEST(PrintStlContainerTest, HashMultiMap) {
<<
" where Print(map1) returns
\"
"
<<
result
<<
"
\"
."
;
<<
" where Print(map1) returns
\"
"
<<
result
<<
"
\"
."
;
}
}
#endif // GTEST_HAS_
HASH
_MAP_
#endif // GTEST_HAS_
UNORDERED
_MAP_
#if GTEST_HAS_
HASH
_SET_
#if GTEST_HAS_
UNORDERED
_SET_
TEST
(
PrintStlContainerTest
,
HashSet
)
{
TEST
(
PrintStlContainerTest
,
HashSet
)
{
hash
_set
<
int
>
set1
;
::
std
::
unordered
_set
<
int
>
set1
;
set1
.
insert
(
1
);
set1
.
insert
(
1
);
EXPECT_EQ
(
"{ 1 }"
,
Print
(
set1
));
EXPECT_EQ
(
"{ 1 }"
,
Print
(
set1
));
}
}
...
@@ -901,7 +852,7 @@ TEST(PrintStlContainerTest, HashSet) {
...
@@ -901,7 +852,7 @@ TEST(PrintStlContainerTest, HashSet) {
TEST
(
PrintStlContainerTest
,
HashMultiSet
)
{
TEST
(
PrintStlContainerTest
,
HashMultiSet
)
{
const
int
kSize
=
5
;
const
int
kSize
=
5
;
int
a
[
kSize
]
=
{
1
,
1
,
2
,
5
,
1
};
int
a
[
kSize
]
=
{
1
,
1
,
2
,
5
,
1
};
hash
_multiset
<
int
>
set1
(
a
,
a
+
kSize
);
::
std
::
unordered
_multiset
<
int
>
set1
(
a
,
a
+
kSize
);
// Elements of hash_multiset can be printed in any order.
// Elements of hash_multiset can be printed in any order.
const
std
::
string
result
=
Print
(
set1
);
const
std
::
string
result
=
Print
(
set1
);
...
@@ -927,7 +878,7 @@ TEST(PrintStlContainerTest, HashMultiSet) {
...
@@ -927,7 +878,7 @@ TEST(PrintStlContainerTest, HashMultiSet) {
EXPECT_TRUE
(
std
::
equal
(
a
,
a
+
kSize
,
numbers
.
begin
()));
EXPECT_TRUE
(
std
::
equal
(
a
,
a
+
kSize
,
numbers
.
begin
()));
}
}
#endif // GTEST_HAS_
HASH
_SET_
#endif //
GTEST_HAS_
UNORDERED
_SET_
TEST
(
PrintStlContainerTest
,
List
)
{
TEST
(
PrintStlContainerTest
,
List
)
{
const
std
::
string
a
[]
=
{
"hello"
,
"world"
};
const
std
::
string
a
[]
=
{
"hello"
,
"world"
};
...
...
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