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
ffc5f5ad
Unverified
Commit
ffc5f5ad
authored
Feb 13, 2018
by
Gennadiy Civil
Committed by
GitHub
Feb 13, 2018
Browse files
Merge pull request #1454 from gennadiycivil/master
merges
parents
9d1a80c0
30d276da
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
7 deletions
+53
-7
googletest/test/gtest-param-test_test.cc
googletest/test/gtest-param-test_test.cc
+53
-7
No files found.
googletest/test/gtest-param-test_test.cc
View file @
ffc5f5ad
...
...
@@ -41,8 +41,8 @@
# include <sstream>
# include <string>
# 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"
using
::
std
::
vector
;
...
...
@@ -536,6 +536,51 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
VerifyGenerator
(
gen
,
expected_values
);
}
#if GTEST_LANG_CXX11
class
NonDefaultConstructAssignString
{
public:
NonDefaultConstructAssignString
(
const
std
::
string
&
s
)
:
str_
(
s
)
{}
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_LANG_CXX11
# endif // GTEST_HAS_COMBINE
// Tests that an generator produces correct sequence after being
...
...
@@ -811,8 +856,8 @@ class CustomFunctorNamingTest : public TestWithParam<std::string> {};
TEST_P
(
CustomFunctorNamingTest
,
CustomTestNames
)
{}
struct
CustomParamNameFunctor
{
std
::
string
operator
()(
const
::
testing
::
TestParamInfo
<
std
::
string
>&
inf
o
)
{
return
inf
o
.
param
;
std
::
string
operator
()(
const
::
testing
::
TestParamInfo
<
std
::
string
>&
inf
)
{
return
inf
.
param
;
}
};
...
...
@@ -829,8 +874,8 @@ INSTANTIATE_TEST_CASE_P(AllAllowedCharacters,
CustomParamNameFunctor
());
inline
std
::
string
CustomParamNameFunction
(
const
::
testing
::
TestParamInfo
<
std
::
string
>&
inf
o
)
{
return
inf
o
.
param
;
const
::
testing
::
TestParamInfo
<
std
::
string
>&
inf
)
{
return
inf
.
param
;
}
class
CustomFunctionNamingTest
:
public
TestWithParam
<
std
::
string
>
{};
...
...
@@ -851,8 +896,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
INSTANTIATE_TEST_CASE_P
(
CustomParamNameLambda
,
CustomLambdaNamingTest
,
Values
(
std
::
string
(
"LambdaName"
)),
[](
const
::
testing
::
TestParamInfo
<
std
::
string
>&
tp
inf
o
)
{
return
tp
inf
o
.
param
;
[](
const
::
testing
::
TestParamInfo
<
std
::
string
>&
inf
)
{
return
inf
.
param
;
});
#endif // GTEST_LANG_CXX11
...
...
@@ -1019,6 +1064,7 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
INSTANTIATE_TEST_CASE_P
(
RangeZeroToFive
,
ParameterizedDerivedTest
,
Range
(
0
,
5
));
int
main
(
int
argc
,
char
**
argv
)
{
// Used in TestGenerationTest test case.
AddGlobalTestEnvironment
(
TestGenerationTest
::
Environment
::
Instance
());
...
...
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