blob: 91ba1d9b2c0723986f18d30f96cea275e660b560 [file] [log] [blame]
zhanyong.wan844fa942013-03-01 01:54:22 +00001// This file was GENERATED by command:
2// pump.py gmock-generated-nice-strict.h.pump
3// DO NOT EDIT BY HAND!!!
shiqiane35fdd92008-12-10 05:08:54 +00004
5// Copyright 2008, Google Inc.
6// All rights reserved.
7//
8// Redistribution and use in source and binary forms, with or without
9// modification, are permitted provided that the following conditions are
10// met:
11//
12// * Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14// * Redistributions in binary form must reproduce the above
15// copyright notice, this list of conditions and the following disclaimer
16// in the documentation and/or other materials provided with the
17// distribution.
18// * Neither the name of Google Inc. nor the names of its
19// contributors may be used to endorse or promote products derived from
20// this software without specific prior written permission.
21//
22// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Gennadiy Civila3c0dd02018-08-14 14:04:07 -040033
shiqiane35fdd92008-12-10 05:08:54 +000034
zhanyong.wan844fa942013-03-01 01:54:22 +000035// Implements class templates NiceMock, NaggyMock, and StrictMock.
shiqiane35fdd92008-12-10 05:08:54 +000036//
37// Given a mock class MockFoo that is created using Google Mock,
38// NiceMock<MockFoo> is a subclass of MockFoo that allows
39// uninteresting calls (i.e. calls to mock methods that have no
zhanyong.wan844fa942013-03-01 01:54:22 +000040// EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
41// that prints a warning when an uninteresting call occurs, and
42// StrictMock<MockFoo> is a subclass of MockFoo that treats all
43// uninteresting calls as errors.
shiqiane35fdd92008-12-10 05:08:54 +000044//
zhanyong.wan844fa942013-03-01 01:54:22 +000045// Currently a mock is naggy by default, so MockFoo and
46// NaggyMock<MockFoo> behave like the same. However, we will soon
47// switch the default behavior of mocks to be nice, as that in general
48// leads to more maintainable tests. When that happens, MockFoo will
49// stop behaving like NaggyMock<MockFoo> and start behaving like
50// NiceMock<MockFoo>.
shiqiane35fdd92008-12-10 05:08:54 +000051//
zhanyong.wan844fa942013-03-01 01:54:22 +000052// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
Gennadiy Civilfe402c22018-04-05 16:09:17 -040053// their respective base class. Therefore you can write
54// NiceMock<MockFoo>(5, "a") to construct a nice mock where MockFoo
55// has a constructor that accepts (int, const char*), for example.
zhanyong.wan844fa942013-03-01 01:54:22 +000056//
57// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
58// and StrictMock<MockFoo> only works for mock methods defined using
59// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
60// If a mock method is defined in a base class of MockFoo, the "nice"
61// or "strict" modifier may not affect it, depending on the compiler.
62// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
63// supported.
shiqiane35fdd92008-12-10 05:08:54 +000064
Gennadiy Civil984cba32018-07-27 11:15:08 -040065// GOOGLETEST_CM0002 DO NOT DELETE
66
shiqiane35fdd92008-12-10 05:08:54 +000067#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
68#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
69
zhanyong.wan53e08c42010-09-14 05:38:21 +000070#include "gmock/gmock-spec-builders.h"
71#include "gmock/internal/gmock-port.h"
shiqiane35fdd92008-12-10 05:08:54 +000072
73namespace testing {
74
Gennadiy Civilfe402c22018-04-05 16:09:17 -040075template <class MockClass>
Victor Costan1324e2d2018-04-09 21:57:54 -070076class NiceMock : public MockClass {
Gennadiy Civilfe402c22018-04-05 16:09:17 -040077 public:
Victor Costan1324e2d2018-04-09 21:57:54 -070078 NiceMock() : MockClass() {
79 ::testing::Mock::AllowUninterestingCalls(
80 internal::ImplicitCast_<MockClass*>(this));
81 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -040082
83#if GTEST_LANG_CXX11
Gennadiy Civila79851f2018-04-12 14:00:38 -040084 // Ideally, we would inherit base class's constructors through a using
85 // declaration, which would preserve their visibility. However, many existing
86 // tests rely on the fact that current implementation reexports protected
87 // constructors as public. These tests would need to be cleaned up first.
88
Gennadiy Civilfe402c22018-04-05 16:09:17 -040089 // Single argument constructor is special-cased so that it can be
90 // made explicit.
91 template <typename A>
Victor Costan1324e2d2018-04-09 21:57:54 -070092 explicit NiceMock(A&& arg) : MockClass(std::forward<A>(arg)) {
93 ::testing::Mock::AllowUninterestingCalls(
94 internal::ImplicitCast_<MockClass*>(this));
95 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -040096
97 template <typename A1, typename A2, typename... An>
98 NiceMock(A1&& arg1, A2&& arg2, An&&... args)
99 : MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
Victor Costan1324e2d2018-04-09 21:57:54 -0700100 std::forward<An>(args)...) {
101 ::testing::Mock::AllowUninterestingCalls(
102 internal::ImplicitCast_<MockClass*>(this));
103 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400104#else
105 // C++98 doesn't have variadic templates, so we have to define one
106 // for each arity.
shiqiane35fdd92008-12-10 05:08:54 +0000107 template <typename A1>
Victor Costan1324e2d2018-04-09 21:57:54 -0700108 explicit NiceMock(const A1& a1) : MockClass(a1) {
109 ::testing::Mock::AllowUninterestingCalls(
110 internal::ImplicitCast_<MockClass*>(this));
111 }
shiqiane35fdd92008-12-10 05:08:54 +0000112 template <typename A1, typename A2>
Victor Costan1324e2d2018-04-09 21:57:54 -0700113 NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
114 ::testing::Mock::AllowUninterestingCalls(
115 internal::ImplicitCast_<MockClass*>(this));
116 }
shiqiane35fdd92008-12-10 05:08:54 +0000117
118 template <typename A1, typename A2, typename A3>
Victor Costan1324e2d2018-04-09 21:57:54 -0700119 NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
120 ::testing::Mock::AllowUninterestingCalls(
121 internal::ImplicitCast_<MockClass*>(this));
122 }
shiqiane35fdd92008-12-10 05:08:54 +0000123
124 template <typename A1, typename A2, typename A3, typename A4>
125 NiceMock(const A1& a1, const A2& a2, const A3& a3,
Victor Costan1324e2d2018-04-09 21:57:54 -0700126 const A4& a4) : MockClass(a1, a2, a3, a4) {
127 ::testing::Mock::AllowUninterestingCalls(
128 internal::ImplicitCast_<MockClass*>(this));
129 }
shiqiane35fdd92008-12-10 05:08:54 +0000130
131 template <typename A1, typename A2, typename A3, typename A4, typename A5>
132 NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Victor Costan1324e2d2018-04-09 21:57:54 -0700133 const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
134 ::testing::Mock::AllowUninterestingCalls(
135 internal::ImplicitCast_<MockClass*>(this));
136 }
shiqiane35fdd92008-12-10 05:08:54 +0000137
138 template <typename A1, typename A2, typename A3, typename A4, typename A5,
139 typename A6>
140 NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Victor Costan1324e2d2018-04-09 21:57:54 -0700141 const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
142 ::testing::Mock::AllowUninterestingCalls(
143 internal::ImplicitCast_<MockClass*>(this));
144 }
shiqiane35fdd92008-12-10 05:08:54 +0000145
146 template <typename A1, typename A2, typename A3, typename A4, typename A5,
147 typename A6, typename A7>
148 NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
149 const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
Victor Costan1324e2d2018-04-09 21:57:54 -0700150 a6, a7) {
151 ::testing::Mock::AllowUninterestingCalls(
152 internal::ImplicitCast_<MockClass*>(this));
153 }
shiqiane35fdd92008-12-10 05:08:54 +0000154
155 template <typename A1, typename A2, typename A3, typename A4, typename A5,
156 typename A6, typename A7, typename A8>
157 NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
158 const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
Victor Costan1324e2d2018-04-09 21:57:54 -0700159 a2, a3, a4, a5, a6, a7, a8) {
160 ::testing::Mock::AllowUninterestingCalls(
161 internal::ImplicitCast_<MockClass*>(this));
162 }
shiqiane35fdd92008-12-10 05:08:54 +0000163
164 template <typename A1, typename A2, typename A3, typename A4, typename A5,
165 typename A6, typename A7, typename A8, typename A9>
166 NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
167 const A5& a5, const A6& a6, const A7& a7, const A8& a8,
Victor Costan1324e2d2018-04-09 21:57:54 -0700168 const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
169 ::testing::Mock::AllowUninterestingCalls(
170 internal::ImplicitCast_<MockClass*>(this));
171 }
shiqiane35fdd92008-12-10 05:08:54 +0000172
173 template <typename A1, typename A2, typename A3, typename A4, typename A5,
174 typename A6, typename A7, typename A8, typename A9, typename A10>
175 NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
176 const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
Victor Costan1324e2d2018-04-09 21:57:54 -0700177 const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
178 ::testing::Mock::AllowUninterestingCalls(
179 internal::ImplicitCast_<MockClass*>(this));
180 }
shiqiane35fdd92008-12-10 05:08:54 +0000181
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400182#endif // GTEST_LANG_CXX11
zhanyong.wan32de5f52009-12-23 00:13:23 +0000183
Victor Costan1324e2d2018-04-09 21:57:54 -0700184 ~NiceMock() {
185 ::testing::Mock::UnregisterCallReaction(
186 internal::ImplicitCast_<MockClass*>(this));
187 }
188
zhanyong.wan32de5f52009-12-23 00:13:23 +0000189 private:
190 GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
shiqiane35fdd92008-12-10 05:08:54 +0000191};
192
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400193template <class MockClass>
Victor Costan1324e2d2018-04-09 21:57:54 -0700194class NaggyMock : public MockClass {
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400195 public:
Victor Costan1324e2d2018-04-09 21:57:54 -0700196 NaggyMock() : MockClass() {
197 ::testing::Mock::WarnUninterestingCalls(
198 internal::ImplicitCast_<MockClass*>(this));
199 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400200
201#if GTEST_LANG_CXX11
Gennadiy Civila79851f2018-04-12 14:00:38 -0400202 // Ideally, we would inherit base class's constructors through a using
203 // declaration, which would preserve their visibility. However, many existing
204 // tests rely on the fact that current implementation reexports protected
205 // constructors as public. These tests would need to be cleaned up first.
206
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400207 // Single argument constructor is special-cased so that it can be
208 // made explicit.
209 template <typename A>
Victor Costan1324e2d2018-04-09 21:57:54 -0700210 explicit NaggyMock(A&& arg) : MockClass(std::forward<A>(arg)) {
211 ::testing::Mock::WarnUninterestingCalls(
212 internal::ImplicitCast_<MockClass*>(this));
213 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400214
215 template <typename A1, typename A2, typename... An>
216 NaggyMock(A1&& arg1, A2&& arg2, An&&... args)
217 : MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
Victor Costan1324e2d2018-04-09 21:57:54 -0700218 std::forward<An>(args)...) {
219 ::testing::Mock::WarnUninterestingCalls(
220 internal::ImplicitCast_<MockClass*>(this));
221 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400222#else
223 // C++98 doesn't have variadic templates, so we have to define one
224 // for each arity.
zhanyong.wan844fa942013-03-01 01:54:22 +0000225 template <typename A1>
Victor Costan1324e2d2018-04-09 21:57:54 -0700226 explicit NaggyMock(const A1& a1) : MockClass(a1) {
227 ::testing::Mock::WarnUninterestingCalls(
228 internal::ImplicitCast_<MockClass*>(this));
229 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000230 template <typename A1, typename A2>
Victor Costan1324e2d2018-04-09 21:57:54 -0700231 NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
232 ::testing::Mock::WarnUninterestingCalls(
233 internal::ImplicitCast_<MockClass*>(this));
234 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000235
236 template <typename A1, typename A2, typename A3>
Victor Costan1324e2d2018-04-09 21:57:54 -0700237 NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
238 ::testing::Mock::WarnUninterestingCalls(
239 internal::ImplicitCast_<MockClass*>(this));
240 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000241
242 template <typename A1, typename A2, typename A3, typename A4>
243 NaggyMock(const A1& a1, const A2& a2, const A3& a3,
Victor Costan1324e2d2018-04-09 21:57:54 -0700244 const A4& a4) : MockClass(a1, a2, a3, a4) {
245 ::testing::Mock::WarnUninterestingCalls(
246 internal::ImplicitCast_<MockClass*>(this));
247 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000248
249 template <typename A1, typename A2, typename A3, typename A4, typename A5>
250 NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Victor Costan1324e2d2018-04-09 21:57:54 -0700251 const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
252 ::testing::Mock::WarnUninterestingCalls(
253 internal::ImplicitCast_<MockClass*>(this));
254 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000255
256 template <typename A1, typename A2, typename A3, typename A4, typename A5,
257 typename A6>
258 NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Victor Costan1324e2d2018-04-09 21:57:54 -0700259 const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
260 ::testing::Mock::WarnUninterestingCalls(
261 internal::ImplicitCast_<MockClass*>(this));
262 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000263
264 template <typename A1, typename A2, typename A3, typename A4, typename A5,
265 typename A6, typename A7>
266 NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
267 const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
Victor Costan1324e2d2018-04-09 21:57:54 -0700268 a6, a7) {
269 ::testing::Mock::WarnUninterestingCalls(
270 internal::ImplicitCast_<MockClass*>(this));
271 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000272
273 template <typename A1, typename A2, typename A3, typename A4, typename A5,
274 typename A6, typename A7, typename A8>
275 NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
276 const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
Victor Costan1324e2d2018-04-09 21:57:54 -0700277 a2, a3, a4, a5, a6, a7, a8) {
278 ::testing::Mock::WarnUninterestingCalls(
279 internal::ImplicitCast_<MockClass*>(this));
280 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000281
282 template <typename A1, typename A2, typename A3, typename A4, typename A5,
283 typename A6, typename A7, typename A8, typename A9>
284 NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
285 const A5& a5, const A6& a6, const A7& a7, const A8& a8,
Victor Costan1324e2d2018-04-09 21:57:54 -0700286 const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
287 ::testing::Mock::WarnUninterestingCalls(
288 internal::ImplicitCast_<MockClass*>(this));
289 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000290
291 template <typename A1, typename A2, typename A3, typename A4, typename A5,
292 typename A6, typename A7, typename A8, typename A9, typename A10>
293 NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
294 const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
Victor Costan1324e2d2018-04-09 21:57:54 -0700295 const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
296 ::testing::Mock::WarnUninterestingCalls(
297 internal::ImplicitCast_<MockClass*>(this));
298 }
zhanyong.wan844fa942013-03-01 01:54:22 +0000299
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400300#endif // GTEST_LANG_CXX11
zhanyong.wan844fa942013-03-01 01:54:22 +0000301
Victor Costan1324e2d2018-04-09 21:57:54 -0700302 ~NaggyMock() {
303 ::testing::Mock::UnregisterCallReaction(
304 internal::ImplicitCast_<MockClass*>(this));
305 }
306
zhanyong.wan844fa942013-03-01 01:54:22 +0000307 private:
308 GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock);
309};
310
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400311template <class MockClass>
Victor Costan1324e2d2018-04-09 21:57:54 -0700312class StrictMock : public MockClass {
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400313 public:
Victor Costan1324e2d2018-04-09 21:57:54 -0700314 StrictMock() : MockClass() {
315 ::testing::Mock::FailUninterestingCalls(
316 internal::ImplicitCast_<MockClass*>(this));
317 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400318
319#if GTEST_LANG_CXX11
Gennadiy Civila79851f2018-04-12 14:00:38 -0400320 // Ideally, we would inherit base class's constructors through a using
321 // declaration, which would preserve their visibility. However, many existing
322 // tests rely on the fact that current implementation reexports protected
323 // constructors as public. These tests would need to be cleaned up first.
324
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400325 // Single argument constructor is special-cased so that it can be
326 // made explicit.
327 template <typename A>
Victor Costan1324e2d2018-04-09 21:57:54 -0700328 explicit StrictMock(A&& arg) : MockClass(std::forward<A>(arg)) {
329 ::testing::Mock::FailUninterestingCalls(
330 internal::ImplicitCast_<MockClass*>(this));
331 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400332
333 template <typename A1, typename A2, typename... An>
334 StrictMock(A1&& arg1, A2&& arg2, An&&... args)
335 : MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
Victor Costan1324e2d2018-04-09 21:57:54 -0700336 std::forward<An>(args)...) {
337 ::testing::Mock::FailUninterestingCalls(
338 internal::ImplicitCast_<MockClass*>(this));
339 }
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400340#else
341 // C++98 doesn't have variadic templates, so we have to define one
342 // for each arity.
shiqiane35fdd92008-12-10 05:08:54 +0000343 template <typename A1>
Victor Costan1324e2d2018-04-09 21:57:54 -0700344 explicit StrictMock(const A1& a1) : MockClass(a1) {
345 ::testing::Mock::FailUninterestingCalls(
346 internal::ImplicitCast_<MockClass*>(this));
347 }
shiqiane35fdd92008-12-10 05:08:54 +0000348 template <typename A1, typename A2>
Victor Costan1324e2d2018-04-09 21:57:54 -0700349 StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
350 ::testing::Mock::FailUninterestingCalls(
351 internal::ImplicitCast_<MockClass*>(this));
352 }
shiqiane35fdd92008-12-10 05:08:54 +0000353
354 template <typename A1, typename A2, typename A3>
Victor Costan1324e2d2018-04-09 21:57:54 -0700355 StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
356 ::testing::Mock::FailUninterestingCalls(
357 internal::ImplicitCast_<MockClass*>(this));
358 }
shiqiane35fdd92008-12-10 05:08:54 +0000359
360 template <typename A1, typename A2, typename A3, typename A4>
361 StrictMock(const A1& a1, const A2& a2, const A3& a3,
Victor Costan1324e2d2018-04-09 21:57:54 -0700362 const A4& a4) : MockClass(a1, a2, a3, a4) {
363 ::testing::Mock::FailUninterestingCalls(
364 internal::ImplicitCast_<MockClass*>(this));
365 }
shiqiane35fdd92008-12-10 05:08:54 +0000366
367 template <typename A1, typename A2, typename A3, typename A4, typename A5>
368 StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Victor Costan1324e2d2018-04-09 21:57:54 -0700369 const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
370 ::testing::Mock::FailUninterestingCalls(
371 internal::ImplicitCast_<MockClass*>(this));
372 }
shiqiane35fdd92008-12-10 05:08:54 +0000373
374 template <typename A1, typename A2, typename A3, typename A4, typename A5,
375 typename A6>
376 StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Victor Costan1324e2d2018-04-09 21:57:54 -0700377 const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
378 ::testing::Mock::FailUninterestingCalls(
379 internal::ImplicitCast_<MockClass*>(this));
380 }
shiqiane35fdd92008-12-10 05:08:54 +0000381
382 template <typename A1, typename A2, typename A3, typename A4, typename A5,
383 typename A6, typename A7>
384 StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
385 const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
Victor Costan1324e2d2018-04-09 21:57:54 -0700386 a6, a7) {
387 ::testing::Mock::FailUninterestingCalls(
388 internal::ImplicitCast_<MockClass*>(this));
389 }
shiqiane35fdd92008-12-10 05:08:54 +0000390
391 template <typename A1, typename A2, typename A3, typename A4, typename A5,
392 typename A6, typename A7, typename A8>
393 StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
394 const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
Victor Costan1324e2d2018-04-09 21:57:54 -0700395 a2, a3, a4, a5, a6, a7, a8) {
396 ::testing::Mock::FailUninterestingCalls(
397 internal::ImplicitCast_<MockClass*>(this));
398 }
shiqiane35fdd92008-12-10 05:08:54 +0000399
400 template <typename A1, typename A2, typename A3, typename A4, typename A5,
401 typename A6, typename A7, typename A8, typename A9>
402 StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
403 const A5& a5, const A6& a6, const A7& a7, const A8& a8,
Victor Costan1324e2d2018-04-09 21:57:54 -0700404 const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
405 ::testing::Mock::FailUninterestingCalls(
406 internal::ImplicitCast_<MockClass*>(this));
407 }
shiqiane35fdd92008-12-10 05:08:54 +0000408
409 template <typename A1, typename A2, typename A3, typename A4, typename A5,
410 typename A6, typename A7, typename A8, typename A9, typename A10>
411 StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
412 const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
Victor Costan1324e2d2018-04-09 21:57:54 -0700413 const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
414 ::testing::Mock::FailUninterestingCalls(
415 internal::ImplicitCast_<MockClass*>(this));
416 }
shiqiane35fdd92008-12-10 05:08:54 +0000417
Gennadiy Civilfe402c22018-04-05 16:09:17 -0400418#endif // GTEST_LANG_CXX11
zhanyong.wan32de5f52009-12-23 00:13:23 +0000419
Victor Costan1324e2d2018-04-09 21:57:54 -0700420 ~StrictMock() {
421 ::testing::Mock::UnregisterCallReaction(
422 internal::ImplicitCast_<MockClass*>(this));
423 }
424
zhanyong.wan32de5f52009-12-23 00:13:23 +0000425 private:
426 GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock);
shiqiane35fdd92008-12-10 05:08:54 +0000427};
428
429// The following specializations catch some (relatively more common)
430// user errors of nesting nice and strict mocks. They do NOT catch
431// all possible errors.
432
zhanyong.wan844fa942013-03-01 01:54:22 +0000433// These specializations are declared but not defined, as NiceMock,
434// NaggyMock, and StrictMock cannot be nested.
435
shiqiane35fdd92008-12-10 05:08:54 +0000436template <typename MockClass>
437class NiceMock<NiceMock<MockClass> >;
438template <typename MockClass>
zhanyong.wan844fa942013-03-01 01:54:22 +0000439class NiceMock<NaggyMock<MockClass> >;
440template <typename MockClass>
shiqiane35fdd92008-12-10 05:08:54 +0000441class NiceMock<StrictMock<MockClass> >;
zhanyong.wan844fa942013-03-01 01:54:22 +0000442
443template <typename MockClass>
444class NaggyMock<NiceMock<MockClass> >;
445template <typename MockClass>
446class NaggyMock<NaggyMock<MockClass> >;
447template <typename MockClass>
448class NaggyMock<StrictMock<MockClass> >;
449
shiqiane35fdd92008-12-10 05:08:54 +0000450template <typename MockClass>
451class StrictMock<NiceMock<MockClass> >;
452template <typename MockClass>
zhanyong.wan844fa942013-03-01 01:54:22 +0000453class StrictMock<NaggyMock<MockClass> >;
454template <typename MockClass>
shiqiane35fdd92008-12-10 05:08:54 +0000455class StrictMock<StrictMock<MockClass> >;
456
457} // namespace testing
458
459#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_