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
c53b3dca
Commit
c53b3dca
authored
Sep 12, 2009
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes dead code in gmock-more-actions_test.cc.
parent
04d6ed81
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
132 deletions
+0
-132
gmock-more-actions_test.cc
test/gmock-more-actions_test.cc
+0
-132
No files found.
test/gmock-more-actions_test.cc
View file @
c53b3dca
...
@@ -350,25 +350,6 @@ TEST(InvokeTest, FunctionWithCompatibleType) {
...
@@ -350,25 +350,6 @@ TEST(InvokeTest, FunctionWithCompatibleType) {
EXPECT_EQ
(
4321
,
a
.
Perform
(
make_tuple
(
4000
,
300
,
20
,
true
)));
EXPECT_EQ
(
4321
,
a
.
Perform
(
make_tuple
(
4000
,
300
,
20
,
true
)));
}
}
#if GMOCK_HAS_GOOGLE3_CALLBACK_
// Tests IgnoreResult(Invoke(result_callback)).
TEST
(
InvokeTest
,
IgnoreResultOfResultCallback
)
{
ResultCallback
<
int
>*
c
=
NewPermanentCallback
(
Nullary
);
Action
<
void
()
>
a
=
IgnoreResult
(
Invoke
(
c
));
a
.
Perform
(
make_tuple
());
}
// Tests IgnoreResult(Invoke(result_callback4)).
TEST
(
InvokeTest
,
IgnoreResultOfResultCallback4
)
{
ResultCallback4
<
int
,
int
,
int
,
int
,
int
>*
c
=
NewPermanentCallback
(
SumOf4
);
Action
<
void
(
int
,
int
,
int
,
int
)
>
a
=
IgnoreResult
(
Invoke
(
c
));
a
.
Perform
(
make_tuple
(
1
,
2
,
3
,
4
));
}
#endif // GMOCK_HAS_GOOGLE3_CALLBACK_
// Tests using Invoke() with an object pointer and a method pointer.
// Tests using Invoke() with an object pointer and a method pointer.
// Tests using Invoke() with a nullary method.
// Tests using Invoke() with a nullary method.
...
@@ -479,119 +460,6 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) {
...
@@ -479,119 +460,6 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) {
EXPECT_EQ
(
4444
,
a
.
Perform
(
make_tuple
(
4000
,
300
,
20
,
true
)));
EXPECT_EQ
(
4444
,
a
.
Perform
(
make_tuple
(
4000
,
300
,
20
,
true
)));
}
}
#if GMOCK_HAS_GOOGLE3_CALLBACK_
// We don't have dedicated tests to verify that Invoke(callback) and
// InvokeWithoutArgs(callback) delete the callback argument. Instead,
// we rely on the heap checker linked in this test program to do that.
// Tests that Invoke(non-permanent-callback) kills the process.
TEST
(
InvokeCallbackDeathTest
,
RejectsNonPermanentCallback
)
{
EXPECT_DEATH
({
Action
<
int
()
>
a
=
Invoke
(
NewCallback
(
Nullary
));
// NOLINT
},
""
);
}
// Tests using Invoke() with a nullary callback.
TEST
(
InvokeCallbackTest
,
Nullary
)
{
// Tests using Invoke(callback) as an action of the exact type.
Action
<
int
()
>
a
=
Invoke
(
NewPermanentCallback
(
Nullary
));
// NOLINT
EXPECT_EQ
(
1
,
a
.
Perform
(
make_tuple
()));
// Tests using Invoke(callback) as an action of a compatible type.
Action
<
bool
()
>
a2
=
Invoke
(
NewPermanentCallback
(
Nullary
));
// NOLINT
EXPECT_TRUE
(
a2
.
Perform
(
make_tuple
()));
// Tests using Invoke() on a callback that returns void.
Action
<
void
()
>
a3
=
Invoke
(
NewPermanentCallback
(
VoidNullary
));
// NOLINT
g_done
=
false
;
a3
.
Perform
(
make_tuple
());
EXPECT_TRUE
(
g_done
);
}
// Tests using Invoke() with a unary callback.
TEST
(
InvokeCallbackTest
,
Unary
)
{
// Tests using Invoke(callback1) as an action of the exact type.
Action
<
bool
(
int
)
>
a
=
Invoke
(
NewPermanentCallback
(
Unary
));
// NOLINT
EXPECT_FALSE
(
a
.
Perform
(
make_tuple
(
1
)));
EXPECT_TRUE
(
a
.
Perform
(
make_tuple
(
-
1
)));
// Tests using Invoke(callback1) as an action of a compatible type.
Action
<
int
(
long
)
>
a2
=
Invoke
(
NewPermanentCallback
(
Unary
));
// NOLINT
EXPECT_EQ
(
0
,
a2
.
Perform
(
make_tuple
(
1L
)));
EXPECT_EQ
(
1
,
a2
.
Perform
(
make_tuple
(
-
1L
)));
// Tests using Invoke() on a callback that returns void.
Action
<
void
(
char
)
>
a3
=
Invoke
(
NewPermanentCallback
(
VoidUnary
));
// NOLINT
g_done
=
false
;
a3
.
Perform
(
make_tuple
(
'a'
));
EXPECT_TRUE
(
g_done
);
}
// Tests using Invoke() with a binary callback.
TEST
(
InvokeCallbackTest
,
Binary
)
{
// Tests using Invoke(callback2) as an action of the exact type.
Action
<
const
char
*
(
const
char
*
,
short
)
>
a
=
// NOLINT
Invoke
(
NewPermanentCallback
(
Binary
));
const
char
*
p
=
"Hello"
;
EXPECT_EQ
(
p
+
2
,
a
.
Perform
(
make_tuple
(
p
,
2
)));
// Tests using Invoke(callback2) as an action of a compatible type.
Action
<
bool
(
char
*
,
int
)
>
a2
=
// NOLINT
Invoke
(
NewPermanentCallback
(
Binary
));
char
str
[]
=
"Hello"
;
EXPECT_TRUE
(
a2
.
Perform
(
make_tuple
(
str
,
2
)));
// Tests using Invoke() on a callback that returns void.
Action
<
void
(
char
,
char
)
>
a3
=
Invoke
(
NewPermanentCallback
(
VoidBinary
));
// NOLINT
g_done
=
false
;
a3
.
Perform
(
make_tuple
(
'a'
,
'b'
));
EXPECT_TRUE
(
g_done
);
}
// Tests using Invoke() with a ternary callback.
TEST
(
InvokeCallbackTest
,
Ternary
)
{
// Tests using Invoke(callback3) as an action of the exact type.
Action
<
int
(
int
,
char
,
short
)
>
a
=
// NOLINT
Invoke
(
NewPermanentCallback
(
Ternary
));
EXPECT_EQ
(
6
,
a
.
Perform
(
make_tuple
(
1
,
'\2'
,
3
)));
// Tests using Invoke(callback3) as an action of a compatible type.
Action
<
long
(
char
,
int
,
int
)
>
a2
=
// NOLINT
Invoke
(
NewPermanentCallback
(
Ternary
));
EXPECT_EQ
(
6
,
a2
.
Perform
(
make_tuple
(
'\1'
,
2
,
3
)));
// Tests using Invoke() on a callback that returns void.
Action
<
void
(
char
,
char
,
bool
)
>
a3
=
Invoke
(
NewPermanentCallback
(
VoidTernary
));
// NOLINT
g_done
=
false
;
a3
.
Perform
(
make_tuple
(
'a'
,
'b'
,
true
));
EXPECT_TRUE
(
g_done
);
}
// Tests using Invoke() with a 4-argument callback.
TEST
(
InvokeCallbackTest
,
CallbackThatTakes4Arguments
)
{
// Tests using Invoke(callback4) as an action of the exact type.
Action
<
int
(
int
,
int
,
int
,
int
)
>
a
=
// NOLINT
Invoke
(
NewPermanentCallback
(
SumOf4
));
EXPECT_EQ
(
1234
,
a
.
Perform
(
make_tuple
(
1000
,
200
,
30
,
4
)));
// Tests using Invoke(callback4) as an action of a compatible type.
Action
<
long
(
int
,
short
,
char
,
bool
)
>
a2
=
// NOLINT
Invoke
(
NewPermanentCallback
(
SumOf4
));
EXPECT_EQ
(
4321
,
a2
.
Perform
(
make_tuple
(
4000
,
300
,
20
,
true
)));
// Tests using Invoke() on a callback that returns void.
Action
<
void
(
char
,
char
,
double
,
double
)
>
a3
=
Invoke
(
NewPermanentCallback
(
VoidFunctionWithFourArguments
));
// NOLINT
g_done
=
false
;
a3
.
Perform
(
make_tuple
(
'a'
,
'b'
,
0
,
1
));
EXPECT_TRUE
(
g_done
);
}
#endif // GMOCK_HAS_GOOGLE3_CALLBACK_
// Tests using WithoutArgs with an action that takes no argument.
// Tests using WithoutArgs with an action that takes no argument.
TEST
(
WithoutArgsTest
,
NoArg
)
{
TEST
(
WithoutArgsTest
,
NoArg
)
{
Action
<
int
(
int
n
)
>
a
=
WithoutArgs
(
Invoke
(
Nullary
));
// NOLINT
Action
<
int
(
int
n
)
>
a
=
WithoutArgs
(
Invoke
(
Nullary
));
// NOLINT
...
...
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