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
8e37822b
Commit
8e37822b
authored
Jan 30, 2019
by
Ashley Hedberg
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2063 from mathbunnyru:master
PiperOrigin-RevId: 231456275
parents
ce29e55c
7c4164bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
18 deletions
+31
-18
.travis.yml
.travis.yml
+1
-1
advanced.md
googletest/docs/advanced.md
+1
-1
gtest-param-test.h
googletest/include/gtest/gtest-param-test.h
+8
-15
gtest-param-util.h
googletest/include/gtest/internal/gtest-param-util.h
+21
-1
No files found.
.travis.yml
View file @
8e37822b
...
@@ -40,7 +40,7 @@ matrix:
...
@@ -40,7 +40,7 @@ matrix:
-
os
:
linux
-
os
:
linux
group
:
deprecated-2017Q4
group
:
deprecated-2017Q4
compiler
:
clang
compiler
:
clang
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
-Wgnu-zero-variadic-macro-arguments"
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 NO_EXCEPTION=ON NO_RTTI=ON COMPILER_IS_GNUCXX=ON
env
:
BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 NO_EXCEPTION=ON NO_RTTI=ON COMPILER_IS_GNUCXX=ON
...
...
googletest/docs/advanced.md
View file @
8e37822b
...
@@ -1198,7 +1198,7 @@ also supports per-test-suite set-up/tear-down. To use it:
...
@@ -1198,7 +1198,7 @@ also supports per-test-suite set-up/tear-down. To use it:
1.
Outside your test fixture class (typically just below it), define those
1.
Outside your test fixture class (typically just below it), define those
member variables, optionally giving them initial values.
member variables, optionally giving them initial values.
1.
In the same test fixture class, define a
`static void SetUpTestSuite()`
1.
In the same test fixture class, define a
`static void SetUpTestSuite()`
function (remember not to spell it as
**`Set
u
pTestSuite`**
with a small
`u`
!)
function (remember not to spell it as
**`Set
U
pTestSuite`**
with a small
`u`
!)
to set up the shared resources and a
`static void TearDownTestSuite()`
to set up the shared resources and a
`static void TearDownTestSuite()`
function to tear them down.
function to tear them down.
...
...
googletest/include/gtest/gtest-param-test.h
View file @
8e37822b
...
@@ -544,11 +544,10 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
...
@@ -544,11 +544,10 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
// The last argument to INSTANTIATE_TEST_SUITE_P allows the user to specify
// The optional last argument to INSTANTIATE_TEST_SUITE_P allows the user
// generator and an optional function or functor that generates custom test name
// to specify a function or functor that generates custom test name suffixes
// suffixes based on the test parameters. Such a function or functor should
// based on the test parameters. The function should accept one argument of
// accept one argument of type testing::TestParamInfo<class ParamType>, and
// type testing::TestParamInfo<class ParamType>, and return std::string.
// return std::string.
//
//
// testing::PrintToStringParamName is a builtin test suffix generator that
// testing::PrintToStringParamName is a builtin test suffix generator that
// returns the value of testing::PrintToString(GetParam()).
// returns the value of testing::PrintToString(GetParam()).
...
@@ -557,21 +556,15 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
...
@@ -557,21 +556,15 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
// alphanumeric characters or underscore. Because PrintToString adds quotes
// alphanumeric characters or underscore. Because PrintToString adds quotes
// to std::string and C strings, it won't work for these types.
// to std::string and C strings, it won't work for these types.
#define GTEST_EXPAND_(arg) arg
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, generator, ...) \
#define GTEST_GET_FIRST_(first, ...) first
#define GTEST_GET_SECOND_(first, second, ...) second
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
gtest_##prefix##test_suite_name##_EvalGenerator_() { \
gtest_##prefix##test_suite_name##_EvalGenerator_() { \
return
GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_));
\
return
generator;
\
} \
} \
static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
return GTEST_EXPAND_(GTEST_GET_SECOND_( \
return ::testing::internal::GetParamNameGen<test_suite_name::ParamType>( \
__VA_ARGS__, \
__VA_ARGS__)(info); \
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
DUMMY_PARAM_))(info); \
} \
} \
static int gtest_##prefix##test_suite_name##_dummy_ \
static int gtest_##prefix##test_suite_name##_dummy_ \
GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_ATTRIBUTE_UNUSED_ = \
...
...
googletest/include/gtest/internal/gtest-param-util.h
View file @
8e37822b
...
@@ -378,6 +378,26 @@ std::string DefaultParamName(const TestParamInfo<ParamType>& info) {
...
@@ -378,6 +378,26 @@ std::string DefaultParamName(const TestParamInfo<ParamType>& info) {
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
//
// Parameterized test name overload helpers, which help the
// INSTANTIATE_TEST_SUITE_P macro choose between the default parameterized
// test name generator and user param name generator.
template
<
class
ParamType
,
class
ParamNameGenFunctor
>
ParamNameGenFunctor
GetParamNameGen
(
ParamNameGenFunctor
func
)
{
return
func
;
}
template
<
class
ParamType
>
struct
ParamNameGenFunc
{
typedef
std
::
string
Type
(
const
TestParamInfo
<
ParamType
>&
);
};
template
<
class
ParamType
>
typename
ParamNameGenFunc
<
ParamType
>::
Type
*
GetParamNameGen
()
{
return
DefaultParamName
;
}
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
// Stores a parameter value and later creates tests parameterized with that
// Stores a parameter value and later creates tests parameterized with that
// value.
// value.
template
<
class
TestClass
>
template
<
class
TestClass
>
...
@@ -480,7 +500,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
...
@@ -480,7 +500,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
using
ParamType
=
typename
TestSuite
::
ParamType
;
using
ParamType
=
typename
TestSuite
::
ParamType
;
// A function that returns an instance of appropriate generator type.
// A function that returns an instance of appropriate generator type.
typedef
ParamGenerator
<
ParamType
>
(
GeneratorCreationFunc
)();
typedef
ParamGenerator
<
ParamType
>
(
GeneratorCreationFunc
)();
typedef
std
::
string
ParamNameGeneratorFunc
(
const
TestParamInfo
<
ParamType
>&
)
;
typedef
typename
ParamNameGenFunc
<
ParamType
>::
Type
ParamNameGeneratorFunc
;
explicit
ParameterizedTestSuiteInfo
(
const
char
*
name
,
explicit
ParameterizedTestSuiteInfo
(
const
char
*
name
,
CodeLocation
code_location
)
CodeLocation
code_location
)
...
...
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