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
4bd79e4f
Commit
4bd79e4f
authored
Sep 16, 2009
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplifies the definition of NativeArray. Works around a VC bug in StrictMock & NiceMock.
parent
f5e1ce5b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
117 additions
and
81 deletions
+117
-81
gmock-generated-nice-strict.h
include/gmock/gmock-generated-nice-strict.h
+48
-24
gmock-generated-nice-strict.h.pump
include/gmock/gmock-generated-nice-strict.h.pump
+16
-8
gmock-internal-utils.h
include/gmock/internal/gmock-internal-utils.h
+9
-19
gmock-internal-utils_test.cc
test/gmock-internal-utils_test.cc
+11
-26
gmock-nice-strict_test.cc
test/gmock-nice-strict_test.cc
+29
-0
gmock-printers_test.cc
test/gmock-printers_test.cc
+4
-4
No files found.
include/gmock/gmock-generated-nice-strict.h
View file @
4bd79e4f
...
@@ -70,42 +70,49 @@ class NiceMock : public MockClass {
...
@@ -70,42 +70,49 @@ class NiceMock : public MockClass {
// We don't factor out the constructor body to a common method, as
// We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass.
// we have to avoid a possible clash with members of MockClass.
NiceMock
()
{
NiceMock
()
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
// C++ doesn't (yet) allow inheritance of constructors, so we have
// C++ doesn't (yet) allow inheritance of constructors, so we have
// to define it for each arity.
// to define it for each arity.
template
<
typename
A1
>
template
<
typename
A1
>
explicit
NiceMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
explicit
NiceMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
>
template
<
typename
A1
,
typename
A2
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
)
:
MockClass
(
a1
,
a2
)
{
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
)
:
MockClass
(
a1
,
a2
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
>
template
<
typename
A1
,
typename
A2
,
typename
A3
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
)
:
MockClass
(
a1
,
a2
,
a3
)
{
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
)
:
MockClass
(
a1
,
a2
,
a3
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
>
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
)
{
const
A4
&
a4
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
>
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
)
{
const
A5
&
a5
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
>
typename
A6
>
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
)
{
const
A5
&
a5
,
const
A6
&
a6
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -113,7 +120,8 @@ class NiceMock : public MockClass {
...
@@ -113,7 +120,8 @@ class NiceMock : public MockClass {
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
)
{
a6
,
a7
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -121,7 +129,8 @@ class NiceMock : public MockClass {
...
@@ -121,7 +129,8 @@ class NiceMock : public MockClass {
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
)
:
MockClass
(
a1
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
)
{
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -129,7 +138,8 @@ class NiceMock : public MockClass {
...
@@ -129,7 +138,8 @@ class NiceMock : public MockClass {
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
const
A9
&
a9
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -137,11 +147,13 @@ class NiceMock : public MockClass {
...
@@ -137,11 +147,13 @@ class NiceMock : public MockClass {
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
NiceMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
,
const
A10
&
a10
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
,
a10
)
{
const
A10
&
a10
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
,
a10
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
virtual
~
NiceMock
()
{
virtual
~
NiceMock
()
{
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
};
};
...
@@ -151,40 +163,47 @@ class StrictMock : public MockClass {
...
@@ -151,40 +163,47 @@ class StrictMock : public MockClass {
// We don't factor out the constructor body to a common method, as
// We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass.
// we have to avoid a possible clash with members of MockClass.
StrictMock
()
{
StrictMock
()
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
>
template
<
typename
A1
>
explicit
StrictMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
explicit
StrictMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
>
template
<
typename
A1
,
typename
A2
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
)
:
MockClass
(
a1
,
a2
)
{
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
)
:
MockClass
(
a1
,
a2
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
>
template
<
typename
A1
,
typename
A2
,
typename
A3
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
)
:
MockClass
(
a1
,
a2
,
a3
)
{
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
)
:
MockClass
(
a1
,
a2
,
a3
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
>
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
)
{
const
A4
&
a4
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
>
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
)
{
const
A5
&
a5
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
typename
A6
>
typename
A6
>
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
)
{
const
A5
&
a5
,
const
A6
&
a6
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -192,7 +211,8 @@ class StrictMock : public MockClass {
...
@@ -192,7 +211,8 @@ class StrictMock : public MockClass {
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
)
{
a6
,
a7
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -200,7 +220,8 @@ class StrictMock : public MockClass {
...
@@ -200,7 +220,8 @@ class StrictMock : public MockClass {
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
)
:
MockClass
(
a1
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
)
{
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -208,7 +229,8 @@ class StrictMock : public MockClass {
...
@@ -208,7 +229,8 @@ class StrictMock : public MockClass {
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
const
A9
&
a9
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
template
<
typename
A1
,
typename
A2
,
typename
A3
,
typename
A4
,
typename
A5
,
...
@@ -216,11 +238,13 @@ class StrictMock : public MockClass {
...
@@ -216,11 +238,13 @@ class StrictMock : public MockClass {
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
StrictMock
(
const
A1
&
a1
,
const
A2
&
a2
,
const
A3
&
a3
,
const
A4
&
a4
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
,
const
A5
&
a5
,
const
A6
&
a6
,
const
A7
&
a7
,
const
A8
&
a8
,
const
A9
&
a9
,
const
A10
&
a10
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
,
a10
)
{
const
A10
&
a10
)
:
MockClass
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
a8
,
a9
,
a10
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
virtual
~
StrictMock
()
{
virtual
~
StrictMock
()
{
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
};
};
...
...
include/gmock/gmock-generated-nice-strict.h.pump
View file @
4bd79e4f
...
@@ -73,14 +73,16 @@ class NiceMock : public MockClass {
...
@@ -73,14 +73,16 @@ class NiceMock : public MockClass {
// We don't factor out the constructor body to a common method, as
// We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass.
// we have to avoid a possible clash with members of MockClass.
NiceMock
()
{
NiceMock
()
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
// C++ doesn't (yet) allow inheritance of constructors, so we have
// C++ doesn't (yet) allow inheritance of constructors, so we have
// to define it for each arity.
// to define it for each arity.
template
<
typename
A1
>
template
<
typename
A1
>
explicit
NiceMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
explicit
NiceMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
$
range
i
2.
.
n
$
range
i
2.
.
n
...
@@ -88,13 +90,15 @@ $for i [[
...
@@ -88,13 +90,15 @@ $for i [[
$
range
j
1.
.
i
$
range
j
1.
.
i
template
<
$
for
j
,
[[
typename
A
$
j
]]
>
template
<
$
for
j
,
[[
typename
A
$
j
]]
>
NiceMock
(
$
for
j
,
[[
const
A
$
j
&
a
$
j
]])
:
MockClass
(
$
for
j
,
[[
a
$
j
]])
{
NiceMock
(
$
for
j
,
[[
const
A
$
j
&
a
$
j
]])
:
MockClass
(
$
for
j
,
[[
a
$
j
]])
{
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
AllowUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
]]
]]
virtual
~
NiceMock
()
{
virtual
~
NiceMock
()
{
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
};
};
...
@@ -104,25 +108,29 @@ class StrictMock : public MockClass {
...
@@ -104,25 +108,29 @@ class StrictMock : public MockClass {
// We don't factor out the constructor body to a common method, as
// We don't factor out the constructor body to a common method, as
// we have to avoid a possible clash with members of MockClass.
// we have to avoid a possible clash with members of MockClass.
StrictMock
()
{
StrictMock
()
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
template
<
typename
A1
>
template
<
typename
A1
>
explicit
StrictMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
explicit
StrictMock
(
const
A1
&
a1
)
:
MockClass
(
a1
)
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
$
for
i
[[
$
for
i
[[
$
range
j
1.
.
i
$
range
j
1.
.
i
template
<
$
for
j
,
[[
typename
A
$
j
]]
>
template
<
$
for
j
,
[[
typename
A
$
j
]]
>
StrictMock
(
$
for
j
,
[[
const
A
$
j
&
a
$
j
]])
:
MockClass
(
$
for
j
,
[[
a
$
j
]])
{
StrictMock
(
$
for
j
,
[[
const
A
$
j
&
a
$
j
]])
:
MockClass
(
$
for
j
,
[[
a
$
j
]])
{
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
FailUninterestingCalls
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
]]
]]
virtual
~
StrictMock
()
{
virtual
~
StrictMock
()
{
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
::
testing
::
Mock
::
UnregisterCallReaction
(
internal
::
implicit_cast
<
MockClass
*>
(
this
));
}
}
};
};
...
...
include/gmock/internal/gmock-internal-utils.h
View file @
4bd79e4f
...
@@ -581,21 +581,9 @@ class NativeArray {
...
@@ -581,21 +581,9 @@ class NativeArray {
typedef
Element
value_type
;
typedef
Element
value_type
;
typedef
const
Element
*
const_iterator
;
typedef
const
Element
*
const_iterator
;
// Constructs from a native array passed by reference.
// Constructs from a native array.
template
<
size_t
N
>
NativeArray
(
const
Element
*
array
,
size_t
count
,
RelationToSource
relation
)
{
NativeArray
(
const
Element
(
&
array
)[
N
],
RelationToSource
relation
)
{
Init
(
array
,
count
,
relation
);
Init
(
array
,
N
,
relation
);
}
// Constructs from a native array passed by a pointer and a size.
// For generality we don't artificially restrict the types of the
// pointer and the size.
template
<
typename
Pointer
,
typename
Size
>
NativeArray
(
const
::
std
::
tr1
::
tuple
<
Pointer
,
Size
>&
array
,
RelationToSource
relation
)
{
Init
(
internal
::
GetRawPointer
(
::
std
::
tr1
::
get
<
0
>
(
array
)),
::
std
::
tr1
::
get
<
1
>
(
array
),
relation
);
}
}
// Copy constructor.
// Copy constructor.
...
@@ -691,10 +679,10 @@ class StlContainerView<Element[N]> {
...
@@ -691,10 +679,10 @@ class StlContainerView<Element[N]> {
static
const_reference
ConstReference
(
const
Element
(
&
array
)[
N
])
{
static
const_reference
ConstReference
(
const
Element
(
&
array
)[
N
])
{
// Ensures that Element is not a const type.
// Ensures that Element is not a const type.
testing
::
StaticAssertTypeEq
<
Element
,
RawElement
>
();
testing
::
StaticAssertTypeEq
<
Element
,
RawElement
>
();
return
type
(
array
,
kReference
);
return
type
(
array
,
N
,
kReference
);
}
}
static
type
Copy
(
const
Element
(
&
array
)[
N
])
{
static
type
Copy
(
const
Element
(
&
array
)[
N
])
{
return
type
(
array
,
kCopy
);
return
type
(
array
,
N
,
kCopy
);
}
}
};
};
...
@@ -710,10 +698,12 @@ class StlContainerView< ::std::tr1::tuple<ElementPointer, Size> > {
...
@@ -710,10 +698,12 @@ class StlContainerView< ::std::tr1::tuple<ElementPointer, Size> > {
static
const_reference
ConstReference
(
static
const_reference
ConstReference
(
const
::
std
::
tr1
::
tuple
<
ElementPointer
,
Size
>&
array
)
{
const
::
std
::
tr1
::
tuple
<
ElementPointer
,
Size
>&
array
)
{
return
type
(
array
,
kReference
);
using
::
std
::
tr1
::
get
;
return
type
(
get
<
0
>
(
array
),
get
<
1
>
(
array
),
kReference
);
}
}
static
type
Copy
(
const
::
std
::
tr1
::
tuple
<
ElementPointer
,
Size
>&
array
)
{
static
type
Copy
(
const
::
std
::
tr1
::
tuple
<
ElementPointer
,
Size
>&
array
)
{
return
type
(
array
,
kCopy
);
using
::
std
::
tr1
::
get
;
return
type
(
get
<
0
>
(
array
),
get
<
1
>
(
array
),
kCopy
);
}
}
};
};
...
...
test/gmock-internal-utils_test.cc
View file @
4bd79e4f
...
@@ -815,34 +815,19 @@ TEST(CopyArrayTest, WorksForTwoDimensionalArrays) {
...
@@ -815,34 +815,19 @@ TEST(CopyArrayTest, WorksForTwoDimensionalArrays) {
// Tests NativeArray.
// Tests NativeArray.
TEST
(
NativeArrayTest
,
ConstructorFromArray
Reference
Works
)
{
TEST
(
NativeArrayTest
,
ConstructorFromArrayWorks
)
{
const
int
a
[
3
]
=
{
0
,
1
,
2
};
const
int
a
[
3
]
=
{
0
,
1
,
2
};
NativeArray
<
int
>
na
(
a
,
kReference
);
NativeArray
<
int
>
na
(
a
,
3
,
kReference
);
EXPECT_EQ
(
3
,
na
.
size
());
EXPECT_EQ
(
3
,
na
.
size
());
EXPECT_EQ
(
a
,
na
.
begin
());
EXPECT_EQ
(
a
,
na
.
begin
());
}
}
TEST
(
NativeArrayTest
,
ConstructorFromTupleWorks
)
{
int
a
[
3
]
=
{
0
,
1
,
2
};
int
*
const
p
=
a
;
// Tests with a plain pointer.
NativeArray
<
int
>
na
(
make_tuple
(
p
,
3U
),
kReference
);
EXPECT_EQ
(
a
,
na
.
begin
());
const
linked_ptr
<
char
>
b
(
new
char
);
*
b
=
'a'
;
// Tests with a smart pointer.
NativeArray
<
char
>
nb
(
make_tuple
(
b
,
1
),
kCopy
);
EXPECT_NE
(
b
.
get
(),
nb
.
begin
());
EXPECT_EQ
(
'a'
,
nb
.
begin
()[
0
]);
}
TEST
(
NativeArrayTest
,
CreatesAndDeletesCopyOfArrayWhenAskedTo
)
{
TEST
(
NativeArrayTest
,
CreatesAndDeletesCopyOfArrayWhenAskedTo
)
{
typedef
int
Array
[
2
];
typedef
int
Array
[
2
];
Array
*
a
=
new
Array
[
1
];
Array
*
a
=
new
Array
[
1
];
(
*
a
)[
0
]
=
0
;
(
*
a
)[
0
]
=
0
;
(
*
a
)[
1
]
=
1
;
(
*
a
)[
1
]
=
1
;
NativeArray
<
int
>
na
(
*
a
,
kCopy
);
NativeArray
<
int
>
na
(
*
a
,
2
,
kCopy
);
EXPECT_NE
(
*
a
,
na
.
begin
());
EXPECT_NE
(
*
a
,
na
.
begin
());
delete
[]
a
;
delete
[]
a
;
EXPECT_EQ
(
0
,
na
.
begin
()[
0
]);
EXPECT_EQ
(
0
,
na
.
begin
()[
0
]);
...
@@ -861,8 +846,8 @@ TEST(NativeArrayTest, TypeMembersAreCorrect) {
...
@@ -861,8 +846,8 @@ TEST(NativeArrayTest, TypeMembersAreCorrect) {
}
}
TEST
(
NativeArrayTest
,
MethodsWork
)
{
TEST
(
NativeArrayTest
,
MethodsWork
)
{
const
int
a
[]
=
{
0
,
1
,
2
};
const
int
a
[
3
]
=
{
0
,
1
,
2
};
NativeArray
<
int
>
na
(
a
,
kCopy
);
NativeArray
<
int
>
na
(
a
,
3
,
kCopy
);
ASSERT_EQ
(
3
,
na
.
size
());
ASSERT_EQ
(
3
,
na
.
size
());
EXPECT_EQ
(
3
,
na
.
end
()
-
na
.
begin
());
EXPECT_EQ
(
3
,
na
.
end
()
-
na
.
begin
());
...
@@ -877,18 +862,18 @@ TEST(NativeArrayTest, MethodsWork) {
...
@@ -877,18 +862,18 @@ TEST(NativeArrayTest, MethodsWork) {
EXPECT_THAT
(
na
,
Eq
(
na
));
EXPECT_THAT
(
na
,
Eq
(
na
));
NativeArray
<
int
>
na2
(
a
,
kReference
);
NativeArray
<
int
>
na2
(
a
,
3
,
kReference
);
EXPECT_THAT
(
na
,
Eq
(
na2
));
EXPECT_THAT
(
na
,
Eq
(
na2
));
const
int
b1
[]
=
{
0
,
1
,
1
};
const
int
b1
[
3
]
=
{
0
,
1
,
1
};
const
int
b2
[]
=
{
0
,
1
,
2
,
3
};
const
int
b2
[
4
]
=
{
0
,
1
,
2
,
3
};
EXPECT_THAT
(
na
,
Not
(
Eq
(
NativeArray
<
int
>
(
b1
,
kReference
))));
EXPECT_THAT
(
na
,
Not
(
Eq
(
NativeArray
<
int
>
(
b1
,
3
,
kReference
))));
EXPECT_THAT
(
na
,
Not
(
Eq
(
NativeArray
<
int
>
(
b2
,
kCopy
))));
EXPECT_THAT
(
na
,
Not
(
Eq
(
NativeArray
<
int
>
(
b2
,
4
,
kCopy
))));
}
}
TEST
(
NativeArrayTest
,
WorksForTwoDimensionalArray
)
{
TEST
(
NativeArrayTest
,
WorksForTwoDimensionalArray
)
{
const
char
a
[
2
][
3
]
=
{
"hi"
,
"lo"
};
const
char
a
[
2
][
3
]
=
{
"hi"
,
"lo"
};
NativeArray
<
char
[
3
]
>
na
(
a
,
kReference
);
NativeArray
<
char
[
3
]
>
na
(
a
,
2
,
kReference
);
ASSERT_EQ
(
2
,
na
.
size
());
ASSERT_EQ
(
2
,
na
.
size
());
EXPECT_EQ
(
a
,
na
.
begin
());
EXPECT_EQ
(
a
,
na
.
begin
());
}
}
...
...
test/gmock-nice-strict_test.cc
View file @
4bd79e4f
...
@@ -36,6 +36,13 @@
...
@@ -36,6 +36,13 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <gtest/gtest-spi.h>
#include <gtest/gtest-spi.h>
// This must not be defined inside the ::testing namespace, or it will
// clash with ::testing::Mock.
class
Mock
{
public
:
MOCK_METHOD0
(
DoThis
,
void
());
};
namespace
testing
{
namespace
testing
{
namespace
gmock_nice_strict_test
{
namespace
gmock_nice_strict_test
{
...
@@ -166,6 +173,17 @@ TEST(NiceMockTest, NonDefaultConstructor10) {
...
@@ -166,6 +173,17 @@ TEST(NiceMockTest, NonDefaultConstructor10) {
nice_bar
.
That
(
5
,
true
);
nice_bar
.
That
(
5
,
true
);
}
}
// Tests that NiceMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to workaround an
// MSVC 8.0 bug that caused the symbol Mock used in the definition of
// NiceMock to be looked up in the wrong context, and this test
// ensures that our fix works.
TEST
(
NiceMockTest
,
AcceptsClassNamedMock
)
{
NiceMock
<
::
Mock
>
nice
;
EXPECT_CALL
(
nice
,
DoThis
());
nice
.
DoThis
();
}
// Tests that a strict mock allows expected calls.
// Tests that a strict mock allows expected calls.
TEST
(
StrictMockTest
,
AllowsExpectedCall
)
{
TEST
(
StrictMockTest
,
AllowsExpectedCall
)
{
StrictMock
<
MockFoo
>
strict_foo
;
StrictMock
<
MockFoo
>
strict_foo
;
...
@@ -224,5 +242,16 @@ TEST(StrictMockTest, NonDefaultConstructor10) {
...
@@ -224,5 +242,16 @@ TEST(StrictMockTest, NonDefaultConstructor10) {
"Uninteresting mock function call"
);
"Uninteresting mock function call"
);
}
}
// Tests that StrictMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to workaround an
// MSVC 8.0 bug that caused the symbol Mock used in the definition of
// StrictMock to be looked up in the wrong context, and this test
// ensures that our fix works.
TEST
(
StrictMockTest
,
AcceptsClassNamedMock
)
{
StrictMock
<
::
Mock
>
nice
;
EXPECT_CALL
(
nice
,
DoThis
());
nice
.
DoThis
();
}
}
// namespace gmock_nice_strict_test
}
// namespace gmock_nice_strict_test
}
// namespace testing
}
// namespace testing
test/gmock-printers_test.cc
View file @
4bd79e4f
...
@@ -790,14 +790,14 @@ TEST(PrintStlContainerTest, NestedContainer) {
...
@@ -790,14 +790,14 @@ TEST(PrintStlContainerTest, NestedContainer) {
}
}
TEST
(
PrintStlContainerTest
,
OneDimensionalNativeArray
)
{
TEST
(
PrintStlContainerTest
,
OneDimensionalNativeArray
)
{
const
int
a
[]
=
{
1
,
2
,
3
};
const
int
a
[
3
]
=
{
1
,
2
,
3
};
NativeArray
<
int
>
b
(
a
,
kReference
);
NativeArray
<
int
>
b
(
a
,
3
,
kReference
);
EXPECT_EQ
(
"{ 1, 2, 3 }"
,
Print
(
b
));
EXPECT_EQ
(
"{ 1, 2, 3 }"
,
Print
(
b
));
}
}
TEST
(
PrintStlContainerTest
,
TwoDimensionalNativeArray
)
{
TEST
(
PrintStlContainerTest
,
TwoDimensionalNativeArray
)
{
const
int
a
[][
3
]
=
{
{
1
,
2
,
3
},
{
4
,
5
,
6
}
};
const
int
a
[
2
][
3
]
=
{
{
1
,
2
,
3
},
{
4
,
5
,
6
}
};
NativeArray
<
int
[
3
]
>
b
(
a
,
kReference
);
NativeArray
<
int
[
3
]
>
b
(
a
,
2
,
kReference
);
EXPECT_EQ
(
"{ { 1, 2, 3 }, { 4, 5, 6 } }"
,
Print
(
b
));
EXPECT_EQ
(
"{ { 1, 2, 3 }, { 4, 5, 6 } }"
,
Print
(
b
));
}
}
...
...
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