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
b8c0e16e
Commit
b8c0e16e
authored
Apr 12, 2011
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes Sun C++ compiler errors (by Pasi Valminen)
parent
fc99b1ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
16 deletions
+29
-16
gtest-param-util.h
include/gtest/internal/gtest-param-util.h
+11
-11
gtest-internal-inl.h
src/gtest-internal-inl.h
+8
-1
gtest-printers_test.cc
test/gtest-printers_test.cc
+10
-4
No files found.
include/gtest/internal/gtest-param-util.h
View file @
b8c0e16e
...
...
@@ -417,7 +417,7 @@ class ParameterizedTestCaseInfoBase {
virtual
~
ParameterizedTestCaseInfoBase
()
{}
// Base part of test case name for display purposes.
virtual
const
S
tring
&
GetTestCaseName
()
const
=
0
;
virtual
const
s
tring
&
GetTestCaseName
()
const
=
0
;
// Test case id to verify identity.
virtual
TypeId
GetTestCaseTypeId
()
const
=
0
;
// UnitTest class invokes this method to register tests in this
...
...
@@ -454,7 +454,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
:
test_case_name_
(
name
)
{}
// Test case base name for display purposes.
virtual
const
S
tring
&
GetTestCaseName
()
const
{
return
test_case_name_
;
}
virtual
const
s
tring
&
GetTestCaseName
()
const
{
return
test_case_name_
;
}
// Test case id to verify identity.
virtual
TypeId
GetTestCaseTypeId
()
const
{
return
GetTypeId
<
TestCase
>
();
}
// TEST_P macro uses AddTestPattern() to record information
...
...
@@ -472,7 +472,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
}
// INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
// about a generator.
int
AddTestCaseInstantiation
(
const
char
*
instantiation_name
,
int
AddTestCaseInstantiation
(
const
string
&
instantiation_name
,
GeneratorCreationFunc
*
func
,
const
char
*
/* file */
,
int
/* line */
)
{
...
...
@@ -491,20 +491,20 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
for
(
typename
InstantiationContainer
::
iterator
gen_it
=
instantiations_
.
begin
();
gen_it
!=
instantiations_
.
end
();
++
gen_it
)
{
const
S
tring
&
instantiation_name
=
gen_it
->
first
;
const
s
tring
&
instantiation_name
=
gen_it
->
first
;
ParamGenerator
<
ParamType
>
generator
((
*
gen_it
->
second
)());
Message
test_case_name_stream
;
if
(
!
instantiation_name
.
empty
()
)
test_case_name_stream
<<
instantiation_name
.
c_str
()
<<
"/"
;
test_case_name_stream
<<
test_info
->
test_case_base_name
.
c_str
()
;
test_case_name_stream
<<
instantiation_name
<<
"/"
;
test_case_name_stream
<<
test_info
->
test_case_base_name
;
int
i
=
0
;
for
(
typename
ParamGenerator
<
ParamType
>::
iterator
param_it
=
generator
.
begin
();
param_it
!=
generator
.
end
();
++
param_it
,
++
i
)
{
Message
test_name_stream
;
test_name_stream
<<
test_info
->
test_base_name
.
c_str
()
<<
"/"
<<
i
;
test_name_stream
<<
test_info
->
test_base_name
<<
"/"
<<
i
;
MakeAndRegisterTestInfo
(
test_case_name_stream
.
GetString
().
c_str
(),
test_name_stream
.
GetString
().
c_str
(),
...
...
@@ -530,17 +530,17 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
test_base_name
(
a_test_base_name
),
test_meta_factory
(
a_test_meta_factory
)
{}
const
S
tring
test_case_base_name
;
const
S
tring
test_base_name
;
const
s
tring
test_case_base_name
;
const
s
tring
test_base_name
;
const
scoped_ptr
<
TestMetaFactoryBase
<
ParamType
>
>
test_meta_factory
;
};
typedef
::
std
::
vector
<
linked_ptr
<
TestInfo
>
>
TestInfoContainer
;
// Keeps pairs of <Instantiation name, Sequence generator creation function>
// received from INSTANTIATE_TEST_CASE_P macros.
typedef
::
std
::
vector
<
std
::
pair
<
S
tring
,
GeneratorCreationFunc
*>
>
typedef
::
std
::
vector
<
std
::
pair
<
s
tring
,
GeneratorCreationFunc
*>
>
InstantiationContainer
;
const
S
tring
test_case_name_
;
const
s
tring
test_case_name_
;
TestInfoContainer
tests_
;
InstantiationContainer
instantiations_
;
...
...
src/gtest-internal-inl.h
View file @
b8c0e16e
...
...
@@ -271,7 +271,14 @@ GTEST_API_ bool ShouldRunTestOnShard(
// the given predicate.
template
<
class
Container
,
typename
Predicate
>
inline
int
CountIf
(
const
Container
&
c
,
Predicate
predicate
)
{
return
static_cast
<
int
>
(
std
::
count_if
(
c
.
begin
(),
c
.
end
(),
predicate
));
// Implemented as an explicit loop since std::count_if() in libCstd on
// Solaris has a non-standard signature.
int
count
=
0
;
for
(
typename
Container
::
const_iterator
it
=
c
.
begin
();
it
!=
c
.
end
();
++
it
)
{
if
(
predicate
(
*
it
))
++
count
;
}
return
count
;
}
// Applies a function/functor to each element in the container.
...
...
test/gtest-printers_test.cc
View file @
b8c0e16e
...
...
@@ -857,7 +857,7 @@ TEST(PrintStlContainerTest, HashMultiSet) {
#endif // GTEST_HAS_HASH_SET_
TEST
(
PrintStlContainerTest
,
List
)
{
const
char
*
a
[]
=
{
const
string
a
[]
=
{
"hello"
,
"world"
};
...
...
@@ -875,9 +875,15 @@ TEST(PrintStlContainerTest, Map) {
TEST
(
PrintStlContainerTest
,
MultiMap
)
{
multimap
<
bool
,
int
>
map1
;
map1
.
insert
(
make_pair
(
true
,
0
));
map1
.
insert
(
make_pair
(
true
,
1
));
map1
.
insert
(
make_pair
(
false
,
2
));
// The make_pair template function would deduce the type as
// pair<bool, int> here, and since the key part in a multimap has to
// be constant, without a templated ctor in the pair class (as in
// libCstd on Solaris), make_pair call would fail to compile as no
// implicit conversion is found. Thus explicit typename is used
// here instead.
map1
.
insert
(
pair
<
const
bool
,
int
>
(
true
,
0
));
map1
.
insert
(
pair
<
const
bool
,
int
>
(
true
,
1
));
map1
.
insert
(
pair
<
const
bool
,
int
>
(
false
,
2
));
EXPECT_EQ
(
"{ (false, 2), (true, 0), (true, 1) }"
,
Print
(
map1
));
}
...
...
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