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
d237297c
Commit
d237297c
authored
Jan 09, 2018
by
Gennadiy Civil
Browse files
code merge, cleanups
parent
2ad5661d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
20 deletions
+59
-20
googletest/include/gtest/gtest-death-test.h
googletest/include/gtest/gtest-death-test.h
+1
-1
googletest/test/gtest-param-test2_test.cc
googletest/test/gtest-param-test2_test.cc
+0
-1
googletest/test/gtest-param-test_test.cc
googletest/test/gtest-param-test_test.cc
+46
-3
googletest/test/gtest-printers_test.cc
googletest/test/gtest-printers_test.cc
+11
-14
googletest/test/production.h
googletest/test/production.h
+1
-1
No files found.
googletest/include/gtest/gtest-death-test.h
View file @
d237297c
...
@@ -102,7 +102,7 @@ GTEST_API_ bool InDeathTestChild();
...
@@ -102,7 +102,7 @@ GTEST_API_ bool InDeathTestChild();
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
// which uses the POSIX extended regex syntax.
// which uses the POSIX extended regex syntax.
//
//
// On other platforms (e.g. Windows), we only support a simple regex
// On other platforms (e.g. Windows
or Mac
), we only support a simple regex
// syntax implemented as part of Google Test. This limited
// syntax implemented as part of Google Test. This limited
// implementation should be enough most of the time when writing
// implementation should be enough most of the time when writing
// death tests; though it lacks many features you can find in PCRE
// death tests; though it lacks many features you can find in PCRE
...
...
googletest/test/gtest-param-test2_test.cc
View file @
d237297c
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
// Google Test work.
// Google Test work.
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#include "test/gtest-param-test_test.h"
#include "test/gtest-param-test_test.h"
using
::
testing
::
Values
;
using
::
testing
::
Values
;
...
...
googletest/test/gtest-param-test_test.cc
View file @
d237297c
...
@@ -41,8 +41,8 @@
...
@@ -41,8 +41,8 @@
# include <sstream>
# include <sstream>
# include <string>
# include <string>
# include <vector>
# include <vector>
# include "src/gtest-internal-inl.h" // for UnitTestOptions
# include "src/gtest-internal-inl.h" // for UnitTestOptions
# include "test/gtest-param-test_test.h"
# include "test/gtest-param-test_test.h"
using
::
std
::
vector
;
using
::
std
::
vector
;
...
@@ -536,6 +536,48 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
...
@@ -536,6 +536,48 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
VerifyGenerator
(
gen
,
expected_values
);
VerifyGenerator
(
gen
,
expected_values
);
}
}
class
NonDefaultConstructAssignString
{
public:
NonDefaultConstructAssignString
(
const
std
::
string
&
str
)
:
str_
(
str
)
{}
const
std
::
string
&
str
()
const
{
return
str_
;
}
private:
std
::
string
str_
;
// Not default constructible
NonDefaultConstructAssignString
();
// Not assignable
void
operator
=
(
const
NonDefaultConstructAssignString
&
);
};
TEST
(
CombineTest
,
NonDefaultConstructAssign
)
{
const
ParamGenerator
<
tuple
<
int
,
NonDefaultConstructAssignString
>>
gen
=
Combine
(
Values
(
0
,
1
),
Values
(
NonDefaultConstructAssignString
(
"A"
),
NonDefaultConstructAssignString
(
"B"
)));
ParamGenerator
<
tuple
<
int
,
NonDefaultConstructAssignString
>>::
iterator
it
=
gen
.
begin
();
EXPECT_EQ
(
0
,
std
::
get
<
0
>
(
*
it
));
EXPECT_EQ
(
"A"
,
std
::
get
<
1
>
(
*
it
).
str
());
++
it
;
EXPECT_EQ
(
0
,
std
::
get
<
0
>
(
*
it
));
EXPECT_EQ
(
"B"
,
std
::
get
<
1
>
(
*
it
).
str
());
++
it
;
EXPECT_EQ
(
1
,
std
::
get
<
0
>
(
*
it
));
EXPECT_EQ
(
"A"
,
std
::
get
<
1
>
(
*
it
).
str
());
++
it
;
EXPECT_EQ
(
1
,
std
::
get
<
0
>
(
*
it
));
EXPECT_EQ
(
"B"
,
std
::
get
<
1
>
(
*
it
).
str
());
++
it
;
EXPECT_TRUE
(
it
==
gen
.
end
());
}
# endif // GTEST_HAS_COMBINE
# endif // GTEST_HAS_COMBINE
// Tests that an generator produces correct sequence after being
// Tests that an generator produces correct sequence after being
...
@@ -851,8 +893,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
...
@@ -851,8 +893,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
INSTANTIATE_TEST_CASE_P
(
CustomParamNameLambda
,
INSTANTIATE_TEST_CASE_P
(
CustomParamNameLambda
,
CustomLambdaNamingTest
,
CustomLambdaNamingTest
,
Values
(
std
::
string
(
"LambdaName"
)),
Values
(
std
::
string
(
"LambdaName"
)),
[](
const
::
testing
::
TestParamInfo
<
std
::
string
>&
tp
info
)
{
[](
const
::
testing
::
TestParamInfo
<
std
::
string
>&
info
)
{
return
tp
info
.
param
;
return
info
.
param
;
});
});
#endif // GTEST_LANG_CXX11
#endif // GTEST_LANG_CXX11
...
@@ -1019,6 +1061,7 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
...
@@ -1019,6 +1061,7 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
INSTANTIATE_TEST_CASE_P
(
RangeZeroToFive
,
ParameterizedDerivedTest
,
Range
(
0
,
5
));
INSTANTIATE_TEST_CASE_P
(
RangeZeroToFive
,
ParameterizedDerivedTest
,
Range
(
0
,
5
));
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
// Used in TestGenerationTest test case.
// Used in TestGenerationTest test case.
AddGlobalTestEnvironment
(
TestGenerationTest
::
Environment
::
Instance
());
AddGlobalTestEnvironment
(
TestGenerationTest
::
Environment
::
Instance
());
...
...
googletest/test/gtest-printers_test.cc
View file @
d237297c
...
@@ -52,13 +52,13 @@
...
@@ -52,13 +52,13 @@
// hash_map and hash_set are available under Visual C++, or on Linux.
// 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_
#elif GTEST_HAS_HASH_MAP_
# include <hash_map> // NOLINT
# include <hash_map> // NOLINT
#endif // GTEST_HAS_HASH_MAP_
#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_
#elif GTEST_HAS_HASH_SET_
# include <hash_set> // NOLINT
# include <hash_set> // NOLINT
#endif // GTEST_HAS_HASH_SET_
#endif // GTEST_HAS_HASH_SET_
...
@@ -192,13 +192,12 @@ inline ::std::ostream& operator<<(::std::ostream& os,
...
@@ -192,13 +192,12 @@ inline ::std::ostream& operator<<(::std::ostream& os,
return
os
<<
"StreamableTemplateInFoo: "
<<
x
.
value
();
return
os
<<
"StreamableTemplateInFoo: "
<<
x
.
value
();
}
}
// A user-defined streamable but recursivly-defined container type in
// A user-defined streamable but recursivly-defined container type in
// a user namespace, it mimics therefore std::filesystem::path or
// a user namespace, it mimics therefore std::filesystem::path or
// boost::filesystem::path.
// boost::filesystem::path.
class
PathLike
{
class
PathLike
{
public:
public:
struct
iterator
struct
iterator
{
{
typedef
PathLike
value_type
;
typedef
PathLike
value_type
;
};
};
typedef
iterator
const_iterator
;
typedef
iterator
const_iterator
;
...
@@ -208,9 +207,7 @@ class PathLike {
...
@@ -208,9 +207,7 @@ class PathLike {
iterator
begin
()
const
{
return
iterator
();
}
iterator
begin
()
const
{
return
iterator
();
}
iterator
end
()
const
{
return
iterator
();
}
iterator
end
()
const
{
return
iterator
();
}
friend
friend
::
std
::
ostream
&
operator
<<
(
::
std
::
ostream
&
os
,
const
PathLike
&
)
{
::
std
::
ostream
&
operator
<<
(
::
std
::
ostream
&
os
,
const
PathLike
&
)
{
return
os
<<
"Streamable-PathLike"
;
return
os
<<
"Streamable-PathLike"
;
}
}
};
};
...
@@ -250,9 +247,9 @@ using ::testing::internal::string;
...
@@ -250,9 +247,9 @@ using ::testing::internal::string;
#if GTEST_HAS_UNORDERED_MAP_
#if GTEST_HAS_UNORDERED_MAP_
#define GTEST_HAS_HASH_MAP_ 1
#define GTEST_HAS_HASH_MAP_ 1
template
<
class
Key
,
class
T
>
template
<
class
Key
,
class
T
>
using
hash_map
=
::
std
::
unordered_map
<
Key
,
T
>
;
using
hash_map
=
::
std
::
unordered_map
<
Key
,
T
>
;
template
<
class
Key
,
class
T
>
template
<
class
Key
,
class
T
>
using
hash_multimap
=
::
std
::
unordered_multimap
<
Key
,
T
>
;
using
hash_multimap
=
::
std
::
unordered_multimap
<
Key
,
T
>
;
#elif GTEST_HAS_HASH_MAP_
#elif GTEST_HAS_HASH_MAP_
...
@@ -270,9 +267,9 @@ using ::stdext::hash_multimap;
...
@@ -270,9 +267,9 @@ using ::stdext::hash_multimap;
#if GTEST_HAS_UNORDERED_SET_
#if GTEST_HAS_UNORDERED_SET_
#define GTEST_HAS_HASH_SET_ 1
#define GTEST_HAS_HASH_SET_ 1
template
<
class
Key
>
template
<
class
Key
>
using
hash_set
=
::
std
::
unordered_set
<
Key
>
;
using
hash_set
=
::
std
::
unordered_set
<
Key
>
;
template
<
class
Key
>
template
<
class
Key
>
using
hash_multiset
=
::
std
::
unordered_multiset
<
Key
>
;
using
hash_multiset
=
::
std
::
unordered_multiset
<
Key
>
;
#elif GTEST_HAS_HASH_SET_
#elif GTEST_HAS_HASH_SET_
...
@@ -1092,7 +1089,7 @@ TEST(PrintTr1TupleTest, VariousSizes) {
...
@@ -1092,7 +1089,7 @@ TEST(PrintTr1TupleTest, VariousSizes) {
::
std
::
tr1
::
tuple
<
bool
,
char
,
short
,
testing
::
internal
::
Int32
,
// NOLINT
::
std
::
tr1
::
tuple
<
bool
,
char
,
short
,
testing
::
internal
::
Int32
,
// NOLINT
testing
::
internal
::
Int64
,
float
,
double
,
const
char
*
,
void
*
,
testing
::
internal
::
Int64
,
float
,
double
,
const
char
*
,
void
*
,
std
::
string
>
std
::
string
>
t10
(
false
,
'a'
,
static_cast
<
short
>
(
3
),
4
,
5
,
1.5
F
,
-
2.5
,
str
,
t10
(
false
,
'a'
,
static_cast
<
short
>
(
3
),
4
,
5
,
1.5
F
,
-
2.5
,
str
,
// NOLINT
ImplicitCast_
<
void
*>
(
NULL
),
"10"
);
ImplicitCast_
<
void
*>
(
NULL
),
"10"
);
EXPECT_EQ
(
"(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, "
+
PrintPointer
(
str
)
+
EXPECT_EQ
(
"(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, "
+
PrintPointer
(
str
)
+
" pointing to
\"
8
\"
, NULL,
\"
10
\"
)"
,
" pointing to
\"
8
\"
, NULL,
\"
10
\"
)"
,
...
@@ -1152,7 +1149,7 @@ TEST(PrintStdTupleTest, VariousSizes) {
...
@@ -1152,7 +1149,7 @@ TEST(PrintStdTupleTest, VariousSizes) {
::
std
::
tuple
<
bool
,
char
,
short
,
testing
::
internal
::
Int32
,
// NOLINT
::
std
::
tuple
<
bool
,
char
,
short
,
testing
::
internal
::
Int32
,
// NOLINT
testing
::
internal
::
Int64
,
float
,
double
,
const
char
*
,
void
*
,
testing
::
internal
::
Int64
,
float
,
double
,
const
char
*
,
void
*
,
std
::
string
>
std
::
string
>
t10
(
false
,
'a'
,
static_cast
<
short
>
(
3
),
4
,
5
,
1.5
F
,
-
2.5
,
str
,
t10
(
false
,
'a'
,
static_cast
<
short
>
(
3
),
4
,
5
,
1.5
F
,
-
2.5
,
str
,
// NOLINT
ImplicitCast_
<
void
*>
(
NULL
),
"10"
);
ImplicitCast_
<
void
*>
(
NULL
),
"10"
);
EXPECT_EQ
(
"(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, "
+
PrintPointer
(
str
)
+
EXPECT_EQ
(
"(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, "
+
PrintPointer
(
str
)
+
" pointing to
\"
8
\"
, NULL,
\"
10
\"
)"
,
" pointing to
\"
8
\"
, NULL,
\"
10
\"
)"
,
...
...
googletest/test/production.h
View file @
d237297c
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
//
//
// Author: wan@google.com (Zhanyong Wan)
// Author: wan@google.com (Zhanyong Wan)
//
//
// This is part of the unit test for
include/gtest/
gtest_prod.h.
// This is part of the unit test for gtest_prod.h.
#ifndef GTEST_TEST_PRODUCTION_H_
#ifndef GTEST_TEST_PRODUCTION_H_
#define GTEST_TEST_PRODUCTION_H_
#define GTEST_TEST_PRODUCTION_H_
...
...
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