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
a1a98f84
Commit
a1a98f84
authored
Mar 01, 2013
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a cmake target for gmock_ex_test; also fixes name shadowing warnings.
parent
c896504e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
CMakeLists.txt
CMakeLists.txt
+1
-0
gmock-actions_test.cc
test/gmock-actions_test.cc
+7
-7
No files found.
CMakeLists.txt
View file @
a1a98f84
...
@@ -103,6 +103,7 @@ if (gmock_build_tests)
...
@@ -103,6 +103,7 @@ if (gmock_build_tests)
cxx_test
(
gmock-actions_test gmock_main
)
cxx_test
(
gmock-actions_test gmock_main
)
cxx_test
(
gmock-cardinalities_test gmock_main
)
cxx_test
(
gmock-cardinalities_test gmock_main
)
cxx_test
(
gmock_ex_test gmock_main
)
cxx_test
(
gmock-generated-actions_test gmock_main
)
cxx_test
(
gmock-generated-actions_test gmock_main
)
cxx_test
(
gmock-generated-function-mockers_test gmock_main
)
cxx_test
(
gmock-generated-function-mockers_test gmock_main
)
cxx_test
(
gmock-generated-internal-utils_test gmock_main
)
cxx_test
(
gmock-generated-internal-utils_test gmock_main
)
...
...
test/gmock-actions_test.cc
View file @
a1a98f84
...
@@ -323,9 +323,9 @@ TEST(DefaultValueOfReferenceDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
...
@@ -323,9 +323,9 @@ TEST(DefaultValueOfReferenceDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
// Tests that ActionInterface can be implemented by defining the
// Tests that ActionInterface can be implemented by defining the
// Perform method.
// Perform method.
typedef
int
MyFunction
(
bool
,
int
);
typedef
int
My
Global
Function
(
bool
,
int
);
class
MyActionImpl
:
public
ActionInterface
<
MyFunction
>
{
class
MyActionImpl
:
public
ActionInterface
<
My
Global
Function
>
{
public
:
public
:
virtual
int
Perform
(
const
tuple
<
bool
,
int
>&
args
)
{
virtual
int
Perform
(
const
tuple
<
bool
,
int
>&
args
)
{
return
get
<
0
>
(
args
)
?
get
<
1
>
(
args
)
:
0
;
return
get
<
0
>
(
args
)
?
get
<
1
>
(
args
)
:
0
;
...
@@ -338,7 +338,7 @@ TEST(ActionInterfaceTest, CanBeImplementedByDefiningPerform) {
...
@@ -338,7 +338,7 @@ TEST(ActionInterfaceTest, CanBeImplementedByDefiningPerform) {
}
}
TEST
(
ActionInterfaceTest
,
MakeAction
)
{
TEST
(
ActionInterfaceTest
,
MakeAction
)
{
Action
<
MyFunction
>
action
=
MakeAction
(
new
MyActionImpl
);
Action
<
My
Global
Function
>
action
=
MakeAction
(
new
MyActionImpl
);
// When exercising the Perform() method of Action<F>, we must pass
// When exercising the Perform() method of Action<F>, we must pass
// it a tuple whose size and type are compatible with F's argument
// it a tuple whose size and type are compatible with F's argument
...
@@ -351,12 +351,12 @@ TEST(ActionInterfaceTest, MakeAction) {
...
@@ -351,12 +351,12 @@ TEST(ActionInterfaceTest, MakeAction) {
// Tests that Action<F> can be contructed from a pointer to
// Tests that Action<F> can be contructed from a pointer to
// ActionInterface<F>.
// ActionInterface<F>.
TEST
(
ActionTest
,
CanBeConstructedFromActionInterface
)
{
TEST
(
ActionTest
,
CanBeConstructedFromActionInterface
)
{
Action
<
MyFunction
>
action
(
new
MyActionImpl
);
Action
<
My
Global
Function
>
action
(
new
MyActionImpl
);
}
}
// Tests that Action<F> delegates actual work to ActionInterface<F>.
// Tests that Action<F> delegates actual work to ActionInterface<F>.
TEST
(
ActionTest
,
DelegatesWorkToActionInterface
)
{
TEST
(
ActionTest
,
DelegatesWorkToActionInterface
)
{
const
Action
<
MyFunction
>
action
(
new
MyActionImpl
);
const
Action
<
My
Global
Function
>
action
(
new
MyActionImpl
);
EXPECT_EQ
(
5
,
action
.
Perform
(
make_tuple
(
true
,
5
)));
EXPECT_EQ
(
5
,
action
.
Perform
(
make_tuple
(
true
,
5
)));
EXPECT_EQ
(
0
,
action
.
Perform
(
make_tuple
(
false
,
1
)));
EXPECT_EQ
(
0
,
action
.
Perform
(
make_tuple
(
false
,
1
)));
...
@@ -364,8 +364,8 @@ TEST(ActionTest, DelegatesWorkToActionInterface) {
...
@@ -364,8 +364,8 @@ TEST(ActionTest, DelegatesWorkToActionInterface) {
// Tests that Action<F> can be copied.
// Tests that Action<F> can be copied.
TEST
(
ActionTest
,
IsCopyable
)
{
TEST
(
ActionTest
,
IsCopyable
)
{
Action
<
MyFunction
>
a1
(
new
MyActionImpl
);
Action
<
My
Global
Function
>
a1
(
new
MyActionImpl
);
Action
<
MyFunction
>
a2
(
a1
);
// Tests the copy constructor.
Action
<
My
Global
Function
>
a2
(
a1
);
// Tests the copy constructor.
// a1 should continue to work after being copied from.
// a1 should continue to work after being copied from.
EXPECT_EQ
(
5
,
a1
.
Perform
(
make_tuple
(
true
,
5
)));
EXPECT_EQ
(
5
,
a1
.
Perform
(
make_tuple
(
true
,
5
)));
...
...
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