1 // This file was GENERATED by command: 2 // pump.py gmock-generated-function-mockers.h.pump 3 // DO NOT EDIT BY HAND!!! 4 5 // Copyright 2007, 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. 33 // 34 // Author: wan@google.com (Zhanyong Wan) 35 36 // Google Mock - a framework for writing C++ mock classes. 37 // 38 // This file implements function mockers of various arities. 39 40 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ 41 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ 42 43 #include "gmock/gmock-spec-builders.h" 44 #include "gmock/internal/gmock-internal-utils.h" 45 46 namespace testing { 47 namespace internal { 48 49 template <typename F> 50 class FunctionMockerBase; 51 52 // Note: class FunctionMocker really belongs to the ::testing 53 // namespace. However if we define it in ::testing, MSVC will 54 // complain when classes in ::testing::internal declare it as a 55 // friend class template. To workaround this compiler bug, we define 56 // FunctionMocker in ::testing::internal and import it into ::testing. 57 template <typename F> 58 class FunctionMocker; 59 60 template <typename R> 61 class FunctionMocker<R()> : public 62 internal::FunctionMockerBase<R()> { 63 public: 64 typedef R F(); 65 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 66 With()67 MockSpec<F>& With() { 68 return this->current_spec(); 69 } 70 Invoke()71 R Invoke() { 72 // Even though gcc and MSVC don't enforce it, 'this->' is required 73 // by the C++ standard [14.6.4] here, as the base class type is 74 // dependent on the template argument (and thus shouldn't be 75 // looked into when resolving InvokeWith). 76 return this->InvokeWith(ArgumentTuple()); 77 } 78 }; 79 80 template <typename R, typename A1> 81 class FunctionMocker<R(A1)> : public 82 internal::FunctionMockerBase<R(A1)> { 83 public: 84 typedef R F(A1); 85 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 86 With(const Matcher<A1> & m1)87 MockSpec<F>& With(const Matcher<A1>& m1) { 88 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1)); 89 return this->current_spec(); 90 } 91 Invoke(A1 a1)92 R Invoke(A1 a1) { 93 // Even though gcc and MSVC don't enforce it, 'this->' is required 94 // by the C++ standard [14.6.4] here, as the base class type is 95 // dependent on the template argument (and thus shouldn't be 96 // looked into when resolving InvokeWith). 97 return this->InvokeWith(ArgumentTuple(a1)); 98 } 99 }; 100 101 template <typename R, typename A1, typename A2> 102 class FunctionMocker<R(A1, A2)> : public 103 internal::FunctionMockerBase<R(A1, A2)> { 104 public: 105 typedef R F(A1, A2); 106 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 107 With(const Matcher<A1> & m1,const Matcher<A2> & m2)108 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2) { 109 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2)); 110 return this->current_spec(); 111 } 112 Invoke(A1 a1,A2 a2)113 R Invoke(A1 a1, A2 a2) { 114 // Even though gcc and MSVC don't enforce it, 'this->' is required 115 // by the C++ standard [14.6.4] here, as the base class type is 116 // dependent on the template argument (and thus shouldn't be 117 // looked into when resolving InvokeWith). 118 return this->InvokeWith(ArgumentTuple(a1, a2)); 119 } 120 }; 121 122 template <typename R, typename A1, typename A2, typename A3> 123 class FunctionMocker<R(A1, A2, A3)> : public 124 internal::FunctionMockerBase<R(A1, A2, A3)> { 125 public: 126 typedef R F(A1, A2, A3); 127 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 128 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3)129 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 130 const Matcher<A3>& m3) { 131 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3)); 132 return this->current_spec(); 133 } 134 Invoke(A1 a1,A2 a2,A3 a3)135 R Invoke(A1 a1, A2 a2, A3 a3) { 136 // Even though gcc and MSVC don't enforce it, 'this->' is required 137 // by the C++ standard [14.6.4] here, as the base class type is 138 // dependent on the template argument (and thus shouldn't be 139 // looked into when resolving InvokeWith). 140 return this->InvokeWith(ArgumentTuple(a1, a2, a3)); 141 } 142 }; 143 144 template <typename R, typename A1, typename A2, typename A3, typename A4> 145 class FunctionMocker<R(A1, A2, A3, A4)> : public 146 internal::FunctionMockerBase<R(A1, A2, A3, A4)> { 147 public: 148 typedef R F(A1, A2, A3, A4); 149 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 150 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3,const Matcher<A4> & m4)151 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 152 const Matcher<A3>& m3, const Matcher<A4>& m4) { 153 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4)); 154 return this->current_spec(); 155 } 156 Invoke(A1 a1,A2 a2,A3 a3,A4 a4)157 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) { 158 // Even though gcc and MSVC don't enforce it, 'this->' is required 159 // by the C++ standard [14.6.4] here, as the base class type is 160 // dependent on the template argument (and thus shouldn't be 161 // looked into when resolving InvokeWith). 162 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4)); 163 } 164 }; 165 166 template <typename R, typename A1, typename A2, typename A3, typename A4, 167 typename A5> 168 class FunctionMocker<R(A1, A2, A3, A4, A5)> : public 169 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> { 170 public: 171 typedef R F(A1, A2, A3, A4, A5); 172 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 173 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3,const Matcher<A4> & m4,const Matcher<A5> & m5)174 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 175 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) { 176 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, 177 m5)); 178 return this->current_spec(); 179 } 180 Invoke(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)181 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { 182 // Even though gcc and MSVC don't enforce it, 'this->' is required 183 // by the C++ standard [14.6.4] here, as the base class type is 184 // dependent on the template argument (and thus shouldn't be 185 // looked into when resolving InvokeWith). 186 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5)); 187 } 188 }; 189 190 template <typename R, typename A1, typename A2, typename A3, typename A4, 191 typename A5, typename A6> 192 class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public 193 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> { 194 public: 195 typedef R F(A1, A2, A3, A4, A5, A6); 196 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 197 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3,const Matcher<A4> & m4,const Matcher<A5> & m5,const Matcher<A6> & m6)198 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 199 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, 200 const Matcher<A6>& m6) { 201 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, 202 m6)); 203 return this->current_spec(); 204 } 205 Invoke(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6)206 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { 207 // Even though gcc and MSVC don't enforce it, 'this->' is required 208 // by the C++ standard [14.6.4] here, as the base class type is 209 // dependent on the template argument (and thus shouldn't be 210 // looked into when resolving InvokeWith). 211 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6)); 212 } 213 }; 214 215 template <typename R, typename A1, typename A2, typename A3, typename A4, 216 typename A5, typename A6, typename A7> 217 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public 218 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> { 219 public: 220 typedef R F(A1, A2, A3, A4, A5, A6, A7); 221 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 222 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3,const Matcher<A4> & m4,const Matcher<A5> & m5,const Matcher<A6> & m6,const Matcher<A7> & m7)223 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 224 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, 225 const Matcher<A6>& m6, const Matcher<A7>& m7) { 226 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, 227 m6, m7)); 228 return this->current_spec(); 229 } 230 Invoke(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7)231 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { 232 // Even though gcc and MSVC don't enforce it, 'this->' is required 233 // by the C++ standard [14.6.4] here, as the base class type is 234 // dependent on the template argument (and thus shouldn't be 235 // looked into when resolving InvokeWith). 236 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7)); 237 } 238 }; 239 240 template <typename R, typename A1, typename A2, typename A3, typename A4, 241 typename A5, typename A6, typename A7, typename A8> 242 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public 243 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> { 244 public: 245 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8); 246 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 247 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3,const Matcher<A4> & m4,const Matcher<A5> & m5,const Matcher<A6> & m6,const Matcher<A7> & m7,const Matcher<A8> & m8)248 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 249 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, 250 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) { 251 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, 252 m6, m7, m8)); 253 return this->current_spec(); 254 } 255 Invoke(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8)256 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { 257 // Even though gcc and MSVC don't enforce it, 'this->' is required 258 // by the C++ standard [14.6.4] here, as the base class type is 259 // dependent on the template argument (and thus shouldn't be 260 // looked into when resolving InvokeWith). 261 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8)); 262 } 263 }; 264 265 template <typename R, typename A1, typename A2, typename A3, typename A4, 266 typename A5, typename A6, typename A7, typename A8, typename A9> 267 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public 268 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> { 269 public: 270 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9); 271 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 272 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3,const Matcher<A4> & m4,const Matcher<A5> & m5,const Matcher<A6> & m6,const Matcher<A7> & m7,const Matcher<A8> & m8,const Matcher<A9> & m9)273 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 274 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, 275 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8, 276 const Matcher<A9>& m9) { 277 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, 278 m6, m7, m8, m9)); 279 return this->current_spec(); 280 } 281 Invoke(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9)282 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { 283 // Even though gcc and MSVC don't enforce it, 'this->' is required 284 // by the C++ standard [14.6.4] here, as the base class type is 285 // dependent on the template argument (and thus shouldn't be 286 // looked into when resolving InvokeWith). 287 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9)); 288 } 289 }; 290 291 template <typename R, typename A1, typename A2, typename A3, typename A4, 292 typename A5, typename A6, typename A7, typename A8, typename A9, 293 typename A10> 294 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public 295 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> { 296 public: 297 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); 298 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; 299 With(const Matcher<A1> & m1,const Matcher<A2> & m2,const Matcher<A3> & m3,const Matcher<A4> & m4,const Matcher<A5> & m5,const Matcher<A6> & m6,const Matcher<A7> & m7,const Matcher<A8> & m8,const Matcher<A9> & m9,const Matcher<A10> & m10)300 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, 301 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, 302 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8, 303 const Matcher<A9>& m9, const Matcher<A10>& m10) { 304 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, 305 m6, m7, m8, m9, m10)); 306 return this->current_spec(); 307 } 308 Invoke(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9,A10 a10)309 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, 310 A10 a10) { 311 // Even though gcc and MSVC don't enforce it, 'this->' is required 312 // by the C++ standard [14.6.4] here, as the base class type is 313 // dependent on the template argument (and thus shouldn't be 314 // looked into when resolving InvokeWith). 315 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9, 316 a10)); 317 } 318 }; 319 320 } // namespace internal 321 322 // The style guide prohibits "using" statements in a namespace scope 323 // inside a header file. However, the FunctionMocker class template 324 // is meant to be defined in the ::testing namespace. The following 325 // line is just a trick for working around a bug in MSVC 8.0, which 326 // cannot handle it if we define FunctionMocker in ::testing. 327 using internal::FunctionMocker; 328 329 // The result type of function type F. 330 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 331 #define GMOCK_RESULT_(tn, F) tn ::testing::internal::Function<F>::Result 332 333 // The type of argument N of function type F. 334 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 335 #define GMOCK_ARG_(tn, F, N) tn ::testing::internal::Function<F>::Argument##N 336 337 // The matcher type for argument N of function type F. 338 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 339 #define GMOCK_MATCHER_(tn, F, N) const ::testing::Matcher<GMOCK_ARG_(tn, F, N)>& 340 341 // The variable for mocking the given method. 342 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 343 #define GMOCK_MOCKER_(arity, constness, Method) \ 344 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) 345 346 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 347 #define GMOCK_METHOD0_(tn, constness, ct, Method, F) \ 348 GMOCK_RESULT_(tn, F) ct Method() constness { \ 349 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 350 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 0, \ 351 this_method_does_not_take_0_arguments); \ 352 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \ 353 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \ 354 } \ 355 ::testing::MockSpec<F>& \ 356 gmock_##Method() constness { \ 357 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \ 358 return GMOCK_MOCKER_(0, constness, Method).With(); \ 359 } \ 360 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(0, constness, Method) 361 362 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 363 #define GMOCK_METHOD1_(tn, constness, ct, Method, F) \ 364 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1) constness { \ 365 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 366 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 1, \ 367 this_method_does_not_take_1_argument); \ 368 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \ 369 return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \ 370 } \ 371 ::testing::MockSpec<F>& \ 372 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1) constness { \ 373 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \ 374 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \ 375 } \ 376 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(1, constness, Method) 377 378 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 379 #define GMOCK_METHOD2_(tn, constness, ct, Method, F) \ 380 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 381 GMOCK_ARG_(tn, F, 2) gmock_a2) constness { \ 382 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 383 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 2, \ 384 this_method_does_not_take_2_arguments); \ 385 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \ 386 return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \ 387 } \ 388 ::testing::MockSpec<F>& \ 389 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 390 GMOCK_MATCHER_(tn, F, 2) gmock_a2) constness { \ 391 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \ 392 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \ 393 } \ 394 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(2, constness, Method) 395 396 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 397 #define GMOCK_METHOD3_(tn, constness, ct, Method, F) \ 398 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 399 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 400 GMOCK_ARG_(tn, F, 3) gmock_a3) constness { \ 401 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 402 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 3, \ 403 this_method_does_not_take_3_arguments); \ 404 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \ 405 return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \ 406 gmock_a3); \ 407 } \ 408 ::testing::MockSpec<F>& \ 409 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 410 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 411 GMOCK_MATCHER_(tn, F, 3) gmock_a3) constness { \ 412 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \ 413 return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \ 414 gmock_a3); \ 415 } \ 416 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(3, constness, Method) 417 418 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 419 #define GMOCK_METHOD4_(tn, constness, ct, Method, F) \ 420 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 421 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 422 GMOCK_ARG_(tn, F, 3) gmock_a3, \ 423 GMOCK_ARG_(tn, F, 4) gmock_a4) constness { \ 424 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 425 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 4, \ 426 this_method_does_not_take_4_arguments); \ 427 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \ 428 return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \ 429 gmock_a3, gmock_a4); \ 430 } \ 431 ::testing::MockSpec<F>& \ 432 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 433 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 434 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ 435 GMOCK_MATCHER_(tn, F, 4) gmock_a4) constness { \ 436 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \ 437 return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \ 438 gmock_a3, gmock_a4); \ 439 } \ 440 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(4, constness, Method) 441 442 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 443 #define GMOCK_METHOD5_(tn, constness, ct, Method, F) \ 444 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 445 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 446 GMOCK_ARG_(tn, F, 3) gmock_a3, \ 447 GMOCK_ARG_(tn, F, 4) gmock_a4, \ 448 GMOCK_ARG_(tn, F, 5) gmock_a5) constness { \ 449 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 450 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 5, \ 451 this_method_does_not_take_5_arguments); \ 452 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \ 453 return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \ 454 gmock_a3, gmock_a4, gmock_a5); \ 455 } \ 456 ::testing::MockSpec<F>& \ 457 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 458 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 459 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ 460 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ 461 GMOCK_MATCHER_(tn, F, 5) gmock_a5) constness { \ 462 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \ 463 return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \ 464 gmock_a3, gmock_a4, gmock_a5); \ 465 } \ 466 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(5, constness, Method) 467 468 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 469 #define GMOCK_METHOD6_(tn, constness, ct, Method, F) \ 470 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 471 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 472 GMOCK_ARG_(tn, F, 3) gmock_a3, \ 473 GMOCK_ARG_(tn, F, 4) gmock_a4, \ 474 GMOCK_ARG_(tn, F, 5) gmock_a5, \ 475 GMOCK_ARG_(tn, F, 6) gmock_a6) constness { \ 476 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 477 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 6, \ 478 this_method_does_not_take_6_arguments); \ 479 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \ 480 return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \ 481 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ 482 } \ 483 ::testing::MockSpec<F>& \ 484 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 485 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 486 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ 487 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ 488 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ 489 GMOCK_MATCHER_(tn, F, 6) gmock_a6) constness { \ 490 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \ 491 return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \ 492 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ 493 } \ 494 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(6, constness, Method) 495 496 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 497 #define GMOCK_METHOD7_(tn, constness, ct, Method, F) \ 498 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 499 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 500 GMOCK_ARG_(tn, F, 3) gmock_a3, \ 501 GMOCK_ARG_(tn, F, 4) gmock_a4, \ 502 GMOCK_ARG_(tn, F, 5) gmock_a5, \ 503 GMOCK_ARG_(tn, F, 6) gmock_a6, \ 504 GMOCK_ARG_(tn, F, 7) gmock_a7) constness { \ 505 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 506 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 7, \ 507 this_method_does_not_take_7_arguments); \ 508 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \ 509 return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \ 510 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ 511 } \ 512 ::testing::MockSpec<F>& \ 513 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 514 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 515 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ 516 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ 517 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ 518 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ 519 GMOCK_MATCHER_(tn, F, 7) gmock_a7) constness { \ 520 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \ 521 return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \ 522 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ 523 } \ 524 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(7, constness, Method) 525 526 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 527 #define GMOCK_METHOD8_(tn, constness, ct, Method, F) \ 528 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 529 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 530 GMOCK_ARG_(tn, F, 3) gmock_a3, \ 531 GMOCK_ARG_(tn, F, 4) gmock_a4, \ 532 GMOCK_ARG_(tn, F, 5) gmock_a5, \ 533 GMOCK_ARG_(tn, F, 6) gmock_a6, \ 534 GMOCK_ARG_(tn, F, 7) gmock_a7, \ 535 GMOCK_ARG_(tn, F, 8) gmock_a8) constness { \ 536 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 537 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 8, \ 538 this_method_does_not_take_8_arguments); \ 539 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \ 540 return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \ 541 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ 542 } \ 543 ::testing::MockSpec<F>& \ 544 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 545 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 546 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ 547 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ 548 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ 549 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ 550 GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ 551 GMOCK_MATCHER_(tn, F, 8) gmock_a8) constness { \ 552 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \ 553 return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \ 554 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ 555 } \ 556 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(8, constness, Method) 557 558 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 559 #define GMOCK_METHOD9_(tn, constness, ct, Method, F) \ 560 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 561 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 562 GMOCK_ARG_(tn, F, 3) gmock_a3, \ 563 GMOCK_ARG_(tn, F, 4) gmock_a4, \ 564 GMOCK_ARG_(tn, F, 5) gmock_a5, \ 565 GMOCK_ARG_(tn, F, 6) gmock_a6, \ 566 GMOCK_ARG_(tn, F, 7) gmock_a7, \ 567 GMOCK_ARG_(tn, F, 8) gmock_a8, \ 568 GMOCK_ARG_(tn, F, 9) gmock_a9) constness { \ 569 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 570 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 9, \ 571 this_method_does_not_take_9_arguments); \ 572 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \ 573 return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \ 574 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ 575 gmock_a9); \ 576 } \ 577 ::testing::MockSpec<F>& \ 578 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 579 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 580 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ 581 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ 582 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ 583 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ 584 GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ 585 GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ 586 GMOCK_MATCHER_(tn, F, 9) gmock_a9) constness { \ 587 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \ 588 return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \ 589 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ 590 gmock_a9); \ 591 } \ 592 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(9, constness, Method) 593 594 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! 595 #define GMOCK_METHOD10_(tn, constness, ct, Method, F) \ 596 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ 597 GMOCK_ARG_(tn, F, 2) gmock_a2, \ 598 GMOCK_ARG_(tn, F, 3) gmock_a3, \ 599 GMOCK_ARG_(tn, F, 4) gmock_a4, \ 600 GMOCK_ARG_(tn, F, 5) gmock_a5, \ 601 GMOCK_ARG_(tn, F, 6) gmock_a6, \ 602 GMOCK_ARG_(tn, F, 7) gmock_a7, \ 603 GMOCK_ARG_(tn, F, 8) gmock_a8, \ 604 GMOCK_ARG_(tn, F, 9) gmock_a9, \ 605 GMOCK_ARG_(tn, F, 10) gmock_a10) constness { \ 606 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \ 607 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 10, \ 608 this_method_does_not_take_10_arguments); \ 609 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \ 610 return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \ 611 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ 612 gmock_a10); \ 613 } \ 614 ::testing::MockSpec<F>& \ 615 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ 616 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ 617 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ 618 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ 619 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ 620 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ 621 GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ 622 GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ 623 GMOCK_MATCHER_(tn, F, 9) gmock_a9, \ 624 GMOCK_MATCHER_(tn, F, 10) gmock_a10) constness { \ 625 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \ 626 return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \ 627 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ 628 gmock_a10); \ 629 } \ 630 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(10, constness, Method) 631 632 #define MOCK_METHOD0(m, F) GMOCK_METHOD0_(, , , m, F) 633 #define MOCK_METHOD1(m, F) GMOCK_METHOD1_(, , , m, F) 634 #define MOCK_METHOD2(m, F) GMOCK_METHOD2_(, , , m, F) 635 #define MOCK_METHOD3(m, F) GMOCK_METHOD3_(, , , m, F) 636 #define MOCK_METHOD4(m, F) GMOCK_METHOD4_(, , , m, F) 637 #define MOCK_METHOD5(m, F) GMOCK_METHOD5_(, , , m, F) 638 #define MOCK_METHOD6(m, F) GMOCK_METHOD6_(, , , m, F) 639 #define MOCK_METHOD7(m, F) GMOCK_METHOD7_(, , , m, F) 640 #define MOCK_METHOD8(m, F) GMOCK_METHOD8_(, , , m, F) 641 #define MOCK_METHOD9(m, F) GMOCK_METHOD9_(, , , m, F) 642 #define MOCK_METHOD10(m, F) GMOCK_METHOD10_(, , , m, F) 643 644 #define MOCK_CONST_METHOD0(m, F) GMOCK_METHOD0_(, const, , m, F) 645 #define MOCK_CONST_METHOD1(m, F) GMOCK_METHOD1_(, const, , m, F) 646 #define MOCK_CONST_METHOD2(m, F) GMOCK_METHOD2_(, const, , m, F) 647 #define MOCK_CONST_METHOD3(m, F) GMOCK_METHOD3_(, const, , m, F) 648 #define MOCK_CONST_METHOD4(m, F) GMOCK_METHOD4_(, const, , m, F) 649 #define MOCK_CONST_METHOD5(m, F) GMOCK_METHOD5_(, const, , m, F) 650 #define MOCK_CONST_METHOD6(m, F) GMOCK_METHOD6_(, const, , m, F) 651 #define MOCK_CONST_METHOD7(m, F) GMOCK_METHOD7_(, const, , m, F) 652 #define MOCK_CONST_METHOD8(m, F) GMOCK_METHOD8_(, const, , m, F) 653 #define MOCK_CONST_METHOD9(m, F) GMOCK_METHOD9_(, const, , m, F) 654 #define MOCK_CONST_METHOD10(m, F) GMOCK_METHOD10_(, const, , m, F) 655 656 #define MOCK_METHOD0_T(m, F) GMOCK_METHOD0_(typename, , , m, F) 657 #define MOCK_METHOD1_T(m, F) GMOCK_METHOD1_(typename, , , m, F) 658 #define MOCK_METHOD2_T(m, F) GMOCK_METHOD2_(typename, , , m, F) 659 #define MOCK_METHOD3_T(m, F) GMOCK_METHOD3_(typename, , , m, F) 660 #define MOCK_METHOD4_T(m, F) GMOCK_METHOD4_(typename, , , m, F) 661 #define MOCK_METHOD5_T(m, F) GMOCK_METHOD5_(typename, , , m, F) 662 #define MOCK_METHOD6_T(m, F) GMOCK_METHOD6_(typename, , , m, F) 663 #define MOCK_METHOD7_T(m, F) GMOCK_METHOD7_(typename, , , m, F) 664 #define MOCK_METHOD8_T(m, F) GMOCK_METHOD8_(typename, , , m, F) 665 #define MOCK_METHOD9_T(m, F) GMOCK_METHOD9_(typename, , , m, F) 666 #define MOCK_METHOD10_T(m, F) GMOCK_METHOD10_(typename, , , m, F) 667 668 #define MOCK_CONST_METHOD0_T(m, F) GMOCK_METHOD0_(typename, const, , m, F) 669 #define MOCK_CONST_METHOD1_T(m, F) GMOCK_METHOD1_(typename, const, , m, F) 670 #define MOCK_CONST_METHOD2_T(m, F) GMOCK_METHOD2_(typename, const, , m, F) 671 #define MOCK_CONST_METHOD3_T(m, F) GMOCK_METHOD3_(typename, const, , m, F) 672 #define MOCK_CONST_METHOD4_T(m, F) GMOCK_METHOD4_(typename, const, , m, F) 673 #define MOCK_CONST_METHOD5_T(m, F) GMOCK_METHOD5_(typename, const, , m, F) 674 #define MOCK_CONST_METHOD6_T(m, F) GMOCK_METHOD6_(typename, const, , m, F) 675 #define MOCK_CONST_METHOD7_T(m, F) GMOCK_METHOD7_(typename, const, , m, F) 676 #define MOCK_CONST_METHOD8_T(m, F) GMOCK_METHOD8_(typename, const, , m, F) 677 #define MOCK_CONST_METHOD9_T(m, F) GMOCK_METHOD9_(typename, const, , m, F) 678 #define MOCK_CONST_METHOD10_T(m, F) GMOCK_METHOD10_(typename, const, , m, F) 679 680 #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD0_(, , ct, m, F) 681 #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD1_(, , ct, m, F) 682 #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD2_(, , ct, m, F) 683 #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD3_(, , ct, m, F) 684 #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD4_(, , ct, m, F) 685 #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD5_(, , ct, m, F) 686 #define MOCK_METHOD6_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD6_(, , ct, m, F) 687 #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD7_(, , ct, m, F) 688 #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD8_(, , ct, m, F) 689 #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD9_(, , ct, m, F) 690 #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD10_(, , ct, m, F) 691 692 #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, F) \ 693 GMOCK_METHOD0_(, const, ct, m, F) 694 #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, F) \ 695 GMOCK_METHOD1_(, const, ct, m, F) 696 #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, F) \ 697 GMOCK_METHOD2_(, const, ct, m, F) 698 #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, F) \ 699 GMOCK_METHOD3_(, const, ct, m, F) 700 #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, F) \ 701 GMOCK_METHOD4_(, const, ct, m, F) 702 #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, F) \ 703 GMOCK_METHOD5_(, const, ct, m, F) 704 #define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, F) \ 705 GMOCK_METHOD6_(, const, ct, m, F) 706 #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, F) \ 707 GMOCK_METHOD7_(, const, ct, m, F) 708 #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, F) \ 709 GMOCK_METHOD8_(, const, ct, m, F) 710 #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, F) \ 711 GMOCK_METHOD9_(, const, ct, m, F) 712 #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, F) \ 713 GMOCK_METHOD10_(, const, ct, m, F) 714 715 #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, F) \ 716 GMOCK_METHOD0_(typename, , ct, m, F) 717 #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, F) \ 718 GMOCK_METHOD1_(typename, , ct, m, F) 719 #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, F) \ 720 GMOCK_METHOD2_(typename, , ct, m, F) 721 #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, F) \ 722 GMOCK_METHOD3_(typename, , ct, m, F) 723 #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, F) \ 724 GMOCK_METHOD4_(typename, , ct, m, F) 725 #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, F) \ 726 GMOCK_METHOD5_(typename, , ct, m, F) 727 #define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, F) \ 728 GMOCK_METHOD6_(typename, , ct, m, F) 729 #define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, F) \ 730 GMOCK_METHOD7_(typename, , ct, m, F) 731 #define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, F) \ 732 GMOCK_METHOD8_(typename, , ct, m, F) 733 #define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, F) \ 734 GMOCK_METHOD9_(typename, , ct, m, F) 735 #define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, F) \ 736 GMOCK_METHOD10_(typename, , ct, m, F) 737 738 #define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, F) \ 739 GMOCK_METHOD0_(typename, const, ct, m, F) 740 #define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, F) \ 741 GMOCK_METHOD1_(typename, const, ct, m, F) 742 #define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, F) \ 743 GMOCK_METHOD2_(typename, const, ct, m, F) 744 #define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, F) \ 745 GMOCK_METHOD3_(typename, const, ct, m, F) 746 #define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, F) \ 747 GMOCK_METHOD4_(typename, const, ct, m, F) 748 #define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, F) \ 749 GMOCK_METHOD5_(typename, const, ct, m, F) 750 #define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, F) \ 751 GMOCK_METHOD6_(typename, const, ct, m, F) 752 #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, F) \ 753 GMOCK_METHOD7_(typename, const, ct, m, F) 754 #define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, F) \ 755 GMOCK_METHOD8_(typename, const, ct, m, F) 756 #define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, F) \ 757 GMOCK_METHOD9_(typename, const, ct, m, F) 758 #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, F) \ 759 GMOCK_METHOD10_(typename, const, ct, m, F) 760 761 // A MockFunction<F> class has one mock method whose type is F. It is 762 // useful when you just want your test code to emit some messages and 763 // have Google Mock verify the right messages are sent (and perhaps at 764 // the right times). For example, if you are exercising code: 765 // 766 // Foo(1); 767 // Foo(2); 768 // Foo(3); 769 // 770 // and want to verify that Foo(1) and Foo(3) both invoke 771 // mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write: 772 // 773 // TEST(FooTest, InvokesBarCorrectly) { 774 // MyMock mock; 775 // MockFunction<void(string check_point_name)> check; 776 // { 777 // InSequence s; 778 // 779 // EXPECT_CALL(mock, Bar("a")); 780 // EXPECT_CALL(check, Call("1")); 781 // EXPECT_CALL(check, Call("2")); 782 // EXPECT_CALL(mock, Bar("a")); 783 // } 784 // Foo(1); 785 // check.Call("1"); 786 // Foo(2); 787 // check.Call("2"); 788 // Foo(3); 789 // } 790 // 791 // The expectation spec says that the first Bar("a") must happen 792 // before check point "1", the second Bar("a") must happen after check 793 // point "2", and nothing should happen between the two check 794 // points. The explicit check points make it easy to tell which 795 // Bar("a") is called by which call to Foo(). 796 template <typename F> 797 class MockFunction; 798 799 template <typename R> 800 class MockFunction<R()> { 801 public: MockFunction()802 MockFunction() {} 803 804 MOCK_METHOD0_T(Call, R()); 805 806 private: 807 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 808 }; 809 810 template <typename R, typename A0> 811 class MockFunction<R(A0)> { 812 public: MockFunction()813 MockFunction() {} 814 815 MOCK_METHOD1_T(Call, R(A0)); 816 817 private: 818 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 819 }; 820 821 template <typename R, typename A0, typename A1> 822 class MockFunction<R(A0, A1)> { 823 public: MockFunction()824 MockFunction() {} 825 826 MOCK_METHOD2_T(Call, R(A0, A1)); 827 828 private: 829 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 830 }; 831 832 template <typename R, typename A0, typename A1, typename A2> 833 class MockFunction<R(A0, A1, A2)> { 834 public: MockFunction()835 MockFunction() {} 836 837 MOCK_METHOD3_T(Call, R(A0, A1, A2)); 838 839 private: 840 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 841 }; 842 843 template <typename R, typename A0, typename A1, typename A2, typename A3> 844 class MockFunction<R(A0, A1, A2, A3)> { 845 public: MockFunction()846 MockFunction() {} 847 848 MOCK_METHOD4_T(Call, R(A0, A1, A2, A3)); 849 850 private: 851 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 852 }; 853 854 template <typename R, typename A0, typename A1, typename A2, typename A3, 855 typename A4> 856 class MockFunction<R(A0, A1, A2, A3, A4)> { 857 public: MockFunction()858 MockFunction() {} 859 860 MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4)); 861 862 private: 863 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 864 }; 865 866 template <typename R, typename A0, typename A1, typename A2, typename A3, 867 typename A4, typename A5> 868 class MockFunction<R(A0, A1, A2, A3, A4, A5)> { 869 public: MockFunction()870 MockFunction() {} 871 872 MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5)); 873 874 private: 875 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 876 }; 877 878 template <typename R, typename A0, typename A1, typename A2, typename A3, 879 typename A4, typename A5, typename A6> 880 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> { 881 public: MockFunction()882 MockFunction() {} 883 884 MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6)); 885 886 private: 887 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 888 }; 889 890 template <typename R, typename A0, typename A1, typename A2, typename A3, 891 typename A4, typename A5, typename A6, typename A7> 892 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> { 893 public: MockFunction()894 MockFunction() {} 895 896 MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7)); 897 898 private: 899 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 900 }; 901 902 template <typename R, typename A0, typename A1, typename A2, typename A3, 903 typename A4, typename A5, typename A6, typename A7, typename A8> 904 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> { 905 public: MockFunction()906 MockFunction() {} 907 908 MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8)); 909 910 private: 911 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 912 }; 913 914 template <typename R, typename A0, typename A1, typename A2, typename A3, 915 typename A4, typename A5, typename A6, typename A7, typename A8, 916 typename A9> 917 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> { 918 public: MockFunction()919 MockFunction() {} 920 921 MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); 922 923 private: 924 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); 925 }; 926 927 } // namespace testing 928 929 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ 930