| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 #ifndef CHROME_FRAME_TEST_HELPER_GMOCK_H_ | 4 |
| 5 #define CHROME_FRAME_TEST_HELPER_GMOCK_H_ | 5 #ifndef TESTING_GMOCK_MUTANT_H_ |
| 6 #define TESTING_GMOCK_MUTANT_H_ |
| 7 |
| 6 // The intention of this file is to make possible using GMock actions in | 8 // The intention of this file is to make possible using GMock actions in |
| 7 // all of its syntactic beauty. Classes and helper functions could be used as | 9 // all of its syntactic beauty. Classes and helper functions can be used as |
| 8 // more generic variants of Task and Callback classes (see base/task.h) | 10 // more generic variants of Task and Callback classes (see base/task.h) |
| 9 // Mutant supports both pre-bound arguments (like Task) and call-time arguments | 11 // Mutant supports both pre-bound arguments (like Task) and call-time |
| 10 // (like Callback) - hence the name. :-) | 12 // arguments (like Callback) - hence the name. :-) |
| 11 // DispatchToMethod supporting two sets of arguments - | 13 // |
| 12 // pre-bound (P) and call-time (C) as well as return value type is templatized | 14 // DispatchToMethod supports two sets of arguments: pre-bound (P) and |
| 13 // It will also try to call the selected method even if provided pre-bound args | 15 // call-time (C). The arguments as well as the return type are templatized. |
| 14 // does not match exactly with the function signature - hence the X1, X2 | 16 // DispatchToMethod will also try to call the selected method even if provided |
| 15 // parameters in CreateFunctor. | 17 // pre-bound arguments does not match exactly with the function signature |
| 18 // hence the X1, X2 ... XN parameters in CreateFunctor. |
| 19 // |
| 20 // Additionally you can bind the object at calltime by binding a pointer to |
| 21 // pointer to the object at creation time - before including this file you |
| 22 // have to #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING. |
| 23 // |
| 24 // TODO(stoyan): It's yet not clear to me should we use T& and T&* instead |
| 25 // of T* and T** when we invoke CreateFunctor to match the EXPECT_CALL style. |
| 26 // |
| 27 // |
| 28 // Sample usage with gMock: |
| 29 // |
| 30 // struct Mock : public ObjectDelegate { |
| 31 // MOCK_METHOD2(string, OnRequest(int n, const string& request)); |
| 32 // MOCK_METHOD1(void, OnQuit(int exit_code)); |
| 33 // MOCK_METHOD2(void, LogMessage(int level, const string& message)); |
| 34 // |
| 35 // string HandleFlowers(const string& reply, int n, const string& request) { |
| 36 // string result = SStringPrintf("In request of %d %s ", n, request); |
| 37 // for (int i = 0; i < n; ++i) result.append(reply) |
| 38 // return result; |
| 39 // } |
| 40 // |
| 41 // void DoLogMessage(int level, const string& message) { |
| 42 // } |
| 43 // |
| 44 // void QuitMessageLoop(int seconds) { |
| 45 // MessageLoop* loop = MessageLoop::current(); |
| 46 // loop->PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, |
| 47 // 1000 * seconds); |
| 48 // } |
| 49 // }; |
| 50 // |
| 51 // Mock mock; |
| 52 // // Will invoke mock.HandleFlowers("orchids", n, request) |
| 53 // // "orchids" is a pre-bound argument, and <n> and <request> are call-time |
| 54 // // arguments - they are not known until the OnRequest mock is invoked. |
| 55 // EXPECT_CALL(mock, OnRequest(Ge(5), StartsWith("flower")) |
| 56 // .Times(1) |
| 57 // .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers, |
| 58 // string("orchids")))); |
| 59 // |
| 60 // |
| 61 // // No pre-bound arguments, two call-time arguments passed |
| 62 // // directly to DoLogMessage |
| 63 // EXPECT_CALL(mock, OnLogMessage(_, _)) |
| 64 // .Times(AnyNumber()) |
| 65 // .WillAlways(Invoke(CreateFunctor, &mock, &Mock::DoLogMessage)); |
| 66 // |
| 67 // |
| 68 // // In this case we have a single pre-bound argument - 3. We ignore |
| 69 // // all of the arguments of OnQuit. |
| 70 // EXCEPT_CALL(mock, OnQuit(_)) |
| 71 // .Times(1) |
| 72 // .WillOnce(InvokeWithoutArgs(CreateFunctor( |
| 73 // &mock, &Mock::QuitMessageLoop, 3))); |
| 74 // |
| 75 // MessageLoop loop; |
| 76 // loop.Run(); |
| 77 // |
| 78 // |
| 79 // // Here is another example of how we can set an action that invokes |
| 80 // // method of an object that is not yet created. |
| 81 // struct Mock : public ObjectDelegate { |
| 82 // MOCK_METHOD1(void, DemiurgeCreated(Demiurge*)); |
| 83 // MOCK_METHOD2(void, OnRequest(int count, const string&)); |
| 84 // |
| 85 // void StoreDemiurge(Demiurge* w) { |
| 86 // demiurge_ = w; |
| 87 // } |
| 88 // |
| 89 // Demiurge* demiurge; |
| 90 // } |
| 91 // |
| 92 // EXPECT_CALL(mock, DemiurgeCreated(_)).Times(1) |
| 93 // .WillOnce(Invoke(CreateFunctor(&mock, &Mock::StoreDemiurge))); |
| 94 // |
| 95 // EXPECT_CALL(mock, OnRequest(_, StrEq("Moby Dick"))) |
| 96 // .Times(AnyNumber()) |
| 97 // .WillAlways(WithArgs<0>(Invoke( |
| 98 // CreateFunctor(&mock->demiurge_, &Demiurge::DecreaseMonsters)))); |
| 99 // |
| 16 | 100 |
| 17 #include "base/linked_ptr.h" | 101 #include "base/linked_ptr.h" |
| 18 #include "base/task.h" // for CallBackStorage | |
| 19 #include "base/tuple.h" // for Tuple | 102 #include "base/tuple.h" // for Tuple |
| 20 | 103 |
| 104 namespace testing { |
| 21 | 105 |
| 22 // 0 - 0 | 106 // 0 - 0 |
| 23 template <typename R, typename T, typename Method> | 107 template <typename R, typename T, typename Method> |
| 24 inline R DispatchToMethod(T* obj, Method method, | 108 inline R DispatchToMethod(T* obj, Method method, |
| 25 const Tuple0& p, | 109 const Tuple0& p, |
| 26 const Tuple0& c) { | 110 const Tuple0& c) { |
| 27 return (obj->*method)(); | 111 return (obj->*method)(); |
| 28 } | 112 } |
| 29 | 113 |
| 30 // 0 - 1 | 114 // 0 - 1 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 325 |
| 242 // Interface that is exposed to the consumer, that does the actual calling | 326 // Interface that is exposed to the consumer, that does the actual calling |
| 243 // of the method. | 327 // of the method. |
| 244 template <typename R, typename Params> | 328 template <typename R, typename Params> |
| 245 class MutantRunner { | 329 class MutantRunner { |
| 246 public: | 330 public: |
| 247 virtual R RunWithParams(const Params& params) = 0; | 331 virtual R RunWithParams(const Params& params) = 0; |
| 248 virtual ~MutantRunner() {} | 332 virtual ~MutantRunner() {} |
| 249 }; | 333 }; |
| 250 | 334 |
| 251 // MutantImpl holds pre-bound arguments (like Task) and like Callback | 335 // Mutant holds pre-bound arguments (like Task). Like Callback |
| 252 // allows call-time arguments. | 336 // allows call-time arguments. You bind a pointer to the object |
| 337 // at creation time. |
| 253 template <typename R, typename T, typename Method, | 338 template <typename R, typename T, typename Method, |
| 254 typename PreBound, typename Params> | 339 typename PreBound, typename Params> |
| 255 class MutantImpl : public CallbackStorage<T, Method>, | 340 class Mutant : public MutantRunner<R, Params> { |
| 256 public MutantRunner<R, Params> { | |
| 257 public: | 341 public: |
| 258 MutantImpl(T* obj, Method meth, const PreBound& pb) | 342 Mutant(T* obj, Method method, const PreBound& pb) |
| 259 : CallbackStorage<T, Method>(obj, meth), | 343 : obj_(obj), method_(method), pb_(pb) { |
| 260 pb_(pb) { | |
| 261 } | 344 } |
| 262 | 345 |
| 263 // MutantRunner implementation | 346 // MutantRunner implementation |
| 264 virtual R RunWithParams(const Params& params) { | 347 virtual R RunWithParams(const Params& params) { |
| 265 return DispatchToMethod<R>(this->obj_, this->meth_, pb_, params); | 348 return DispatchToMethod<R>(this->obj_, this->method_, pb_, params); |
| 266 } | 349 } |
| 267 | 350 |
| 351 T* obj_; |
| 352 Method method_; |
| 268 PreBound pb_; | 353 PreBound pb_; |
| 269 }; | 354 }; |
| 270 | 355 |
| 356 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 357 // MutantLateBind is like Mutant, but you bind a pointer to a pointer |
| 358 // to the object. This way you can create actions for an object |
| 359 // that is not yet created (has only storage for a pointer to it). |
| 360 template <typename R, typename T, typename Method, |
| 361 typename PreBound, typename Params> |
| 362 class MutantLateObjectBind : public MutantRunner<R, Params> { |
| 363 public: |
| 364 MutantLateObjectBind(T** obj, Method method, const PreBound& pb) |
| 365 : obj_(obj), method_(method), pb_(pb) { |
| 366 } |
| 367 |
| 368 // MutantRunner implementation. |
| 369 virtual R RunWithParams(const Params& params) { |
| 370 EXPECT_THAT(*this->obj_, testing::NotNull()); |
| 371 if (NULL == *this->obj_) |
| 372 return R(); |
| 373 return DispatchToMethod<R>( *this->obj_, this->method_, pb_, params); |
| 374 } |
| 375 |
| 376 T** obj_; |
| 377 Method method_; |
| 378 PreBound pb_; |
| 379 }; |
| 380 #endif |
| 381 |
| 271 // Simple MutantRunner<> wrapper acting as a functor. | 382 // Simple MutantRunner<> wrapper acting as a functor. |
| 272 // Redirects operator() to MutantRunner<Params>::Run() | 383 // Redirects operator() to MutantRunner<Params>::Run() |
| 273 template <typename R, typename Params> | 384 template <typename R, typename Params> |
| 274 struct MutantFunctor { | 385 struct MutantFunctor { |
| 275 explicit MutantFunctor(MutantRunner<R, Params>* cb) : impl_(cb) { | 386 explicit MutantFunctor(MutantRunner<R, Params>* cb) : impl_(cb) { |
| 276 } | 387 } |
| 277 | 388 |
| 278 ~MutantFunctor() { | 389 ~MutantFunctor() { |
| 279 } | 390 } |
| 280 | 391 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 309 MutantFunctor(); | 420 MutantFunctor(); |
| 310 linked_ptr<MutantRunner<R, Params> > impl_; | 421 linked_ptr<MutantRunner<R, Params> > impl_; |
| 311 }; | 422 }; |
| 312 | 423 |
| 313 | 424 |
| 314 | 425 |
| 315 // 0 - 0 | 426 // 0 - 0 |
| 316 template <typename R, typename T> | 427 template <typename R, typename T> |
| 317 inline MutantFunctor<R, Tuple0> | 428 inline MutantFunctor<R, Tuple0> |
| 318 CreateFunctor(T* obj, R (T::*method)()) { | 429 CreateFunctor(T* obj, R (T::*method)()) { |
| 319 MutantRunner<R, Tuple0> *t = new MutantImpl<R, T, | 430 MutantRunner<R, Tuple0> *t = |
| 320 R (T::*)(), | 431 new Mutant<R, T, R (T::*)(), |
| 321 Tuple0, Tuple0> | 432 Tuple0, Tuple0> |
| 322 (obj, method, MakeTuple()); | 433 (obj, method, MakeTuple()); |
| 323 return MutantFunctor<R, Tuple0>(t); | 434 return MutantFunctor<R, Tuple0>(t); |
| 324 } | 435 } |
| 436 |
| 437 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 438 // 0 - 0 |
| 439 template <typename R, typename T> |
| 440 inline MutantFunctor<R, Tuple0> |
| 441 CreateFunctor(T** obj, R (T::*method)()) { |
| 442 MutantRunner<R, Tuple0> *t = |
| 443 new MutantLateObjectBind<R, T, R (T::*)(), |
| 444 Tuple0, Tuple0> |
| 445 (obj, method, MakeTuple()); |
| 446 return MutantFunctor<R, Tuple0>(t); |
| 447 } |
| 448 #endif |
| 325 | 449 |
| 326 // 0 - 1 | 450 // 0 - 1 |
| 327 template <typename R, typename T, typename A1> | 451 template <typename R, typename T, typename A1> |
| 328 inline MutantFunctor<R, Tuple1<A1> > | 452 inline MutantFunctor<R, Tuple1<A1> > |
| 329 CreateFunctor(T* obj, R (T::*method)(A1)) { | 453 CreateFunctor(T* obj, R (T::*method)(A1)) { |
| 330 MutantRunner<R, Tuple1<A1> > *t = new MutantImpl<R, T, | 454 MutantRunner<R, Tuple1<A1> > *t = |
| 331 R (T::*)(A1), | 455 new Mutant<R, T, R (T::*)(A1), |
| 332 Tuple0, Tuple1<A1> > | 456 Tuple0, Tuple1<A1> > |
| 333 (obj, method, MakeTuple()); | 457 (obj, method, MakeTuple()); |
| 334 return MutantFunctor<R, Tuple1<A1> >(t); | 458 return MutantFunctor<R, Tuple1<A1> >(t); |
| 335 } | 459 } |
| 460 |
| 461 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 462 // 0 - 1 |
| 463 template <typename R, typename T, typename A1> |
| 464 inline MutantFunctor<R, Tuple1<A1> > |
| 465 CreateFunctor(T** obj, R (T::*method)(A1)) { |
| 466 MutantRunner<R, Tuple1<A1> > *t = |
| 467 new MutantLateObjectBind<R, T, R (T::*)(A1), |
| 468 Tuple0, Tuple1<A1> > |
| 469 (obj, method, MakeTuple()); |
| 470 return MutantFunctor<R, Tuple1<A1> >(t); |
| 471 } |
| 472 #endif |
| 336 | 473 |
| 337 // 0 - 2 | 474 // 0 - 2 |
| 338 template <typename R, typename T, typename A1, typename A2> | 475 template <typename R, typename T, typename A1, typename A2> |
| 339 inline MutantFunctor<R, Tuple2<A1, A2> > | 476 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 340 CreateFunctor(T* obj, R (T::*method)(A1, A2)) { | 477 CreateFunctor(T* obj, R (T::*method)(A1, A2)) { |
| 341 MutantRunner<R, Tuple2<A1, A2> > *t = new MutantImpl<R, T, | 478 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 342 R (T::*)(A1, A2), | 479 new Mutant<R, T, R (T::*)(A1, A2), |
| 343 Tuple0, Tuple2<A1, A2> > | 480 Tuple0, Tuple2<A1, A2> > |
| 344 (obj, method, MakeTuple()); | 481 (obj, method, MakeTuple()); |
| 345 return MutantFunctor<R, Tuple2<A1, A2> >(t); | 482 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 346 } | 483 } |
| 484 |
| 485 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 486 // 0 - 2 |
| 487 template <typename R, typename T, typename A1, typename A2> |
| 488 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 489 CreateFunctor(T** obj, R (T::*method)(A1, A2)) { |
| 490 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 491 new MutantLateObjectBind<R, T, R (T::*)(A1, A2), |
| 492 Tuple0, Tuple2<A1, A2> > |
| 493 (obj, method, MakeTuple()); |
| 494 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 495 } |
| 496 #endif |
| 347 | 497 |
| 348 // 0 - 3 | 498 // 0 - 3 |
| 349 template <typename R, typename T, typename A1, typename A2, typename A3> | 499 template <typename R, typename T, typename A1, typename A2, typename A3> |
| 350 inline MutantFunctor<R, Tuple3<A1, A2, A3> > | 500 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 351 CreateFunctor(T* obj, R (T::*method)(A1, A2, A3)) { | 501 CreateFunctor(T* obj, R (T::*method)(A1, A2, A3)) { |
| 352 MutantRunner<R, Tuple3<A1, A2, A3> > *t = new MutantImpl<R, T, | 502 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 353 R (T::*)(A1, A2, A3), | 503 new Mutant<R, T, R (T::*)(A1, A2, A3), |
| 354 Tuple0, Tuple3<A1, A2, A3> > | 504 Tuple0, Tuple3<A1, A2, A3> > |
| 355 (obj, method, MakeTuple()); | 505 (obj, method, MakeTuple()); |
| 356 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); | 506 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 357 } | 507 } |
| 508 |
| 509 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 510 // 0 - 3 |
| 511 template <typename R, typename T, typename A1, typename A2, typename A3> |
| 512 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 513 CreateFunctor(T** obj, R (T::*method)(A1, A2, A3)) { |
| 514 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 515 new MutantLateObjectBind<R, T, R (T::*)(A1, A2, A3), |
| 516 Tuple0, Tuple3<A1, A2, A3> > |
| 517 (obj, method, MakeTuple()); |
| 518 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 519 } |
| 520 #endif |
| 358 | 521 |
| 359 // 0 - 4 | 522 // 0 - 4 |
| 360 template <typename R, typename T, typename A1, typename A2, typename A3, | 523 template <typename R, typename T, typename A1, typename A2, typename A3, |
| 361 typename A4> | 524 typename A4> |
| 362 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > | 525 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 363 CreateFunctor(T* obj, R (T::*method)(A1, A2, A3, A4)) { | 526 CreateFunctor(T* obj, R (T::*method)(A1, A2, A3, A4)) { |
| 364 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = new MutantImpl<R, T, | 527 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 365 R (T::*)(A1, A2, A3, A4), | 528 new Mutant<R, T, R (T::*)(A1, A2, A3, A4), |
| 366 Tuple0, Tuple4<A1, A2, A3, A4> > | 529 Tuple0, Tuple4<A1, A2, A3, A4> > |
| 367 (obj, method, MakeTuple()); | 530 (obj, method, MakeTuple()); |
| 368 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); | 531 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 369 } | 532 } |
| 533 |
| 534 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 535 // 0 - 4 |
| 536 template <typename R, typename T, typename A1, typename A2, typename A3, |
| 537 typename A4> |
| 538 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 539 CreateFunctor(T** obj, R (T::*method)(A1, A2, A3, A4)) { |
| 540 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 541 new MutantLateObjectBind<R, T, R (T::*)(A1, A2, A3, A4), |
| 542 Tuple0, Tuple4<A1, A2, A3, A4> > |
| 543 (obj, method, MakeTuple()); |
| 544 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 545 } |
| 546 #endif |
| 370 | 547 |
| 371 // 1 - 0 | 548 // 1 - 0 |
| 372 template <typename R, typename T, typename P1, typename X1> | 549 template <typename R, typename T, typename P1, typename X1> |
| 373 inline MutantFunctor<R, Tuple0> | 550 inline MutantFunctor<R, Tuple0> |
| 374 CreateFunctor(T* obj, R (T::*method)(X1), const P1& p1) { | 551 CreateFunctor(T* obj, R (T::*method)(X1), const P1& p1) { |
| 375 MutantRunner<R, Tuple0> *t = new MutantImpl<R, T, | 552 MutantRunner<R, Tuple0> *t = |
| 376 R (T::*)(X1), | 553 new Mutant<R, T, R (T::*)(X1), |
| 377 Tuple1<P1>, Tuple0> | 554 Tuple1<P1>, Tuple0> |
| 378 (obj, method, MakeTuple(p1)); | 555 (obj, method, MakeTuple(p1)); |
| 379 return MutantFunctor<R, Tuple0>(t); | 556 return MutantFunctor<R, Tuple0>(t); |
| 380 } | 557 } |
| 558 |
| 559 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 560 // 1 - 0 |
| 561 template <typename R, typename T, typename P1, typename X1> |
| 562 inline MutantFunctor<R, Tuple0> |
| 563 CreateFunctor(T** obj, R (T::*method)(X1), const P1& p1) { |
| 564 MutantRunner<R, Tuple0> *t = |
| 565 new MutantLateObjectBind<R, T, R (T::*)(X1), |
| 566 Tuple1<P1>, Tuple0> |
| 567 (obj, method, MakeTuple(p1)); |
| 568 return MutantFunctor<R, Tuple0>(t); |
| 569 } |
| 570 #endif |
| 381 | 571 |
| 382 // 1 - 1 | 572 // 1 - 1 |
| 383 template <typename R, typename T, typename P1, typename A1, typename X1> | 573 template <typename R, typename T, typename P1, typename A1, typename X1> |
| 384 inline MutantFunctor<R, Tuple1<A1> > | 574 inline MutantFunctor<R, Tuple1<A1> > |
| 385 CreateFunctor(T* obj, R (T::*method)(X1, A1), const P1& p1) { | 575 CreateFunctor(T* obj, R (T::*method)(X1, A1), const P1& p1) { |
| 386 MutantRunner<R, Tuple1<A1> > *t = new MutantImpl<R, T, | 576 MutantRunner<R, Tuple1<A1> > *t = |
| 387 R (T::*)(X1, A1), | 577 new Mutant<R, T, R (T::*)(X1, A1), |
| 388 Tuple1<P1>, Tuple1<A1> > | 578 Tuple1<P1>, Tuple1<A1> > |
| 389 (obj, method, MakeTuple(p1)); | 579 (obj, method, MakeTuple(p1)); |
| 390 return MutantFunctor<R, Tuple1<A1> >(t); | 580 return MutantFunctor<R, Tuple1<A1> >(t); |
| 391 } | 581 } |
| 582 |
| 583 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 584 // 1 - 1 |
| 585 template <typename R, typename T, typename P1, typename A1, typename X1> |
| 586 inline MutantFunctor<R, Tuple1<A1> > |
| 587 CreateFunctor(T** obj, R (T::*method)(X1, A1), const P1& p1) { |
| 588 MutantRunner<R, Tuple1<A1> > *t = |
| 589 new MutantLateObjectBind<R, T, R (T::*)(X1, A1), |
| 590 Tuple1<P1>, Tuple1<A1> > |
| 591 (obj, method, MakeTuple(p1)); |
| 592 return MutantFunctor<R, Tuple1<A1> >(t); |
| 593 } |
| 594 #endif |
| 392 | 595 |
| 393 // 1 - 2 | 596 // 1 - 2 |
| 394 template <typename R, typename T, typename P1, typename A1, typename A2, | 597 template <typename R, typename T, typename P1, typename A1, typename A2, |
| 395 typename X1> | 598 typename X1> |
| 396 inline MutantFunctor<R, Tuple2<A1, A2> > | 599 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 397 CreateFunctor(T* obj, R (T::*method)(X1, A1, A2), const P1& p1) { | 600 CreateFunctor(T* obj, R (T::*method)(X1, A1, A2), const P1& p1) { |
| 398 MutantRunner<R, Tuple2<A1, A2> > *t = new MutantImpl<R, T, | 601 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 399 R (T::*)(X1, A1, A2), | 602 new Mutant<R, T, R (T::*)(X1, A1, A2), |
| 400 Tuple1<P1>, Tuple2<A1, A2> > | 603 Tuple1<P1>, Tuple2<A1, A2> > |
| 401 (obj, method, MakeTuple(p1)); | 604 (obj, method, MakeTuple(p1)); |
| 402 return MutantFunctor<R, Tuple2<A1, A2> >(t); | 605 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 403 } | 606 } |
| 607 |
| 608 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 609 // 1 - 2 |
| 610 template <typename R, typename T, typename P1, typename A1, typename A2, |
| 611 typename X1> |
| 612 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 613 CreateFunctor(T** obj, R (T::*method)(X1, A1, A2), const P1& p1) { |
| 614 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 615 new MutantLateObjectBind<R, T, R (T::*)(X1, A1, A2), |
| 616 Tuple1<P1>, Tuple2<A1, A2> > |
| 617 (obj, method, MakeTuple(p1)); |
| 618 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 619 } |
| 620 #endif |
| 404 | 621 |
| 405 // 1 - 3 | 622 // 1 - 3 |
| 406 template <typename R, typename T, typename P1, typename A1, typename A2, | 623 template <typename R, typename T, typename P1, typename A1, typename A2, |
| 407 typename A3, typename X1> | 624 typename A3, typename X1> |
| 408 inline MutantFunctor<R, Tuple3<A1, A2, A3> > | 625 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 409 CreateFunctor(T* obj, R (T::*method)(X1, A1, A2, A3), const P1& p1) { | 626 CreateFunctor(T* obj, R (T::*method)(X1, A1, A2, A3), const P1& p1) { |
| 410 MutantRunner<R, Tuple3<A1, A2, A3> > *t = new MutantImpl<R, T, | 627 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 411 R (T::*)(X1, A1, A2, A3), | 628 new Mutant<R, T, R (T::*)(X1, A1, A2, A3), |
| 412 Tuple1<P1>, Tuple3<A1, A2, A3> > | 629 Tuple1<P1>, Tuple3<A1, A2, A3> > |
| 413 (obj, method, MakeTuple(p1)); | 630 (obj, method, MakeTuple(p1)); |
| 414 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); | 631 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 415 } | 632 } |
| 633 |
| 634 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 635 // 1 - 3 |
| 636 template <typename R, typename T, typename P1, typename A1, typename A2, |
| 637 typename A3, typename X1> |
| 638 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 639 CreateFunctor(T** obj, R (T::*method)(X1, A1, A2, A3), const P1& p1) { |
| 640 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 641 new MutantLateObjectBind<R, T, R (T::*)(X1, A1, A2, A3), |
| 642 Tuple1<P1>, Tuple3<A1, A2, A3> > |
| 643 (obj, method, MakeTuple(p1)); |
| 644 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 645 } |
| 646 #endif |
| 416 | 647 |
| 417 // 1 - 4 | 648 // 1 - 4 |
| 418 template <typename R, typename T, typename P1, typename A1, typename A2, | 649 template <typename R, typename T, typename P1, typename A1, typename A2, |
| 419 typename A3, typename A4, typename X1> | 650 typename A3, typename A4, typename X1> |
| 420 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > | 651 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 421 CreateFunctor(T* obj, R (T::*method)(X1, A1, A2, A3, A4), const P1& p1) { | 652 CreateFunctor(T* obj, R (T::*method)(X1, A1, A2, A3, A4), const P1& p1) { |
| 422 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = new MutantImpl<R, T, | 653 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 423 R (T::*)(X1, A1, A2, A3, A4), | 654 new Mutant<R, T, R (T::*)(X1, A1, A2, A3, A4), |
| 424 Tuple1<P1>, Tuple4<A1, A2, A3, A4> > | 655 Tuple1<P1>, Tuple4<A1, A2, A3, A4> > |
| 425 (obj, method, MakeTuple(p1)); | 656 (obj, method, MakeTuple(p1)); |
| 426 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); | 657 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 427 } | 658 } |
| 659 |
| 660 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 661 // 1 - 4 |
| 662 template <typename R, typename T, typename P1, typename A1, typename A2, |
| 663 typename A3, typename A4, typename X1> |
| 664 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 665 CreateFunctor(T** obj, R (T::*method)(X1, A1, A2, A3, A4), const P1& p1) { |
| 666 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 667 new MutantLateObjectBind<R, T, R (T::*)(X1, A1, A2, A3, A4), |
| 668 Tuple1<P1>, Tuple4<A1, A2, A3, A4> > |
| 669 (obj, method, MakeTuple(p1)); |
| 670 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 671 } |
| 672 #endif |
| 428 | 673 |
| 429 // 2 - 0 | 674 // 2 - 0 |
| 430 template <typename R, typename T, typename P1, typename P2, typename X1, | 675 template <typename R, typename T, typename P1, typename P2, typename X1, |
| 431 typename X2> | 676 typename X2> |
| 432 inline MutantFunctor<R, Tuple0> | 677 inline MutantFunctor<R, Tuple0> |
| 433 CreateFunctor(T* obj, R (T::*method)(X1, X2), const P1& p1, const P2& p2) { | 678 CreateFunctor(T* obj, R (T::*method)(X1, X2), const P1& p1, const P2& p2) { |
| 434 MutantRunner<R, Tuple0> *t = new MutantImpl<R, T, | 679 MutantRunner<R, Tuple0> *t = |
| 435 R (T::*)(X1, X2), | 680 new Mutant<R, T, R (T::*)(X1, X2), |
| 436 Tuple2<P1, P2>, Tuple0> | 681 Tuple2<P1, P2>, Tuple0> |
| 437 (obj, method, MakeTuple(p1, p2)); | 682 (obj, method, MakeTuple(p1, p2)); |
| 438 return MutantFunctor<R, Tuple0>(t); | 683 return MutantFunctor<R, Tuple0>(t); |
| 439 } | 684 } |
| 685 |
| 686 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 687 // 2 - 0 |
| 688 template <typename R, typename T, typename P1, typename P2, typename X1, |
| 689 typename X2> |
| 690 inline MutantFunctor<R, Tuple0> |
| 691 CreateFunctor(T** obj, R (T::*method)(X1, X2), const P1& p1, const P2& p2) { |
| 692 MutantRunner<R, Tuple0> *t = |
| 693 new MutantLateObjectBind<R, T, R (T::*)(X1, X2), |
| 694 Tuple2<P1, P2>, Tuple0> |
| 695 (obj, method, MakeTuple(p1, p2)); |
| 696 return MutantFunctor<R, Tuple0>(t); |
| 697 } |
| 698 #endif |
| 440 | 699 |
| 441 // 2 - 1 | 700 // 2 - 1 |
| 442 template <typename R, typename T, typename P1, typename P2, typename A1, | 701 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 443 typename X1, typename X2> | 702 typename X1, typename X2> |
| 444 inline MutantFunctor<R, Tuple1<A1> > | 703 inline MutantFunctor<R, Tuple1<A1> > |
| 445 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1), const P1& p1, const P2& p2) { | 704 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1), const P1& p1, const P2& p2) { |
| 446 MutantRunner<R, Tuple1<A1> > *t = new MutantImpl<R, T, | 705 MutantRunner<R, Tuple1<A1> > *t = |
| 447 R (T::*)(X1, X2, A1), | 706 new Mutant<R, T, R (T::*)(X1, X2, A1), |
| 448 Tuple2<P1, P2>, Tuple1<A1> > | 707 Tuple2<P1, P2>, Tuple1<A1> > |
| 449 (obj, method, MakeTuple(p1, p2)); | 708 (obj, method, MakeTuple(p1, p2)); |
| 450 return MutantFunctor<R, Tuple1<A1> >(t); | 709 return MutantFunctor<R, Tuple1<A1> >(t); |
| 451 } | 710 } |
| 711 |
| 712 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 713 // 2 - 1 |
| 714 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 715 typename X1, typename X2> |
| 716 inline MutantFunctor<R, Tuple1<A1> > |
| 717 CreateFunctor(T** obj, R (T::*method)(X1, X2, A1), const P1& p1, const P2& p2) { |
| 718 MutantRunner<R, Tuple1<A1> > *t = |
| 719 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, A1), |
| 720 Tuple2<P1, P2>, Tuple1<A1> > |
| 721 (obj, method, MakeTuple(p1, p2)); |
| 722 return MutantFunctor<R, Tuple1<A1> >(t); |
| 723 } |
| 724 #endif |
| 452 | 725 |
| 453 // 2 - 2 | 726 // 2 - 2 |
| 454 template <typename R, typename T, typename P1, typename P2, typename A1, | 727 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 455 typename A2, typename X1, typename X2> | 728 typename A2, typename X1, typename X2> |
| 456 inline MutantFunctor<R, Tuple2<A1, A2> > | 729 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 457 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1, A2), const P1& p1, | 730 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1, A2), const P1& p1, |
| 458 const P2& p2) { | 731 const P2& p2) { |
| 459 MutantRunner<R, Tuple2<A1, A2> > *t = new MutantImpl<R, T, | 732 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 460 R (T::*)(X1, X2, A1, A2), | 733 new Mutant<R, T, R (T::*)(X1, X2, A1, A2), |
| 461 Tuple2<P1, P2>, Tuple2<A1, A2> > | 734 Tuple2<P1, P2>, Tuple2<A1, A2> > |
| 462 (obj, method, MakeTuple(p1, p2)); | 735 (obj, method, MakeTuple(p1, p2)); |
| 463 return MutantFunctor<R, Tuple2<A1, A2> >(t); | 736 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 464 } | 737 } |
| 738 |
| 739 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 740 // 2 - 2 |
| 741 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 742 typename A2, typename X1, typename X2> |
| 743 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 744 CreateFunctor(T** obj, R (T::*method)(X1, X2, A1, A2), const P1& p1, |
| 745 const P2& p2) { |
| 746 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 747 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, A1, A2), |
| 748 Tuple2<P1, P2>, Tuple2<A1, A2> > |
| 749 (obj, method, MakeTuple(p1, p2)); |
| 750 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 751 } |
| 752 #endif |
| 465 | 753 |
| 466 // 2 - 3 | 754 // 2 - 3 |
| 467 template <typename R, typename T, typename P1, typename P2, typename A1, | 755 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 468 typename A2, typename A3, typename X1, typename X2> | 756 typename A2, typename A3, typename X1, typename X2> |
| 469 inline MutantFunctor<R, Tuple3<A1, A2, A3> > | 757 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 470 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1, A2, A3), const P1& p1, | 758 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1, A2, A3), const P1& p1, |
| 471 const P2& p2) { | 759 const P2& p2) { |
| 472 MutantRunner<R, Tuple3<A1, A2, A3> > *t = new MutantImpl<R, T, | 760 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 473 R (T::*)(X1, X2, A1, A2, A3), | 761 new Mutant<R, T, R (T::*)(X1, X2, A1, A2, A3), |
| 474 Tuple2<P1, P2>, Tuple3<A1, A2, A3> > | 762 Tuple2<P1, P2>, Tuple3<A1, A2, A3> > |
| 475 (obj, method, MakeTuple(p1, p2)); | 763 (obj, method, MakeTuple(p1, p2)); |
| 476 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); | 764 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 477 } | 765 } |
| 766 |
| 767 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 768 // 2 - 3 |
| 769 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 770 typename A2, typename A3, typename X1, typename X2> |
| 771 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 772 CreateFunctor(T** obj, R (T::*method)(X1, X2, A1, A2, A3), const P1& p1, |
| 773 const P2& p2) { |
| 774 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 775 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, A1, A2, A3), |
| 776 Tuple2<P1, P2>, Tuple3<A1, A2, A3> > |
| 777 (obj, method, MakeTuple(p1, p2)); |
| 778 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 779 } |
| 780 #endif |
| 478 | 781 |
| 479 // 2 - 4 | 782 // 2 - 4 |
| 480 template <typename R, typename T, typename P1, typename P2, typename A1, | 783 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 481 typename A2, typename A3, typename A4, typename X1, typename X2> | 784 typename A2, typename A3, typename A4, typename X1, typename X2> |
| 482 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > | 785 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 483 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1, A2, A3, A4), const P1& p1, | 786 CreateFunctor(T* obj, R (T::*method)(X1, X2, A1, A2, A3, A4), const P1& p1, |
| 484 const P2& p2) { | 787 const P2& p2) { |
| 485 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = new MutantImpl<R, T, | 788 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 486 R (T::*)(X1, X2, A1, A2, A3, A4), | 789 new Mutant<R, T, R (T::*)(X1, X2, A1, A2, A3, A4), |
| 487 Tuple2<P1, P2>, Tuple4<A1, A2, A3, A4> > | 790 Tuple2<P1, P2>, Tuple4<A1, A2, A3, A4> > |
| 488 (obj, method, MakeTuple(p1, p2)); | 791 (obj, method, MakeTuple(p1, p2)); |
| 489 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); | 792 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 490 } | 793 } |
| 794 |
| 795 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 796 // 2 - 4 |
| 797 template <typename R, typename T, typename P1, typename P2, typename A1, |
| 798 typename A2, typename A3, typename A4, typename X1, typename X2> |
| 799 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 800 CreateFunctor(T** obj, R (T::*method)(X1, X2, A1, A2, A3, A4), const P1& p1, |
| 801 const P2& p2) { |
| 802 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 803 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, A1, A2, A3, A4), |
| 804 Tuple2<P1, P2>, Tuple4<A1, A2, A3, A4> > |
| 805 (obj, method, MakeTuple(p1, p2)); |
| 806 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 807 } |
| 808 #endif |
| 491 | 809 |
| 492 // 3 - 0 | 810 // 3 - 0 |
| 493 template <typename R, typename T, typename P1, typename P2, typename P3, | 811 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 494 typename X1, typename X2, typename X3> | 812 typename X1, typename X2, typename X3> |
| 495 inline MutantFunctor<R, Tuple0> | 813 inline MutantFunctor<R, Tuple0> |
| 496 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3), const P1& p1, const P2& p2, | 814 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3), const P1& p1, const P2& p2, |
| 497 const P3& p3) { | 815 const P3& p3) { |
| 498 MutantRunner<R, Tuple0> *t = new MutantImpl<R, T, | 816 MutantRunner<R, Tuple0> *t = |
| 499 R (T::*)(X1, X2, X3), | 817 new Mutant<R, T, R (T::*)(X1, X2, X3), |
| 500 Tuple3<P1, P2, P3>, Tuple0> | 818 Tuple3<P1, P2, P3>, Tuple0> |
| 501 (obj, method, MakeTuple(p1, p2, p3)); | 819 (obj, method, MakeTuple(p1, p2, p3)); |
| 502 return MutantFunctor<R, Tuple0>(t); | 820 return MutantFunctor<R, Tuple0>(t); |
| 503 } | 821 } |
| 822 |
| 823 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 824 // 3 - 0 |
| 825 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 826 typename X1, typename X2, typename X3> |
| 827 inline MutantFunctor<R, Tuple0> |
| 828 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3), const P1& p1, const P2& p2, |
| 829 const P3& p3) { |
| 830 MutantRunner<R, Tuple0> *t = |
| 831 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3), |
| 832 Tuple3<P1, P2, P3>, Tuple0> |
| 833 (obj, method, MakeTuple(p1, p2, p3)); |
| 834 return MutantFunctor<R, Tuple0>(t); |
| 835 } |
| 836 #endif |
| 504 | 837 |
| 505 // 3 - 1 | 838 // 3 - 1 |
| 506 template <typename R, typename T, typename P1, typename P2, typename P3, | 839 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 507 typename A1, typename X1, typename X2, typename X3> | 840 typename A1, typename X1, typename X2, typename X3> |
| 508 inline MutantFunctor<R, Tuple1<A1> > | 841 inline MutantFunctor<R, Tuple1<A1> > |
| 509 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1), const P1& p1, | 842 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1), const P1& p1, |
| 510 const P2& p2, const P3& p3) { | 843 const P2& p2, const P3& p3) { |
| 511 MutantRunner<R, Tuple1<A1> > *t = new MutantImpl<R, T, | 844 MutantRunner<R, Tuple1<A1> > *t = |
| 512 R (T::*)(X1, X2, X3, A1), | 845 new Mutant<R, T, R (T::*)(X1, X2, X3, A1), |
| 513 Tuple3<P1, P2, P3>, Tuple1<A1> > | 846 Tuple3<P1, P2, P3>, Tuple1<A1> > |
| 514 (obj, method, MakeTuple(p1, p2, p3)); | 847 (obj, method, MakeTuple(p1, p2, p3)); |
| 515 return MutantFunctor<R, Tuple1<A1> >(t); | 848 return MutantFunctor<R, Tuple1<A1> >(t); |
| 516 } | 849 } |
| 850 |
| 851 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 852 // 3 - 1 |
| 853 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 854 typename A1, typename X1, typename X2, typename X3> |
| 855 inline MutantFunctor<R, Tuple1<A1> > |
| 856 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, A1), const P1& p1, |
| 857 const P2& p2, const P3& p3) { |
| 858 MutantRunner<R, Tuple1<A1> > *t = |
| 859 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, A1), |
| 860 Tuple3<P1, P2, P3>, Tuple1<A1> > |
| 861 (obj, method, MakeTuple(p1, p2, p3)); |
| 862 return MutantFunctor<R, Tuple1<A1> >(t); |
| 863 } |
| 864 #endif |
| 517 | 865 |
| 518 // 3 - 2 | 866 // 3 - 2 |
| 519 template <typename R, typename T, typename P1, typename P2, typename P3, | 867 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 520 typename A1, typename A2, typename X1, typename X2, typename X3> | 868 typename A1, typename A2, typename X1, typename X2, typename X3> |
| 521 inline MutantFunctor<R, Tuple2<A1, A2> > | 869 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 522 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1, A2), const P1& p1, | 870 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1, A2), const P1& p1, |
| 523 const P2& p2, const P3& p3) { | 871 const P2& p2, const P3& p3) { |
| 524 MutantRunner<R, Tuple2<A1, A2> > *t = new MutantImpl<R, T, | 872 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 525 R (T::*)(X1, X2, X3, A1, A2), | 873 new Mutant<R, T, R (T::*)(X1, X2, X3, A1, A2), |
| 526 Tuple3<P1, P2, P3>, Tuple2<A1, A2> > | 874 Tuple3<P1, P2, P3>, Tuple2<A1, A2> > |
| 527 (obj, method, MakeTuple(p1, p2, p3)); | 875 (obj, method, MakeTuple(p1, p2, p3)); |
| 528 return MutantFunctor<R, Tuple2<A1, A2> >(t); | 876 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 529 } | 877 } |
| 878 |
| 879 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 880 // 3 - 2 |
| 881 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 882 typename A1, typename A2, typename X1, typename X2, typename X3> |
| 883 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 884 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, A1, A2), const P1& p1, |
| 885 const P2& p2, const P3& p3) { |
| 886 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 887 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, A1, A2), |
| 888 Tuple3<P1, P2, P3>, Tuple2<A1, A2> > |
| 889 (obj, method, MakeTuple(p1, p2, p3)); |
| 890 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 891 } |
| 892 #endif |
| 530 | 893 |
| 531 // 3 - 3 | 894 // 3 - 3 |
| 532 template <typename R, typename T, typename P1, typename P2, typename P3, | 895 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 533 typename A1, typename A2, typename A3, typename X1, typename X2, | 896 typename A1, typename A2, typename A3, typename X1, typename X2, |
| 534 typename X3> | 897 typename X3> |
| 535 inline MutantFunctor<R, Tuple3<A1, A2, A3> > | 898 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 536 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1, A2, A3), const P1& p1, | 899 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1, A2, A3), const P1& p1, |
| 537 const P2& p2, const P3& p3) { | 900 const P2& p2, const P3& p3) { |
| 538 MutantRunner<R, Tuple3<A1, A2, A3> > *t = new MutantImpl<R, T, | 901 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 539 R (T::*)(X1, X2, X3, A1, A2, A3), | 902 new Mutant<R, T, R (T::*)(X1, X2, X3, A1, A2, A3), |
| 540 Tuple3<P1, P2, P3>, Tuple3<A1, A2, A3> > | 903 Tuple3<P1, P2, P3>, Tuple3<A1, A2, A3> > |
| 541 (obj, method, MakeTuple(p1, p2, p3)); | 904 (obj, method, MakeTuple(p1, p2, p3)); |
| 542 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); | 905 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 543 } | 906 } |
| 544 | 907 |
| 908 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 909 // 3 - 3 |
| 910 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 911 typename A1, typename A2, typename A3, typename X1, typename X2, |
| 912 typename X3> |
| 913 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 914 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, A1, A2, A3), const P1& p1, |
| 915 const P2& p2, const P3& p3) { |
| 916 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 917 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, A1, A2, A3), |
| 918 Tuple3<P1, P2, P3>, Tuple3<A1, A2, A3> > |
| 919 (obj, method, MakeTuple(p1, p2, p3)); |
| 920 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 921 } |
| 922 #endif |
| 923 |
| 545 // 3 - 4 | 924 // 3 - 4 |
| 546 template <typename R, typename T, typename P1, typename P2, typename P3, | 925 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 547 typename A1, typename A2, typename A3, typename A4, typename X1, | 926 typename A1, typename A2, typename A3, typename A4, typename X1, |
| 548 typename X2, typename X3> | 927 typename X2, typename X3> |
| 549 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > | 928 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 550 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, | 929 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, |
| 551 const P2& p2, const P3& p3) { | 930 const P2& p2, const P3& p3) { |
| 552 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = new MutantImpl<R, T, | 931 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 553 R (T::*)(X1, X2, X3, A1, A2, A3, A4), | 932 new Mutant<R, T, R (T::*)(X1, X2, X3, A1, A2, A3, A4), |
| 554 Tuple3<P1, P2, P3>, Tuple4<A1, A2, A3, A4> > | 933 Tuple3<P1, P2, P3>, Tuple4<A1, A2, A3, A4> > |
| 555 (obj, method, MakeTuple(p1, p2, p3)); | 934 (obj, method, MakeTuple(p1, p2, p3)); |
| 556 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); | 935 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 557 } | 936 } |
| 558 | 937 |
| 938 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 939 // 3 - 4 |
| 940 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 941 typename A1, typename A2, typename A3, typename A4, typename X1, |
| 942 typename X2, typename X3> |
| 943 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 944 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, |
| 945 const P2& p2, const P3& p3) { |
| 946 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 947 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, A1, A2, A3, A4), |
| 948 Tuple3<P1, P2, P3>, Tuple4<A1, A2, A3, A4> > |
| 949 (obj, method, MakeTuple(p1, p2, p3)); |
| 950 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 951 } |
| 952 #endif |
| 953 |
| 559 // 4 - 0 | 954 // 4 - 0 |
| 560 template <typename R, typename T, typename P1, typename P2, typename P3, | 955 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 561 typename P4, typename X1, typename X2, typename X3, typename X4> | 956 typename P4, typename X1, typename X2, typename X3, typename X4> |
| 562 inline MutantFunctor<R, Tuple0> | 957 inline MutantFunctor<R, Tuple0> |
| 563 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4), const P1& p1, | 958 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4), const P1& p1, |
| 564 const P2& p2, const P3& p3, const P4& p4) { | 959 const P2& p2, const P3& p3, const P4& p4) { |
| 565 MutantRunner<R, Tuple0> *t = new MutantImpl<R, T, | 960 MutantRunner<R, Tuple0> *t = |
| 566 R (T::*)(X1, X2, X3, X4), | 961 new Mutant<R, T, R (T::*)(X1, X2, X3, X4), |
| 567 Tuple4<P1, P2, P3, P4>, Tuple0> | 962 Tuple4<P1, P2, P3, P4>, Tuple0> |
| 568 (obj, method, MakeTuple(p1, p2, p3, p4)); | 963 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 569 return MutantFunctor<R, Tuple0>(t); | 964 return MutantFunctor<R, Tuple0>(t); |
| 570 } | 965 } |
| 571 | 966 |
| 967 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 968 // 4 - 0 |
| 969 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 970 typename P4, typename X1, typename X2, typename X3, typename X4> |
| 971 inline MutantFunctor<R, Tuple0> |
| 972 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, X4), const P1& p1, |
| 973 const P2& p2, const P3& p3, const P4& p4) { |
| 974 MutantRunner<R, Tuple0> *t = |
| 975 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, X4), |
| 976 Tuple4<P1, P2, P3, P4>, Tuple0> |
| 977 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 978 return MutantFunctor<R, Tuple0>(t); |
| 979 } |
| 980 #endif |
| 981 |
| 572 // 4 - 1 | 982 // 4 - 1 |
| 573 template <typename R, typename T, typename P1, typename P2, typename P3, | 983 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 574 typename P4, typename A1, typename X1, typename X2, typename X3, | 984 typename P4, typename A1, typename X1, typename X2, typename X3, |
| 575 typename X4> | 985 typename X4> |
| 576 inline MutantFunctor<R, Tuple1<A1> > | 986 inline MutantFunctor<R, Tuple1<A1> > |
| 577 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1), const P1& p1, | 987 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1), const P1& p1, |
| 578 const P2& p2, const P3& p3, const P4& p4) { | 988 const P2& p2, const P3& p3, const P4& p4) { |
| 579 MutantRunner<R, Tuple1<A1> > *t = new MutantImpl<R, T, | 989 MutantRunner<R, Tuple1<A1> > *t = |
| 580 R (T::*)(X1, X2, X3, X4, A1), | 990 new Mutant<R, T, R (T::*)(X1, X2, X3, X4, A1), |
| 581 Tuple4<P1, P2, P3, P4>, Tuple1<A1> > | 991 Tuple4<P1, P2, P3, P4>, Tuple1<A1> > |
| 582 (obj, method, MakeTuple(p1, p2, p3, p4)); | 992 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 583 return MutantFunctor<R, Tuple1<A1> >(t); | 993 return MutantFunctor<R, Tuple1<A1> >(t); |
| 584 } | 994 } |
| 585 | 995 |
| 996 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 997 // 4 - 1 |
| 998 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 999 typename P4, typename A1, typename X1, typename X2, typename X3, |
| 1000 typename X4> |
| 1001 inline MutantFunctor<R, Tuple1<A1> > |
| 1002 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, X4, A1), const P1& p1, |
| 1003 const P2& p2, const P3& p3, const P4& p4) { |
| 1004 MutantRunner<R, Tuple1<A1> > *t = |
| 1005 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, X4, A1), |
| 1006 Tuple4<P1, P2, P3, P4>, Tuple1<A1> > |
| 1007 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 1008 return MutantFunctor<R, Tuple1<A1> >(t); |
| 1009 } |
| 1010 #endif |
| 1011 |
| 586 // 4 - 2 | 1012 // 4 - 2 |
| 587 template <typename R, typename T, typename P1, typename P2, typename P3, | 1013 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 588 typename P4, typename A1, typename A2, typename X1, typename X2, | 1014 typename P4, typename A1, typename A2, typename X1, typename X2, |
| 589 typename X3, typename X4> | 1015 typename X3, typename X4> |
| 590 inline MutantFunctor<R, Tuple2<A1, A2> > | 1016 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 591 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1, A2), const P1& p1, | 1017 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1, A2), const P1& p1, |
| 592 const P2& p2, const P3& p3, const P4& p4) { | 1018 const P2& p2, const P3& p3, const P4& p4) { |
| 593 MutantRunner<R, Tuple2<A1, A2> > *t = new MutantImpl<R, T, | 1019 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 594 R (T::*)(X1, X2, X3, X4, A1, A2), | 1020 new Mutant<R, T, R (T::*)(X1, X2, X3, X4, A1, A2), |
| 595 Tuple4<P1, P2, P3, P4>, Tuple2<A1, A2> > | 1021 Tuple4<P1, P2, P3, P4>, Tuple2<A1, A2> > |
| 596 (obj, method, MakeTuple(p1, p2, p3, p4)); | 1022 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 597 return MutantFunctor<R, Tuple2<A1, A2> >(t); | 1023 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 598 } | 1024 } |
| 599 | 1025 |
| 1026 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 1027 // 4 - 2 |
| 1028 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 1029 typename P4, typename A1, typename A2, typename X1, typename X2, |
| 1030 typename X3, typename X4> |
| 1031 inline MutantFunctor<R, Tuple2<A1, A2> > |
| 1032 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, X4, A1, A2), const P1& p1, |
| 1033 const P2& p2, const P3& p3, const P4& p4) { |
| 1034 MutantRunner<R, Tuple2<A1, A2> > *t = |
| 1035 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, X4, A1, A2), |
| 1036 Tuple4<P1, P2, P3, P4>, Tuple2<A1, A2> > |
| 1037 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 1038 return MutantFunctor<R, Tuple2<A1, A2> >(t); |
| 1039 } |
| 1040 #endif |
| 1041 |
| 600 // 4 - 3 | 1042 // 4 - 3 |
| 601 template <typename R, typename T, typename P1, typename P2, typename P3, | 1043 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 602 typename P4, typename A1, typename A2, typename A3, typename X1, | 1044 typename P4, typename A1, typename A2, typename A3, typename X1, |
| 603 typename X2, typename X3, typename X4> | 1045 typename X2, typename X3, typename X4> |
| 604 inline MutantFunctor<R, Tuple3<A1, A2, A3> > | 1046 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 605 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, | 1047 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, |
| 606 const P2& p2, const P3& p3, const P4& p4) { | 1048 const P2& p2, const P3& p3, const P4& p4) { |
| 607 MutantRunner<R, Tuple3<A1, A2, A3> > *t = new MutantImpl<R, T, | 1049 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 608 R (T::*)(X1, X2, X3, X4, A1, A2, A3), | 1050 new Mutant<R, T, R (T::*)(X1, X2, X3, X4, A1, A2, A3), |
| 609 Tuple4<P1, P2, P3, P4>, Tuple3<A1, A2, A3> > | 1051 Tuple4<P1, P2, P3, P4>, Tuple3<A1, A2, A3> > |
| 610 (obj, method, MakeTuple(p1, p2, p3, p4)); | 1052 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 611 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); | 1053 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 612 } | 1054 } |
| 613 | 1055 |
| 1056 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 1057 // 4 - 3 |
| 1058 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 1059 typename P4, typename A1, typename A2, typename A3, typename X1, |
| 1060 typename X2, typename X3, typename X4> |
| 1061 inline MutantFunctor<R, Tuple3<A1, A2, A3> > |
| 1062 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, |
| 1063 const P2& p2, const P3& p3, const P4& p4) { |
| 1064 MutantRunner<R, Tuple3<A1, A2, A3> > *t = |
| 1065 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, X4, A1, A2, A3), |
| 1066 Tuple4<P1, P2, P3, P4>, Tuple3<A1, A2, A3> > |
| 1067 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 1068 return MutantFunctor<R, Tuple3<A1, A2, A3> >(t); |
| 1069 } |
| 1070 #endif |
| 1071 |
| 614 // 4 - 4 | 1072 // 4 - 4 |
| 615 template <typename R, typename T, typename P1, typename P2, typename P3, | 1073 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 616 typename P4, typename A1, typename A2, typename A3, typename A4, | 1074 typename P4, typename A1, typename A2, typename A3, typename A4, |
| 617 typename X1, typename X2, typename X3, typename X4> | 1075 typename X1, typename X2, typename X3, typename X4> |
| 618 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > | 1076 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 619 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1, A2, A3, A4), | 1077 CreateFunctor(T* obj, R (T::*method)(X1, X2, X3, X4, A1, A2, A3, A4), |
| 620 const P1& p1, const P2& p2, const P3& p3, const P4& p4) { | 1078 const P1& p1, const P2& p2, const P3& p3, const P4& p4) { |
| 621 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = new MutantImpl<R, T, | 1079 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 622 R (T::*)(X1, X2, X3, X4, A1, A2, A3, A4), | 1080 new Mutant<R, T, R (T::*)(X1, X2, X3, X4, A1, A2, A3, A4), |
| 623 Tuple4<P1, P2, P3, P4>, Tuple4<A1, A2, A3, A4> > | 1081 Tuple4<P1, P2, P3, P4>, Tuple4<A1, A2, A3, A4> > |
| 624 (obj, method, MakeTuple(p1, p2, p3, p4)); | 1082 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 625 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); | 1083 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 626 } | 1084 } |
| 627 #endif // CHROME_FRAME_TEST_HELPER_GMOCK_H_ | 1085 |
| 1086 #ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 1087 // 4 - 4 |
| 1088 template <typename R, typename T, typename P1, typename P2, typename P3, |
| 1089 typename P4, typename A1, typename A2, typename A3, typename A4, |
| 1090 typename X1, typename X2, typename X3, typename X4> |
| 1091 inline MutantFunctor<R, Tuple4<A1, A2, A3, A4> > |
| 1092 CreateFunctor(T** obj, R (T::*method)(X1, X2, X3, X4, A1, A2, A3, A4), |
| 1093 const P1& p1, const P2& p2, const P3& p3, const P4& p4) { |
| 1094 MutantRunner<R, Tuple4<A1, A2, A3, A4> > *t = |
| 1095 new MutantLateObjectBind<R, T, R (T::*)(X1, X2, X3, X4, A1, A2, A3, A4), |
| 1096 Tuple4<P1, P2, P3, P4>, Tuple4<A1, A2, A3, A4> > |
| 1097 (obj, method, MakeTuple(p1, p2, p3, p4)); |
| 1098 return MutantFunctor<R, Tuple4<A1, A2, A3, A4> >(t); |
| 1099 } |
| 1100 #endif |
| 1101 |
| 1102 } // namespace testing |
| 1103 |
| 1104 #endif // TESTING_GMOCK_MUTANT_H_ |
| OLD | NEW |