1 #pragma once 2 /* 3 * FakeIt - A Simplified C++ Mocking Framework 4 * Copyright (c) Eran Pe'er 2013 5 * Generated: 2018-08-17 00:22:40.428924 6 * Distributed under the MIT License. Please refer to the LICENSE file at: 7 * https://github.com/eranpeer/FakeIt 8 */ 9 10 #ifndef fakeit_h__ 11 #define fakeit_h__ 12 13 14 15 #include <functional> 16 #include <memory> 17 #include <set> 18 #include <vector> 19 #include <stdexcept> 20 #if defined (__GNUG__) || _MSC_VER >= 1900 21 #define THROWS noexcept(false) 22 #define NO_THROWS noexcept(true) 23 #elif defined (_MSC_VER) 24 #define THROWS throw(...) 25 #define NO_THROWS 26 #endif 27 #include <typeinfo> 28 #include <unordered_set> 29 #include <tuple> 30 #include <string> 31 #include <iosfwd> 32 #include <atomic> 33 #include <tuple> 34 35 36 namespace fakeit { 37 38 template<class C> 39 struct naked_type { 40 typedef typename std::remove_cv<typename std::remove_reference<C>::type>::type type; 41 }; 42 43 template< class T > struct tuple_arg { typedef T type; }; 44 template< class T > struct tuple_arg < T& > { typedef T& type; }; 45 template< class T > struct tuple_arg < T&& > { typedef T&& type; }; 46 47 48 49 50 template<typename... arglist> 51 using ArgumentsTuple = std::tuple < arglist... > ; 52 53 template< class T > struct test_arg { typedef T& type; }; 54 template< class T > struct test_arg< T& > { typedef T& type; }; 55 template< class T > struct test_arg< T&& > { typedef T& type; }; 56 57 template< class T > struct production_arg { typedef T& type; }; 58 template< class T > struct production_arg< T& > { typedef T& type; }; 59 template< class T > struct production_arg< T&& > { typedef T&& type; }; 60 61 template <typename T> 62 class is_ostreamable { 63 struct no {}; 64 #if defined(_MSC_VER) && _MSC_VER < 1900 65 template <typename T1> 66 static decltype(operator<<(std::declval<std::ostream&>(), std::declval<const T1>())) test(std::ostream &s, const T1 &t); 67 #else 68 template <typename T1> 69 static auto test(std::ostream &s, const T1 &t) -> decltype(s << t); 70 #endif 71 static no test(...); 72 public: 73 74 static const bool value = 75 std::is_arithmetic<T>::value || 76 std::is_pointer<T>::value || 77 std::is_same<decltype(test(*(std::ostream *)nullptr, 78 std::declval<T>())), std::ostream &>::value; 79 }; 80 81 82 template <> 83 class is_ostreamable<std::ios_base& (*)(std::ios_base&)> { 84 public: 85 static const bool value = true; 86 }; 87 88 template <typename CharT, typename Traits> 89 class is_ostreamable<std::basic_ios<CharT,Traits>& (*)(std::basic_ios<CharT,Traits>&)> { 90 public: 91 static const bool value = true; 92 }; 93 94 template <typename CharT, typename Traits> 95 class is_ostreamable<std::basic_ostream<CharT,Traits>& (*)(std::basic_ostream<CharT,Traits>&)> { 96 public: 97 static const bool value = true; 98 }; 99 100 template<typename R, typename... arglist> 101 struct VTableMethodType { 102 #if defined (__GNUG__) 103 typedef R(*type)(void *, arglist...); 104 #elif defined (_MSC_VER) 105 typedef R(__thiscall *type)(void *, arglist...); 106 #endif 107 }; 108 } 109 #include <typeinfo> 110 #include <tuple> 111 #include <string> 112 #include <iosfwd> 113 #include <sstream> 114 #include <string> 115 116 namespace fakeit { 117 118 struct FakeitContext; 119 120 template<typename C> 121 struct MockObject { ~MockObjectfakeit::MockObject122 virtual ~MockObject() THROWS { }; 123 124 virtual C &get() = 0; 125 126 virtual FakeitContext &getFakeIt() = 0; 127 }; 128 129 struct MethodInfo { 130 nextMethodOrdinalfakeit::MethodInfo131 static unsigned int nextMethodOrdinal() { 132 static std::atomic_uint ordinal{0}; 133 return ++ordinal; 134 } 135 MethodInfofakeit::MethodInfo136 MethodInfo(unsigned int anId, std::string aName) : 137 _id(anId), _name(aName) { } 138 idfakeit::MethodInfo139 unsigned int id() const { 140 return _id; 141 } 142 namefakeit::MethodInfo143 std::string name() const { 144 return _name; 145 } 146 setNamefakeit::MethodInfo147 void setName(const std::string &value) { 148 _name = value; 149 } 150 151 private: 152 unsigned int _id; 153 std::string _name; 154 }; 155 156 struct UnknownMethod { 157 instancefakeit::UnknownMethod158 static MethodInfo &instance() { 159 static MethodInfo instance(MethodInfo::nextMethodOrdinal(), "unknown"); 160 return instance; 161 } 162 163 }; 164 165 } 166 namespace fakeit { 167 class Destructible { 168 public: ~Destructible()169 virtual ~Destructible() {} 170 }; 171 } 172 173 namespace fakeit { 174 175 struct Invocation : Destructible { 176 nextInvocationOrdinalfakeit::Invocation177 static unsigned int nextInvocationOrdinal() { 178 static std::atomic_uint invocationOrdinal{0}; 179 return ++invocationOrdinal; 180 } 181 182 struct Matcher { 183 ~Matcherfakeit::Invocation::Matcher184 virtual ~Matcher() THROWS { 185 } 186 187 virtual bool matches(Invocation &invocation) = 0; 188 189 virtual std::string format() const = 0; 190 }; 191 Invocationfakeit::Invocation192 Invocation(unsigned int ordinal, MethodInfo &method) : 193 _ordinal(ordinal), _method(method), _isVerified(false) { 194 } 195 196 virtual ~Invocation() override = default; 197 getOrdinalfakeit::Invocation198 unsigned int getOrdinal() const { 199 return _ordinal; 200 } 201 getMethodfakeit::Invocation202 MethodInfo &getMethod() const { 203 return _method; 204 } 205 markAsVerifiedfakeit::Invocation206 void markAsVerified() { 207 _isVerified = true; 208 } 209 isVerifiedfakeit::Invocation210 bool isVerified() const { 211 return _isVerified; 212 } 213 214 virtual std::string format() const = 0; 215 216 private: 217 const unsigned int _ordinal; 218 MethodInfo &_method; 219 bool _isVerified; 220 }; 221 222 } 223 #include <iosfwd> 224 #include <tuple> 225 #include <string> 226 #include <sstream> 227 #include <ostream> 228 229 namespace fakeit { 230 231 template<typename T, class Enable = void> 232 struct Formatter; 233 234 template <> 235 struct Formatter<bool> 236 { formatfakeit::Formatter237 static std::string format(bool const &val) 238 { 239 return val ? "true" : "false"; 240 } 241 }; 242 243 template <> 244 struct Formatter<char> 245 { formatfakeit::Formatter246 static std::string format(char const &val) 247 { 248 std::string s; 249 s += "'"; 250 s += val; 251 s += "'"; 252 return s; 253 } 254 }; 255 256 template <> 257 struct Formatter<char const*> 258 { formatfakeit::Formatter259 static std::string format(char const* const &val) 260 { 261 std::string s; 262 if(val != nullptr) 263 { 264 s += '"'; 265 s += val; 266 s += '"'; 267 } 268 else 269 { 270 s = "[nullptr]"; 271 } 272 return s; 273 } 274 }; 275 276 template <> 277 struct Formatter<char*> 278 { formatfakeit::Formatter279 static std::string format(char* const &val) 280 { 281 return Formatter<char const*>::format( val ); 282 } 283 }; 284 285 template<class C> 286 struct Formatter<C, typename std::enable_if<!is_ostreamable<C>::value>::type> { formatfakeit::Formatter287 static std::string format(C const &) 288 { 289 return "?"; 290 } 291 }; 292 293 template<class C> 294 struct Formatter<C, typename std::enable_if<is_ostreamable<C>::value>::type> { formatfakeit::Formatter295 static std::string format(C const &val) 296 { 297 std::ostringstream os; 298 os << val; 299 return os.str(); 300 } 301 }; 302 303 304 template <typename T> 305 using TypeFormatter = Formatter<typename fakeit::naked_type<T>::type>; 306 } 307 308 namespace fakeit { 309 310 311 template<class Tuple, std::size_t N> 312 struct TuplePrinter { printfakeit::TuplePrinter313 static void print(std::ostream &strm, const Tuple &t) { 314 TuplePrinter<Tuple, N - 1>::print(strm, t); 315 strm << ", " << fakeit::TypeFormatter<decltype(std::get<N - 1>(t))>::format(std::get<N - 1>(t)); 316 } 317 }; 318 319 template<class Tuple> 320 struct TuplePrinter<Tuple, 1> { printfakeit::TuplePrinter321 static void print(std::ostream &strm, const Tuple &t) { 322 strm << fakeit::TypeFormatter<decltype(std::get<0>(t))>::format(std::get<0>(t)); 323 } 324 }; 325 326 template<class Tuple> 327 struct TuplePrinter<Tuple, 0> { printfakeit::TuplePrinter328 static void print(std::ostream &, const Tuple &) { 329 } 330 }; 331 332 template<class ... Args> print(std::ostream & strm,const std::tuple<Args...> & t)333 void print(std::ostream &strm, const std::tuple<Args...> &t) { 334 strm << "("; 335 TuplePrinter<decltype(t), sizeof...(Args)>::print(strm, t); 336 strm << ")"; 337 } 338 339 template<class ... Args> operator <<(std::ostream & strm,const std::tuple<Args...> & t)340 std::ostream &operator<<(std::ostream &strm, const std::tuple<Args...> &t) { 341 print(strm, t); 342 return strm; 343 } 344 345 } 346 347 348 namespace fakeit { 349 350 template<typename ... arglist> 351 struct ActualInvocation : public Invocation { 352 353 struct Matcher : public virtual Destructible { 354 virtual bool matches(ActualInvocation<arglist...> &actualInvocation) = 0; 355 356 virtual std::string format() const = 0; 357 }; 358 ActualInvocationfakeit::ActualInvocation359 ActualInvocation(unsigned int ordinal, MethodInfo &method, const typename fakeit::production_arg<arglist>::type... args) : 360 Invocation(ordinal, method), _matcher{ nullptr } 361 , actualArguments{ std::forward<arglist>(args)... } 362 { 363 } 364 getActualArgumentsfakeit::ActualInvocation365 ArgumentsTuple<arglist...> & getActualArguments() { 366 return actualArguments; 367 } 368 369 setActualMatcherfakeit::ActualInvocation370 void setActualMatcher(Matcher *matcher) { 371 this->_matcher = matcher; 372 } 373 getActualMatcherfakeit::ActualInvocation374 Matcher *getActualMatcher() { 375 return _matcher; 376 } 377 formatfakeit::ActualInvocation378 virtual std::string format() const override { 379 std::ostringstream out; 380 out << getMethod().name(); 381 print(out, actualArguments); 382 return out.str(); 383 } 384 385 private: 386 387 Matcher *_matcher; 388 ArgumentsTuple<arglist...> actualArguments; 389 }; 390 391 template<typename ... arglist> operator <<(std::ostream & strm,const ActualInvocation<arglist...> & ai)392 std::ostream &operator<<(std::ostream &strm, const ActualInvocation<arglist...> &ai) { 393 strm << ai.format(); 394 return strm; 395 } 396 397 } 398 399 400 401 402 403 #include <unordered_set> 404 405 namespace fakeit { 406 407 struct ActualInvocationsContainer { 408 virtual void clear() = 0; 409 ~ActualInvocationsContainerfakeit::ActualInvocationsContainer410 virtual ~ActualInvocationsContainer() NO_THROWS { } 411 }; 412 413 struct ActualInvocationsSource { 414 virtual void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const = 0; 415 ~ActualInvocationsSourcefakeit::ActualInvocationsSource416 virtual ~ActualInvocationsSource() NO_THROWS { } 417 }; 418 419 struct InvocationsSourceProxy : public ActualInvocationsSource { 420 InvocationsSourceProxyfakeit::InvocationsSourceProxy421 InvocationsSourceProxy(ActualInvocationsSource *inner) : 422 _inner(inner) { 423 } 424 getActualInvocationsfakeit::InvocationsSourceProxy425 void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const override { 426 _inner->getActualInvocations(into); 427 } 428 429 private: 430 std::shared_ptr<ActualInvocationsSource> _inner; 431 }; 432 433 struct UnverifiedInvocationsSource : public ActualInvocationsSource { 434 UnverifiedInvocationsSourcefakeit::UnverifiedInvocationsSource435 UnverifiedInvocationsSource(InvocationsSourceProxy decorated) : _decorated(decorated) { 436 } 437 getActualInvocationsfakeit::UnverifiedInvocationsSource438 void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const override { 439 std::unordered_set<fakeit::Invocation *> all; 440 _decorated.getActualInvocations(all); 441 for (fakeit::Invocation *i : all) { 442 if (!i->isVerified()) { 443 into.insert(i); 444 } 445 } 446 } 447 448 private: 449 InvocationsSourceProxy _decorated; 450 }; 451 452 struct AggregateInvocationsSource : public ActualInvocationsSource { 453 AggregateInvocationsSourcefakeit::AggregateInvocationsSource454 AggregateInvocationsSource(std::vector<ActualInvocationsSource *> &sources) : _sources(sources) { 455 } 456 getActualInvocationsfakeit::AggregateInvocationsSource457 void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const override { 458 std::unordered_set<fakeit::Invocation *> tmp; 459 for (ActualInvocationsSource *source : _sources) { 460 source->getActualInvocations(tmp); 461 } 462 filter(tmp, into); 463 } 464 465 protected: shouldIncludefakeit::AggregateInvocationsSource466 bool shouldInclude(fakeit::Invocation *) const { 467 return true; 468 } 469 470 private: 471 std::vector<ActualInvocationsSource *> _sources; 472 filterfakeit::AggregateInvocationsSource473 void filter(std::unordered_set<Invocation *> &source, std::unordered_set<Invocation *> &target) const { 474 for (Invocation *i:source) { 475 if (shouldInclude(i)) { 476 target.insert(i); 477 } 478 } 479 } 480 }; 481 } 482 483 namespace fakeit { 484 485 class Sequence { 486 private: 487 488 protected: 489 Sequence()490 Sequence() { 491 } 492 ~Sequence()493 virtual ~Sequence() THROWS { 494 } 495 496 public: 497 498 499 virtual void getExpectedSequence(std::vector<Invocation::Matcher *> &into) const = 0; 500 501 502 virtual void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const = 0; 503 504 virtual unsigned int size() const = 0; 505 506 friend class VerifyFunctor; 507 }; 508 509 class ConcatenatedSequence : public virtual Sequence { 510 private: 511 const Sequence &s1; 512 const Sequence &s2; 513 514 protected: ConcatenatedSequence(const Sequence & seq1,const Sequence & seq2)515 ConcatenatedSequence(const Sequence &seq1, const Sequence &seq2) : 516 s1(seq1), s2(seq2) { 517 } 518 519 public: 520 ~ConcatenatedSequence()521 virtual ~ConcatenatedSequence() { 522 } 523 size() const524 unsigned int size() const override { 525 return s1.size() + s2.size(); 526 } 527 getLeft() const528 const Sequence &getLeft() const { 529 return s1; 530 } 531 getRight() const532 const Sequence &getRight() const { 533 return s2; 534 } 535 getExpectedSequence(std::vector<Invocation::Matcher * > & into) const536 void getExpectedSequence(std::vector<Invocation::Matcher *> &into) const override { 537 s1.getExpectedSequence(into); 538 s2.getExpectedSequence(into); 539 } 540 getInvolvedMocks(std::vector<ActualInvocationsSource * > & into) const541 virtual void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const override { 542 s1.getInvolvedMocks(into); 543 s2.getInvolvedMocks(into); 544 } 545 546 friend inline ConcatenatedSequence operator+(const Sequence &s1, const Sequence &s2); 547 }; 548 549 class RepeatedSequence : public virtual Sequence { 550 private: 551 const Sequence &_s; 552 const int times; 553 554 protected: RepeatedSequence(const Sequence & s,const int t)555 RepeatedSequence(const Sequence &s, const int t) : 556 _s(s), times(t) { 557 } 558 559 public: 560 ~RepeatedSequence()561 ~RepeatedSequence() { 562 } 563 size() const564 unsigned int size() const override { 565 return _s.size() * times; 566 } 567 568 friend inline RepeatedSequence operator*(const Sequence &s, int times); 569 570 friend inline RepeatedSequence operator*(int times, const Sequence &s); 571 getInvolvedMocks(std::vector<ActualInvocationsSource * > & into) const572 void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const override { 573 _s.getInvolvedMocks(into); 574 } 575 getExpectedSequence(std::vector<Invocation::Matcher * > & into) const576 void getExpectedSequence(std::vector<Invocation::Matcher *> &into) const override { 577 for (int i = 0; i < times; i++) 578 _s.getExpectedSequence(into); 579 } 580 getTimes() const581 int getTimes() const { 582 return times; 583 } 584 getSequence() const585 const Sequence &getSequence() const { 586 return _s; 587 } 588 }; 589 operator +(const Sequence & s1,const Sequence & s2)590 inline ConcatenatedSequence operator+(const Sequence &s1, const Sequence &s2) { 591 return ConcatenatedSequence(s1, s2); 592 } 593 operator *(const Sequence & s,int times)594 inline RepeatedSequence operator*(const Sequence &s, int times) { 595 if (times <= 0) 596 throw std::invalid_argument("times"); 597 return RepeatedSequence(s, times); 598 } 599 operator *(int times,const Sequence & s)600 inline RepeatedSequence operator*(int times, const Sequence &s) { 601 if (times <= 0) 602 throw std::invalid_argument("times"); 603 return RepeatedSequence(s, times); 604 } 605 606 } 607 608 namespace fakeit { 609 610 enum class VerificationType { 611 Exact, AtLeast, NoMoreInvocations 612 }; 613 614 enum class UnexpectedType { 615 Unmocked, Unmatched 616 }; 617 618 struct VerificationEvent { 619 VerificationEventfakeit::VerificationEvent620 VerificationEvent(VerificationType aVerificationType) : 621 _verificationType(aVerificationType), _line(0) { 622 } 623 624 virtual ~VerificationEvent() = default; 625 verificationTypefakeit::VerificationEvent626 VerificationType verificationType() const { 627 return _verificationType; 628 } 629 setFileInfofakeit::VerificationEvent630 void setFileInfo(const char * aFile, int aLine, const char * aCallingMethod) { 631 _file = aFile; 632 _callingMethod = aCallingMethod; 633 _line = aLine; 634 } 635 filefakeit::VerificationEvent636 const char * file() const { 637 return _file; 638 } 639 linefakeit::VerificationEvent640 int line() const { 641 return _line; 642 } 643 callingMethodfakeit::VerificationEvent644 const char * callingMethod() const { 645 return _callingMethod; 646 } 647 648 private: 649 VerificationType _verificationType; 650 const char * _file; 651 int _line; 652 const char * _callingMethod; 653 }; 654 655 struct NoMoreInvocationsVerificationEvent : public VerificationEvent { 656 657 ~NoMoreInvocationsVerificationEvent() = default; 658 NoMoreInvocationsVerificationEventfakeit::NoMoreInvocationsVerificationEvent659 NoMoreInvocationsVerificationEvent( 660 std::vector<Invocation *> &allTheIvocations, 661 std::vector<Invocation *> &anUnverifedIvocations) : 662 VerificationEvent(VerificationType::NoMoreInvocations), 663 _allIvocations(allTheIvocations), 664 _unverifedIvocations(anUnverifedIvocations) { 665 } 666 allIvocationsfakeit::NoMoreInvocationsVerificationEvent667 const std::vector<Invocation *> &allIvocations() const { 668 return _allIvocations; 669 } 670 unverifedIvocationsfakeit::NoMoreInvocationsVerificationEvent671 const std::vector<Invocation *> &unverifedIvocations() const { 672 return _unverifedIvocations; 673 } 674 675 private: 676 const std::vector<Invocation *> _allIvocations; 677 const std::vector<Invocation *> _unverifedIvocations; 678 }; 679 680 struct SequenceVerificationEvent : public VerificationEvent { 681 682 ~SequenceVerificationEvent() = default; 683 SequenceVerificationEventfakeit::SequenceVerificationEvent684 SequenceVerificationEvent(VerificationType aVerificationType, 685 std::vector<Sequence *> &anExpectedPattern, 686 std::vector<Invocation *> &anActualSequence, 687 int anExpectedCount, 688 int anActualCount) : 689 VerificationEvent(aVerificationType), 690 _expectedPattern(anExpectedPattern), 691 _actualSequence(anActualSequence), 692 _expectedCount(anExpectedCount), 693 _actualCount(anActualCount) 694 { 695 } 696 expectedPatternfakeit::SequenceVerificationEvent697 const std::vector<Sequence *> &expectedPattern() const { 698 return _expectedPattern; 699 } 700 actualSequencefakeit::SequenceVerificationEvent701 const std::vector<Invocation *> &actualSequence() const { 702 return _actualSequence; 703 } 704 expectedCountfakeit::SequenceVerificationEvent705 int expectedCount() const { 706 return _expectedCount; 707 } 708 actualCountfakeit::SequenceVerificationEvent709 int actualCount() const { 710 return _actualCount; 711 } 712 713 private: 714 const std::vector<Sequence *> _expectedPattern; 715 const std::vector<Invocation *> _actualSequence; 716 const int _expectedCount; 717 const int _actualCount; 718 }; 719 720 struct UnexpectedMethodCallEvent { UnexpectedMethodCallEventfakeit::UnexpectedMethodCallEvent721 UnexpectedMethodCallEvent(UnexpectedType unexpectedType, const Invocation &invocation) : 722 _unexpectedType(unexpectedType), _invocation(invocation) { 723 } 724 getInvocationfakeit::UnexpectedMethodCallEvent725 const Invocation &getInvocation() const { 726 return _invocation; 727 } 728 getUnexpectedTypefakeit::UnexpectedMethodCallEvent729 UnexpectedType getUnexpectedType() const { 730 return _unexpectedType; 731 } 732 733 const UnexpectedType _unexpectedType; 734 const Invocation &_invocation; 735 }; 736 737 } 738 739 namespace fakeit { 740 741 struct VerificationEventHandler { 742 virtual void handle(const SequenceVerificationEvent &e) = 0; 743 744 virtual void handle(const NoMoreInvocationsVerificationEvent &e) = 0; 745 }; 746 747 struct EventHandler : public VerificationEventHandler { 748 using VerificationEventHandler::handle; 749 750 virtual void handle(const UnexpectedMethodCallEvent &e) = 0; 751 }; 752 753 } 754 #include <vector> 755 #include <string> 756 757 namespace fakeit { 758 759 struct UnexpectedMethodCallEvent; 760 struct SequenceVerificationEvent; 761 struct NoMoreInvocationsVerificationEvent; 762 763 struct EventFormatter { 764 765 virtual std::string format(const fakeit::UnexpectedMethodCallEvent &e) = 0; 766 767 virtual std::string format(const fakeit::SequenceVerificationEvent &e) = 0; 768 769 virtual std::string format(const fakeit::NoMoreInvocationsVerificationEvent &e) = 0; 770 771 }; 772 773 } 774 #ifdef FAKEIT_ASSERT_ON_UNEXPECTED_METHOD_INVOCATION 775 #include <cassert> 776 #endif 777 778 namespace fakeit { 779 780 struct FakeitContext : public EventHandler, protected EventFormatter { 781 782 virtual ~FakeitContext() = default; 783 handlefakeit::FakeitContext784 void handle(const UnexpectedMethodCallEvent &e) override { 785 fireEvent(e); 786 auto &eh = getTestingFrameworkAdapter(); 787 #ifdef FAKEIT_ASSERT_ON_UNEXPECTED_METHOD_INVOCATION 788 assert(!"Unexpected method invocation"); 789 #endif 790 eh.handle(e); 791 } 792 handlefakeit::FakeitContext793 void handle(const SequenceVerificationEvent &e) override { 794 fireEvent(e); 795 auto &eh = getTestingFrameworkAdapter(); 796 return eh.handle(e); 797 } 798 handlefakeit::FakeitContext799 void handle(const NoMoreInvocationsVerificationEvent &e) override { 800 fireEvent(e); 801 auto &eh = getTestingFrameworkAdapter(); 802 return eh.handle(e); 803 } 804 formatfakeit::FakeitContext805 std::string format(const UnexpectedMethodCallEvent &e) override { 806 auto &eventFormatter = getEventFormatter(); 807 return eventFormatter.format(e); 808 } 809 formatfakeit::FakeitContext810 std::string format(const SequenceVerificationEvent &e) override { 811 auto &eventFormatter = getEventFormatter(); 812 return eventFormatter.format(e); 813 } 814 formatfakeit::FakeitContext815 std::string format(const NoMoreInvocationsVerificationEvent &e) override { 816 auto &eventFormatter = getEventFormatter(); 817 return eventFormatter.format(e); 818 } 819 addEventHandlerfakeit::FakeitContext820 void addEventHandler(EventHandler &eventListener) { 821 _eventListeners.push_back(&eventListener); 822 } 823 clearEventHandlersfakeit::FakeitContext824 void clearEventHandlers() { 825 _eventListeners.clear(); 826 } 827 828 protected: 829 virtual EventHandler &getTestingFrameworkAdapter() = 0; 830 831 virtual EventFormatter &getEventFormatter() = 0; 832 833 private: 834 std::vector<EventHandler *> _eventListeners; 835 fireEventfakeit::FakeitContext836 void fireEvent(const NoMoreInvocationsVerificationEvent &evt) { 837 for (auto listener : _eventListeners) 838 listener->handle(evt); 839 } 840 fireEventfakeit::FakeitContext841 void fireEvent(const UnexpectedMethodCallEvent &evt) { 842 for (auto listener : _eventListeners) 843 listener->handle(evt); 844 } 845 fireEventfakeit::FakeitContext846 void fireEvent(const SequenceVerificationEvent &evt) { 847 for (auto listener : _eventListeners) 848 listener->handle(evt); 849 } 850 851 }; 852 853 } 854 #include <iostream> 855 #include <iosfwd> 856 857 namespace fakeit { 858 859 struct DefaultEventFormatter : public EventFormatter { 860 formatfakeit::DefaultEventFormatter861 virtual std::string format(const UnexpectedMethodCallEvent &e) override { 862 std::ostringstream out; 863 out << "Unexpected method invocation: "; 864 out << e.getInvocation().format() << std::endl; 865 if (UnexpectedType::Unmatched == e.getUnexpectedType()) { 866 out << " Could not find any recorded behavior to support this method call."; 867 } else { 868 out << " An unmocked method was invoked. All used virtual methods must be stubbed!"; 869 } 870 return out.str(); 871 } 872 873 formatfakeit::DefaultEventFormatter874 virtual std::string format(const SequenceVerificationEvent &e) override { 875 std::ostringstream out; 876 out << "Verification error" << std::endl; 877 878 out << "Expected pattern: "; 879 const std::vector<fakeit::Sequence *> expectedPattern = e.expectedPattern(); 880 out << formatExpectedPattern(expectedPattern) << std::endl; 881 882 out << "Expected matches: "; 883 formatExpectedCount(out, e.verificationType(), e.expectedCount()); 884 out << std::endl; 885 886 out << "Actual matches : " << e.actualCount() << std::endl; 887 888 auto actualSequence = e.actualSequence(); 889 out << "Actual sequence : total of " << actualSequence.size() << " actual invocations"; 890 if (actualSequence.size() == 0) { 891 out << "."; 892 } else { 893 out << ":" << std::endl; 894 } 895 formatInvocationList(out, actualSequence); 896 897 return out.str(); 898 } 899 formatfakeit::DefaultEventFormatter900 virtual std::string format(const NoMoreInvocationsVerificationEvent &e) override { 901 std::ostringstream out; 902 out << "Verification error" << std::endl; 903 out << "Expected no more invocations!! but the following unverified invocations were found:" << std::endl; 904 formatInvocationList(out, e.unverifedIvocations()); 905 return out.str(); 906 } 907 formatExpectedPatternfakeit::DefaultEventFormatter908 static std::string formatExpectedPattern(const std::vector<fakeit::Sequence *> &expectedPattern) { 909 std::string expectedPatternStr; 910 for (unsigned int i = 0; i < expectedPattern.size(); i++) { 911 Sequence *s = expectedPattern[i]; 912 expectedPatternStr += formatSequence(*s); 913 if (i < expectedPattern.size() - 1) 914 expectedPatternStr += " ... "; 915 } 916 return expectedPatternStr; 917 } 918 919 private: 920 formatSequencefakeit::DefaultEventFormatter921 static std::string formatSequence(const Sequence &val) { 922 const ConcatenatedSequence *cs = dynamic_cast<const ConcatenatedSequence *>(&val); 923 if (cs) { 924 return format(*cs); 925 } 926 const RepeatedSequence *rs = dynamic_cast<const RepeatedSequence *>(&val); 927 if (rs) { 928 return format(*rs); 929 } 930 931 932 std::vector<Invocation::Matcher *> vec; 933 val.getExpectedSequence(vec); 934 return vec[0]->format(); 935 } 936 formatExpectedCountfakeit::DefaultEventFormatter937 static void formatExpectedCount(std::ostream &out, fakeit::VerificationType verificationType, 938 int expectedCount) { 939 if (verificationType == fakeit::VerificationType::Exact) 940 out << "exactly "; 941 942 if (verificationType == fakeit::VerificationType::AtLeast) 943 out << "at least "; 944 945 out << expectedCount; 946 } 947 formatInvocationListfakeit::DefaultEventFormatter948 static void formatInvocationList(std::ostream &out, const std::vector<fakeit::Invocation *> &actualSequence) { 949 size_t max_size = actualSequence.size(); 950 if (max_size > 50) 951 max_size = 50; 952 953 for (unsigned int i = 0; i < max_size; i++) { 954 out << " "; 955 auto invocation = actualSequence[i]; 956 out << invocation->format(); 957 if (i < max_size - 1) 958 out << std::endl; 959 } 960 961 if (actualSequence.size() > max_size) 962 out << std::endl << " ..."; 963 } 964 formatfakeit::DefaultEventFormatter965 static std::string format(const ConcatenatedSequence &val) { 966 std::ostringstream out; 967 out << formatSequence(val.getLeft()) << " + " << formatSequence(val.getRight()); 968 return out.str(); 969 } 970 formatfakeit::DefaultEventFormatter971 static std::string format(const RepeatedSequence &val) { 972 std::ostringstream out; 973 const ConcatenatedSequence *cs = dynamic_cast<const ConcatenatedSequence *>(&val.getSequence()); 974 const RepeatedSequence *rs = dynamic_cast<const RepeatedSequence *>(&val.getSequence()); 975 if (rs || cs) 976 out << '('; 977 out << formatSequence(val.getSequence()); 978 if (rs || cs) 979 out << ')'; 980 981 out << " * " << val.getTimes(); 982 return out.str(); 983 } 984 }; 985 } 986 namespace fakeit { 987 988 struct FakeitException { 989 std::exception err; 990 991 virtual ~FakeitException() = default; 992 993 virtual std::string what() const = 0; 994 operator <<(std::ostream & os,const FakeitException & val)995 friend std::ostream &operator<<(std::ostream &os, const FakeitException &val) { 996 os << val.what(); 997 return os; 998 } 999 }; 1000 1001 1002 1003 1004 struct UnexpectedMethodCallException : public FakeitException { 1005 UnexpectedMethodCallExceptionfakeit::UnexpectedMethodCallException1006 UnexpectedMethodCallException(std::string format) : 1007 _format(format) { 1008 } 1009 whatfakeit::UnexpectedMethodCallException1010 virtual std::string what() const override { 1011 return _format; 1012 } 1013 1014 private: 1015 std::string _format; 1016 }; 1017 1018 } 1019 1020 namespace fakeit { 1021 1022 struct DefaultEventLogger : public fakeit::EventHandler { 1023 DefaultEventLoggerfakeit::DefaultEventLogger1024 DefaultEventLogger(EventFormatter &formatter) : _formatter(formatter), _out(std::cout) { } 1025 handlefakeit::DefaultEventLogger1026 virtual void handle(const UnexpectedMethodCallEvent &e) override { 1027 _out << _formatter.format(e) << std::endl; 1028 } 1029 handlefakeit::DefaultEventLogger1030 virtual void handle(const SequenceVerificationEvent &e) override { 1031 _out << _formatter.format(e) << std::endl; 1032 } 1033 handlefakeit::DefaultEventLogger1034 virtual void handle(const NoMoreInvocationsVerificationEvent &e) override { 1035 _out << _formatter.format(e) << std::endl; 1036 } 1037 1038 private: 1039 EventFormatter &_formatter; 1040 std::ostream &_out; 1041 }; 1042 1043 } 1044 1045 namespace fakeit { 1046 1047 class AbstractFakeit : public FakeitContext { 1048 public: 1049 virtual ~AbstractFakeit() = default; 1050 1051 protected: 1052 1053 virtual fakeit::EventHandler &accessTestingFrameworkAdapter() = 0; 1054 1055 virtual EventFormatter &accessEventFormatter() = 0; 1056 }; 1057 1058 class DefaultFakeit : public AbstractFakeit { 1059 DefaultEventFormatter _formatter; 1060 fakeit::EventFormatter *_customFormatter; 1061 fakeit::EventHandler *_testingFrameworkAdapter; 1062 1063 public: 1064 DefaultFakeit()1065 DefaultFakeit() : _formatter(), 1066 _customFormatter(nullptr), 1067 _testingFrameworkAdapter(nullptr) { 1068 } 1069 1070 virtual ~DefaultFakeit() = default; 1071 setCustomEventFormatter(fakeit::EventFormatter & customEventFormatter)1072 void setCustomEventFormatter(fakeit::EventFormatter &customEventFormatter) { 1073 _customFormatter = &customEventFormatter; 1074 } 1075 resetCustomEventFormatter()1076 void resetCustomEventFormatter() { 1077 _customFormatter = nullptr; 1078 } 1079 setTestingFrameworkAdapter(fakeit::EventHandler & testingFrameforkAdapter)1080 void setTestingFrameworkAdapter(fakeit::EventHandler &testingFrameforkAdapter) { 1081 _testingFrameworkAdapter = &testingFrameforkAdapter; 1082 } 1083 resetTestingFrameworkAdapter()1084 void resetTestingFrameworkAdapter() { 1085 _testingFrameworkAdapter = nullptr; 1086 } 1087 1088 protected: 1089 getTestingFrameworkAdapter()1090 fakeit::EventHandler &getTestingFrameworkAdapter() override { 1091 if (_testingFrameworkAdapter) 1092 return *_testingFrameworkAdapter; 1093 return accessTestingFrameworkAdapter(); 1094 } 1095 getEventFormatter()1096 EventFormatter &getEventFormatter() override { 1097 if (_customFormatter) 1098 return *_customFormatter; 1099 return accessEventFormatter(); 1100 } 1101 accessEventFormatter()1102 EventFormatter &accessEventFormatter() override { 1103 return _formatter; 1104 } 1105 1106 }; 1107 } 1108 #include <string> 1109 #include <sstream> 1110 #include <iomanip> 1111 1112 namespace fakeit { 1113 1114 template<typename T> to_string(const T & n)1115 static std::string to_string(const T &n) { 1116 std::ostringstream stm; 1117 stm << n; 1118 return stm.str(); 1119 } 1120 1121 } 1122 1123 namespace fakeit { 1124 1125 struct VerificationException : public FakeitException { 1126 virtual ~VerificationException() = default; 1127 setFileInfofakeit::VerificationException1128 void setFileInfo(const char *file, int line, const char *callingMethod) { 1129 _file = file; 1130 _callingMethod = callingMethod; 1131 _line = line; 1132 } 1133 filefakeit::VerificationException1134 const char *file() const { 1135 return _file; 1136 } 1137 linefakeit::VerificationException1138 int line() const { 1139 return _line; 1140 } 1141 callingMethodfakeit::VerificationException1142 const char *callingMethod() const { 1143 return _callingMethod; 1144 } 1145 1146 private: 1147 const char *_file; 1148 int _line; 1149 const char *_callingMethod; 1150 }; 1151 1152 struct NoMoreInvocationsVerificationException : public VerificationException { 1153 NoMoreInvocationsVerificationExceptionfakeit::NoMoreInvocationsVerificationException1154 NoMoreInvocationsVerificationException(std::string format) : 1155 _format(format) { 1156 } 1157 whatfakeit::NoMoreInvocationsVerificationException1158 virtual std::string what() const override { 1159 return _format; 1160 } 1161 1162 private: 1163 std::string _format; 1164 }; 1165 1166 struct SequenceVerificationException : public VerificationException { SequenceVerificationExceptionfakeit::SequenceVerificationException1167 SequenceVerificationException(const std::string &format) : 1168 _format(format) 1169 { 1170 } 1171 whatfakeit::SequenceVerificationException1172 virtual std::string what() const override { 1173 return _format; 1174 } 1175 1176 private: 1177 std::string _format; 1178 }; 1179 1180 class CatchAdapter : public EventHandler { 1181 EventFormatter &_formatter; 1182 formatLineNumber(std::string file,int num)1183 std::string formatLineNumber(std::string file, int num) { 1184 #ifndef __GNUG__ 1185 return file + std::string("(") + fakeit::to_string(num) + std::string(")"); 1186 #else 1187 return file + std::string(":") + fakeit::to_string(num); 1188 #endif 1189 } 1190 1191 public: 1192 1193 virtual ~CatchAdapter() = default; 1194 CatchAdapter(EventFormatter & formatter)1195 CatchAdapter(EventFormatter &formatter) 1196 : _formatter(formatter) {} 1197 fail(std::string vetificationType,Catch::SourceLineInfo sourceLineInfo,std::string failingExpression,std::string fomattedMessage,Catch::ResultWas::OfType resultWas=Catch::ResultWas::OfType::ExpressionFailed)1198 void fail( 1199 std::string vetificationType, 1200 Catch::SourceLineInfo sourceLineInfo, 1201 std::string failingExpression, 1202 std::string fomattedMessage, 1203 Catch::ResultWas::OfType resultWas = Catch::ResultWas::OfType::ExpressionFailed ){ 1204 Catch::AssertionHandler catchAssertionHandler( vetificationType, sourceLineInfo, failingExpression, Catch::ResultDisposition::Normal ); 1205 INTERNAL_CATCH_TRY { \ 1206 CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ 1207 catchAssertionHandler.handleMessage(resultWas, fomattedMessage); \ 1208 CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ 1209 } INTERNAL_CATCH_CATCH(catchAssertionHandler) { \ 1210 INTERNAL_CATCH_REACT(catchAssertionHandler) \ 1211 } 1212 } 1213 handle(const UnexpectedMethodCallEvent & evt)1214 virtual void handle(const UnexpectedMethodCallEvent &evt) override { 1215 std::string format = _formatter.format(evt); 1216 fail("UnexpectedMethodCall",::Catch::SourceLineInfo("Unknown file",0),"",format, Catch::ResultWas::OfType::ExplicitFailure); 1217 } 1218 handle(const SequenceVerificationEvent & evt)1219 virtual void handle(const SequenceVerificationEvent &evt) override { 1220 std::string format(formatLineNumber(evt.file(), evt.line()) + ": " + _formatter.format(evt)); 1221 std::string expectedPattern {DefaultEventFormatter::formatExpectedPattern(evt.expectedPattern())}; 1222 fail("Verify",::Catch::SourceLineInfo(evt.file(),evt.line()),expectedPattern,format); 1223 } 1224 1225 handle(const NoMoreInvocationsVerificationEvent & evt)1226 virtual void handle(const NoMoreInvocationsVerificationEvent &evt) override { 1227 std::string format(formatLineNumber(evt.file(), evt.line()) + ": " + _formatter.format(evt)); 1228 fail("VerifyNoMoreInvocations",::Catch::SourceLineInfo(evt.file(),evt.line()),"",format); 1229 } 1230 1231 }; 1232 1233 1234 class CatchFakeit : public DefaultFakeit { 1235 1236 1237 public: 1238 1239 virtual ~CatchFakeit() = default; 1240 CatchFakeit()1241 CatchFakeit() : _formatter(), _catchAdapter(_formatter) {} 1242 getInstance()1243 static CatchFakeit &getInstance() { 1244 static CatchFakeit instance; 1245 return instance; 1246 } 1247 1248 protected: 1249 accessTestingFrameworkAdapter()1250 fakeit::EventHandler &accessTestingFrameworkAdapter() override { 1251 return _catchAdapter; 1252 } 1253 accessEventFormatter()1254 EventFormatter &accessEventFormatter() override { 1255 return _formatter; 1256 } 1257 1258 private: 1259 1260 DefaultEventFormatter _formatter; 1261 CatchAdapter _catchAdapter; 1262 }; 1263 1264 } 1265 1266 static fakeit::DefaultFakeit& Fakeit = fakeit::CatchFakeit::getInstance(); 1267 1268 1269 #include <type_traits> 1270 #include <unordered_set> 1271 1272 #include <memory> 1273 #undef max 1274 #include <functional> 1275 #include <type_traits> 1276 #include <vector> 1277 #include <array> 1278 #include <new> 1279 #include <limits> 1280 1281 #include <functional> 1282 #include <type_traits> 1283 namespace fakeit { 1284 1285 struct VirtualOffsetSelector { 1286 1287 unsigned int offset; 1288 offset0fakeit::VirtualOffsetSelector1289 virtual unsigned int offset0(int) { 1290 return offset = 0; 1291 } 1292 offset1fakeit::VirtualOffsetSelector1293 virtual unsigned int offset1(int) { 1294 return offset = 1; 1295 } 1296 offset2fakeit::VirtualOffsetSelector1297 virtual unsigned int offset2(int) { 1298 return offset = 2; 1299 } 1300 offset3fakeit::VirtualOffsetSelector1301 virtual unsigned int offset3(int) { 1302 return offset = 3; 1303 } 1304 offset4fakeit::VirtualOffsetSelector1305 virtual unsigned int offset4(int) { 1306 return offset = 4; 1307 } 1308 offset5fakeit::VirtualOffsetSelector1309 virtual unsigned int offset5(int) { 1310 return offset = 5; 1311 } 1312 offset6fakeit::VirtualOffsetSelector1313 virtual unsigned int offset6(int) { 1314 return offset = 6; 1315 } 1316 offset7fakeit::VirtualOffsetSelector1317 virtual unsigned int offset7(int) { 1318 return offset = 7; 1319 } 1320 offset8fakeit::VirtualOffsetSelector1321 virtual unsigned int offset8(int) { 1322 return offset = 8; 1323 } 1324 offset9fakeit::VirtualOffsetSelector1325 virtual unsigned int offset9(int) { 1326 return offset = 9; 1327 } 1328 offset10fakeit::VirtualOffsetSelector1329 virtual unsigned int offset10(int) { 1330 return offset = 10; 1331 } 1332 offset11fakeit::VirtualOffsetSelector1333 virtual unsigned int offset11(int) { 1334 return offset = 11; 1335 } 1336 offset12fakeit::VirtualOffsetSelector1337 virtual unsigned int offset12(int) { 1338 return offset = 12; 1339 } 1340 offset13fakeit::VirtualOffsetSelector1341 virtual unsigned int offset13(int) { 1342 return offset = 13; 1343 } 1344 offset14fakeit::VirtualOffsetSelector1345 virtual unsigned int offset14(int) { 1346 return offset = 14; 1347 } 1348 offset15fakeit::VirtualOffsetSelector1349 virtual unsigned int offset15(int) { 1350 return offset = 15; 1351 } 1352 offset16fakeit::VirtualOffsetSelector1353 virtual unsigned int offset16(int) { 1354 return offset = 16; 1355 } 1356 offset17fakeit::VirtualOffsetSelector1357 virtual unsigned int offset17(int) { 1358 return offset = 17; 1359 } 1360 offset18fakeit::VirtualOffsetSelector1361 virtual unsigned int offset18(int) { 1362 return offset = 18; 1363 } 1364 offset19fakeit::VirtualOffsetSelector1365 virtual unsigned int offset19(int) { 1366 return offset = 19; 1367 } 1368 offset20fakeit::VirtualOffsetSelector1369 virtual unsigned int offset20(int) { 1370 return offset = 20; 1371 } 1372 offset21fakeit::VirtualOffsetSelector1373 virtual unsigned int offset21(int) { 1374 return offset = 21; 1375 } 1376 offset22fakeit::VirtualOffsetSelector1377 virtual unsigned int offset22(int) { 1378 return offset = 22; 1379 } 1380 offset23fakeit::VirtualOffsetSelector1381 virtual unsigned int offset23(int) { 1382 return offset = 23; 1383 } 1384 offset24fakeit::VirtualOffsetSelector1385 virtual unsigned int offset24(int) { 1386 return offset = 24; 1387 } 1388 offset25fakeit::VirtualOffsetSelector1389 virtual unsigned int offset25(int) { 1390 return offset = 25; 1391 } 1392 offset26fakeit::VirtualOffsetSelector1393 virtual unsigned int offset26(int) { 1394 return offset = 26; 1395 } 1396 offset27fakeit::VirtualOffsetSelector1397 virtual unsigned int offset27(int) { 1398 return offset = 27; 1399 } 1400 offset28fakeit::VirtualOffsetSelector1401 virtual unsigned int offset28(int) { 1402 return offset = 28; 1403 } 1404 offset29fakeit::VirtualOffsetSelector1405 virtual unsigned int offset29(int) { 1406 return offset = 29; 1407 } 1408 offset30fakeit::VirtualOffsetSelector1409 virtual unsigned int offset30(int) { 1410 return offset = 30; 1411 } 1412 offset31fakeit::VirtualOffsetSelector1413 virtual unsigned int offset31(int) { 1414 return offset = 31; 1415 } 1416 offset32fakeit::VirtualOffsetSelector1417 virtual unsigned int offset32(int) { 1418 return offset = 32; 1419 } 1420 offset33fakeit::VirtualOffsetSelector1421 virtual unsigned int offset33(int) { 1422 return offset = 33; 1423 } 1424 offset34fakeit::VirtualOffsetSelector1425 virtual unsigned int offset34(int) { 1426 return offset = 34; 1427 } 1428 offset35fakeit::VirtualOffsetSelector1429 virtual unsigned int offset35(int) { 1430 return offset = 35; 1431 } 1432 offset36fakeit::VirtualOffsetSelector1433 virtual unsigned int offset36(int) { 1434 return offset = 36; 1435 } 1436 offset37fakeit::VirtualOffsetSelector1437 virtual unsigned int offset37(int) { 1438 return offset = 37; 1439 } 1440 offset38fakeit::VirtualOffsetSelector1441 virtual unsigned int offset38(int) { 1442 return offset = 38; 1443 } 1444 offset39fakeit::VirtualOffsetSelector1445 virtual unsigned int offset39(int) { 1446 return offset = 39; 1447 } 1448 offset40fakeit::VirtualOffsetSelector1449 virtual unsigned int offset40(int) { 1450 return offset = 40; 1451 } 1452 offset41fakeit::VirtualOffsetSelector1453 virtual unsigned int offset41(int) { 1454 return offset = 41; 1455 } 1456 offset42fakeit::VirtualOffsetSelector1457 virtual unsigned int offset42(int) { 1458 return offset = 42; 1459 } 1460 offset43fakeit::VirtualOffsetSelector1461 virtual unsigned int offset43(int) { 1462 return offset = 43; 1463 } 1464 offset44fakeit::VirtualOffsetSelector1465 virtual unsigned int offset44(int) { 1466 return offset = 44; 1467 } 1468 offset45fakeit::VirtualOffsetSelector1469 virtual unsigned int offset45(int) { 1470 return offset = 45; 1471 } 1472 offset46fakeit::VirtualOffsetSelector1473 virtual unsigned int offset46(int) { 1474 return offset = 46; 1475 } 1476 offset47fakeit::VirtualOffsetSelector1477 virtual unsigned int offset47(int) { 1478 return offset = 47; 1479 } 1480 offset48fakeit::VirtualOffsetSelector1481 virtual unsigned int offset48(int) { 1482 return offset = 48; 1483 } 1484 offset49fakeit::VirtualOffsetSelector1485 virtual unsigned int offset49(int) { 1486 return offset = 49; 1487 } 1488 offset50fakeit::VirtualOffsetSelector1489 virtual unsigned int offset50(int) { 1490 return offset = 50; 1491 } 1492 offset51fakeit::VirtualOffsetSelector1493 virtual unsigned int offset51(int) { 1494 return offset = 51; 1495 } 1496 offset52fakeit::VirtualOffsetSelector1497 virtual unsigned int offset52(int) { 1498 return offset = 52; 1499 } 1500 offset53fakeit::VirtualOffsetSelector1501 virtual unsigned int offset53(int) { 1502 return offset = 53; 1503 } 1504 offset54fakeit::VirtualOffsetSelector1505 virtual unsigned int offset54(int) { 1506 return offset = 54; 1507 } 1508 offset55fakeit::VirtualOffsetSelector1509 virtual unsigned int offset55(int) { 1510 return offset = 55; 1511 } 1512 offset56fakeit::VirtualOffsetSelector1513 virtual unsigned int offset56(int) { 1514 return offset = 56; 1515 } 1516 offset57fakeit::VirtualOffsetSelector1517 virtual unsigned int offset57(int) { 1518 return offset = 57; 1519 } 1520 offset58fakeit::VirtualOffsetSelector1521 virtual unsigned int offset58(int) { 1522 return offset = 58; 1523 } 1524 offset59fakeit::VirtualOffsetSelector1525 virtual unsigned int offset59(int) { 1526 return offset = 59; 1527 } 1528 offset60fakeit::VirtualOffsetSelector1529 virtual unsigned int offset60(int) { 1530 return offset = 60; 1531 } 1532 offset61fakeit::VirtualOffsetSelector1533 virtual unsigned int offset61(int) { 1534 return offset = 61; 1535 } 1536 offset62fakeit::VirtualOffsetSelector1537 virtual unsigned int offset62(int) { 1538 return offset = 62; 1539 } 1540 offset63fakeit::VirtualOffsetSelector1541 virtual unsigned int offset63(int) { 1542 return offset = 63; 1543 } 1544 offset64fakeit::VirtualOffsetSelector1545 virtual unsigned int offset64(int) { 1546 return offset = 64; 1547 } 1548 offset65fakeit::VirtualOffsetSelector1549 virtual unsigned int offset65(int) { 1550 return offset = 65; 1551 } 1552 offset66fakeit::VirtualOffsetSelector1553 virtual unsigned int offset66(int) { 1554 return offset = 66; 1555 } 1556 offset67fakeit::VirtualOffsetSelector1557 virtual unsigned int offset67(int) { 1558 return offset = 67; 1559 } 1560 offset68fakeit::VirtualOffsetSelector1561 virtual unsigned int offset68(int) { 1562 return offset = 68; 1563 } 1564 offset69fakeit::VirtualOffsetSelector1565 virtual unsigned int offset69(int) { 1566 return offset = 69; 1567 } 1568 offset70fakeit::VirtualOffsetSelector1569 virtual unsigned int offset70(int) { 1570 return offset = 70; 1571 } 1572 offset71fakeit::VirtualOffsetSelector1573 virtual unsigned int offset71(int) { 1574 return offset = 71; 1575 } 1576 offset72fakeit::VirtualOffsetSelector1577 virtual unsigned int offset72(int) { 1578 return offset = 72; 1579 } 1580 offset73fakeit::VirtualOffsetSelector1581 virtual unsigned int offset73(int) { 1582 return offset = 73; 1583 } 1584 offset74fakeit::VirtualOffsetSelector1585 virtual unsigned int offset74(int) { 1586 return offset = 74; 1587 } 1588 offset75fakeit::VirtualOffsetSelector1589 virtual unsigned int offset75(int) { 1590 return offset = 75; 1591 } 1592 offset76fakeit::VirtualOffsetSelector1593 virtual unsigned int offset76(int) { 1594 return offset = 76; 1595 } 1596 offset77fakeit::VirtualOffsetSelector1597 virtual unsigned int offset77(int) { 1598 return offset = 77; 1599 } 1600 offset78fakeit::VirtualOffsetSelector1601 virtual unsigned int offset78(int) { 1602 return offset = 78; 1603 } 1604 offset79fakeit::VirtualOffsetSelector1605 virtual unsigned int offset79(int) { 1606 return offset = 79; 1607 } 1608 offset80fakeit::VirtualOffsetSelector1609 virtual unsigned int offset80(int) { 1610 return offset = 80; 1611 } 1612 offset81fakeit::VirtualOffsetSelector1613 virtual unsigned int offset81(int) { 1614 return offset = 81; 1615 } 1616 offset82fakeit::VirtualOffsetSelector1617 virtual unsigned int offset82(int) { 1618 return offset = 82; 1619 } 1620 offset83fakeit::VirtualOffsetSelector1621 virtual unsigned int offset83(int) { 1622 return offset = 83; 1623 } 1624 offset84fakeit::VirtualOffsetSelector1625 virtual unsigned int offset84(int) { 1626 return offset = 84; 1627 } 1628 offset85fakeit::VirtualOffsetSelector1629 virtual unsigned int offset85(int) { 1630 return offset = 85; 1631 } 1632 offset86fakeit::VirtualOffsetSelector1633 virtual unsigned int offset86(int) { 1634 return offset = 86; 1635 } 1636 offset87fakeit::VirtualOffsetSelector1637 virtual unsigned int offset87(int) { 1638 return offset = 87; 1639 } 1640 offset88fakeit::VirtualOffsetSelector1641 virtual unsigned int offset88(int) { 1642 return offset = 88; 1643 } 1644 offset89fakeit::VirtualOffsetSelector1645 virtual unsigned int offset89(int) { 1646 return offset = 89; 1647 } 1648 offset90fakeit::VirtualOffsetSelector1649 virtual unsigned int offset90(int) { 1650 return offset = 90; 1651 } 1652 offset91fakeit::VirtualOffsetSelector1653 virtual unsigned int offset91(int) { 1654 return offset = 91; 1655 } 1656 offset92fakeit::VirtualOffsetSelector1657 virtual unsigned int offset92(int) { 1658 return offset = 92; 1659 } 1660 offset93fakeit::VirtualOffsetSelector1661 virtual unsigned int offset93(int) { 1662 return offset = 93; 1663 } 1664 offset94fakeit::VirtualOffsetSelector1665 virtual unsigned int offset94(int) { 1666 return offset = 94; 1667 } 1668 offset95fakeit::VirtualOffsetSelector1669 virtual unsigned int offset95(int) { 1670 return offset = 95; 1671 } 1672 offset96fakeit::VirtualOffsetSelector1673 virtual unsigned int offset96(int) { 1674 return offset = 96; 1675 } 1676 offset97fakeit::VirtualOffsetSelector1677 virtual unsigned int offset97(int) { 1678 return offset = 97; 1679 } 1680 offset98fakeit::VirtualOffsetSelector1681 virtual unsigned int offset98(int) { 1682 return offset = 98; 1683 } 1684 offset99fakeit::VirtualOffsetSelector1685 virtual unsigned int offset99(int) { 1686 return offset = 99; 1687 } 1688 offset100fakeit::VirtualOffsetSelector1689 virtual unsigned int offset100(int) { 1690 return offset = 100; 1691 } 1692 offset101fakeit::VirtualOffsetSelector1693 virtual unsigned int offset101(int) { 1694 return offset = 101; 1695 } 1696 offset102fakeit::VirtualOffsetSelector1697 virtual unsigned int offset102(int) { 1698 return offset = 102; 1699 } 1700 offset103fakeit::VirtualOffsetSelector1701 virtual unsigned int offset103(int) { 1702 return offset = 103; 1703 } 1704 offset104fakeit::VirtualOffsetSelector1705 virtual unsigned int offset104(int) { 1706 return offset = 104; 1707 } 1708 offset105fakeit::VirtualOffsetSelector1709 virtual unsigned int offset105(int) { 1710 return offset = 105; 1711 } 1712 offset106fakeit::VirtualOffsetSelector1713 virtual unsigned int offset106(int) { 1714 return offset = 106; 1715 } 1716 offset107fakeit::VirtualOffsetSelector1717 virtual unsigned int offset107(int) { 1718 return offset = 107; 1719 } 1720 offset108fakeit::VirtualOffsetSelector1721 virtual unsigned int offset108(int) { 1722 return offset = 108; 1723 } 1724 offset109fakeit::VirtualOffsetSelector1725 virtual unsigned int offset109(int) { 1726 return offset = 109; 1727 } 1728 offset110fakeit::VirtualOffsetSelector1729 virtual unsigned int offset110(int) { 1730 return offset = 110; 1731 } 1732 offset111fakeit::VirtualOffsetSelector1733 virtual unsigned int offset111(int) { 1734 return offset = 111; 1735 } 1736 offset112fakeit::VirtualOffsetSelector1737 virtual unsigned int offset112(int) { 1738 return offset = 112; 1739 } 1740 offset113fakeit::VirtualOffsetSelector1741 virtual unsigned int offset113(int) { 1742 return offset = 113; 1743 } 1744 offset114fakeit::VirtualOffsetSelector1745 virtual unsigned int offset114(int) { 1746 return offset = 114; 1747 } 1748 offset115fakeit::VirtualOffsetSelector1749 virtual unsigned int offset115(int) { 1750 return offset = 115; 1751 } 1752 offset116fakeit::VirtualOffsetSelector1753 virtual unsigned int offset116(int) { 1754 return offset = 116; 1755 } 1756 offset117fakeit::VirtualOffsetSelector1757 virtual unsigned int offset117(int) { 1758 return offset = 117; 1759 } 1760 offset118fakeit::VirtualOffsetSelector1761 virtual unsigned int offset118(int) { 1762 return offset = 118; 1763 } 1764 offset119fakeit::VirtualOffsetSelector1765 virtual unsigned int offset119(int) { 1766 return offset = 119; 1767 } 1768 offset120fakeit::VirtualOffsetSelector1769 virtual unsigned int offset120(int) { 1770 return offset = 120; 1771 } 1772 offset121fakeit::VirtualOffsetSelector1773 virtual unsigned int offset121(int) { 1774 return offset = 121; 1775 } 1776 offset122fakeit::VirtualOffsetSelector1777 virtual unsigned int offset122(int) { 1778 return offset = 122; 1779 } 1780 offset123fakeit::VirtualOffsetSelector1781 virtual unsigned int offset123(int) { 1782 return offset = 123; 1783 } 1784 offset124fakeit::VirtualOffsetSelector1785 virtual unsigned int offset124(int) { 1786 return offset = 124; 1787 } 1788 offset125fakeit::VirtualOffsetSelector1789 virtual unsigned int offset125(int) { 1790 return offset = 125; 1791 } 1792 offset126fakeit::VirtualOffsetSelector1793 virtual unsigned int offset126(int) { 1794 return offset = 126; 1795 } 1796 offset127fakeit::VirtualOffsetSelector1797 virtual unsigned int offset127(int) { 1798 return offset = 127; 1799 } 1800 offset128fakeit::VirtualOffsetSelector1801 virtual unsigned int offset128(int) { 1802 return offset = 128; 1803 } 1804 offset129fakeit::VirtualOffsetSelector1805 virtual unsigned int offset129(int) { 1806 return offset = 129; 1807 } 1808 offset130fakeit::VirtualOffsetSelector1809 virtual unsigned int offset130(int) { 1810 return offset = 130; 1811 } 1812 offset131fakeit::VirtualOffsetSelector1813 virtual unsigned int offset131(int) { 1814 return offset = 131; 1815 } 1816 offset132fakeit::VirtualOffsetSelector1817 virtual unsigned int offset132(int) { 1818 return offset = 132; 1819 } 1820 offset133fakeit::VirtualOffsetSelector1821 virtual unsigned int offset133(int) { 1822 return offset = 133; 1823 } 1824 offset134fakeit::VirtualOffsetSelector1825 virtual unsigned int offset134(int) { 1826 return offset = 134; 1827 } 1828 offset135fakeit::VirtualOffsetSelector1829 virtual unsigned int offset135(int) { 1830 return offset = 135; 1831 } 1832 offset136fakeit::VirtualOffsetSelector1833 virtual unsigned int offset136(int) { 1834 return offset = 136; 1835 } 1836 offset137fakeit::VirtualOffsetSelector1837 virtual unsigned int offset137(int) { 1838 return offset = 137; 1839 } 1840 offset138fakeit::VirtualOffsetSelector1841 virtual unsigned int offset138(int) { 1842 return offset = 138; 1843 } 1844 offset139fakeit::VirtualOffsetSelector1845 virtual unsigned int offset139(int) { 1846 return offset = 139; 1847 } 1848 offset140fakeit::VirtualOffsetSelector1849 virtual unsigned int offset140(int) { 1850 return offset = 140; 1851 } 1852 offset141fakeit::VirtualOffsetSelector1853 virtual unsigned int offset141(int) { 1854 return offset = 141; 1855 } 1856 offset142fakeit::VirtualOffsetSelector1857 virtual unsigned int offset142(int) { 1858 return offset = 142; 1859 } 1860 offset143fakeit::VirtualOffsetSelector1861 virtual unsigned int offset143(int) { 1862 return offset = 143; 1863 } 1864 offset144fakeit::VirtualOffsetSelector1865 virtual unsigned int offset144(int) { 1866 return offset = 144; 1867 } 1868 offset145fakeit::VirtualOffsetSelector1869 virtual unsigned int offset145(int) { 1870 return offset = 145; 1871 } 1872 offset146fakeit::VirtualOffsetSelector1873 virtual unsigned int offset146(int) { 1874 return offset = 146; 1875 } 1876 offset147fakeit::VirtualOffsetSelector1877 virtual unsigned int offset147(int) { 1878 return offset = 147; 1879 } 1880 offset148fakeit::VirtualOffsetSelector1881 virtual unsigned int offset148(int) { 1882 return offset = 148; 1883 } 1884 offset149fakeit::VirtualOffsetSelector1885 virtual unsigned int offset149(int) { 1886 return offset = 149; 1887 } 1888 offset150fakeit::VirtualOffsetSelector1889 virtual unsigned int offset150(int) { 1890 return offset = 150; 1891 } 1892 offset151fakeit::VirtualOffsetSelector1893 virtual unsigned int offset151(int) { 1894 return offset = 151; 1895 } 1896 offset152fakeit::VirtualOffsetSelector1897 virtual unsigned int offset152(int) { 1898 return offset = 152; 1899 } 1900 offset153fakeit::VirtualOffsetSelector1901 virtual unsigned int offset153(int) { 1902 return offset = 153; 1903 } 1904 offset154fakeit::VirtualOffsetSelector1905 virtual unsigned int offset154(int) { 1906 return offset = 154; 1907 } 1908 offset155fakeit::VirtualOffsetSelector1909 virtual unsigned int offset155(int) { 1910 return offset = 155; 1911 } 1912 offset156fakeit::VirtualOffsetSelector1913 virtual unsigned int offset156(int) { 1914 return offset = 156; 1915 } 1916 offset157fakeit::VirtualOffsetSelector1917 virtual unsigned int offset157(int) { 1918 return offset = 157; 1919 } 1920 offset158fakeit::VirtualOffsetSelector1921 virtual unsigned int offset158(int) { 1922 return offset = 158; 1923 } 1924 offset159fakeit::VirtualOffsetSelector1925 virtual unsigned int offset159(int) { 1926 return offset = 159; 1927 } 1928 offset160fakeit::VirtualOffsetSelector1929 virtual unsigned int offset160(int) { 1930 return offset = 160; 1931 } 1932 offset161fakeit::VirtualOffsetSelector1933 virtual unsigned int offset161(int) { 1934 return offset = 161; 1935 } 1936 offset162fakeit::VirtualOffsetSelector1937 virtual unsigned int offset162(int) { 1938 return offset = 162; 1939 } 1940 offset163fakeit::VirtualOffsetSelector1941 virtual unsigned int offset163(int) { 1942 return offset = 163; 1943 } 1944 offset164fakeit::VirtualOffsetSelector1945 virtual unsigned int offset164(int) { 1946 return offset = 164; 1947 } 1948 offset165fakeit::VirtualOffsetSelector1949 virtual unsigned int offset165(int) { 1950 return offset = 165; 1951 } 1952 offset166fakeit::VirtualOffsetSelector1953 virtual unsigned int offset166(int) { 1954 return offset = 166; 1955 } 1956 offset167fakeit::VirtualOffsetSelector1957 virtual unsigned int offset167(int) { 1958 return offset = 167; 1959 } 1960 offset168fakeit::VirtualOffsetSelector1961 virtual unsigned int offset168(int) { 1962 return offset = 168; 1963 } 1964 offset169fakeit::VirtualOffsetSelector1965 virtual unsigned int offset169(int) { 1966 return offset = 169; 1967 } 1968 offset170fakeit::VirtualOffsetSelector1969 virtual unsigned int offset170(int) { 1970 return offset = 170; 1971 } 1972 offset171fakeit::VirtualOffsetSelector1973 virtual unsigned int offset171(int) { 1974 return offset = 171; 1975 } 1976 offset172fakeit::VirtualOffsetSelector1977 virtual unsigned int offset172(int) { 1978 return offset = 172; 1979 } 1980 offset173fakeit::VirtualOffsetSelector1981 virtual unsigned int offset173(int) { 1982 return offset = 173; 1983 } 1984 offset174fakeit::VirtualOffsetSelector1985 virtual unsigned int offset174(int) { 1986 return offset = 174; 1987 } 1988 offset175fakeit::VirtualOffsetSelector1989 virtual unsigned int offset175(int) { 1990 return offset = 175; 1991 } 1992 offset176fakeit::VirtualOffsetSelector1993 virtual unsigned int offset176(int) { 1994 return offset = 176; 1995 } 1996 offset177fakeit::VirtualOffsetSelector1997 virtual unsigned int offset177(int) { 1998 return offset = 177; 1999 } 2000 offset178fakeit::VirtualOffsetSelector2001 virtual unsigned int offset178(int) { 2002 return offset = 178; 2003 } 2004 offset179fakeit::VirtualOffsetSelector2005 virtual unsigned int offset179(int) { 2006 return offset = 179; 2007 } 2008 offset180fakeit::VirtualOffsetSelector2009 virtual unsigned int offset180(int) { 2010 return offset = 180; 2011 } 2012 offset181fakeit::VirtualOffsetSelector2013 virtual unsigned int offset181(int) { 2014 return offset = 181; 2015 } 2016 offset182fakeit::VirtualOffsetSelector2017 virtual unsigned int offset182(int) { 2018 return offset = 182; 2019 } 2020 offset183fakeit::VirtualOffsetSelector2021 virtual unsigned int offset183(int) { 2022 return offset = 183; 2023 } 2024 offset184fakeit::VirtualOffsetSelector2025 virtual unsigned int offset184(int) { 2026 return offset = 184; 2027 } 2028 offset185fakeit::VirtualOffsetSelector2029 virtual unsigned int offset185(int) { 2030 return offset = 185; 2031 } 2032 offset186fakeit::VirtualOffsetSelector2033 virtual unsigned int offset186(int) { 2034 return offset = 186; 2035 } 2036 offset187fakeit::VirtualOffsetSelector2037 virtual unsigned int offset187(int) { 2038 return offset = 187; 2039 } 2040 offset188fakeit::VirtualOffsetSelector2041 virtual unsigned int offset188(int) { 2042 return offset = 188; 2043 } 2044 offset189fakeit::VirtualOffsetSelector2045 virtual unsigned int offset189(int) { 2046 return offset = 189; 2047 } 2048 offset190fakeit::VirtualOffsetSelector2049 virtual unsigned int offset190(int) { 2050 return offset = 190; 2051 } 2052 offset191fakeit::VirtualOffsetSelector2053 virtual unsigned int offset191(int) { 2054 return offset = 191; 2055 } 2056 offset192fakeit::VirtualOffsetSelector2057 virtual unsigned int offset192(int) { 2058 return offset = 192; 2059 } 2060 offset193fakeit::VirtualOffsetSelector2061 virtual unsigned int offset193(int) { 2062 return offset = 193; 2063 } 2064 offset194fakeit::VirtualOffsetSelector2065 virtual unsigned int offset194(int) { 2066 return offset = 194; 2067 } 2068 offset195fakeit::VirtualOffsetSelector2069 virtual unsigned int offset195(int) { 2070 return offset = 195; 2071 } 2072 offset196fakeit::VirtualOffsetSelector2073 virtual unsigned int offset196(int) { 2074 return offset = 196; 2075 } 2076 offset197fakeit::VirtualOffsetSelector2077 virtual unsigned int offset197(int) { 2078 return offset = 197; 2079 } 2080 offset198fakeit::VirtualOffsetSelector2081 virtual unsigned int offset198(int) { 2082 return offset = 198; 2083 } 2084 offset199fakeit::VirtualOffsetSelector2085 virtual unsigned int offset199(int) { 2086 return offset = 199; 2087 } 2088 2089 offset200fakeit::VirtualOffsetSelector2090 virtual unsigned int offset200(int) { 2091 return offset = 200; 2092 } 2093 offset201fakeit::VirtualOffsetSelector2094 virtual unsigned int offset201(int) { 2095 return offset = 201; 2096 } 2097 offset202fakeit::VirtualOffsetSelector2098 virtual unsigned int offset202(int) { 2099 return offset = 202; 2100 } 2101 offset203fakeit::VirtualOffsetSelector2102 virtual unsigned int offset203(int) { 2103 return offset = 203; 2104 } 2105 offset204fakeit::VirtualOffsetSelector2106 virtual unsigned int offset204(int) { 2107 return offset = 204; 2108 } 2109 offset205fakeit::VirtualOffsetSelector2110 virtual unsigned int offset205(int) { 2111 return offset = 205; 2112 } 2113 offset206fakeit::VirtualOffsetSelector2114 virtual unsigned int offset206(int) { 2115 return offset = 206; 2116 } 2117 offset207fakeit::VirtualOffsetSelector2118 virtual unsigned int offset207(int) { 2119 return offset = 207; 2120 } 2121 offset208fakeit::VirtualOffsetSelector2122 virtual unsigned int offset208(int) { 2123 return offset = 208; 2124 } 2125 offset209fakeit::VirtualOffsetSelector2126 virtual unsigned int offset209(int) { 2127 return offset = 209; 2128 } 2129 offset210fakeit::VirtualOffsetSelector2130 virtual unsigned int offset210(int) { 2131 return offset = 210; 2132 } 2133 offset211fakeit::VirtualOffsetSelector2134 virtual unsigned int offset211(int) { 2135 return offset = 211; 2136 } 2137 offset212fakeit::VirtualOffsetSelector2138 virtual unsigned int offset212(int) { 2139 return offset = 212; 2140 } 2141 offset213fakeit::VirtualOffsetSelector2142 virtual unsigned int offset213(int) { 2143 return offset = 213; 2144 } 2145 offset214fakeit::VirtualOffsetSelector2146 virtual unsigned int offset214(int) { 2147 return offset = 214; 2148 } 2149 offset215fakeit::VirtualOffsetSelector2150 virtual unsigned int offset215(int) { 2151 return offset = 215; 2152 } 2153 offset216fakeit::VirtualOffsetSelector2154 virtual unsigned int offset216(int) { 2155 return offset = 216; 2156 } 2157 offset217fakeit::VirtualOffsetSelector2158 virtual unsigned int offset217(int) { 2159 return offset = 217; 2160 } 2161 offset218fakeit::VirtualOffsetSelector2162 virtual unsigned int offset218(int) { 2163 return offset = 218; 2164 } 2165 offset219fakeit::VirtualOffsetSelector2166 virtual unsigned int offset219(int) { 2167 return offset = 219; 2168 } 2169 offset220fakeit::VirtualOffsetSelector2170 virtual unsigned int offset220(int) { 2171 return offset = 220; 2172 } 2173 offset221fakeit::VirtualOffsetSelector2174 virtual unsigned int offset221(int) { 2175 return offset = 221; 2176 } 2177 offset222fakeit::VirtualOffsetSelector2178 virtual unsigned int offset222(int) { 2179 return offset = 222; 2180 } 2181 offset223fakeit::VirtualOffsetSelector2182 virtual unsigned int offset223(int) { 2183 return offset = 223; 2184 } 2185 offset224fakeit::VirtualOffsetSelector2186 virtual unsigned int offset224(int) { 2187 return offset = 224; 2188 } 2189 offset225fakeit::VirtualOffsetSelector2190 virtual unsigned int offset225(int) { 2191 return offset = 225; 2192 } 2193 offset226fakeit::VirtualOffsetSelector2194 virtual unsigned int offset226(int) { 2195 return offset = 226; 2196 } 2197 offset227fakeit::VirtualOffsetSelector2198 virtual unsigned int offset227(int) { 2199 return offset = 227; 2200 } 2201 offset228fakeit::VirtualOffsetSelector2202 virtual unsigned int offset228(int) { 2203 return offset = 228; 2204 } 2205 offset229fakeit::VirtualOffsetSelector2206 virtual unsigned int offset229(int) { 2207 return offset = 229; 2208 } 2209 offset230fakeit::VirtualOffsetSelector2210 virtual unsigned int offset230(int) { 2211 return offset = 230; 2212 } 2213 offset231fakeit::VirtualOffsetSelector2214 virtual unsigned int offset231(int) { 2215 return offset = 231; 2216 } 2217 offset232fakeit::VirtualOffsetSelector2218 virtual unsigned int offset232(int) { 2219 return offset = 232; 2220 } 2221 offset233fakeit::VirtualOffsetSelector2222 virtual unsigned int offset233(int) { 2223 return offset = 233; 2224 } 2225 offset234fakeit::VirtualOffsetSelector2226 virtual unsigned int offset234(int) { 2227 return offset = 234; 2228 } 2229 offset235fakeit::VirtualOffsetSelector2230 virtual unsigned int offset235(int) { 2231 return offset = 235; 2232 } 2233 offset236fakeit::VirtualOffsetSelector2234 virtual unsigned int offset236(int) { 2235 return offset = 236; 2236 } 2237 offset237fakeit::VirtualOffsetSelector2238 virtual unsigned int offset237(int) { 2239 return offset = 237; 2240 } 2241 offset238fakeit::VirtualOffsetSelector2242 virtual unsigned int offset238(int) { 2243 return offset = 238; 2244 } 2245 offset239fakeit::VirtualOffsetSelector2246 virtual unsigned int offset239(int) { 2247 return offset = 239; 2248 } 2249 offset240fakeit::VirtualOffsetSelector2250 virtual unsigned int offset240(int) { 2251 return offset = 240; 2252 } 2253 offset241fakeit::VirtualOffsetSelector2254 virtual unsigned int offset241(int) { 2255 return offset = 241; 2256 } 2257 offset242fakeit::VirtualOffsetSelector2258 virtual unsigned int offset242(int) { 2259 return offset = 242; 2260 } 2261 offset243fakeit::VirtualOffsetSelector2262 virtual unsigned int offset243(int) { 2263 return offset = 243; 2264 } 2265 offset244fakeit::VirtualOffsetSelector2266 virtual unsigned int offset244(int) { 2267 return offset = 244; 2268 } 2269 offset245fakeit::VirtualOffsetSelector2270 virtual unsigned int offset245(int) { 2271 return offset = 245; 2272 } 2273 offset246fakeit::VirtualOffsetSelector2274 virtual unsigned int offset246(int) { 2275 return offset = 246; 2276 } 2277 offset247fakeit::VirtualOffsetSelector2278 virtual unsigned int offset247(int) { 2279 return offset = 247; 2280 } 2281 offset248fakeit::VirtualOffsetSelector2282 virtual unsigned int offset248(int) { 2283 return offset = 248; 2284 } 2285 offset249fakeit::VirtualOffsetSelector2286 virtual unsigned int offset249(int) { 2287 return offset = 249; 2288 } 2289 offset250fakeit::VirtualOffsetSelector2290 virtual unsigned int offset250(int) { 2291 return offset = 250; 2292 } 2293 offset251fakeit::VirtualOffsetSelector2294 virtual unsigned int offset251(int) { 2295 return offset = 251; 2296 } 2297 offset252fakeit::VirtualOffsetSelector2298 virtual unsigned int offset252(int) { 2299 return offset = 252; 2300 } 2301 offset253fakeit::VirtualOffsetSelector2302 virtual unsigned int offset253(int) { 2303 return offset = 253; 2304 } 2305 offset254fakeit::VirtualOffsetSelector2306 virtual unsigned int offset254(int) { 2307 return offset = 254; 2308 } 2309 offset255fakeit::VirtualOffsetSelector2310 virtual unsigned int offset255(int) { 2311 return offset = 255; 2312 } 2313 offset256fakeit::VirtualOffsetSelector2314 virtual unsigned int offset256(int) { 2315 return offset = 256; 2316 } 2317 offset257fakeit::VirtualOffsetSelector2318 virtual unsigned int offset257(int) { 2319 return offset = 257; 2320 } 2321 offset258fakeit::VirtualOffsetSelector2322 virtual unsigned int offset258(int) { 2323 return offset = 258; 2324 } 2325 offset259fakeit::VirtualOffsetSelector2326 virtual unsigned int offset259(int) { 2327 return offset = 259; 2328 } 2329 offset260fakeit::VirtualOffsetSelector2330 virtual unsigned int offset260(int) { 2331 return offset = 260; 2332 } 2333 offset261fakeit::VirtualOffsetSelector2334 virtual unsigned int offset261(int) { 2335 return offset = 261; 2336 } 2337 offset262fakeit::VirtualOffsetSelector2338 virtual unsigned int offset262(int) { 2339 return offset = 262; 2340 } 2341 offset263fakeit::VirtualOffsetSelector2342 virtual unsigned int offset263(int) { 2343 return offset = 263; 2344 } 2345 offset264fakeit::VirtualOffsetSelector2346 virtual unsigned int offset264(int) { 2347 return offset = 264; 2348 } 2349 offset265fakeit::VirtualOffsetSelector2350 virtual unsigned int offset265(int) { 2351 return offset = 265; 2352 } 2353 offset266fakeit::VirtualOffsetSelector2354 virtual unsigned int offset266(int) { 2355 return offset = 266; 2356 } 2357 offset267fakeit::VirtualOffsetSelector2358 virtual unsigned int offset267(int) { 2359 return offset = 267; 2360 } 2361 offset268fakeit::VirtualOffsetSelector2362 virtual unsigned int offset268(int) { 2363 return offset = 268; 2364 } 2365 offset269fakeit::VirtualOffsetSelector2366 virtual unsigned int offset269(int) { 2367 return offset = 269; 2368 } 2369 offset270fakeit::VirtualOffsetSelector2370 virtual unsigned int offset270(int) { 2371 return offset = 270; 2372 } 2373 offset271fakeit::VirtualOffsetSelector2374 virtual unsigned int offset271(int) { 2375 return offset = 271; 2376 } 2377 offset272fakeit::VirtualOffsetSelector2378 virtual unsigned int offset272(int) { 2379 return offset = 272; 2380 } 2381 offset273fakeit::VirtualOffsetSelector2382 virtual unsigned int offset273(int) { 2383 return offset = 273; 2384 } 2385 offset274fakeit::VirtualOffsetSelector2386 virtual unsigned int offset274(int) { 2387 return offset = 274; 2388 } 2389 offset275fakeit::VirtualOffsetSelector2390 virtual unsigned int offset275(int) { 2391 return offset = 275; 2392 } 2393 offset276fakeit::VirtualOffsetSelector2394 virtual unsigned int offset276(int) { 2395 return offset = 276; 2396 } 2397 offset277fakeit::VirtualOffsetSelector2398 virtual unsigned int offset277(int) { 2399 return offset = 277; 2400 } 2401 offset278fakeit::VirtualOffsetSelector2402 virtual unsigned int offset278(int) { 2403 return offset = 278; 2404 } 2405 offset279fakeit::VirtualOffsetSelector2406 virtual unsigned int offset279(int) { 2407 return offset = 279; 2408 } 2409 offset280fakeit::VirtualOffsetSelector2410 virtual unsigned int offset280(int) { 2411 return offset = 280; 2412 } 2413 offset281fakeit::VirtualOffsetSelector2414 virtual unsigned int offset281(int) { 2415 return offset = 281; 2416 } 2417 offset282fakeit::VirtualOffsetSelector2418 virtual unsigned int offset282(int) { 2419 return offset = 282; 2420 } 2421 offset283fakeit::VirtualOffsetSelector2422 virtual unsigned int offset283(int) { 2423 return offset = 283; 2424 } 2425 offset284fakeit::VirtualOffsetSelector2426 virtual unsigned int offset284(int) { 2427 return offset = 284; 2428 } 2429 offset285fakeit::VirtualOffsetSelector2430 virtual unsigned int offset285(int) { 2431 return offset = 285; 2432 } 2433 offset286fakeit::VirtualOffsetSelector2434 virtual unsigned int offset286(int) { 2435 return offset = 286; 2436 } 2437 offset287fakeit::VirtualOffsetSelector2438 virtual unsigned int offset287(int) { 2439 return offset = 287; 2440 } 2441 offset288fakeit::VirtualOffsetSelector2442 virtual unsigned int offset288(int) { 2443 return offset = 288; 2444 } 2445 offset289fakeit::VirtualOffsetSelector2446 virtual unsigned int offset289(int) { 2447 return offset = 289; 2448 } 2449 offset290fakeit::VirtualOffsetSelector2450 virtual unsigned int offset290(int) { 2451 return offset = 290; 2452 } 2453 offset291fakeit::VirtualOffsetSelector2454 virtual unsigned int offset291(int) { 2455 return offset = 291; 2456 } 2457 offset292fakeit::VirtualOffsetSelector2458 virtual unsigned int offset292(int) { 2459 return offset = 292; 2460 } 2461 offset293fakeit::VirtualOffsetSelector2462 virtual unsigned int offset293(int) { 2463 return offset = 293; 2464 } 2465 offset294fakeit::VirtualOffsetSelector2466 virtual unsigned int offset294(int) { 2467 return offset = 294; 2468 } 2469 offset295fakeit::VirtualOffsetSelector2470 virtual unsigned int offset295(int) { 2471 return offset = 295; 2472 } 2473 offset296fakeit::VirtualOffsetSelector2474 virtual unsigned int offset296(int) { 2475 return offset = 296; 2476 } 2477 offset297fakeit::VirtualOffsetSelector2478 virtual unsigned int offset297(int) { 2479 return offset = 297; 2480 } 2481 offset298fakeit::VirtualOffsetSelector2482 virtual unsigned int offset298(int) { 2483 return offset = 298; 2484 } 2485 offset299fakeit::VirtualOffsetSelector2486 virtual unsigned int offset299(int) { 2487 return offset = 299; 2488 } 2489 2490 offset300fakeit::VirtualOffsetSelector2491 virtual unsigned int offset300(int) { 2492 return offset = 300; 2493 } 2494 offset301fakeit::VirtualOffsetSelector2495 virtual unsigned int offset301(int) { 2496 return offset = 301; 2497 } 2498 offset302fakeit::VirtualOffsetSelector2499 virtual unsigned int offset302(int) { 2500 return offset = 302; 2501 } 2502 offset303fakeit::VirtualOffsetSelector2503 virtual unsigned int offset303(int) { 2504 return offset = 303; 2505 } 2506 offset304fakeit::VirtualOffsetSelector2507 virtual unsigned int offset304(int) { 2508 return offset = 304; 2509 } 2510 offset305fakeit::VirtualOffsetSelector2511 virtual unsigned int offset305(int) { 2512 return offset = 305; 2513 } 2514 offset306fakeit::VirtualOffsetSelector2515 virtual unsigned int offset306(int) { 2516 return offset = 306; 2517 } 2518 offset307fakeit::VirtualOffsetSelector2519 virtual unsigned int offset307(int) { 2520 return offset = 307; 2521 } 2522 offset308fakeit::VirtualOffsetSelector2523 virtual unsigned int offset308(int) { 2524 return offset = 308; 2525 } 2526 offset309fakeit::VirtualOffsetSelector2527 virtual unsigned int offset309(int) { 2528 return offset = 309; 2529 } 2530 offset310fakeit::VirtualOffsetSelector2531 virtual unsigned int offset310(int) { 2532 return offset = 310; 2533 } 2534 offset311fakeit::VirtualOffsetSelector2535 virtual unsigned int offset311(int) { 2536 return offset = 311; 2537 } 2538 offset312fakeit::VirtualOffsetSelector2539 virtual unsigned int offset312(int) { 2540 return offset = 312; 2541 } 2542 offset313fakeit::VirtualOffsetSelector2543 virtual unsigned int offset313(int) { 2544 return offset = 313; 2545 } 2546 offset314fakeit::VirtualOffsetSelector2547 virtual unsigned int offset314(int) { 2548 return offset = 314; 2549 } 2550 offset315fakeit::VirtualOffsetSelector2551 virtual unsigned int offset315(int) { 2552 return offset = 315; 2553 } 2554 offset316fakeit::VirtualOffsetSelector2555 virtual unsigned int offset316(int) { 2556 return offset = 316; 2557 } 2558 offset317fakeit::VirtualOffsetSelector2559 virtual unsigned int offset317(int) { 2560 return offset = 317; 2561 } 2562 offset318fakeit::VirtualOffsetSelector2563 virtual unsigned int offset318(int) { 2564 return offset = 318; 2565 } 2566 offset319fakeit::VirtualOffsetSelector2567 virtual unsigned int offset319(int) { 2568 return offset = 319; 2569 } 2570 offset320fakeit::VirtualOffsetSelector2571 virtual unsigned int offset320(int) { 2572 return offset = 320; 2573 } 2574 offset321fakeit::VirtualOffsetSelector2575 virtual unsigned int offset321(int) { 2576 return offset = 321; 2577 } 2578 offset322fakeit::VirtualOffsetSelector2579 virtual unsigned int offset322(int) { 2580 return offset = 322; 2581 } 2582 offset323fakeit::VirtualOffsetSelector2583 virtual unsigned int offset323(int) { 2584 return offset = 323; 2585 } 2586 offset324fakeit::VirtualOffsetSelector2587 virtual unsigned int offset324(int) { 2588 return offset = 324; 2589 } 2590 offset325fakeit::VirtualOffsetSelector2591 virtual unsigned int offset325(int) { 2592 return offset = 325; 2593 } 2594 offset326fakeit::VirtualOffsetSelector2595 virtual unsigned int offset326(int) { 2596 return offset = 326; 2597 } 2598 offset327fakeit::VirtualOffsetSelector2599 virtual unsigned int offset327(int) { 2600 return offset = 327; 2601 } 2602 offset328fakeit::VirtualOffsetSelector2603 virtual unsigned int offset328(int) { 2604 return offset = 328; 2605 } 2606 offset329fakeit::VirtualOffsetSelector2607 virtual unsigned int offset329(int) { 2608 return offset = 329; 2609 } 2610 offset330fakeit::VirtualOffsetSelector2611 virtual unsigned int offset330(int) { 2612 return offset = 330; 2613 } 2614 offset331fakeit::VirtualOffsetSelector2615 virtual unsigned int offset331(int) { 2616 return offset = 331; 2617 } 2618 offset332fakeit::VirtualOffsetSelector2619 virtual unsigned int offset332(int) { 2620 return offset = 332; 2621 } 2622 offset333fakeit::VirtualOffsetSelector2623 virtual unsigned int offset333(int) { 2624 return offset = 333; 2625 } 2626 offset334fakeit::VirtualOffsetSelector2627 virtual unsigned int offset334(int) { 2628 return offset = 334; 2629 } 2630 offset335fakeit::VirtualOffsetSelector2631 virtual unsigned int offset335(int) { 2632 return offset = 335; 2633 } 2634 offset336fakeit::VirtualOffsetSelector2635 virtual unsigned int offset336(int) { 2636 return offset = 336; 2637 } 2638 offset337fakeit::VirtualOffsetSelector2639 virtual unsigned int offset337(int) { 2640 return offset = 337; 2641 } 2642 offset338fakeit::VirtualOffsetSelector2643 virtual unsigned int offset338(int) { 2644 return offset = 338; 2645 } 2646 offset339fakeit::VirtualOffsetSelector2647 virtual unsigned int offset339(int) { 2648 return offset = 339; 2649 } 2650 offset340fakeit::VirtualOffsetSelector2651 virtual unsigned int offset340(int) { 2652 return offset = 340; 2653 } 2654 offset341fakeit::VirtualOffsetSelector2655 virtual unsigned int offset341(int) { 2656 return offset = 341; 2657 } 2658 offset342fakeit::VirtualOffsetSelector2659 virtual unsigned int offset342(int) { 2660 return offset = 342; 2661 } 2662 offset343fakeit::VirtualOffsetSelector2663 virtual unsigned int offset343(int) { 2664 return offset = 343; 2665 } 2666 offset344fakeit::VirtualOffsetSelector2667 virtual unsigned int offset344(int) { 2668 return offset = 344; 2669 } 2670 offset345fakeit::VirtualOffsetSelector2671 virtual unsigned int offset345(int) { 2672 return offset = 345; 2673 } 2674 offset346fakeit::VirtualOffsetSelector2675 virtual unsigned int offset346(int) { 2676 return offset = 346; 2677 } 2678 offset347fakeit::VirtualOffsetSelector2679 virtual unsigned int offset347(int) { 2680 return offset = 347; 2681 } 2682 offset348fakeit::VirtualOffsetSelector2683 virtual unsigned int offset348(int) { 2684 return offset = 348; 2685 } 2686 offset349fakeit::VirtualOffsetSelector2687 virtual unsigned int offset349(int) { 2688 return offset = 349; 2689 } 2690 offset350fakeit::VirtualOffsetSelector2691 virtual unsigned int offset350(int) { 2692 return offset = 350; 2693 } 2694 offset351fakeit::VirtualOffsetSelector2695 virtual unsigned int offset351(int) { 2696 return offset = 351; 2697 } 2698 offset352fakeit::VirtualOffsetSelector2699 virtual unsigned int offset352(int) { 2700 return offset = 352; 2701 } 2702 offset353fakeit::VirtualOffsetSelector2703 virtual unsigned int offset353(int) { 2704 return offset = 353; 2705 } 2706 offset354fakeit::VirtualOffsetSelector2707 virtual unsigned int offset354(int) { 2708 return offset = 354; 2709 } 2710 offset355fakeit::VirtualOffsetSelector2711 virtual unsigned int offset355(int) { 2712 return offset = 355; 2713 } 2714 offset356fakeit::VirtualOffsetSelector2715 virtual unsigned int offset356(int) { 2716 return offset = 356; 2717 } 2718 offset357fakeit::VirtualOffsetSelector2719 virtual unsigned int offset357(int) { 2720 return offset = 357; 2721 } 2722 offset358fakeit::VirtualOffsetSelector2723 virtual unsigned int offset358(int) { 2724 return offset = 358; 2725 } 2726 offset359fakeit::VirtualOffsetSelector2727 virtual unsigned int offset359(int) { 2728 return offset = 359; 2729 } 2730 offset360fakeit::VirtualOffsetSelector2731 virtual unsigned int offset360(int) { 2732 return offset = 360; 2733 } 2734 offset361fakeit::VirtualOffsetSelector2735 virtual unsigned int offset361(int) { 2736 return offset = 361; 2737 } 2738 offset362fakeit::VirtualOffsetSelector2739 virtual unsigned int offset362(int) { 2740 return offset = 362; 2741 } 2742 offset363fakeit::VirtualOffsetSelector2743 virtual unsigned int offset363(int) { 2744 return offset = 363; 2745 } 2746 offset364fakeit::VirtualOffsetSelector2747 virtual unsigned int offset364(int) { 2748 return offset = 364; 2749 } 2750 offset365fakeit::VirtualOffsetSelector2751 virtual unsigned int offset365(int) { 2752 return offset = 365; 2753 } 2754 offset366fakeit::VirtualOffsetSelector2755 virtual unsigned int offset366(int) { 2756 return offset = 366; 2757 } 2758 offset367fakeit::VirtualOffsetSelector2759 virtual unsigned int offset367(int) { 2760 return offset = 367; 2761 } 2762 offset368fakeit::VirtualOffsetSelector2763 virtual unsigned int offset368(int) { 2764 return offset = 368; 2765 } 2766 offset369fakeit::VirtualOffsetSelector2767 virtual unsigned int offset369(int) { 2768 return offset = 369; 2769 } 2770 offset370fakeit::VirtualOffsetSelector2771 virtual unsigned int offset370(int) { 2772 return offset = 370; 2773 } 2774 offset371fakeit::VirtualOffsetSelector2775 virtual unsigned int offset371(int) { 2776 return offset = 371; 2777 } 2778 offset372fakeit::VirtualOffsetSelector2779 virtual unsigned int offset372(int) { 2780 return offset = 372; 2781 } 2782 offset373fakeit::VirtualOffsetSelector2783 virtual unsigned int offset373(int) { 2784 return offset = 373; 2785 } 2786 offset374fakeit::VirtualOffsetSelector2787 virtual unsigned int offset374(int) { 2788 return offset = 374; 2789 } 2790 offset375fakeit::VirtualOffsetSelector2791 virtual unsigned int offset375(int) { 2792 return offset = 375; 2793 } 2794 offset376fakeit::VirtualOffsetSelector2795 virtual unsigned int offset376(int) { 2796 return offset = 376; 2797 } 2798 offset377fakeit::VirtualOffsetSelector2799 virtual unsigned int offset377(int) { 2800 return offset = 377; 2801 } 2802 offset378fakeit::VirtualOffsetSelector2803 virtual unsigned int offset378(int) { 2804 return offset = 378; 2805 } 2806 offset379fakeit::VirtualOffsetSelector2807 virtual unsigned int offset379(int) { 2808 return offset = 379; 2809 } 2810 offset380fakeit::VirtualOffsetSelector2811 virtual unsigned int offset380(int) { 2812 return offset = 380; 2813 } 2814 offset381fakeit::VirtualOffsetSelector2815 virtual unsigned int offset381(int) { 2816 return offset = 381; 2817 } 2818 offset382fakeit::VirtualOffsetSelector2819 virtual unsigned int offset382(int) { 2820 return offset = 382; 2821 } 2822 offset383fakeit::VirtualOffsetSelector2823 virtual unsigned int offset383(int) { 2824 return offset = 383; 2825 } 2826 offset384fakeit::VirtualOffsetSelector2827 virtual unsigned int offset384(int) { 2828 return offset = 384; 2829 } 2830 offset385fakeit::VirtualOffsetSelector2831 virtual unsigned int offset385(int) { 2832 return offset = 385; 2833 } 2834 offset386fakeit::VirtualOffsetSelector2835 virtual unsigned int offset386(int) { 2836 return offset = 386; 2837 } 2838 offset387fakeit::VirtualOffsetSelector2839 virtual unsigned int offset387(int) { 2840 return offset = 387; 2841 } 2842 offset388fakeit::VirtualOffsetSelector2843 virtual unsigned int offset388(int) { 2844 return offset = 388; 2845 } 2846 offset389fakeit::VirtualOffsetSelector2847 virtual unsigned int offset389(int) { 2848 return offset = 389; 2849 } 2850 offset390fakeit::VirtualOffsetSelector2851 virtual unsigned int offset390(int) { 2852 return offset = 390; 2853 } 2854 offset391fakeit::VirtualOffsetSelector2855 virtual unsigned int offset391(int) { 2856 return offset = 391; 2857 } 2858 offset392fakeit::VirtualOffsetSelector2859 virtual unsigned int offset392(int) { 2860 return offset = 392; 2861 } 2862 offset393fakeit::VirtualOffsetSelector2863 virtual unsigned int offset393(int) { 2864 return offset = 393; 2865 } 2866 offset394fakeit::VirtualOffsetSelector2867 virtual unsigned int offset394(int) { 2868 return offset = 394; 2869 } 2870 offset395fakeit::VirtualOffsetSelector2871 virtual unsigned int offset395(int) { 2872 return offset = 395; 2873 } 2874 offset396fakeit::VirtualOffsetSelector2875 virtual unsigned int offset396(int) { 2876 return offset = 396; 2877 } 2878 offset397fakeit::VirtualOffsetSelector2879 virtual unsigned int offset397(int) { 2880 return offset = 397; 2881 } 2882 offset398fakeit::VirtualOffsetSelector2883 virtual unsigned int offset398(int) { 2884 return offset = 398; 2885 } 2886 offset399fakeit::VirtualOffsetSelector2887 virtual unsigned int offset399(int) { 2888 return offset = 399; 2889 } 2890 2891 offset400fakeit::VirtualOffsetSelector2892 virtual unsigned int offset400(int) { 2893 return offset = 400; 2894 } 2895 offset401fakeit::VirtualOffsetSelector2896 virtual unsigned int offset401(int) { 2897 return offset = 401; 2898 } 2899 offset402fakeit::VirtualOffsetSelector2900 virtual unsigned int offset402(int) { 2901 return offset = 402; 2902 } 2903 offset403fakeit::VirtualOffsetSelector2904 virtual unsigned int offset403(int) { 2905 return offset = 403; 2906 } 2907 offset404fakeit::VirtualOffsetSelector2908 virtual unsigned int offset404(int) { 2909 return offset = 404; 2910 } 2911 offset405fakeit::VirtualOffsetSelector2912 virtual unsigned int offset405(int) { 2913 return offset = 405; 2914 } 2915 offset406fakeit::VirtualOffsetSelector2916 virtual unsigned int offset406(int) { 2917 return offset = 406; 2918 } 2919 offset407fakeit::VirtualOffsetSelector2920 virtual unsigned int offset407(int) { 2921 return offset = 407; 2922 } 2923 offset408fakeit::VirtualOffsetSelector2924 virtual unsigned int offset408(int) { 2925 return offset = 408; 2926 } 2927 offset409fakeit::VirtualOffsetSelector2928 virtual unsigned int offset409(int) { 2929 return offset = 409; 2930 } 2931 offset410fakeit::VirtualOffsetSelector2932 virtual unsigned int offset410(int) { 2933 return offset = 410; 2934 } 2935 offset411fakeit::VirtualOffsetSelector2936 virtual unsigned int offset411(int) { 2937 return offset = 411; 2938 } 2939 offset412fakeit::VirtualOffsetSelector2940 virtual unsigned int offset412(int) { 2941 return offset = 412; 2942 } 2943 offset413fakeit::VirtualOffsetSelector2944 virtual unsigned int offset413(int) { 2945 return offset = 413; 2946 } 2947 offset414fakeit::VirtualOffsetSelector2948 virtual unsigned int offset414(int) { 2949 return offset = 414; 2950 } 2951 offset415fakeit::VirtualOffsetSelector2952 virtual unsigned int offset415(int) { 2953 return offset = 415; 2954 } 2955 offset416fakeit::VirtualOffsetSelector2956 virtual unsigned int offset416(int) { 2957 return offset = 416; 2958 } 2959 offset417fakeit::VirtualOffsetSelector2960 virtual unsigned int offset417(int) { 2961 return offset = 417; 2962 } 2963 offset418fakeit::VirtualOffsetSelector2964 virtual unsigned int offset418(int) { 2965 return offset = 418; 2966 } 2967 offset419fakeit::VirtualOffsetSelector2968 virtual unsigned int offset419(int) { 2969 return offset = 419; 2970 } 2971 offset420fakeit::VirtualOffsetSelector2972 virtual unsigned int offset420(int) { 2973 return offset = 420; 2974 } 2975 offset421fakeit::VirtualOffsetSelector2976 virtual unsigned int offset421(int) { 2977 return offset = 421; 2978 } 2979 offset422fakeit::VirtualOffsetSelector2980 virtual unsigned int offset422(int) { 2981 return offset = 422; 2982 } 2983 offset423fakeit::VirtualOffsetSelector2984 virtual unsigned int offset423(int) { 2985 return offset = 423; 2986 } 2987 offset424fakeit::VirtualOffsetSelector2988 virtual unsigned int offset424(int) { 2989 return offset = 424; 2990 } 2991 offset425fakeit::VirtualOffsetSelector2992 virtual unsigned int offset425(int) { 2993 return offset = 425; 2994 } 2995 offset426fakeit::VirtualOffsetSelector2996 virtual unsigned int offset426(int) { 2997 return offset = 426; 2998 } 2999 offset427fakeit::VirtualOffsetSelector3000 virtual unsigned int offset427(int) { 3001 return offset = 427; 3002 } 3003 offset428fakeit::VirtualOffsetSelector3004 virtual unsigned int offset428(int) { 3005 return offset = 428; 3006 } 3007 offset429fakeit::VirtualOffsetSelector3008 virtual unsigned int offset429(int) { 3009 return offset = 429; 3010 } 3011 offset430fakeit::VirtualOffsetSelector3012 virtual unsigned int offset430(int) { 3013 return offset = 430; 3014 } 3015 offset431fakeit::VirtualOffsetSelector3016 virtual unsigned int offset431(int) { 3017 return offset = 431; 3018 } 3019 offset432fakeit::VirtualOffsetSelector3020 virtual unsigned int offset432(int) { 3021 return offset = 432; 3022 } 3023 offset433fakeit::VirtualOffsetSelector3024 virtual unsigned int offset433(int) { 3025 return offset = 433; 3026 } 3027 offset434fakeit::VirtualOffsetSelector3028 virtual unsigned int offset434(int) { 3029 return offset = 434; 3030 } 3031 offset435fakeit::VirtualOffsetSelector3032 virtual unsigned int offset435(int) { 3033 return offset = 435; 3034 } 3035 offset436fakeit::VirtualOffsetSelector3036 virtual unsigned int offset436(int) { 3037 return offset = 436; 3038 } 3039 offset437fakeit::VirtualOffsetSelector3040 virtual unsigned int offset437(int) { 3041 return offset = 437; 3042 } 3043 offset438fakeit::VirtualOffsetSelector3044 virtual unsigned int offset438(int) { 3045 return offset = 438; 3046 } 3047 offset439fakeit::VirtualOffsetSelector3048 virtual unsigned int offset439(int) { 3049 return offset = 439; 3050 } 3051 offset440fakeit::VirtualOffsetSelector3052 virtual unsigned int offset440(int) { 3053 return offset = 440; 3054 } 3055 offset441fakeit::VirtualOffsetSelector3056 virtual unsigned int offset441(int) { 3057 return offset = 441; 3058 } 3059 offset442fakeit::VirtualOffsetSelector3060 virtual unsigned int offset442(int) { 3061 return offset = 442; 3062 } 3063 offset443fakeit::VirtualOffsetSelector3064 virtual unsigned int offset443(int) { 3065 return offset = 443; 3066 } 3067 offset444fakeit::VirtualOffsetSelector3068 virtual unsigned int offset444(int) { 3069 return offset = 444; 3070 } 3071 offset445fakeit::VirtualOffsetSelector3072 virtual unsigned int offset445(int) { 3073 return offset = 445; 3074 } 3075 offset446fakeit::VirtualOffsetSelector3076 virtual unsigned int offset446(int) { 3077 return offset = 446; 3078 } 3079 offset447fakeit::VirtualOffsetSelector3080 virtual unsigned int offset447(int) { 3081 return offset = 447; 3082 } 3083 offset448fakeit::VirtualOffsetSelector3084 virtual unsigned int offset448(int) { 3085 return offset = 448; 3086 } 3087 offset449fakeit::VirtualOffsetSelector3088 virtual unsigned int offset449(int) { 3089 return offset = 449; 3090 } 3091 offset450fakeit::VirtualOffsetSelector3092 virtual unsigned int offset450(int) { 3093 return offset = 450; 3094 } 3095 offset451fakeit::VirtualOffsetSelector3096 virtual unsigned int offset451(int) { 3097 return offset = 451; 3098 } 3099 offset452fakeit::VirtualOffsetSelector3100 virtual unsigned int offset452(int) { 3101 return offset = 452; 3102 } 3103 offset453fakeit::VirtualOffsetSelector3104 virtual unsigned int offset453(int) { 3105 return offset = 453; 3106 } 3107 offset454fakeit::VirtualOffsetSelector3108 virtual unsigned int offset454(int) { 3109 return offset = 454; 3110 } 3111 offset455fakeit::VirtualOffsetSelector3112 virtual unsigned int offset455(int) { 3113 return offset = 455; 3114 } 3115 offset456fakeit::VirtualOffsetSelector3116 virtual unsigned int offset456(int) { 3117 return offset = 456; 3118 } 3119 offset457fakeit::VirtualOffsetSelector3120 virtual unsigned int offset457(int) { 3121 return offset = 457; 3122 } 3123 offset458fakeit::VirtualOffsetSelector3124 virtual unsigned int offset458(int) { 3125 return offset = 458; 3126 } 3127 offset459fakeit::VirtualOffsetSelector3128 virtual unsigned int offset459(int) { 3129 return offset = 459; 3130 } 3131 offset460fakeit::VirtualOffsetSelector3132 virtual unsigned int offset460(int) { 3133 return offset = 460; 3134 } 3135 offset461fakeit::VirtualOffsetSelector3136 virtual unsigned int offset461(int) { 3137 return offset = 461; 3138 } 3139 offset462fakeit::VirtualOffsetSelector3140 virtual unsigned int offset462(int) { 3141 return offset = 462; 3142 } 3143 offset463fakeit::VirtualOffsetSelector3144 virtual unsigned int offset463(int) { 3145 return offset = 463; 3146 } 3147 offset464fakeit::VirtualOffsetSelector3148 virtual unsigned int offset464(int) { 3149 return offset = 464; 3150 } 3151 offset465fakeit::VirtualOffsetSelector3152 virtual unsigned int offset465(int) { 3153 return offset = 465; 3154 } 3155 offset466fakeit::VirtualOffsetSelector3156 virtual unsigned int offset466(int) { 3157 return offset = 466; 3158 } 3159 offset467fakeit::VirtualOffsetSelector3160 virtual unsigned int offset467(int) { 3161 return offset = 467; 3162 } 3163 offset468fakeit::VirtualOffsetSelector3164 virtual unsigned int offset468(int) { 3165 return offset = 468; 3166 } 3167 offset469fakeit::VirtualOffsetSelector3168 virtual unsigned int offset469(int) { 3169 return offset = 469; 3170 } 3171 offset470fakeit::VirtualOffsetSelector3172 virtual unsigned int offset470(int) { 3173 return offset = 470; 3174 } 3175 offset471fakeit::VirtualOffsetSelector3176 virtual unsigned int offset471(int) { 3177 return offset = 471; 3178 } 3179 offset472fakeit::VirtualOffsetSelector3180 virtual unsigned int offset472(int) { 3181 return offset = 472; 3182 } 3183 offset473fakeit::VirtualOffsetSelector3184 virtual unsigned int offset473(int) { 3185 return offset = 473; 3186 } 3187 offset474fakeit::VirtualOffsetSelector3188 virtual unsigned int offset474(int) { 3189 return offset = 474; 3190 } 3191 offset475fakeit::VirtualOffsetSelector3192 virtual unsigned int offset475(int) { 3193 return offset = 475; 3194 } 3195 offset476fakeit::VirtualOffsetSelector3196 virtual unsigned int offset476(int) { 3197 return offset = 476; 3198 } 3199 offset477fakeit::VirtualOffsetSelector3200 virtual unsigned int offset477(int) { 3201 return offset = 477; 3202 } 3203 offset478fakeit::VirtualOffsetSelector3204 virtual unsigned int offset478(int) { 3205 return offset = 478; 3206 } 3207 offset479fakeit::VirtualOffsetSelector3208 virtual unsigned int offset479(int) { 3209 return offset = 479; 3210 } 3211 offset480fakeit::VirtualOffsetSelector3212 virtual unsigned int offset480(int) { 3213 return offset = 480; 3214 } 3215 offset481fakeit::VirtualOffsetSelector3216 virtual unsigned int offset481(int) { 3217 return offset = 481; 3218 } 3219 offset482fakeit::VirtualOffsetSelector3220 virtual unsigned int offset482(int) { 3221 return offset = 482; 3222 } 3223 offset483fakeit::VirtualOffsetSelector3224 virtual unsigned int offset483(int) { 3225 return offset = 483; 3226 } 3227 offset484fakeit::VirtualOffsetSelector3228 virtual unsigned int offset484(int) { 3229 return offset = 484; 3230 } 3231 offset485fakeit::VirtualOffsetSelector3232 virtual unsigned int offset485(int) { 3233 return offset = 485; 3234 } 3235 offset486fakeit::VirtualOffsetSelector3236 virtual unsigned int offset486(int) { 3237 return offset = 486; 3238 } 3239 offset487fakeit::VirtualOffsetSelector3240 virtual unsigned int offset487(int) { 3241 return offset = 487; 3242 } 3243 offset488fakeit::VirtualOffsetSelector3244 virtual unsigned int offset488(int) { 3245 return offset = 488; 3246 } 3247 offset489fakeit::VirtualOffsetSelector3248 virtual unsigned int offset489(int) { 3249 return offset = 489; 3250 } 3251 offset490fakeit::VirtualOffsetSelector3252 virtual unsigned int offset490(int) { 3253 return offset = 490; 3254 } 3255 offset491fakeit::VirtualOffsetSelector3256 virtual unsigned int offset491(int) { 3257 return offset = 491; 3258 } 3259 offset492fakeit::VirtualOffsetSelector3260 virtual unsigned int offset492(int) { 3261 return offset = 492; 3262 } 3263 offset493fakeit::VirtualOffsetSelector3264 virtual unsigned int offset493(int) { 3265 return offset = 493; 3266 } 3267 offset494fakeit::VirtualOffsetSelector3268 virtual unsigned int offset494(int) { 3269 return offset = 494; 3270 } 3271 offset495fakeit::VirtualOffsetSelector3272 virtual unsigned int offset495(int) { 3273 return offset = 495; 3274 } 3275 offset496fakeit::VirtualOffsetSelector3276 virtual unsigned int offset496(int) { 3277 return offset = 496; 3278 } 3279 offset497fakeit::VirtualOffsetSelector3280 virtual unsigned int offset497(int) { 3281 return offset = 497; 3282 } 3283 offset498fakeit::VirtualOffsetSelector3284 virtual unsigned int offset498(int) { 3285 return offset = 498; 3286 } 3287 offset499fakeit::VirtualOffsetSelector3288 virtual unsigned int offset499(int) { 3289 return offset = 499; 3290 } 3291 3292 offset500fakeit::VirtualOffsetSelector3293 virtual unsigned int offset500(int) { 3294 return offset = 500; 3295 } 3296 offset501fakeit::VirtualOffsetSelector3297 virtual unsigned int offset501(int) { 3298 return offset = 501; 3299 } 3300 offset502fakeit::VirtualOffsetSelector3301 virtual unsigned int offset502(int) { 3302 return offset = 502; 3303 } 3304 offset503fakeit::VirtualOffsetSelector3305 virtual unsigned int offset503(int) { 3306 return offset = 503; 3307 } 3308 offset504fakeit::VirtualOffsetSelector3309 virtual unsigned int offset504(int) { 3310 return offset = 504; 3311 } 3312 offset505fakeit::VirtualOffsetSelector3313 virtual unsigned int offset505(int) { 3314 return offset = 505; 3315 } 3316 offset506fakeit::VirtualOffsetSelector3317 virtual unsigned int offset506(int) { 3318 return offset = 506; 3319 } 3320 offset507fakeit::VirtualOffsetSelector3321 virtual unsigned int offset507(int) { 3322 return offset = 507; 3323 } 3324 offset508fakeit::VirtualOffsetSelector3325 virtual unsigned int offset508(int) { 3326 return offset = 508; 3327 } 3328 offset509fakeit::VirtualOffsetSelector3329 virtual unsigned int offset509(int) { 3330 return offset = 509; 3331 } 3332 offset510fakeit::VirtualOffsetSelector3333 virtual unsigned int offset510(int) { 3334 return offset = 510; 3335 } 3336 offset511fakeit::VirtualOffsetSelector3337 virtual unsigned int offset511(int) { 3338 return offset = 511; 3339 } 3340 offset512fakeit::VirtualOffsetSelector3341 virtual unsigned int offset512(int) { 3342 return offset = 512; 3343 } 3344 offset513fakeit::VirtualOffsetSelector3345 virtual unsigned int offset513(int) { 3346 return offset = 513; 3347 } 3348 offset514fakeit::VirtualOffsetSelector3349 virtual unsigned int offset514(int) { 3350 return offset = 514; 3351 } 3352 offset515fakeit::VirtualOffsetSelector3353 virtual unsigned int offset515(int) { 3354 return offset = 515; 3355 } 3356 offset516fakeit::VirtualOffsetSelector3357 virtual unsigned int offset516(int) { 3358 return offset = 516; 3359 } 3360 offset517fakeit::VirtualOffsetSelector3361 virtual unsigned int offset517(int) { 3362 return offset = 517; 3363 } 3364 offset518fakeit::VirtualOffsetSelector3365 virtual unsigned int offset518(int) { 3366 return offset = 518; 3367 } 3368 offset519fakeit::VirtualOffsetSelector3369 virtual unsigned int offset519(int) { 3370 return offset = 519; 3371 } 3372 offset520fakeit::VirtualOffsetSelector3373 virtual unsigned int offset520(int) { 3374 return offset = 520; 3375 } 3376 offset521fakeit::VirtualOffsetSelector3377 virtual unsigned int offset521(int) { 3378 return offset = 521; 3379 } 3380 offset522fakeit::VirtualOffsetSelector3381 virtual unsigned int offset522(int) { 3382 return offset = 522; 3383 } 3384 offset523fakeit::VirtualOffsetSelector3385 virtual unsigned int offset523(int) { 3386 return offset = 523; 3387 } 3388 offset524fakeit::VirtualOffsetSelector3389 virtual unsigned int offset524(int) { 3390 return offset = 524; 3391 } 3392 offset525fakeit::VirtualOffsetSelector3393 virtual unsigned int offset525(int) { 3394 return offset = 525; 3395 } 3396 offset526fakeit::VirtualOffsetSelector3397 virtual unsigned int offset526(int) { 3398 return offset = 526; 3399 } 3400 offset527fakeit::VirtualOffsetSelector3401 virtual unsigned int offset527(int) { 3402 return offset = 527; 3403 } 3404 offset528fakeit::VirtualOffsetSelector3405 virtual unsigned int offset528(int) { 3406 return offset = 528; 3407 } 3408 offset529fakeit::VirtualOffsetSelector3409 virtual unsigned int offset529(int) { 3410 return offset = 529; 3411 } 3412 offset530fakeit::VirtualOffsetSelector3413 virtual unsigned int offset530(int) { 3414 return offset = 530; 3415 } 3416 offset531fakeit::VirtualOffsetSelector3417 virtual unsigned int offset531(int) { 3418 return offset = 531; 3419 } 3420 offset532fakeit::VirtualOffsetSelector3421 virtual unsigned int offset532(int) { 3422 return offset = 532; 3423 } 3424 offset533fakeit::VirtualOffsetSelector3425 virtual unsigned int offset533(int) { 3426 return offset = 533; 3427 } 3428 offset534fakeit::VirtualOffsetSelector3429 virtual unsigned int offset534(int) { 3430 return offset = 534; 3431 } 3432 offset535fakeit::VirtualOffsetSelector3433 virtual unsigned int offset535(int) { 3434 return offset = 535; 3435 } 3436 offset536fakeit::VirtualOffsetSelector3437 virtual unsigned int offset536(int) { 3438 return offset = 536; 3439 } 3440 offset537fakeit::VirtualOffsetSelector3441 virtual unsigned int offset537(int) { 3442 return offset = 537; 3443 } 3444 offset538fakeit::VirtualOffsetSelector3445 virtual unsigned int offset538(int) { 3446 return offset = 538; 3447 } 3448 offset539fakeit::VirtualOffsetSelector3449 virtual unsigned int offset539(int) { 3450 return offset = 539; 3451 } 3452 offset540fakeit::VirtualOffsetSelector3453 virtual unsigned int offset540(int) { 3454 return offset = 540; 3455 } 3456 offset541fakeit::VirtualOffsetSelector3457 virtual unsigned int offset541(int) { 3458 return offset = 541; 3459 } 3460 offset542fakeit::VirtualOffsetSelector3461 virtual unsigned int offset542(int) { 3462 return offset = 542; 3463 } 3464 offset543fakeit::VirtualOffsetSelector3465 virtual unsigned int offset543(int) { 3466 return offset = 543; 3467 } 3468 offset544fakeit::VirtualOffsetSelector3469 virtual unsigned int offset544(int) { 3470 return offset = 544; 3471 } 3472 offset545fakeit::VirtualOffsetSelector3473 virtual unsigned int offset545(int) { 3474 return offset = 545; 3475 } 3476 offset546fakeit::VirtualOffsetSelector3477 virtual unsigned int offset546(int) { 3478 return offset = 546; 3479 } 3480 offset547fakeit::VirtualOffsetSelector3481 virtual unsigned int offset547(int) { 3482 return offset = 547; 3483 } 3484 offset548fakeit::VirtualOffsetSelector3485 virtual unsigned int offset548(int) { 3486 return offset = 548; 3487 } 3488 offset549fakeit::VirtualOffsetSelector3489 virtual unsigned int offset549(int) { 3490 return offset = 549; 3491 } 3492 offset550fakeit::VirtualOffsetSelector3493 virtual unsigned int offset550(int) { 3494 return offset = 550; 3495 } 3496 offset551fakeit::VirtualOffsetSelector3497 virtual unsigned int offset551(int) { 3498 return offset = 551; 3499 } 3500 offset552fakeit::VirtualOffsetSelector3501 virtual unsigned int offset552(int) { 3502 return offset = 552; 3503 } 3504 offset553fakeit::VirtualOffsetSelector3505 virtual unsigned int offset553(int) { 3506 return offset = 553; 3507 } 3508 offset554fakeit::VirtualOffsetSelector3509 virtual unsigned int offset554(int) { 3510 return offset = 554; 3511 } 3512 offset555fakeit::VirtualOffsetSelector3513 virtual unsigned int offset555(int) { 3514 return offset = 555; 3515 } 3516 offset556fakeit::VirtualOffsetSelector3517 virtual unsigned int offset556(int) { 3518 return offset = 556; 3519 } 3520 offset557fakeit::VirtualOffsetSelector3521 virtual unsigned int offset557(int) { 3522 return offset = 557; 3523 } 3524 offset558fakeit::VirtualOffsetSelector3525 virtual unsigned int offset558(int) { 3526 return offset = 558; 3527 } 3528 offset559fakeit::VirtualOffsetSelector3529 virtual unsigned int offset559(int) { 3530 return offset = 559; 3531 } 3532 offset560fakeit::VirtualOffsetSelector3533 virtual unsigned int offset560(int) { 3534 return offset = 560; 3535 } 3536 offset561fakeit::VirtualOffsetSelector3537 virtual unsigned int offset561(int) { 3538 return offset = 561; 3539 } 3540 offset562fakeit::VirtualOffsetSelector3541 virtual unsigned int offset562(int) { 3542 return offset = 562; 3543 } 3544 offset563fakeit::VirtualOffsetSelector3545 virtual unsigned int offset563(int) { 3546 return offset = 563; 3547 } 3548 offset564fakeit::VirtualOffsetSelector3549 virtual unsigned int offset564(int) { 3550 return offset = 564; 3551 } 3552 offset565fakeit::VirtualOffsetSelector3553 virtual unsigned int offset565(int) { 3554 return offset = 565; 3555 } 3556 offset566fakeit::VirtualOffsetSelector3557 virtual unsigned int offset566(int) { 3558 return offset = 566; 3559 } 3560 offset567fakeit::VirtualOffsetSelector3561 virtual unsigned int offset567(int) { 3562 return offset = 567; 3563 } 3564 offset568fakeit::VirtualOffsetSelector3565 virtual unsigned int offset568(int) { 3566 return offset = 568; 3567 } 3568 offset569fakeit::VirtualOffsetSelector3569 virtual unsigned int offset569(int) { 3570 return offset = 569; 3571 } 3572 offset570fakeit::VirtualOffsetSelector3573 virtual unsigned int offset570(int) { 3574 return offset = 570; 3575 } 3576 offset571fakeit::VirtualOffsetSelector3577 virtual unsigned int offset571(int) { 3578 return offset = 571; 3579 } 3580 offset572fakeit::VirtualOffsetSelector3581 virtual unsigned int offset572(int) { 3582 return offset = 572; 3583 } 3584 offset573fakeit::VirtualOffsetSelector3585 virtual unsigned int offset573(int) { 3586 return offset = 573; 3587 } 3588 offset574fakeit::VirtualOffsetSelector3589 virtual unsigned int offset574(int) { 3590 return offset = 574; 3591 } 3592 offset575fakeit::VirtualOffsetSelector3593 virtual unsigned int offset575(int) { 3594 return offset = 575; 3595 } 3596 offset576fakeit::VirtualOffsetSelector3597 virtual unsigned int offset576(int) { 3598 return offset = 576; 3599 } 3600 offset577fakeit::VirtualOffsetSelector3601 virtual unsigned int offset577(int) { 3602 return offset = 577; 3603 } 3604 offset578fakeit::VirtualOffsetSelector3605 virtual unsigned int offset578(int) { 3606 return offset = 578; 3607 } 3608 offset579fakeit::VirtualOffsetSelector3609 virtual unsigned int offset579(int) { 3610 return offset = 579; 3611 } 3612 offset580fakeit::VirtualOffsetSelector3613 virtual unsigned int offset580(int) { 3614 return offset = 580; 3615 } 3616 offset581fakeit::VirtualOffsetSelector3617 virtual unsigned int offset581(int) { 3618 return offset = 581; 3619 } 3620 offset582fakeit::VirtualOffsetSelector3621 virtual unsigned int offset582(int) { 3622 return offset = 582; 3623 } 3624 offset583fakeit::VirtualOffsetSelector3625 virtual unsigned int offset583(int) { 3626 return offset = 583; 3627 } 3628 offset584fakeit::VirtualOffsetSelector3629 virtual unsigned int offset584(int) { 3630 return offset = 584; 3631 } 3632 offset585fakeit::VirtualOffsetSelector3633 virtual unsigned int offset585(int) { 3634 return offset = 585; 3635 } 3636 offset586fakeit::VirtualOffsetSelector3637 virtual unsigned int offset586(int) { 3638 return offset = 586; 3639 } 3640 offset587fakeit::VirtualOffsetSelector3641 virtual unsigned int offset587(int) { 3642 return offset = 587; 3643 } 3644 offset588fakeit::VirtualOffsetSelector3645 virtual unsigned int offset588(int) { 3646 return offset = 588; 3647 } 3648 offset589fakeit::VirtualOffsetSelector3649 virtual unsigned int offset589(int) { 3650 return offset = 589; 3651 } 3652 offset590fakeit::VirtualOffsetSelector3653 virtual unsigned int offset590(int) { 3654 return offset = 590; 3655 } 3656 offset591fakeit::VirtualOffsetSelector3657 virtual unsigned int offset591(int) { 3658 return offset = 591; 3659 } 3660 offset592fakeit::VirtualOffsetSelector3661 virtual unsigned int offset592(int) { 3662 return offset = 592; 3663 } 3664 offset593fakeit::VirtualOffsetSelector3665 virtual unsigned int offset593(int) { 3666 return offset = 593; 3667 } 3668 offset594fakeit::VirtualOffsetSelector3669 virtual unsigned int offset594(int) { 3670 return offset = 594; 3671 } 3672 offset595fakeit::VirtualOffsetSelector3673 virtual unsigned int offset595(int) { 3674 return offset = 595; 3675 } 3676 offset596fakeit::VirtualOffsetSelector3677 virtual unsigned int offset596(int) { 3678 return offset = 596; 3679 } 3680 offset597fakeit::VirtualOffsetSelector3681 virtual unsigned int offset597(int) { 3682 return offset = 597; 3683 } 3684 offset598fakeit::VirtualOffsetSelector3685 virtual unsigned int offset598(int) { 3686 return offset = 598; 3687 } 3688 offset599fakeit::VirtualOffsetSelector3689 virtual unsigned int offset599(int) { 3690 return offset = 599; 3691 } 3692 3693 offset600fakeit::VirtualOffsetSelector3694 virtual unsigned int offset600(int) { 3695 return offset = 600; 3696 } 3697 offset601fakeit::VirtualOffsetSelector3698 virtual unsigned int offset601(int) { 3699 return offset = 601; 3700 } 3701 offset602fakeit::VirtualOffsetSelector3702 virtual unsigned int offset602(int) { 3703 return offset = 602; 3704 } 3705 offset603fakeit::VirtualOffsetSelector3706 virtual unsigned int offset603(int) { 3707 return offset = 603; 3708 } 3709 offset604fakeit::VirtualOffsetSelector3710 virtual unsigned int offset604(int) { 3711 return offset = 604; 3712 } 3713 offset605fakeit::VirtualOffsetSelector3714 virtual unsigned int offset605(int) { 3715 return offset = 605; 3716 } 3717 offset606fakeit::VirtualOffsetSelector3718 virtual unsigned int offset606(int) { 3719 return offset = 606; 3720 } 3721 offset607fakeit::VirtualOffsetSelector3722 virtual unsigned int offset607(int) { 3723 return offset = 607; 3724 } 3725 offset608fakeit::VirtualOffsetSelector3726 virtual unsigned int offset608(int) { 3727 return offset = 608; 3728 } 3729 offset609fakeit::VirtualOffsetSelector3730 virtual unsigned int offset609(int) { 3731 return offset = 609; 3732 } 3733 offset610fakeit::VirtualOffsetSelector3734 virtual unsigned int offset610(int) { 3735 return offset = 610; 3736 } 3737 offset611fakeit::VirtualOffsetSelector3738 virtual unsigned int offset611(int) { 3739 return offset = 611; 3740 } 3741 offset612fakeit::VirtualOffsetSelector3742 virtual unsigned int offset612(int) { 3743 return offset = 612; 3744 } 3745 offset613fakeit::VirtualOffsetSelector3746 virtual unsigned int offset613(int) { 3747 return offset = 613; 3748 } 3749 offset614fakeit::VirtualOffsetSelector3750 virtual unsigned int offset614(int) { 3751 return offset = 614; 3752 } 3753 offset615fakeit::VirtualOffsetSelector3754 virtual unsigned int offset615(int) { 3755 return offset = 615; 3756 } 3757 offset616fakeit::VirtualOffsetSelector3758 virtual unsigned int offset616(int) { 3759 return offset = 616; 3760 } 3761 offset617fakeit::VirtualOffsetSelector3762 virtual unsigned int offset617(int) { 3763 return offset = 617; 3764 } 3765 offset618fakeit::VirtualOffsetSelector3766 virtual unsigned int offset618(int) { 3767 return offset = 618; 3768 } 3769 offset619fakeit::VirtualOffsetSelector3770 virtual unsigned int offset619(int) { 3771 return offset = 619; 3772 } 3773 offset620fakeit::VirtualOffsetSelector3774 virtual unsigned int offset620(int) { 3775 return offset = 620; 3776 } 3777 offset621fakeit::VirtualOffsetSelector3778 virtual unsigned int offset621(int) { 3779 return offset = 621; 3780 } 3781 offset622fakeit::VirtualOffsetSelector3782 virtual unsigned int offset622(int) { 3783 return offset = 622; 3784 } 3785 offset623fakeit::VirtualOffsetSelector3786 virtual unsigned int offset623(int) { 3787 return offset = 623; 3788 } 3789 offset624fakeit::VirtualOffsetSelector3790 virtual unsigned int offset624(int) { 3791 return offset = 624; 3792 } 3793 offset625fakeit::VirtualOffsetSelector3794 virtual unsigned int offset625(int) { 3795 return offset = 625; 3796 } 3797 offset626fakeit::VirtualOffsetSelector3798 virtual unsigned int offset626(int) { 3799 return offset = 626; 3800 } 3801 offset627fakeit::VirtualOffsetSelector3802 virtual unsigned int offset627(int) { 3803 return offset = 627; 3804 } 3805 offset628fakeit::VirtualOffsetSelector3806 virtual unsigned int offset628(int) { 3807 return offset = 628; 3808 } 3809 offset629fakeit::VirtualOffsetSelector3810 virtual unsigned int offset629(int) { 3811 return offset = 629; 3812 } 3813 offset630fakeit::VirtualOffsetSelector3814 virtual unsigned int offset630(int) { 3815 return offset = 630; 3816 } 3817 offset631fakeit::VirtualOffsetSelector3818 virtual unsigned int offset631(int) { 3819 return offset = 631; 3820 } 3821 offset632fakeit::VirtualOffsetSelector3822 virtual unsigned int offset632(int) { 3823 return offset = 632; 3824 } 3825 offset633fakeit::VirtualOffsetSelector3826 virtual unsigned int offset633(int) { 3827 return offset = 633; 3828 } 3829 offset634fakeit::VirtualOffsetSelector3830 virtual unsigned int offset634(int) { 3831 return offset = 634; 3832 } 3833 offset635fakeit::VirtualOffsetSelector3834 virtual unsigned int offset635(int) { 3835 return offset = 635; 3836 } 3837 offset636fakeit::VirtualOffsetSelector3838 virtual unsigned int offset636(int) { 3839 return offset = 636; 3840 } 3841 offset637fakeit::VirtualOffsetSelector3842 virtual unsigned int offset637(int) { 3843 return offset = 637; 3844 } 3845 offset638fakeit::VirtualOffsetSelector3846 virtual unsigned int offset638(int) { 3847 return offset = 638; 3848 } 3849 offset639fakeit::VirtualOffsetSelector3850 virtual unsigned int offset639(int) { 3851 return offset = 639; 3852 } 3853 offset640fakeit::VirtualOffsetSelector3854 virtual unsigned int offset640(int) { 3855 return offset = 640; 3856 } 3857 offset641fakeit::VirtualOffsetSelector3858 virtual unsigned int offset641(int) { 3859 return offset = 641; 3860 } 3861 offset642fakeit::VirtualOffsetSelector3862 virtual unsigned int offset642(int) { 3863 return offset = 642; 3864 } 3865 offset643fakeit::VirtualOffsetSelector3866 virtual unsigned int offset643(int) { 3867 return offset = 643; 3868 } 3869 offset644fakeit::VirtualOffsetSelector3870 virtual unsigned int offset644(int) { 3871 return offset = 644; 3872 } 3873 offset645fakeit::VirtualOffsetSelector3874 virtual unsigned int offset645(int) { 3875 return offset = 645; 3876 } 3877 offset646fakeit::VirtualOffsetSelector3878 virtual unsigned int offset646(int) { 3879 return offset = 646; 3880 } 3881 offset647fakeit::VirtualOffsetSelector3882 virtual unsigned int offset647(int) { 3883 return offset = 647; 3884 } 3885 offset648fakeit::VirtualOffsetSelector3886 virtual unsigned int offset648(int) { 3887 return offset = 648; 3888 } 3889 offset649fakeit::VirtualOffsetSelector3890 virtual unsigned int offset649(int) { 3891 return offset = 649; 3892 } 3893 offset650fakeit::VirtualOffsetSelector3894 virtual unsigned int offset650(int) { 3895 return offset = 650; 3896 } 3897 offset651fakeit::VirtualOffsetSelector3898 virtual unsigned int offset651(int) { 3899 return offset = 651; 3900 } 3901 offset652fakeit::VirtualOffsetSelector3902 virtual unsigned int offset652(int) { 3903 return offset = 652; 3904 } 3905 offset653fakeit::VirtualOffsetSelector3906 virtual unsigned int offset653(int) { 3907 return offset = 653; 3908 } 3909 offset654fakeit::VirtualOffsetSelector3910 virtual unsigned int offset654(int) { 3911 return offset = 654; 3912 } 3913 offset655fakeit::VirtualOffsetSelector3914 virtual unsigned int offset655(int) { 3915 return offset = 655; 3916 } 3917 offset656fakeit::VirtualOffsetSelector3918 virtual unsigned int offset656(int) { 3919 return offset = 656; 3920 } 3921 offset657fakeit::VirtualOffsetSelector3922 virtual unsigned int offset657(int) { 3923 return offset = 657; 3924 } 3925 offset658fakeit::VirtualOffsetSelector3926 virtual unsigned int offset658(int) { 3927 return offset = 658; 3928 } 3929 offset659fakeit::VirtualOffsetSelector3930 virtual unsigned int offset659(int) { 3931 return offset = 659; 3932 } 3933 offset660fakeit::VirtualOffsetSelector3934 virtual unsigned int offset660(int) { 3935 return offset = 660; 3936 } 3937 offset661fakeit::VirtualOffsetSelector3938 virtual unsigned int offset661(int) { 3939 return offset = 661; 3940 } 3941 offset662fakeit::VirtualOffsetSelector3942 virtual unsigned int offset662(int) { 3943 return offset = 662; 3944 } 3945 offset663fakeit::VirtualOffsetSelector3946 virtual unsigned int offset663(int) { 3947 return offset = 663; 3948 } 3949 offset664fakeit::VirtualOffsetSelector3950 virtual unsigned int offset664(int) { 3951 return offset = 664; 3952 } 3953 offset665fakeit::VirtualOffsetSelector3954 virtual unsigned int offset665(int) { 3955 return offset = 665; 3956 } 3957 offset666fakeit::VirtualOffsetSelector3958 virtual unsigned int offset666(int) { 3959 return offset = 666; 3960 } 3961 offset667fakeit::VirtualOffsetSelector3962 virtual unsigned int offset667(int) { 3963 return offset = 667; 3964 } 3965 offset668fakeit::VirtualOffsetSelector3966 virtual unsigned int offset668(int) { 3967 return offset = 668; 3968 } 3969 offset669fakeit::VirtualOffsetSelector3970 virtual unsigned int offset669(int) { 3971 return offset = 669; 3972 } 3973 offset670fakeit::VirtualOffsetSelector3974 virtual unsigned int offset670(int) { 3975 return offset = 670; 3976 } 3977 offset671fakeit::VirtualOffsetSelector3978 virtual unsigned int offset671(int) { 3979 return offset = 671; 3980 } 3981 offset672fakeit::VirtualOffsetSelector3982 virtual unsigned int offset672(int) { 3983 return offset = 672; 3984 } 3985 offset673fakeit::VirtualOffsetSelector3986 virtual unsigned int offset673(int) { 3987 return offset = 673; 3988 } 3989 offset674fakeit::VirtualOffsetSelector3990 virtual unsigned int offset674(int) { 3991 return offset = 674; 3992 } 3993 offset675fakeit::VirtualOffsetSelector3994 virtual unsigned int offset675(int) { 3995 return offset = 675; 3996 } 3997 offset676fakeit::VirtualOffsetSelector3998 virtual unsigned int offset676(int) { 3999 return offset = 676; 4000 } 4001 offset677fakeit::VirtualOffsetSelector4002 virtual unsigned int offset677(int) { 4003 return offset = 677; 4004 } 4005 offset678fakeit::VirtualOffsetSelector4006 virtual unsigned int offset678(int) { 4007 return offset = 678; 4008 } 4009 offset679fakeit::VirtualOffsetSelector4010 virtual unsigned int offset679(int) { 4011 return offset = 679; 4012 } 4013 offset680fakeit::VirtualOffsetSelector4014 virtual unsigned int offset680(int) { 4015 return offset = 680; 4016 } 4017 offset681fakeit::VirtualOffsetSelector4018 virtual unsigned int offset681(int) { 4019 return offset = 681; 4020 } 4021 offset682fakeit::VirtualOffsetSelector4022 virtual unsigned int offset682(int) { 4023 return offset = 682; 4024 } 4025 offset683fakeit::VirtualOffsetSelector4026 virtual unsigned int offset683(int) { 4027 return offset = 683; 4028 } 4029 offset684fakeit::VirtualOffsetSelector4030 virtual unsigned int offset684(int) { 4031 return offset = 684; 4032 } 4033 offset685fakeit::VirtualOffsetSelector4034 virtual unsigned int offset685(int) { 4035 return offset = 685; 4036 } 4037 offset686fakeit::VirtualOffsetSelector4038 virtual unsigned int offset686(int) { 4039 return offset = 686; 4040 } 4041 offset687fakeit::VirtualOffsetSelector4042 virtual unsigned int offset687(int) { 4043 return offset = 687; 4044 } 4045 offset688fakeit::VirtualOffsetSelector4046 virtual unsigned int offset688(int) { 4047 return offset = 688; 4048 } 4049 offset689fakeit::VirtualOffsetSelector4050 virtual unsigned int offset689(int) { 4051 return offset = 689; 4052 } 4053 offset690fakeit::VirtualOffsetSelector4054 virtual unsigned int offset690(int) { 4055 return offset = 690; 4056 } 4057 offset691fakeit::VirtualOffsetSelector4058 virtual unsigned int offset691(int) { 4059 return offset = 691; 4060 } 4061 offset692fakeit::VirtualOffsetSelector4062 virtual unsigned int offset692(int) { 4063 return offset = 692; 4064 } 4065 offset693fakeit::VirtualOffsetSelector4066 virtual unsigned int offset693(int) { 4067 return offset = 693; 4068 } 4069 offset694fakeit::VirtualOffsetSelector4070 virtual unsigned int offset694(int) { 4071 return offset = 694; 4072 } 4073 offset695fakeit::VirtualOffsetSelector4074 virtual unsigned int offset695(int) { 4075 return offset = 695; 4076 } 4077 offset696fakeit::VirtualOffsetSelector4078 virtual unsigned int offset696(int) { 4079 return offset = 696; 4080 } 4081 offset697fakeit::VirtualOffsetSelector4082 virtual unsigned int offset697(int) { 4083 return offset = 697; 4084 } 4085 offset698fakeit::VirtualOffsetSelector4086 virtual unsigned int offset698(int) { 4087 return offset = 698; 4088 } 4089 offset699fakeit::VirtualOffsetSelector4090 virtual unsigned int offset699(int) { 4091 return offset = 699; 4092 } 4093 4094 offset700fakeit::VirtualOffsetSelector4095 virtual unsigned int offset700(int) { 4096 return offset = 700; 4097 } 4098 offset701fakeit::VirtualOffsetSelector4099 virtual unsigned int offset701(int) { 4100 return offset = 701; 4101 } 4102 offset702fakeit::VirtualOffsetSelector4103 virtual unsigned int offset702(int) { 4104 return offset = 702; 4105 } 4106 offset703fakeit::VirtualOffsetSelector4107 virtual unsigned int offset703(int) { 4108 return offset = 703; 4109 } 4110 offset704fakeit::VirtualOffsetSelector4111 virtual unsigned int offset704(int) { 4112 return offset = 704; 4113 } 4114 offset705fakeit::VirtualOffsetSelector4115 virtual unsigned int offset705(int) { 4116 return offset = 705; 4117 } 4118 offset706fakeit::VirtualOffsetSelector4119 virtual unsigned int offset706(int) { 4120 return offset = 706; 4121 } 4122 offset707fakeit::VirtualOffsetSelector4123 virtual unsigned int offset707(int) { 4124 return offset = 707; 4125 } 4126 offset708fakeit::VirtualOffsetSelector4127 virtual unsigned int offset708(int) { 4128 return offset = 708; 4129 } 4130 offset709fakeit::VirtualOffsetSelector4131 virtual unsigned int offset709(int) { 4132 return offset = 709; 4133 } 4134 offset710fakeit::VirtualOffsetSelector4135 virtual unsigned int offset710(int) { 4136 return offset = 710; 4137 } 4138 offset711fakeit::VirtualOffsetSelector4139 virtual unsigned int offset711(int) { 4140 return offset = 711; 4141 } 4142 offset712fakeit::VirtualOffsetSelector4143 virtual unsigned int offset712(int) { 4144 return offset = 712; 4145 } 4146 offset713fakeit::VirtualOffsetSelector4147 virtual unsigned int offset713(int) { 4148 return offset = 713; 4149 } 4150 offset714fakeit::VirtualOffsetSelector4151 virtual unsigned int offset714(int) { 4152 return offset = 714; 4153 } 4154 offset715fakeit::VirtualOffsetSelector4155 virtual unsigned int offset715(int) { 4156 return offset = 715; 4157 } 4158 offset716fakeit::VirtualOffsetSelector4159 virtual unsigned int offset716(int) { 4160 return offset = 716; 4161 } 4162 offset717fakeit::VirtualOffsetSelector4163 virtual unsigned int offset717(int) { 4164 return offset = 717; 4165 } 4166 offset718fakeit::VirtualOffsetSelector4167 virtual unsigned int offset718(int) { 4168 return offset = 718; 4169 } 4170 offset719fakeit::VirtualOffsetSelector4171 virtual unsigned int offset719(int) { 4172 return offset = 719; 4173 } 4174 offset720fakeit::VirtualOffsetSelector4175 virtual unsigned int offset720(int) { 4176 return offset = 720; 4177 } 4178 offset721fakeit::VirtualOffsetSelector4179 virtual unsigned int offset721(int) { 4180 return offset = 721; 4181 } 4182 offset722fakeit::VirtualOffsetSelector4183 virtual unsigned int offset722(int) { 4184 return offset = 722; 4185 } 4186 offset723fakeit::VirtualOffsetSelector4187 virtual unsigned int offset723(int) { 4188 return offset = 723; 4189 } 4190 offset724fakeit::VirtualOffsetSelector4191 virtual unsigned int offset724(int) { 4192 return offset = 724; 4193 } 4194 offset725fakeit::VirtualOffsetSelector4195 virtual unsigned int offset725(int) { 4196 return offset = 725; 4197 } 4198 offset726fakeit::VirtualOffsetSelector4199 virtual unsigned int offset726(int) { 4200 return offset = 726; 4201 } 4202 offset727fakeit::VirtualOffsetSelector4203 virtual unsigned int offset727(int) { 4204 return offset = 727; 4205 } 4206 offset728fakeit::VirtualOffsetSelector4207 virtual unsigned int offset728(int) { 4208 return offset = 728; 4209 } 4210 offset729fakeit::VirtualOffsetSelector4211 virtual unsigned int offset729(int) { 4212 return offset = 729; 4213 } 4214 offset730fakeit::VirtualOffsetSelector4215 virtual unsigned int offset730(int) { 4216 return offset = 730; 4217 } 4218 offset731fakeit::VirtualOffsetSelector4219 virtual unsigned int offset731(int) { 4220 return offset = 731; 4221 } 4222 offset732fakeit::VirtualOffsetSelector4223 virtual unsigned int offset732(int) { 4224 return offset = 732; 4225 } 4226 offset733fakeit::VirtualOffsetSelector4227 virtual unsigned int offset733(int) { 4228 return offset = 733; 4229 } 4230 offset734fakeit::VirtualOffsetSelector4231 virtual unsigned int offset734(int) { 4232 return offset = 734; 4233 } 4234 offset735fakeit::VirtualOffsetSelector4235 virtual unsigned int offset735(int) { 4236 return offset = 735; 4237 } 4238 offset736fakeit::VirtualOffsetSelector4239 virtual unsigned int offset736(int) { 4240 return offset = 736; 4241 } 4242 offset737fakeit::VirtualOffsetSelector4243 virtual unsigned int offset737(int) { 4244 return offset = 737; 4245 } 4246 offset738fakeit::VirtualOffsetSelector4247 virtual unsigned int offset738(int) { 4248 return offset = 738; 4249 } 4250 offset739fakeit::VirtualOffsetSelector4251 virtual unsigned int offset739(int) { 4252 return offset = 739; 4253 } 4254 offset740fakeit::VirtualOffsetSelector4255 virtual unsigned int offset740(int) { 4256 return offset = 740; 4257 } 4258 offset741fakeit::VirtualOffsetSelector4259 virtual unsigned int offset741(int) { 4260 return offset = 741; 4261 } 4262 offset742fakeit::VirtualOffsetSelector4263 virtual unsigned int offset742(int) { 4264 return offset = 742; 4265 } 4266 offset743fakeit::VirtualOffsetSelector4267 virtual unsigned int offset743(int) { 4268 return offset = 743; 4269 } 4270 offset744fakeit::VirtualOffsetSelector4271 virtual unsigned int offset744(int) { 4272 return offset = 744; 4273 } 4274 offset745fakeit::VirtualOffsetSelector4275 virtual unsigned int offset745(int) { 4276 return offset = 745; 4277 } 4278 offset746fakeit::VirtualOffsetSelector4279 virtual unsigned int offset746(int) { 4280 return offset = 746; 4281 } 4282 offset747fakeit::VirtualOffsetSelector4283 virtual unsigned int offset747(int) { 4284 return offset = 747; 4285 } 4286 offset748fakeit::VirtualOffsetSelector4287 virtual unsigned int offset748(int) { 4288 return offset = 748; 4289 } 4290 offset749fakeit::VirtualOffsetSelector4291 virtual unsigned int offset749(int) { 4292 return offset = 749; 4293 } 4294 offset750fakeit::VirtualOffsetSelector4295 virtual unsigned int offset750(int) { 4296 return offset = 750; 4297 } 4298 offset751fakeit::VirtualOffsetSelector4299 virtual unsigned int offset751(int) { 4300 return offset = 751; 4301 } 4302 offset752fakeit::VirtualOffsetSelector4303 virtual unsigned int offset752(int) { 4304 return offset = 752; 4305 } 4306 offset753fakeit::VirtualOffsetSelector4307 virtual unsigned int offset753(int) { 4308 return offset = 753; 4309 } 4310 offset754fakeit::VirtualOffsetSelector4311 virtual unsigned int offset754(int) { 4312 return offset = 754; 4313 } 4314 offset755fakeit::VirtualOffsetSelector4315 virtual unsigned int offset755(int) { 4316 return offset = 755; 4317 } 4318 offset756fakeit::VirtualOffsetSelector4319 virtual unsigned int offset756(int) { 4320 return offset = 756; 4321 } 4322 offset757fakeit::VirtualOffsetSelector4323 virtual unsigned int offset757(int) { 4324 return offset = 757; 4325 } 4326 offset758fakeit::VirtualOffsetSelector4327 virtual unsigned int offset758(int) { 4328 return offset = 758; 4329 } 4330 offset759fakeit::VirtualOffsetSelector4331 virtual unsigned int offset759(int) { 4332 return offset = 759; 4333 } 4334 offset760fakeit::VirtualOffsetSelector4335 virtual unsigned int offset760(int) { 4336 return offset = 760; 4337 } 4338 offset761fakeit::VirtualOffsetSelector4339 virtual unsigned int offset761(int) { 4340 return offset = 761; 4341 } 4342 offset762fakeit::VirtualOffsetSelector4343 virtual unsigned int offset762(int) { 4344 return offset = 762; 4345 } 4346 offset763fakeit::VirtualOffsetSelector4347 virtual unsigned int offset763(int) { 4348 return offset = 763; 4349 } 4350 offset764fakeit::VirtualOffsetSelector4351 virtual unsigned int offset764(int) { 4352 return offset = 764; 4353 } 4354 offset765fakeit::VirtualOffsetSelector4355 virtual unsigned int offset765(int) { 4356 return offset = 765; 4357 } 4358 offset766fakeit::VirtualOffsetSelector4359 virtual unsigned int offset766(int) { 4360 return offset = 766; 4361 } 4362 offset767fakeit::VirtualOffsetSelector4363 virtual unsigned int offset767(int) { 4364 return offset = 767; 4365 } 4366 offset768fakeit::VirtualOffsetSelector4367 virtual unsigned int offset768(int) { 4368 return offset = 768; 4369 } 4370 offset769fakeit::VirtualOffsetSelector4371 virtual unsigned int offset769(int) { 4372 return offset = 769; 4373 } 4374 offset770fakeit::VirtualOffsetSelector4375 virtual unsigned int offset770(int) { 4376 return offset = 770; 4377 } 4378 offset771fakeit::VirtualOffsetSelector4379 virtual unsigned int offset771(int) { 4380 return offset = 771; 4381 } 4382 offset772fakeit::VirtualOffsetSelector4383 virtual unsigned int offset772(int) { 4384 return offset = 772; 4385 } 4386 offset773fakeit::VirtualOffsetSelector4387 virtual unsigned int offset773(int) { 4388 return offset = 773; 4389 } 4390 offset774fakeit::VirtualOffsetSelector4391 virtual unsigned int offset774(int) { 4392 return offset = 774; 4393 } 4394 offset775fakeit::VirtualOffsetSelector4395 virtual unsigned int offset775(int) { 4396 return offset = 775; 4397 } 4398 offset776fakeit::VirtualOffsetSelector4399 virtual unsigned int offset776(int) { 4400 return offset = 776; 4401 } 4402 offset777fakeit::VirtualOffsetSelector4403 virtual unsigned int offset777(int) { 4404 return offset = 777; 4405 } 4406 offset778fakeit::VirtualOffsetSelector4407 virtual unsigned int offset778(int) { 4408 return offset = 778; 4409 } 4410 offset779fakeit::VirtualOffsetSelector4411 virtual unsigned int offset779(int) { 4412 return offset = 779; 4413 } 4414 offset780fakeit::VirtualOffsetSelector4415 virtual unsigned int offset780(int) { 4416 return offset = 780; 4417 } 4418 offset781fakeit::VirtualOffsetSelector4419 virtual unsigned int offset781(int) { 4420 return offset = 781; 4421 } 4422 offset782fakeit::VirtualOffsetSelector4423 virtual unsigned int offset782(int) { 4424 return offset = 782; 4425 } 4426 offset783fakeit::VirtualOffsetSelector4427 virtual unsigned int offset783(int) { 4428 return offset = 783; 4429 } 4430 offset784fakeit::VirtualOffsetSelector4431 virtual unsigned int offset784(int) { 4432 return offset = 784; 4433 } 4434 offset785fakeit::VirtualOffsetSelector4435 virtual unsigned int offset785(int) { 4436 return offset = 785; 4437 } 4438 offset786fakeit::VirtualOffsetSelector4439 virtual unsigned int offset786(int) { 4440 return offset = 786; 4441 } 4442 offset787fakeit::VirtualOffsetSelector4443 virtual unsigned int offset787(int) { 4444 return offset = 787; 4445 } 4446 offset788fakeit::VirtualOffsetSelector4447 virtual unsigned int offset788(int) { 4448 return offset = 788; 4449 } 4450 offset789fakeit::VirtualOffsetSelector4451 virtual unsigned int offset789(int) { 4452 return offset = 789; 4453 } 4454 offset790fakeit::VirtualOffsetSelector4455 virtual unsigned int offset790(int) { 4456 return offset = 790; 4457 } 4458 offset791fakeit::VirtualOffsetSelector4459 virtual unsigned int offset791(int) { 4460 return offset = 791; 4461 } 4462 offset792fakeit::VirtualOffsetSelector4463 virtual unsigned int offset792(int) { 4464 return offset = 792; 4465 } 4466 offset793fakeit::VirtualOffsetSelector4467 virtual unsigned int offset793(int) { 4468 return offset = 793; 4469 } 4470 offset794fakeit::VirtualOffsetSelector4471 virtual unsigned int offset794(int) { 4472 return offset = 794; 4473 } 4474 offset795fakeit::VirtualOffsetSelector4475 virtual unsigned int offset795(int) { 4476 return offset = 795; 4477 } 4478 offset796fakeit::VirtualOffsetSelector4479 virtual unsigned int offset796(int) { 4480 return offset = 796; 4481 } 4482 offset797fakeit::VirtualOffsetSelector4483 virtual unsigned int offset797(int) { 4484 return offset = 797; 4485 } 4486 offset798fakeit::VirtualOffsetSelector4487 virtual unsigned int offset798(int) { 4488 return offset = 798; 4489 } 4490 offset799fakeit::VirtualOffsetSelector4491 virtual unsigned int offset799(int) { 4492 return offset = 799; 4493 } 4494 4495 offset800fakeit::VirtualOffsetSelector4496 virtual unsigned int offset800(int) { 4497 return offset = 800; 4498 } 4499 offset801fakeit::VirtualOffsetSelector4500 virtual unsigned int offset801(int) { 4501 return offset = 801; 4502 } 4503 offset802fakeit::VirtualOffsetSelector4504 virtual unsigned int offset802(int) { 4505 return offset = 802; 4506 } 4507 offset803fakeit::VirtualOffsetSelector4508 virtual unsigned int offset803(int) { 4509 return offset = 803; 4510 } 4511 offset804fakeit::VirtualOffsetSelector4512 virtual unsigned int offset804(int) { 4513 return offset = 804; 4514 } 4515 offset805fakeit::VirtualOffsetSelector4516 virtual unsigned int offset805(int) { 4517 return offset = 805; 4518 } 4519 offset806fakeit::VirtualOffsetSelector4520 virtual unsigned int offset806(int) { 4521 return offset = 806; 4522 } 4523 offset807fakeit::VirtualOffsetSelector4524 virtual unsigned int offset807(int) { 4525 return offset = 807; 4526 } 4527 offset808fakeit::VirtualOffsetSelector4528 virtual unsigned int offset808(int) { 4529 return offset = 808; 4530 } 4531 offset809fakeit::VirtualOffsetSelector4532 virtual unsigned int offset809(int) { 4533 return offset = 809; 4534 } 4535 offset810fakeit::VirtualOffsetSelector4536 virtual unsigned int offset810(int) { 4537 return offset = 810; 4538 } 4539 offset811fakeit::VirtualOffsetSelector4540 virtual unsigned int offset811(int) { 4541 return offset = 811; 4542 } 4543 offset812fakeit::VirtualOffsetSelector4544 virtual unsigned int offset812(int) { 4545 return offset = 812; 4546 } 4547 offset813fakeit::VirtualOffsetSelector4548 virtual unsigned int offset813(int) { 4549 return offset = 813; 4550 } 4551 offset814fakeit::VirtualOffsetSelector4552 virtual unsigned int offset814(int) { 4553 return offset = 814; 4554 } 4555 offset815fakeit::VirtualOffsetSelector4556 virtual unsigned int offset815(int) { 4557 return offset = 815; 4558 } 4559 offset816fakeit::VirtualOffsetSelector4560 virtual unsigned int offset816(int) { 4561 return offset = 816; 4562 } 4563 offset817fakeit::VirtualOffsetSelector4564 virtual unsigned int offset817(int) { 4565 return offset = 817; 4566 } 4567 offset818fakeit::VirtualOffsetSelector4568 virtual unsigned int offset818(int) { 4569 return offset = 818; 4570 } 4571 offset819fakeit::VirtualOffsetSelector4572 virtual unsigned int offset819(int) { 4573 return offset = 819; 4574 } 4575 offset820fakeit::VirtualOffsetSelector4576 virtual unsigned int offset820(int) { 4577 return offset = 820; 4578 } 4579 offset821fakeit::VirtualOffsetSelector4580 virtual unsigned int offset821(int) { 4581 return offset = 821; 4582 } 4583 offset822fakeit::VirtualOffsetSelector4584 virtual unsigned int offset822(int) { 4585 return offset = 822; 4586 } 4587 offset823fakeit::VirtualOffsetSelector4588 virtual unsigned int offset823(int) { 4589 return offset = 823; 4590 } 4591 offset824fakeit::VirtualOffsetSelector4592 virtual unsigned int offset824(int) { 4593 return offset = 824; 4594 } 4595 offset825fakeit::VirtualOffsetSelector4596 virtual unsigned int offset825(int) { 4597 return offset = 825; 4598 } 4599 offset826fakeit::VirtualOffsetSelector4600 virtual unsigned int offset826(int) { 4601 return offset = 826; 4602 } 4603 offset827fakeit::VirtualOffsetSelector4604 virtual unsigned int offset827(int) { 4605 return offset = 827; 4606 } 4607 offset828fakeit::VirtualOffsetSelector4608 virtual unsigned int offset828(int) { 4609 return offset = 828; 4610 } 4611 offset829fakeit::VirtualOffsetSelector4612 virtual unsigned int offset829(int) { 4613 return offset = 829; 4614 } 4615 offset830fakeit::VirtualOffsetSelector4616 virtual unsigned int offset830(int) { 4617 return offset = 830; 4618 } 4619 offset831fakeit::VirtualOffsetSelector4620 virtual unsigned int offset831(int) { 4621 return offset = 831; 4622 } 4623 offset832fakeit::VirtualOffsetSelector4624 virtual unsigned int offset832(int) { 4625 return offset = 832; 4626 } 4627 offset833fakeit::VirtualOffsetSelector4628 virtual unsigned int offset833(int) { 4629 return offset = 833; 4630 } 4631 offset834fakeit::VirtualOffsetSelector4632 virtual unsigned int offset834(int) { 4633 return offset = 834; 4634 } 4635 offset835fakeit::VirtualOffsetSelector4636 virtual unsigned int offset835(int) { 4637 return offset = 835; 4638 } 4639 offset836fakeit::VirtualOffsetSelector4640 virtual unsigned int offset836(int) { 4641 return offset = 836; 4642 } 4643 offset837fakeit::VirtualOffsetSelector4644 virtual unsigned int offset837(int) { 4645 return offset = 837; 4646 } 4647 offset838fakeit::VirtualOffsetSelector4648 virtual unsigned int offset838(int) { 4649 return offset = 838; 4650 } 4651 offset839fakeit::VirtualOffsetSelector4652 virtual unsigned int offset839(int) { 4653 return offset = 839; 4654 } 4655 offset840fakeit::VirtualOffsetSelector4656 virtual unsigned int offset840(int) { 4657 return offset = 840; 4658 } 4659 offset841fakeit::VirtualOffsetSelector4660 virtual unsigned int offset841(int) { 4661 return offset = 841; 4662 } 4663 offset842fakeit::VirtualOffsetSelector4664 virtual unsigned int offset842(int) { 4665 return offset = 842; 4666 } 4667 offset843fakeit::VirtualOffsetSelector4668 virtual unsigned int offset843(int) { 4669 return offset = 843; 4670 } 4671 offset844fakeit::VirtualOffsetSelector4672 virtual unsigned int offset844(int) { 4673 return offset = 844; 4674 } 4675 offset845fakeit::VirtualOffsetSelector4676 virtual unsigned int offset845(int) { 4677 return offset = 845; 4678 } 4679 offset846fakeit::VirtualOffsetSelector4680 virtual unsigned int offset846(int) { 4681 return offset = 846; 4682 } 4683 offset847fakeit::VirtualOffsetSelector4684 virtual unsigned int offset847(int) { 4685 return offset = 847; 4686 } 4687 offset848fakeit::VirtualOffsetSelector4688 virtual unsigned int offset848(int) { 4689 return offset = 848; 4690 } 4691 offset849fakeit::VirtualOffsetSelector4692 virtual unsigned int offset849(int) { 4693 return offset = 849; 4694 } 4695 offset850fakeit::VirtualOffsetSelector4696 virtual unsigned int offset850(int) { 4697 return offset = 850; 4698 } 4699 offset851fakeit::VirtualOffsetSelector4700 virtual unsigned int offset851(int) { 4701 return offset = 851; 4702 } 4703 offset852fakeit::VirtualOffsetSelector4704 virtual unsigned int offset852(int) { 4705 return offset = 852; 4706 } 4707 offset853fakeit::VirtualOffsetSelector4708 virtual unsigned int offset853(int) { 4709 return offset = 853; 4710 } 4711 offset854fakeit::VirtualOffsetSelector4712 virtual unsigned int offset854(int) { 4713 return offset = 854; 4714 } 4715 offset855fakeit::VirtualOffsetSelector4716 virtual unsigned int offset855(int) { 4717 return offset = 855; 4718 } 4719 offset856fakeit::VirtualOffsetSelector4720 virtual unsigned int offset856(int) { 4721 return offset = 856; 4722 } 4723 offset857fakeit::VirtualOffsetSelector4724 virtual unsigned int offset857(int) { 4725 return offset = 857; 4726 } 4727 offset858fakeit::VirtualOffsetSelector4728 virtual unsigned int offset858(int) { 4729 return offset = 858; 4730 } 4731 offset859fakeit::VirtualOffsetSelector4732 virtual unsigned int offset859(int) { 4733 return offset = 859; 4734 } 4735 offset860fakeit::VirtualOffsetSelector4736 virtual unsigned int offset860(int) { 4737 return offset = 860; 4738 } 4739 offset861fakeit::VirtualOffsetSelector4740 virtual unsigned int offset861(int) { 4741 return offset = 861; 4742 } 4743 offset862fakeit::VirtualOffsetSelector4744 virtual unsigned int offset862(int) { 4745 return offset = 862; 4746 } 4747 offset863fakeit::VirtualOffsetSelector4748 virtual unsigned int offset863(int) { 4749 return offset = 863; 4750 } 4751 offset864fakeit::VirtualOffsetSelector4752 virtual unsigned int offset864(int) { 4753 return offset = 864; 4754 } 4755 offset865fakeit::VirtualOffsetSelector4756 virtual unsigned int offset865(int) { 4757 return offset = 865; 4758 } 4759 offset866fakeit::VirtualOffsetSelector4760 virtual unsigned int offset866(int) { 4761 return offset = 866; 4762 } 4763 offset867fakeit::VirtualOffsetSelector4764 virtual unsigned int offset867(int) { 4765 return offset = 867; 4766 } 4767 offset868fakeit::VirtualOffsetSelector4768 virtual unsigned int offset868(int) { 4769 return offset = 868; 4770 } 4771 offset869fakeit::VirtualOffsetSelector4772 virtual unsigned int offset869(int) { 4773 return offset = 869; 4774 } 4775 offset870fakeit::VirtualOffsetSelector4776 virtual unsigned int offset870(int) { 4777 return offset = 870; 4778 } 4779 offset871fakeit::VirtualOffsetSelector4780 virtual unsigned int offset871(int) { 4781 return offset = 871; 4782 } 4783 offset872fakeit::VirtualOffsetSelector4784 virtual unsigned int offset872(int) { 4785 return offset = 872; 4786 } 4787 offset873fakeit::VirtualOffsetSelector4788 virtual unsigned int offset873(int) { 4789 return offset = 873; 4790 } 4791 offset874fakeit::VirtualOffsetSelector4792 virtual unsigned int offset874(int) { 4793 return offset = 874; 4794 } 4795 offset875fakeit::VirtualOffsetSelector4796 virtual unsigned int offset875(int) { 4797 return offset = 875; 4798 } 4799 offset876fakeit::VirtualOffsetSelector4800 virtual unsigned int offset876(int) { 4801 return offset = 876; 4802 } 4803 offset877fakeit::VirtualOffsetSelector4804 virtual unsigned int offset877(int) { 4805 return offset = 877; 4806 } 4807 offset878fakeit::VirtualOffsetSelector4808 virtual unsigned int offset878(int) { 4809 return offset = 878; 4810 } 4811 offset879fakeit::VirtualOffsetSelector4812 virtual unsigned int offset879(int) { 4813 return offset = 879; 4814 } 4815 offset880fakeit::VirtualOffsetSelector4816 virtual unsigned int offset880(int) { 4817 return offset = 880; 4818 } 4819 offset881fakeit::VirtualOffsetSelector4820 virtual unsigned int offset881(int) { 4821 return offset = 881; 4822 } 4823 offset882fakeit::VirtualOffsetSelector4824 virtual unsigned int offset882(int) { 4825 return offset = 882; 4826 } 4827 offset883fakeit::VirtualOffsetSelector4828 virtual unsigned int offset883(int) { 4829 return offset = 883; 4830 } 4831 offset884fakeit::VirtualOffsetSelector4832 virtual unsigned int offset884(int) { 4833 return offset = 884; 4834 } 4835 offset885fakeit::VirtualOffsetSelector4836 virtual unsigned int offset885(int) { 4837 return offset = 885; 4838 } 4839 offset886fakeit::VirtualOffsetSelector4840 virtual unsigned int offset886(int) { 4841 return offset = 886; 4842 } 4843 offset887fakeit::VirtualOffsetSelector4844 virtual unsigned int offset887(int) { 4845 return offset = 887; 4846 } 4847 offset888fakeit::VirtualOffsetSelector4848 virtual unsigned int offset888(int) { 4849 return offset = 888; 4850 } 4851 offset889fakeit::VirtualOffsetSelector4852 virtual unsigned int offset889(int) { 4853 return offset = 889; 4854 } 4855 offset890fakeit::VirtualOffsetSelector4856 virtual unsigned int offset890(int) { 4857 return offset = 890; 4858 } 4859 offset891fakeit::VirtualOffsetSelector4860 virtual unsigned int offset891(int) { 4861 return offset = 891; 4862 } 4863 offset892fakeit::VirtualOffsetSelector4864 virtual unsigned int offset892(int) { 4865 return offset = 892; 4866 } 4867 offset893fakeit::VirtualOffsetSelector4868 virtual unsigned int offset893(int) { 4869 return offset = 893; 4870 } 4871 offset894fakeit::VirtualOffsetSelector4872 virtual unsigned int offset894(int) { 4873 return offset = 894; 4874 } 4875 offset895fakeit::VirtualOffsetSelector4876 virtual unsigned int offset895(int) { 4877 return offset = 895; 4878 } 4879 offset896fakeit::VirtualOffsetSelector4880 virtual unsigned int offset896(int) { 4881 return offset = 896; 4882 } 4883 offset897fakeit::VirtualOffsetSelector4884 virtual unsigned int offset897(int) { 4885 return offset = 897; 4886 } 4887 offset898fakeit::VirtualOffsetSelector4888 virtual unsigned int offset898(int) { 4889 return offset = 898; 4890 } 4891 offset899fakeit::VirtualOffsetSelector4892 virtual unsigned int offset899(int) { 4893 return offset = 899; 4894 } 4895 4896 offset900fakeit::VirtualOffsetSelector4897 virtual unsigned int offset900(int) { 4898 return offset = 900; 4899 } 4900 offset901fakeit::VirtualOffsetSelector4901 virtual unsigned int offset901(int) { 4902 return offset = 901; 4903 } 4904 offset902fakeit::VirtualOffsetSelector4905 virtual unsigned int offset902(int) { 4906 return offset = 902; 4907 } 4908 offset903fakeit::VirtualOffsetSelector4909 virtual unsigned int offset903(int) { 4910 return offset = 903; 4911 } 4912 offset904fakeit::VirtualOffsetSelector4913 virtual unsigned int offset904(int) { 4914 return offset = 904; 4915 } 4916 offset905fakeit::VirtualOffsetSelector4917 virtual unsigned int offset905(int) { 4918 return offset = 905; 4919 } 4920 offset906fakeit::VirtualOffsetSelector4921 virtual unsigned int offset906(int) { 4922 return offset = 906; 4923 } 4924 offset907fakeit::VirtualOffsetSelector4925 virtual unsigned int offset907(int) { 4926 return offset = 907; 4927 } 4928 offset908fakeit::VirtualOffsetSelector4929 virtual unsigned int offset908(int) { 4930 return offset = 908; 4931 } 4932 offset909fakeit::VirtualOffsetSelector4933 virtual unsigned int offset909(int) { 4934 return offset = 909; 4935 } 4936 offset910fakeit::VirtualOffsetSelector4937 virtual unsigned int offset910(int) { 4938 return offset = 910; 4939 } 4940 offset911fakeit::VirtualOffsetSelector4941 virtual unsigned int offset911(int) { 4942 return offset = 911; 4943 } 4944 offset912fakeit::VirtualOffsetSelector4945 virtual unsigned int offset912(int) { 4946 return offset = 912; 4947 } 4948 offset913fakeit::VirtualOffsetSelector4949 virtual unsigned int offset913(int) { 4950 return offset = 913; 4951 } 4952 offset914fakeit::VirtualOffsetSelector4953 virtual unsigned int offset914(int) { 4954 return offset = 914; 4955 } 4956 offset915fakeit::VirtualOffsetSelector4957 virtual unsigned int offset915(int) { 4958 return offset = 915; 4959 } 4960 offset916fakeit::VirtualOffsetSelector4961 virtual unsigned int offset916(int) { 4962 return offset = 916; 4963 } 4964 offset917fakeit::VirtualOffsetSelector4965 virtual unsigned int offset917(int) { 4966 return offset = 917; 4967 } 4968 offset918fakeit::VirtualOffsetSelector4969 virtual unsigned int offset918(int) { 4970 return offset = 918; 4971 } 4972 offset919fakeit::VirtualOffsetSelector4973 virtual unsigned int offset919(int) { 4974 return offset = 919; 4975 } 4976 offset920fakeit::VirtualOffsetSelector4977 virtual unsigned int offset920(int) { 4978 return offset = 920; 4979 } 4980 offset921fakeit::VirtualOffsetSelector4981 virtual unsigned int offset921(int) { 4982 return offset = 921; 4983 } 4984 offset922fakeit::VirtualOffsetSelector4985 virtual unsigned int offset922(int) { 4986 return offset = 922; 4987 } 4988 offset923fakeit::VirtualOffsetSelector4989 virtual unsigned int offset923(int) { 4990 return offset = 923; 4991 } 4992 offset924fakeit::VirtualOffsetSelector4993 virtual unsigned int offset924(int) { 4994 return offset = 924; 4995 } 4996 offset925fakeit::VirtualOffsetSelector4997 virtual unsigned int offset925(int) { 4998 return offset = 925; 4999 } 5000 offset926fakeit::VirtualOffsetSelector5001 virtual unsigned int offset926(int) { 5002 return offset = 926; 5003 } 5004 offset927fakeit::VirtualOffsetSelector5005 virtual unsigned int offset927(int) { 5006 return offset = 927; 5007 } 5008 offset928fakeit::VirtualOffsetSelector5009 virtual unsigned int offset928(int) { 5010 return offset = 928; 5011 } 5012 offset929fakeit::VirtualOffsetSelector5013 virtual unsigned int offset929(int) { 5014 return offset = 929; 5015 } 5016 offset930fakeit::VirtualOffsetSelector5017 virtual unsigned int offset930(int) { 5018 return offset = 930; 5019 } 5020 offset931fakeit::VirtualOffsetSelector5021 virtual unsigned int offset931(int) { 5022 return offset = 931; 5023 } 5024 offset932fakeit::VirtualOffsetSelector5025 virtual unsigned int offset932(int) { 5026 return offset = 932; 5027 } 5028 offset933fakeit::VirtualOffsetSelector5029 virtual unsigned int offset933(int) { 5030 return offset = 933; 5031 } 5032 offset934fakeit::VirtualOffsetSelector5033 virtual unsigned int offset934(int) { 5034 return offset = 934; 5035 } 5036 offset935fakeit::VirtualOffsetSelector5037 virtual unsigned int offset935(int) { 5038 return offset = 935; 5039 } 5040 offset936fakeit::VirtualOffsetSelector5041 virtual unsigned int offset936(int) { 5042 return offset = 936; 5043 } 5044 offset937fakeit::VirtualOffsetSelector5045 virtual unsigned int offset937(int) { 5046 return offset = 937; 5047 } 5048 offset938fakeit::VirtualOffsetSelector5049 virtual unsigned int offset938(int) { 5050 return offset = 938; 5051 } 5052 offset939fakeit::VirtualOffsetSelector5053 virtual unsigned int offset939(int) { 5054 return offset = 939; 5055 } 5056 offset940fakeit::VirtualOffsetSelector5057 virtual unsigned int offset940(int) { 5058 return offset = 940; 5059 } 5060 offset941fakeit::VirtualOffsetSelector5061 virtual unsigned int offset941(int) { 5062 return offset = 941; 5063 } 5064 offset942fakeit::VirtualOffsetSelector5065 virtual unsigned int offset942(int) { 5066 return offset = 942; 5067 } 5068 offset943fakeit::VirtualOffsetSelector5069 virtual unsigned int offset943(int) { 5070 return offset = 943; 5071 } 5072 offset944fakeit::VirtualOffsetSelector5073 virtual unsigned int offset944(int) { 5074 return offset = 944; 5075 } 5076 offset945fakeit::VirtualOffsetSelector5077 virtual unsigned int offset945(int) { 5078 return offset = 945; 5079 } 5080 offset946fakeit::VirtualOffsetSelector5081 virtual unsigned int offset946(int) { 5082 return offset = 946; 5083 } 5084 offset947fakeit::VirtualOffsetSelector5085 virtual unsigned int offset947(int) { 5086 return offset = 947; 5087 } 5088 offset948fakeit::VirtualOffsetSelector5089 virtual unsigned int offset948(int) { 5090 return offset = 948; 5091 } 5092 offset949fakeit::VirtualOffsetSelector5093 virtual unsigned int offset949(int) { 5094 return offset = 949; 5095 } 5096 offset950fakeit::VirtualOffsetSelector5097 virtual unsigned int offset950(int) { 5098 return offset = 950; 5099 } 5100 offset951fakeit::VirtualOffsetSelector5101 virtual unsigned int offset951(int) { 5102 return offset = 951; 5103 } 5104 offset952fakeit::VirtualOffsetSelector5105 virtual unsigned int offset952(int) { 5106 return offset = 952; 5107 } 5108 offset953fakeit::VirtualOffsetSelector5109 virtual unsigned int offset953(int) { 5110 return offset = 953; 5111 } 5112 offset954fakeit::VirtualOffsetSelector5113 virtual unsigned int offset954(int) { 5114 return offset = 954; 5115 } 5116 offset955fakeit::VirtualOffsetSelector5117 virtual unsigned int offset955(int) { 5118 return offset = 955; 5119 } 5120 offset956fakeit::VirtualOffsetSelector5121 virtual unsigned int offset956(int) { 5122 return offset = 956; 5123 } 5124 offset957fakeit::VirtualOffsetSelector5125 virtual unsigned int offset957(int) { 5126 return offset = 957; 5127 } 5128 offset958fakeit::VirtualOffsetSelector5129 virtual unsigned int offset958(int) { 5130 return offset = 958; 5131 } 5132 offset959fakeit::VirtualOffsetSelector5133 virtual unsigned int offset959(int) { 5134 return offset = 959; 5135 } 5136 offset960fakeit::VirtualOffsetSelector5137 virtual unsigned int offset960(int) { 5138 return offset = 960; 5139 } 5140 offset961fakeit::VirtualOffsetSelector5141 virtual unsigned int offset961(int) { 5142 return offset = 961; 5143 } 5144 offset962fakeit::VirtualOffsetSelector5145 virtual unsigned int offset962(int) { 5146 return offset = 962; 5147 } 5148 offset963fakeit::VirtualOffsetSelector5149 virtual unsigned int offset963(int) { 5150 return offset = 963; 5151 } 5152 offset964fakeit::VirtualOffsetSelector5153 virtual unsigned int offset964(int) { 5154 return offset = 964; 5155 } 5156 offset965fakeit::VirtualOffsetSelector5157 virtual unsigned int offset965(int) { 5158 return offset = 965; 5159 } 5160 offset966fakeit::VirtualOffsetSelector5161 virtual unsigned int offset966(int) { 5162 return offset = 966; 5163 } 5164 offset967fakeit::VirtualOffsetSelector5165 virtual unsigned int offset967(int) { 5166 return offset = 967; 5167 } 5168 offset968fakeit::VirtualOffsetSelector5169 virtual unsigned int offset968(int) { 5170 return offset = 968; 5171 } 5172 offset969fakeit::VirtualOffsetSelector5173 virtual unsigned int offset969(int) { 5174 return offset = 969; 5175 } 5176 offset970fakeit::VirtualOffsetSelector5177 virtual unsigned int offset970(int) { 5178 return offset = 970; 5179 } 5180 offset971fakeit::VirtualOffsetSelector5181 virtual unsigned int offset971(int) { 5182 return offset = 971; 5183 } 5184 offset972fakeit::VirtualOffsetSelector5185 virtual unsigned int offset972(int) { 5186 return offset = 972; 5187 } 5188 offset973fakeit::VirtualOffsetSelector5189 virtual unsigned int offset973(int) { 5190 return offset = 973; 5191 } 5192 offset974fakeit::VirtualOffsetSelector5193 virtual unsigned int offset974(int) { 5194 return offset = 974; 5195 } 5196 offset975fakeit::VirtualOffsetSelector5197 virtual unsigned int offset975(int) { 5198 return offset = 975; 5199 } 5200 offset976fakeit::VirtualOffsetSelector5201 virtual unsigned int offset976(int) { 5202 return offset = 976; 5203 } 5204 offset977fakeit::VirtualOffsetSelector5205 virtual unsigned int offset977(int) { 5206 return offset = 977; 5207 } 5208 offset978fakeit::VirtualOffsetSelector5209 virtual unsigned int offset978(int) { 5210 return offset = 978; 5211 } 5212 offset979fakeit::VirtualOffsetSelector5213 virtual unsigned int offset979(int) { 5214 return offset = 979; 5215 } 5216 offset980fakeit::VirtualOffsetSelector5217 virtual unsigned int offset980(int) { 5218 return offset = 980; 5219 } 5220 offset981fakeit::VirtualOffsetSelector5221 virtual unsigned int offset981(int) { 5222 return offset = 981; 5223 } 5224 offset982fakeit::VirtualOffsetSelector5225 virtual unsigned int offset982(int) { 5226 return offset = 982; 5227 } 5228 offset983fakeit::VirtualOffsetSelector5229 virtual unsigned int offset983(int) { 5230 return offset = 983; 5231 } 5232 offset984fakeit::VirtualOffsetSelector5233 virtual unsigned int offset984(int) { 5234 return offset = 984; 5235 } 5236 offset985fakeit::VirtualOffsetSelector5237 virtual unsigned int offset985(int) { 5238 return offset = 985; 5239 } 5240 offset986fakeit::VirtualOffsetSelector5241 virtual unsigned int offset986(int) { 5242 return offset = 986; 5243 } 5244 offset987fakeit::VirtualOffsetSelector5245 virtual unsigned int offset987(int) { 5246 return offset = 987; 5247 } 5248 offset988fakeit::VirtualOffsetSelector5249 virtual unsigned int offset988(int) { 5250 return offset = 988; 5251 } 5252 offset989fakeit::VirtualOffsetSelector5253 virtual unsigned int offset989(int) { 5254 return offset = 989; 5255 } 5256 offset990fakeit::VirtualOffsetSelector5257 virtual unsigned int offset990(int) { 5258 return offset = 990; 5259 } 5260 offset991fakeit::VirtualOffsetSelector5261 virtual unsigned int offset991(int) { 5262 return offset = 991; 5263 } 5264 offset992fakeit::VirtualOffsetSelector5265 virtual unsigned int offset992(int) { 5266 return offset = 992; 5267 } 5268 offset993fakeit::VirtualOffsetSelector5269 virtual unsigned int offset993(int) { 5270 return offset = 993; 5271 } 5272 offset994fakeit::VirtualOffsetSelector5273 virtual unsigned int offset994(int) { 5274 return offset = 994; 5275 } 5276 offset995fakeit::VirtualOffsetSelector5277 virtual unsigned int offset995(int) { 5278 return offset = 995; 5279 } 5280 offset996fakeit::VirtualOffsetSelector5281 virtual unsigned int offset996(int) { 5282 return offset = 996; 5283 } 5284 offset997fakeit::VirtualOffsetSelector5285 virtual unsigned int offset997(int) { 5286 return offset = 997; 5287 } 5288 offset998fakeit::VirtualOffsetSelector5289 virtual unsigned int offset998(int) { 5290 return offset = 998; 5291 } 5292 offset999fakeit::VirtualOffsetSelector5293 virtual unsigned int offset999(int) { 5294 return offset = 999; 5295 } 5296 offset1000fakeit::VirtualOffsetSelector5297 virtual unsigned int offset1000(int) { 5298 return offset = 1000; 5299 } 5300 5301 }; 5302 } 5303 namespace fakeit { 5304 5305 template<typename TARGET, typename SOURCE> 5306 TARGET union_cast(SOURCE source) { 5307 5308 union { 5309 SOURCE source; 5310 TARGET target; 5311 } u; 5312 u.source = source; 5313 return u.target; 5314 } 5315 5316 } 5317 5318 namespace fakeit { 5319 class NoVirtualDtor : public std::runtime_error { 5320 public: NoVirtualDtor()5321 NoVirtualDtor() :std::runtime_error("Can't mock the destructor. No virtual destructor was found") {} 5322 }; 5323 5324 class VTUtils { 5325 public: 5326 5327 template<typename C, typename R, typename ... arglist> getOffset(R (C::* vMethod)(arglist...))5328 static unsigned int getOffset(R (C::*vMethod)(arglist...)) { 5329 auto sMethod = reinterpret_cast<unsigned int (VirtualOffsetSelector::*)(int)>(vMethod); 5330 VirtualOffsetSelector offsetSelctor; 5331 return (offsetSelctor.*sMethod)(0); 5332 } 5333 5334 template<typename C> 5335 static typename std::enable_if<std::has_virtual_destructor<C>::value, unsigned int>::type getDestructorOffset()5336 getDestructorOffset() { 5337 VirtualOffsetSelector offsetSelctor; 5338 union_cast<C *>(&offsetSelctor)->~C(); 5339 return offsetSelctor.offset; 5340 } 5341 5342 template<typename C> 5343 static typename std::enable_if<!std::has_virtual_destructor<C>::value, unsigned int>::type getDestructorOffset()5344 getDestructorOffset() { 5345 throw NoVirtualDtor(); 5346 } 5347 5348 template<typename C> 5349 static typename std::enable_if<std::has_virtual_destructor<C>::value, bool>::type hasVirtualDestructor()5350 hasVirtualDestructor() { 5351 return true; 5352 } 5353 5354 template<typename C> 5355 static typename std::enable_if<!std::has_virtual_destructor<C>::value, bool>::type hasVirtualDestructor()5356 hasVirtualDestructor() { 5357 return false; 5358 } 5359 5360 template<typename C> getVTSize()5361 static unsigned int getVTSize() { 5362 struct Derrived : public C { 5363 virtual void endOfVt() { 5364 } 5365 }; 5366 5367 unsigned int vtSize = getOffset(&Derrived::endOfVt); 5368 return vtSize; 5369 } 5370 }; 5371 5372 5373 } 5374 #ifdef _MSC_VER 5375 namespace fakeit { 5376 5377 typedef unsigned long dword_; 5378 5379 struct TypeDescriptor { TypeDescriptorfakeit::TypeDescriptor5380 TypeDescriptor() : 5381 ptrToVTable(0), spare(0) { 5382 5383 int **tiVFTPtr = (int **) (&typeid(void)); 5384 int *i = (int *) tiVFTPtr[0]; 5385 char *type_info_vft_ptr = (char *) i; 5386 ptrToVTable = type_info_vft_ptr; 5387 } 5388 5389 char *ptrToVTable; 5390 dword_ spare; 5391 char name[8]; 5392 }; 5393 5394 struct PMD { 5395 5396 5397 5398 int mdisp; 5399 5400 int pdisp; 5401 int vdisp; 5402 PMDfakeit::PMD5403 PMD() : 5404 mdisp(0), pdisp(-1), vdisp(0) { 5405 } 5406 }; 5407 5408 struct RTTIBaseClassDescriptor { RTTIBaseClassDescriptorfakeit::RTTIBaseClassDescriptor5409 RTTIBaseClassDescriptor() : 5410 pTypeDescriptor(nullptr), numContainedBases(0), attributes(0) { 5411 } 5412 5413 const std::type_info *pTypeDescriptor; 5414 dword_ numContainedBases; 5415 struct PMD where; 5416 dword_ attributes; 5417 }; 5418 5419 template<typename C, typename... baseclasses> 5420 struct RTTIClassHierarchyDescriptor { RTTIClassHierarchyDescriptorfakeit::RTTIClassHierarchyDescriptor5421 RTTIClassHierarchyDescriptor() : 5422 signature(0), 5423 attributes(0), 5424 numBaseClasses(0), 5425 pBaseClassArray(nullptr) { 5426 pBaseClassArray = new RTTIBaseClassDescriptor *[1 + sizeof...(baseclasses)]; 5427 addBaseClass < C, baseclasses...>(); 5428 } 5429 ~RTTIClassHierarchyDescriptorfakeit::RTTIClassHierarchyDescriptor5430 ~RTTIClassHierarchyDescriptor() { 5431 for (int i = 0; i < 1 + sizeof...(baseclasses); i++) { 5432 RTTIBaseClassDescriptor *desc = pBaseClassArray[i]; 5433 delete desc; 5434 } 5435 delete[] pBaseClassArray; 5436 } 5437 5438 dword_ signature; 5439 dword_ attributes; 5440 dword_ numBaseClasses; 5441 RTTIBaseClassDescriptor **pBaseClassArray; 5442 5443 template<typename BaseType> addBaseClassfakeit::RTTIClassHierarchyDescriptor5444 void addBaseClass() { 5445 static_assert(std::is_base_of<BaseType, C>::value, "C must be a derived class of BaseType"); 5446 RTTIBaseClassDescriptor *desc = new RTTIBaseClassDescriptor(); 5447 desc->pTypeDescriptor = &typeid(BaseType); 5448 pBaseClassArray[numBaseClasses] = desc; 5449 for (unsigned int i = 0; i < numBaseClasses; i++) { 5450 pBaseClassArray[i]->numContainedBases++; 5451 } 5452 numBaseClasses++; 5453 } 5454 5455 template<typename head, typename B1, typename... tail> addBaseClassfakeit::RTTIClassHierarchyDescriptor5456 void addBaseClass() { 5457 static_assert(std::is_base_of<B1, head>::value, "invalid inheritance list"); 5458 addBaseClass<head>(); 5459 addBaseClass<B1, tail...>(); 5460 } 5461 5462 }; 5463 5464 template<typename C, typename... baseclasses> 5465 struct RTTICompleteObjectLocator { 5466 #ifdef _WIN64 RTTICompleteObjectLocatorfakeit::RTTICompleteObjectLocator5467 RTTICompleteObjectLocator(const std::type_info &unused) : 5468 signature(0), offset(0), cdOffset(0), 5469 typeDescriptorOffset(0), classDescriptorOffset(0) 5470 { 5471 } 5472 5473 dword_ signature; 5474 dword_ offset; 5475 dword_ cdOffset; 5476 dword_ typeDescriptorOffset; 5477 dword_ classDescriptorOffset; 5478 #else 5479 RTTICompleteObjectLocator(const std::type_info &info) : 5480 signature(0), offset(0), cdOffset(0), 5481 pTypeDescriptor(&info), 5482 pClassDescriptor(new RTTIClassHierarchyDescriptor<C, baseclasses...>()) { 5483 } 5484 5485 ~RTTICompleteObjectLocator() { 5486 delete pClassDescriptor; 5487 } 5488 5489 dword_ signature; 5490 dword_ offset; 5491 dword_ cdOffset; 5492 const std::type_info *pTypeDescriptor; 5493 struct RTTIClassHierarchyDescriptor<C, baseclasses...> *pClassDescriptor; 5494 #endif 5495 }; 5496 5497 5498 struct VirtualTableBase { 5499 getVTablefakeit::VirtualTableBase5500 static VirtualTableBase &getVTable(void *instance) { 5501 fakeit::VirtualTableBase *vt = (fakeit::VirtualTableBase *) (instance); 5502 return *vt; 5503 } 5504 VirtualTableBasefakeit::VirtualTableBase5505 VirtualTableBase(void **firstMethod) : _firstMethod(firstMethod) { } 5506 getCookiefakeit::VirtualTableBase5507 void *getCookie(int index) { 5508 return _firstMethod[-2 - index]; 5509 } 5510 setCookiefakeit::VirtualTableBase5511 void setCookie(int index, void *value) { 5512 _firstMethod[-2 - index] = value; 5513 } 5514 getMethodfakeit::VirtualTableBase5515 void *getMethod(unsigned int index) const { 5516 return _firstMethod[index]; 5517 } 5518 setMethodfakeit::VirtualTableBase5519 void setMethod(unsigned int index, void *method) { 5520 _firstMethod[index] = method; 5521 } 5522 5523 protected: 5524 void **_firstMethod; 5525 }; 5526 5527 template<class C, class... baseclasses> 5528 struct VirtualTable : public VirtualTableBase { 5529 5530 class Handle { 5531 5532 friend struct VirtualTable<C, baseclasses...>; 5533 5534 void **firstMethod; 5535 Handle(void ** method)5536 Handle(void **method) : firstMethod(method) { } 5537 5538 public: 5539 restore()5540 VirtualTable<C, baseclasses...> &restore() { 5541 VirtualTable<C, baseclasses...> *vt = (VirtualTable<C, baseclasses...> *) this; 5542 return *vt; 5543 } 5544 }; 5545 getVTablefakeit::VirtualTable5546 static VirtualTable<C, baseclasses...> &getVTable(C &instance) { 5547 fakeit::VirtualTable<C, baseclasses...> *vt = (fakeit::VirtualTable<C, baseclasses...> *) (&instance); 5548 return *vt; 5549 } 5550 copyFromfakeit::VirtualTable5551 void copyFrom(VirtualTable<C, baseclasses...> &from) { 5552 unsigned int size = VTUtils::getVTSize<C>(); 5553 for (unsigned int i = 0; i < size; i++) { 5554 _firstMethod[i] = from.getMethod(i); 5555 } 5556 } 5557 VirtualTablefakeit::VirtualTable5558 VirtualTable() : VirtualTable(buildVTArray()) { 5559 } 5560 ~VirtualTablefakeit::VirtualTable5561 ~VirtualTable() { 5562 5563 } 5564 disposefakeit::VirtualTable5565 void dispose() { 5566 _firstMethod--; 5567 RTTICompleteObjectLocator<C, baseclasses...> *locator = (RTTICompleteObjectLocator<C, baseclasses...> *) _firstMethod[0]; 5568 delete locator; 5569 _firstMethod -= numOfCookies; 5570 delete[] _firstMethod; 5571 } 5572 5573 dtorfakeit::VirtualTable5574 unsigned int dtor(int) { 5575 C *c = (C *) this; 5576 C &cRef = *c; 5577 auto vt = VirtualTable<C, baseclasses...>::getVTable(cRef); 5578 void *dtorPtr = vt.getCookie(numOfCookies - 1); 5579 void(*method)(C *) = reinterpret_cast<void (*)(C *)>(dtorPtr); 5580 method(c); 5581 return 0; 5582 } 5583 setDtorfakeit::VirtualTable5584 void setDtor(void *method) { 5585 5586 5587 5588 5589 5590 void *dtorPtr = union_cast<void *>(&VirtualTable<C, baseclasses...>::dtor); 5591 unsigned int index = VTUtils::getDestructorOffset<C>(); 5592 _firstMethod[index] = dtorPtr; 5593 setCookie(numOfCookies - 1, method); 5594 } 5595 getSizefakeit::VirtualTable5596 unsigned int getSize() { 5597 return VTUtils::getVTSize<C>(); 5598 } 5599 initAllfakeit::VirtualTable5600 void initAll(void *value) { 5601 auto size = getSize(); 5602 for (unsigned int i = 0; i < size; i++) { 5603 setMethod(i, value); 5604 } 5605 } 5606 createHandlefakeit::VirtualTable5607 Handle createHandle() { 5608 Handle h(_firstMethod); 5609 return h; 5610 } 5611 5612 private: 5613 5614 class SimpleType { 5615 }; 5616 5617 static_assert(sizeof(unsigned int (SimpleType::*)()) == sizeof(unsigned int (C::*)()), 5618 "Can't mock a type with multiple inheritance or with non-polymorphic base class"); 5619 static const unsigned int numOfCookies = 3; 5620 buildVTArrayfakeit::VirtualTable5621 static void **buildVTArray() { 5622 int vtSize = VTUtils::getVTSize<C>(); 5623 auto array = new void *[vtSize + numOfCookies + 1]{}; 5624 RTTICompleteObjectLocator<C, baseclasses...> *objectLocator = new RTTICompleteObjectLocator<C, baseclasses...>( 5625 typeid(C)); 5626 array += numOfCookies; 5627 array[0] = objectLocator; 5628 array++; 5629 return array; 5630 } 5631 VirtualTablefakeit::VirtualTable5632 VirtualTable(void **firstMethod) : VirtualTableBase(firstMethod) { 5633 } 5634 }; 5635 } 5636 #else 5637 #ifndef __clang__ 5638 #include <type_traits> 5639 #include <tr2/type_traits> 5640 5641 namespace fakeit { 5642 template<typename ... T1> 5643 class has_one_base { 5644 }; 5645 5646 template<typename T1, typename T2, typename ... types> 5647 class has_one_base<std::tr2::__reflection_typelist<T1, T2, types...>> : public std::false_type { 5648 }; 5649 5650 template<typename T1> 5651 class has_one_base<std::tr2::__reflection_typelist<T1>> 5652 : public has_one_base<typename std::tr2::direct_bases<T1>::type> { 5653 }; 5654 5655 template<> 5656 class has_one_base<std::tr2::__reflection_typelist<>> : public std::true_type { 5657 }; 5658 5659 template<typename T> 5660 class is_simple_inheritance_layout : public has_one_base<typename std::tr2::direct_bases<T>::type> { 5661 }; 5662 } 5663 5664 #endif 5665 5666 namespace fakeit { 5667 5668 struct VirtualTableBase { 5669 getVTablefakeit::VirtualTableBase5670 static VirtualTableBase &getVTable(void *instance) { 5671 fakeit::VirtualTableBase *vt = (fakeit::VirtualTableBase *) (instance); 5672 return *vt; 5673 } 5674 VirtualTableBasefakeit::VirtualTableBase5675 VirtualTableBase(void **firstMethod) : _firstMethod(firstMethod) { } 5676 getCookiefakeit::VirtualTableBase5677 void *getCookie(int index) { 5678 return _firstMethod[-3 - index]; 5679 } 5680 setCookiefakeit::VirtualTableBase5681 void setCookie(int index, void *value) { 5682 _firstMethod[-3 - index] = value; 5683 } 5684 getMethodfakeit::VirtualTableBase5685 void *getMethod(unsigned int index) const { 5686 return _firstMethod[index]; 5687 } 5688 setMethodfakeit::VirtualTableBase5689 void setMethod(unsigned int index, void *method) { 5690 _firstMethod[index] = method; 5691 } 5692 5693 protected: 5694 void **_firstMethod; 5695 }; 5696 5697 template<class C, class ... baseclasses> 5698 struct VirtualTable : public VirtualTableBase { 5699 5700 #ifndef __clang__ 5701 static_assert(is_simple_inheritance_layout<C>::value, "Can't mock a type with multiple inheritance"); 5702 #endif 5703 5704 class Handle { 5705 5706 friend struct VirtualTable<C, baseclasses...>; 5707 void **firstMethod; 5708 Handle(void ** method)5709 Handle(void **method) : 5710 firstMethod(method) { 5711 } 5712 5713 public: 5714 restore()5715 VirtualTable<C, baseclasses...> &restore() { 5716 VirtualTable<C, baseclasses...> *vt = (VirtualTable<C, baseclasses...> *) this; 5717 return *vt; 5718 } 5719 }; 5720 getVTablefakeit::VirtualTable5721 static VirtualTable<C, baseclasses...> &getVTable(C &instance) { 5722 fakeit::VirtualTable<C, baseclasses...> *vt = (fakeit::VirtualTable<C, baseclasses...> *) (&instance); 5723 return *vt; 5724 } 5725 copyFromfakeit::VirtualTable5726 void copyFrom(VirtualTable<C, baseclasses...> &from) { 5727 unsigned int size = VTUtils::getVTSize<C>(); 5728 5729 for (size_t i = 0; i < size; ++i) { 5730 _firstMethod[i] = from.getMethod(i); 5731 } 5732 } 5733 VirtualTablefakeit::VirtualTable5734 VirtualTable() : 5735 VirtualTable(buildVTArray()) { 5736 } 5737 disposefakeit::VirtualTable5738 void dispose() { 5739 _firstMethod--; 5740 _firstMethod--; 5741 _firstMethod -= numOfCookies; 5742 delete[] _firstMethod; 5743 } 5744 dtorfakeit::VirtualTable5745 unsigned int dtor(int) { 5746 C *c = (C *) this; 5747 C &cRef = *c; 5748 auto vt = VirtualTable<C, baseclasses...>::getVTable(cRef); 5749 unsigned int index = VTUtils::getDestructorOffset<C>(); 5750 void *dtorPtr = vt.getMethod(index); 5751 void(*method)(C *) = union_cast<void (*)(C *)>(dtorPtr); 5752 method(c); 5753 return 0; 5754 } 5755 5756 setDtorfakeit::VirtualTable5757 void setDtor(void *method) { 5758 unsigned int index = VTUtils::getDestructorOffset<C>(); 5759 void *dtorPtr = union_cast<void *>(&VirtualTable<C, baseclasses...>::dtor); 5760 5761 5762 _firstMethod[index] = method; 5763 5764 _firstMethod[index + 1] = dtorPtr; 5765 } 5766 5767 getSizefakeit::VirtualTable5768 unsigned int getSize() { 5769 return VTUtils::getVTSize<C>(); 5770 } 5771 initAllfakeit::VirtualTable5772 void initAll(void *value) { 5773 unsigned int size = getSize(); 5774 for (unsigned int i = 0; i < size; i++) { 5775 setMethod(i, value); 5776 } 5777 } 5778 getTypeIdfakeit::VirtualTable5779 const std::type_info *getTypeId() { 5780 return (const std::type_info *) (_firstMethod[-1]); 5781 } 5782 createHandlefakeit::VirtualTable5783 Handle createHandle() { 5784 Handle h(_firstMethod); 5785 return h; 5786 } 5787 5788 private: 5789 static const unsigned int numOfCookies = 2; 5790 buildVTArrayfakeit::VirtualTable5791 static void **buildVTArray() { 5792 int size = VTUtils::getVTSize<C>(); 5793 auto array = new void *[size + 2 + numOfCookies]{}; 5794 array += numOfCookies; 5795 array++; 5796 array[0] = const_cast<std::type_info *>(&typeid(C)); 5797 array++; 5798 return array; 5799 } 5800 VirtualTablefakeit::VirtualTable5801 VirtualTable(void **firstMethod) : VirtualTableBase(firstMethod) { 5802 } 5803 5804 }; 5805 } 5806 #endif 5807 namespace fakeit { 5808 5809 struct NoMoreRecordedActionException { 5810 }; 5811 5812 template<typename R, typename ... arglist> 5813 struct MethodInvocationHandler : Destructible { 5814 virtual R handleMethodInvocation(const typename fakeit::production_arg<arglist>::type... args) = 0; 5815 }; 5816 5817 } 5818 #include <new> 5819 5820 namespace fakeit { 5821 5822 #ifdef __GNUG__ 5823 #ifndef __clang__ 5824 #pragma GCC diagnostic ignored "-Wpedantic" 5825 #endif 5826 #endif 5827 5828 5829 #ifdef _MSC_VER 5830 #pragma warning( push ) 5831 #pragma warning( disable : 4200 ) 5832 #endif 5833 5834 5835 template<typename C, typename ... baseclasses> 5836 class FakeObject { 5837 5838 VirtualTable<C, baseclasses...> vtable; 5839 5840 static const size_t SIZE = sizeof(C) - sizeof(VirtualTable<C, baseclasses...>); 5841 char instanceArea[SIZE ? SIZE : 0]; 5842 5843 FakeObject(FakeObject const &) = delete; 5844 FakeObject &operator=(FakeObject const &) = delete; 5845 5846 public: 5847 FakeObject()5848 FakeObject() : vtable() { 5849 initializeDataMembersArea(); 5850 } 5851 ~FakeObject()5852 ~FakeObject() { 5853 vtable.dispose(); 5854 } 5855 initializeDataMembersArea()5856 void initializeDataMembersArea() { 5857 for (size_t i = 0; i < SIZE; ++i) instanceArea[i] = (char) 0; 5858 } 5859 setMethod(unsigned int index,void * method)5860 void setMethod(unsigned int index, void *method) { 5861 vtable.setMethod(index, method); 5862 } 5863 getVirtualTable()5864 VirtualTable<C, baseclasses...> &getVirtualTable() { 5865 return vtable; 5866 } 5867 setVirtualTable(VirtualTable<C,baseclasses...> & t)5868 void setVirtualTable(VirtualTable<C, baseclasses...> &t) { 5869 vtable = t; 5870 } 5871 setDtor(void * dtor)5872 void setDtor(void *dtor) { 5873 vtable.setDtor(dtor); 5874 } 5875 }; 5876 5877 #ifdef _MSC_VER 5878 #pragma warning( pop ) 5879 #endif 5880 5881 #ifdef __GNUG__ 5882 #ifndef __clang__ 5883 #pragma GCC diagnostic pop 5884 #endif 5885 #endif 5886 5887 } 5888 namespace fakeit { 5889 5890 struct MethodProxy { 5891 MethodProxyfakeit::MethodProxy5892 MethodProxy(unsigned int id, unsigned int offset, void *vMethod) : 5893 _id(id), 5894 _offset(offset), 5895 _vMethod(vMethod) { 5896 } 5897 getOffsetfakeit::MethodProxy5898 unsigned int getOffset() const { 5899 return _offset; 5900 } 5901 getIdfakeit::MethodProxy5902 unsigned int getId() const { 5903 return _id; 5904 } 5905 getProxyfakeit::MethodProxy5906 void *getProxy() const { 5907 return union_cast<void *>(_vMethod); 5908 } 5909 5910 private: 5911 unsigned int _id; 5912 unsigned int _offset; 5913 void *_vMethod; 5914 }; 5915 } 5916 #include <utility> 5917 5918 5919 namespace fakeit { 5920 5921 struct InvocationHandlerCollection { 5922 static const unsigned int VT_COOKIE_INDEX = 0; 5923 5924 virtual Destructible *getInvocatoinHandlerPtrById(unsigned int index) = 0; 5925 getInvocationHandlerCollectionfakeit::InvocationHandlerCollection5926 static InvocationHandlerCollection *getInvocationHandlerCollection(void *instance) { 5927 VirtualTableBase &vt = VirtualTableBase::getVTable(instance); 5928 InvocationHandlerCollection *invocationHandlerCollection = (InvocationHandlerCollection *) vt.getCookie( 5929 InvocationHandlerCollection::VT_COOKIE_INDEX); 5930 return invocationHandlerCollection; 5931 } 5932 }; 5933 5934 5935 template<typename R, typename ... arglist> 5936 class MethodProxyCreator { 5937 5938 5939 5940 public: 5941 5942 template<unsigned int id> createMethodProxy(unsigned int offset)5943 MethodProxy createMethodProxy(unsigned int offset) { 5944 return MethodProxy(id, offset, union_cast<void *>(&MethodProxyCreator::methodProxyX < id > )); 5945 } 5946 5947 protected: 5948 methodProxy(unsigned int id,const typename fakeit::production_arg<arglist>::type...args)5949 R methodProxy(unsigned int id, const typename fakeit::production_arg<arglist>::type... args) { 5950 InvocationHandlerCollection *invocationHandlerCollection = InvocationHandlerCollection::getInvocationHandlerCollection( 5951 this); 5952 MethodInvocationHandler<R, arglist...> *invocationHandler = 5953 (MethodInvocationHandler<R, arglist...> *) invocationHandlerCollection->getInvocatoinHandlerPtrById( 5954 id); 5955 return invocationHandler->handleMethodInvocation(std::forward<const typename fakeit::production_arg<arglist>::type>(args)...); 5956 } 5957 5958 template<int id> methodProxyX(arglist...args)5959 R methodProxyX(arglist ... args) { 5960 return methodProxy(id, std::forward<const typename fakeit::production_arg<arglist>::type>(args)...); 5961 } 5962 }; 5963 } 5964 5965 namespace fakeit { 5966 5967 class InvocationHandlers : public InvocationHandlerCollection { 5968 std::vector<std::shared_ptr<Destructible>> &_methodMocks; 5969 std::vector<unsigned int> &_offsets; 5970 getOffset(unsigned int id) const5971 unsigned int getOffset(unsigned int id) const 5972 { 5973 unsigned int offset = 0; 5974 for (; offset < _offsets.size(); offset++) { 5975 if (_offsets[offset] == id) { 5976 break; 5977 } 5978 } 5979 return offset; 5980 } 5981 5982 public: InvocationHandlers(std::vector<std::shared_ptr<Destructible>> & methodMocks,std::vector<unsigned int> & offsets)5983 InvocationHandlers( 5984 std::vector<std::shared_ptr<Destructible>> &methodMocks, 5985 std::vector<unsigned int> &offsets) : 5986 _methodMocks(methodMocks), _offsets(offsets) { 5987 for (std::vector<unsigned int>::iterator it = _offsets.begin(); it != _offsets.end(); ++it) 5988 { 5989 *it = std::numeric_limits<int>::max(); 5990 } 5991 } 5992 getInvocatoinHandlerPtrById(unsigned int id)5993 Destructible *getInvocatoinHandlerPtrById(unsigned int id) override { 5994 unsigned int offset = getOffset(id); 5995 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 5996 return ptr.get(); 5997 } 5998 5999 }; 6000 6001 template<typename C, typename ... baseclasses> 6002 struct DynamicProxy { 6003 6004 static_assert(std::is_polymorphic<C>::value, "DynamicProxy requires a polymorphic type"); 6005 DynamicProxyfakeit::DynamicProxy6006 DynamicProxy(C &inst) : 6007 instance(inst), 6008 originalVtHandle(VirtualTable<C, baseclasses...>::getVTable(instance).createHandle()), 6009 _methodMocks(VTUtils::getVTSize<C>()), 6010 _offsets(VTUtils::getVTSize<C>()), 6011 _invocationHandlers(_methodMocks, _offsets) { 6012 _cloneVt.copyFrom(originalVtHandle.restore()); 6013 _cloneVt.setCookie(InvocationHandlerCollection::VT_COOKIE_INDEX, &_invocationHandlers); 6014 getFake().setVirtualTable(_cloneVt); 6015 } 6016 detachfakeit::DynamicProxy6017 void detach() { 6018 getFake().setVirtualTable(originalVtHandle.restore()); 6019 } 6020 ~DynamicProxyfakeit::DynamicProxy6021 ~DynamicProxy() { 6022 _cloneVt.dispose(); 6023 } 6024 getfakeit::DynamicProxy6025 C &get() { 6026 return instance; 6027 } 6028 Resetfakeit::DynamicProxy6029 void Reset() { 6030 _methodMocks = {}; 6031 _methodMocks.resize(VTUtils::getVTSize<C>()); 6032 _members = {}; 6033 _offsets = {}; 6034 _offsets.resize(VTUtils::getVTSize<C>()); 6035 _cloneVt.copyFrom(originalVtHandle.restore()); 6036 } 6037 Clearfakeit::DynamicProxy6038 void Clear() 6039 { 6040 } 6041 6042 template<int id, typename R, typename ... arglist> stubMethodfakeit::DynamicProxy6043 void stubMethod(R(C::*vMethod)(arglist...), MethodInvocationHandler<R, arglist...> *methodInvocationHandler) { 6044 auto offset = VTUtils::getOffset(vMethod); 6045 MethodProxyCreator<R, arglist...> creator; 6046 bind(creator.template createMethodProxy<id + 1>(offset), methodInvocationHandler); 6047 } 6048 stubDtorfakeit::DynamicProxy6049 void stubDtor(MethodInvocationHandler<void> *methodInvocationHandler) { 6050 auto offset = VTUtils::getDestructorOffset<C>(); 6051 MethodProxyCreator<void> creator; 6052 bindDtor(creator.createMethodProxy<0>(offset), methodInvocationHandler); 6053 } 6054 6055 template<typename R, typename ... arglist> isMethodStubbedfakeit::DynamicProxy6056 bool isMethodStubbed(R(C::*vMethod)(arglist...)) { 6057 unsigned int offset = VTUtils::getOffset(vMethod); 6058 return isBinded(offset); 6059 } 6060 isDtorStubbedfakeit::DynamicProxy6061 bool isDtorStubbed() { 6062 unsigned int offset = VTUtils::getDestructorOffset<C>(); 6063 return isBinded(offset); 6064 } 6065 6066 template<typename R, typename ... arglist> getMethodMockfakeit::DynamicProxy6067 Destructible *getMethodMock(R(C::*vMethod)(arglist...)) { 6068 auto offset = VTUtils::getOffset(vMethod); 6069 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6070 return ptr.get(); 6071 } 6072 getDtorMockfakeit::DynamicProxy6073 Destructible *getDtorMock() { 6074 auto offset = VTUtils::getDestructorOffset<C>(); 6075 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6076 return ptr.get(); 6077 } 6078 6079 template<typename DATA_TYPE, typename ... arglist> stubDataMemberfakeit::DynamicProxy6080 void stubDataMember(DATA_TYPE C::*member, const arglist &... initargs) { 6081 DATA_TYPE C::*theMember = (DATA_TYPE C::*) member; 6082 C &mock = get(); 6083 DATA_TYPE *memberPtr = &(mock.*theMember); 6084 _members.push_back( 6085 std::shared_ptr<DataMemeberWrapper < DATA_TYPE, arglist...> > 6086 {new DataMemeberWrapper < DATA_TYPE, arglist...>(memberPtr, 6087 initargs...)}); 6088 } 6089 6090 template<typename DATA_TYPE> getMethodMocksfakeit::DynamicProxy6091 void getMethodMocks(std::vector<DATA_TYPE> &into) const { 6092 for (std::shared_ptr<Destructible> ptr : _methodMocks) { 6093 DATA_TYPE p = dynamic_cast<DATA_TYPE>(ptr.get()); 6094 if (p) { 6095 into.push_back(p); 6096 } 6097 } 6098 } 6099 getOriginalVTfakeit::DynamicProxy6100 VirtualTable<C, baseclasses...> &getOriginalVT() { 6101 VirtualTable<C, baseclasses...> &vt = originalVtHandle.restore(); 6102 return vt; 6103 } 6104 6105 private: 6106 6107 template<typename DATA_TYPE, typename ... arglist> 6108 class DataMemeberWrapper : public Destructible { 6109 private: 6110 DATA_TYPE *dataMember; 6111 public: DataMemeberWrapper(DATA_TYPE * dataMem,const arglist &...initargs)6112 DataMemeberWrapper(DATA_TYPE *dataMem, const arglist &... initargs) : 6113 dataMember(dataMem) { 6114 new(dataMember) DATA_TYPE{initargs ...}; 6115 } 6116 ~DataMemeberWrapper()6117 ~DataMemeberWrapper() override 6118 { 6119 dataMember->~DATA_TYPE(); 6120 } 6121 }; 6122 6123 static_assert(sizeof(C) == sizeof(FakeObject<C, baseclasses...>), "This is a problem"); 6124 6125 C &instance; 6126 typename VirtualTable<C, baseclasses...>::Handle originalVtHandle; 6127 VirtualTable<C, baseclasses...> _cloneVt; 6128 6129 std::vector<std::shared_ptr<Destructible>> _methodMocks; 6130 std::vector<std::shared_ptr<Destructible>> _members; 6131 std::vector<unsigned int> _offsets; 6132 InvocationHandlers _invocationHandlers; 6133 getFakefakeit::DynamicProxy6134 FakeObject<C, baseclasses...> &getFake() { 6135 return reinterpret_cast<FakeObject<C, baseclasses...> &>(instance); 6136 } 6137 bindfakeit::DynamicProxy6138 void bind(const MethodProxy &methodProxy, Destructible *invocationHandler) { 6139 getFake().setMethod(methodProxy.getOffset(), methodProxy.getProxy()); 6140 _methodMocks[methodProxy.getOffset()].reset(invocationHandler); 6141 _offsets[methodProxy.getOffset()] = methodProxy.getId(); 6142 } 6143 bindDtorfakeit::DynamicProxy6144 void bindDtor(const MethodProxy &methodProxy, Destructible *invocationHandler) { 6145 getFake().setDtor(methodProxy.getProxy()); 6146 _methodMocks[methodProxy.getOffset()].reset(invocationHandler); 6147 _offsets[methodProxy.getOffset()] = methodProxy.getId(); 6148 } 6149 6150 template<typename DATA_TYPE> getMethodMockfakeit::DynamicProxy6151 DATA_TYPE getMethodMock(unsigned int offset) { 6152 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6153 return dynamic_cast<DATA_TYPE>(ptr.get()); 6154 } 6155 6156 template<typename BaseClass> checkMultipleInheritancefakeit::DynamicProxy6157 void checkMultipleInheritance() { 6158 C *ptr = (C *) (unsigned int) 1; 6159 BaseClass *basePtr = ptr; 6160 int delta = (unsigned long) basePtr - (unsigned long) ptr; 6161 if (delta > 0) { 6162 6163 6164 throw std::invalid_argument(std::string("multiple inheritance is not supported")); 6165 } 6166 } 6167 isBindedfakeit::DynamicProxy6168 bool isBinded(unsigned int offset) { 6169 std::shared_ptr<Destructible> ptr = _methodMocks[offset]; 6170 return ptr.get() != nullptr; 6171 } 6172 6173 }; 6174 } 6175 #include <functional> 6176 #include <type_traits> 6177 #include <memory> 6178 #include <iosfwd> 6179 #include <vector> 6180 #include <functional> 6181 #include <tuple> 6182 #include <tuple> 6183 6184 namespace fakeit { 6185 6186 template<int N> 6187 struct apply_func { 6188 template<typename R, typename ... ArgsF, typename ... ArgsT, typename ... Args> applyTuplefakeit::apply_func6189 static R applyTuple(std::function<R(ArgsF &...)> f, std::tuple<ArgsT...> &t, Args &... args) { 6190 return apply_func<N - 1>::template applyTuple(f, t, std::get<N - 1>(t), args...); 6191 } 6192 }; 6193 6194 template<> 6195 struct apply_func < 0 > { 6196 template<typename R, typename ... ArgsF, typename ... ArgsT, typename ... Args> applyTuplefakeit::apply_func6197 static R applyTuple(std::function<R(ArgsF &...)> f, std::tuple<ArgsT...> & , Args &... args) { 6198 return f(args...); 6199 } 6200 }; 6201 6202 struct TupleDispatcher { 6203 6204 template<typename R, typename ... ArgsF, typename ... ArgsT> applyTuplefakeit::TupleDispatcher6205 static R applyTuple(std::function<R(ArgsF &...)> f, std::tuple<ArgsT...> &t) { 6206 return apply_func<sizeof...(ArgsT)>::template applyTuple(f, t); 6207 } 6208 6209 template<typename R, typename ...arglist> invokefakeit::TupleDispatcher6210 static R invoke(std::function<R(arglist &...)> func, const std::tuple<arglist...> &arguments) { 6211 std::tuple<arglist...> &args = const_cast<std::tuple<arglist...> &>(arguments); 6212 return applyTuple(func, args); 6213 } 6214 6215 template<typename TupleType, typename FunctionType> for_eachfakeit::TupleDispatcher6216 static void for_each(TupleType &&, FunctionType &, 6217 std::integral_constant<size_t, std::tuple_size<typename std::remove_reference<TupleType>::type>::value>) { 6218 } 6219 6220 template<std::size_t I, typename TupleType, typename FunctionType, typename = typename std::enable_if< 6221 I != std::tuple_size<typename std::remove_reference<TupleType>::type>::value>::type> for_eachfakeit::TupleDispatcher6222 static void for_each(TupleType &&t, FunctionType &f, std::integral_constant<size_t, I>) { 6223 f(I, std::get < I >(t)); 6224 for_each(std::forward < TupleType >(t), f, std::integral_constant<size_t, I + 1>()); 6225 } 6226 6227 template<typename TupleType, typename FunctionType> for_eachfakeit::TupleDispatcher6228 static void for_each(TupleType &&t, FunctionType &f) { 6229 for_each(std::forward < TupleType >(t), f, std::integral_constant<size_t, 0>()); 6230 } 6231 6232 template<typename TupleType1, typename TupleType2, typename FunctionType> for_eachfakeit::TupleDispatcher6233 static void for_each(TupleType1 &&, TupleType2 &&, FunctionType &, 6234 std::integral_constant<size_t, std::tuple_size<typename std::remove_reference<TupleType1>::type>::value>) { 6235 } 6236 6237 template<std::size_t I, typename TupleType1, typename TupleType2, typename FunctionType, typename = typename std::enable_if< 6238 I != std::tuple_size<typename std::remove_reference<TupleType1>::type>::value>::type> for_eachfakeit::TupleDispatcher6239 static void for_each(TupleType1 &&t, TupleType2 &&t2, FunctionType &f, std::integral_constant<size_t, I>) { 6240 f(I, std::get < I >(t), std::get < I >(t2)); 6241 for_each(std::forward < TupleType1 >(t), std::forward < TupleType2 >(t2), f, std::integral_constant<size_t, I + 1>()); 6242 } 6243 6244 template<typename TupleType1, typename TupleType2, typename FunctionType> for_eachfakeit::TupleDispatcher6245 static void for_each(TupleType1 &&t, TupleType2 &&t2, FunctionType &f) { 6246 for_each(std::forward < TupleType1 >(t), std::forward < TupleType2 >(t2), f, std::integral_constant<size_t, 0>()); 6247 } 6248 }; 6249 } 6250 namespace fakeit { 6251 6252 template<typename R, typename ... arglist> 6253 struct ActualInvocationHandler : Destructible { 6254 virtual R handleMethodInvocation(ArgumentsTuple<arglist...> & args) = 0; 6255 }; 6256 6257 } 6258 #include <functional> 6259 #include <tuple> 6260 #include <string> 6261 #include <iosfwd> 6262 #include <type_traits> 6263 #include <typeinfo> 6264 6265 namespace fakeit { 6266 6267 struct DefaultValueInstatiationException { 6268 virtual ~DefaultValueInstatiationException() = default; 6269 6270 virtual std::string what() const = 0; 6271 }; 6272 6273 6274 template<class C> 6275 struct is_constructible_type { 6276 static const bool value = 6277 std::is_default_constructible<typename naked_type<C>::type>::value 6278 && !std::is_abstract<typename naked_type<C>::type>::value; 6279 }; 6280 6281 template<class C, class Enable = void> 6282 struct DefaultValue; 6283 6284 template<class C> 6285 struct DefaultValue<C, typename std::enable_if<!is_constructible_type<C>::value>::type> { valuefakeit::DefaultValue6286 static C &value() { 6287 if (std::is_reference<C>::value) { 6288 typename naked_type<C>::type *ptr = nullptr; 6289 return *ptr; 6290 } 6291 6292 class Exception : public DefaultValueInstatiationException { 6293 virtual std::string what() const 6294 6295 override { 6296 return (std::string("Type ") + std::string(typeid(C).name()) 6297 + std::string( 6298 " is not default constructible. Could not instantiate a default return value")).c_str(); 6299 } 6300 }; 6301 6302 throw Exception(); 6303 } 6304 }; 6305 6306 template<class C> 6307 struct DefaultValue<C, typename std::enable_if<is_constructible_type<C>::value>::type> { valuefakeit::DefaultValue6308 static C &value() { 6309 static typename naked_type<C>::type val{}; 6310 return val; 6311 } 6312 }; 6313 6314 6315 template<> 6316 struct DefaultValue<void> { valuefakeit::DefaultValue6317 static void value() { 6318 return; 6319 } 6320 }; 6321 6322 template<> 6323 struct DefaultValue<bool> { valuefakeit::DefaultValue6324 static bool &value() { 6325 static bool value{false}; 6326 return value; 6327 } 6328 }; 6329 6330 template<> 6331 struct DefaultValue<char> { valuefakeit::DefaultValue6332 static char &value() { 6333 static char value{0}; 6334 return value; 6335 } 6336 }; 6337 6338 template<> 6339 struct DefaultValue<char16_t> { valuefakeit::DefaultValue6340 static char16_t &value() { 6341 static char16_t value{0}; 6342 return value; 6343 } 6344 }; 6345 6346 template<> 6347 struct DefaultValue<char32_t> { valuefakeit::DefaultValue6348 static char32_t &value() { 6349 static char32_t value{0}; 6350 return value; 6351 } 6352 }; 6353 6354 template<> 6355 struct DefaultValue<wchar_t> { valuefakeit::DefaultValue6356 static wchar_t &value() { 6357 static wchar_t value{0}; 6358 return value; 6359 } 6360 }; 6361 6362 template<> 6363 struct DefaultValue<short> { valuefakeit::DefaultValue6364 static short &value() { 6365 static short value{0}; 6366 return value; 6367 } 6368 }; 6369 6370 template<> 6371 struct DefaultValue<int> { valuefakeit::DefaultValue6372 static int &value() { 6373 static int value{0}; 6374 return value; 6375 } 6376 }; 6377 6378 template<> 6379 struct DefaultValue<long> { valuefakeit::DefaultValue6380 static long &value() { 6381 static long value{0}; 6382 return value; 6383 } 6384 }; 6385 6386 template<> 6387 struct DefaultValue<long long> { valuefakeit::DefaultValue6388 static long long &value() { 6389 static long long value{0}; 6390 return value; 6391 } 6392 }; 6393 6394 template<> 6395 struct DefaultValue<std::string> { valuefakeit::DefaultValue6396 static std::string &value() { 6397 static std::string value{}; 6398 return value; 6399 } 6400 }; 6401 6402 } 6403 namespace fakeit { 6404 6405 struct IMatcher : Destructible { 6406 ~IMatcher() = default; 6407 virtual std::string format() const = 0; 6408 }; 6409 6410 template<typename T> 6411 struct TypedMatcher : IMatcher { 6412 virtual bool matches(const T &actual) const = 0; 6413 }; 6414 6415 template<typename T> 6416 struct TypedMatcherCreator { 6417 6418 virtual ~TypedMatcherCreator() = default; 6419 6420 virtual TypedMatcher<T> *createMatcher() const = 0; 6421 }; 6422 6423 template<typename T> 6424 struct ComparisonMatcherCreator : public TypedMatcherCreator<T> { 6425 6426 virtual ~ComparisonMatcherCreator() = default; 6427 ComparisonMatcherCreatorfakeit::ComparisonMatcherCreator6428 ComparisonMatcherCreator(const T &arg) 6429 : _expected(arg) { 6430 } 6431 6432 struct Matcher : public TypedMatcher<T> { Matcherfakeit::ComparisonMatcherCreator::Matcher6433 Matcher(const T &expected) 6434 : _expected(expected) { 6435 } 6436 6437 const T _expected; 6438 }; 6439 6440 const T &_expected; 6441 }; 6442 6443 namespace internal { 6444 template<typename T> 6445 struct TypedAnyMatcher : public TypedMatcherCreator<T> { 6446 6447 virtual ~TypedAnyMatcher() = default; 6448 TypedAnyMatcherfakeit::internal::TypedAnyMatcher6449 TypedAnyMatcher() { 6450 } 6451 6452 struct Matcher : public TypedMatcher<T> { matchesfakeit::internal::TypedAnyMatcher::Matcher6453 virtual bool matches(const T &) const override { 6454 return true; 6455 } 6456 formatfakeit::internal::TypedAnyMatcher::Matcher6457 virtual std::string format() const override { 6458 return "Any"; 6459 } 6460 }; 6461 createMatcherfakeit::internal::TypedAnyMatcher6462 virtual TypedMatcher<T> *createMatcher() const override { 6463 return new Matcher(); 6464 } 6465 6466 }; 6467 6468 template<typename T> 6469 struct EqMatcherCreator : public ComparisonMatcherCreator<T> { 6470 6471 virtual ~EqMatcherCreator() = default; 6472 EqMatcherCreatorfakeit::internal::EqMatcherCreator6473 EqMatcherCreator(const T &expected) 6474 : ComparisonMatcherCreator<T>(expected) { 6475 } 6476 6477 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { Matcherfakeit::internal::EqMatcherCreator::Matcher6478 Matcher(const T &expected) 6479 : ComparisonMatcherCreator<T>::Matcher(expected) { 6480 } 6481 formatfakeit::internal::EqMatcherCreator::Matcher6482 virtual std::string format() const override { 6483 return TypeFormatter<T>::format(this->_expected); 6484 } 6485 matchesfakeit::internal::EqMatcherCreator::Matcher6486 virtual bool matches(const T &actual) const override { 6487 return actual == this->_expected; 6488 } 6489 }; 6490 createMatcherfakeit::internal::EqMatcherCreator6491 virtual TypedMatcher<T> *createMatcher() const { 6492 return new Matcher(this->_expected); 6493 } 6494 6495 }; 6496 6497 template<typename T> 6498 struct GtMatcherCreator : public ComparisonMatcherCreator<T> { 6499 6500 virtual ~GtMatcherCreator() = default; 6501 GtMatcherCreatorfakeit::internal::GtMatcherCreator6502 GtMatcherCreator(const T &expected) 6503 : ComparisonMatcherCreator<T>(expected) { 6504 } 6505 6506 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { Matcherfakeit::internal::GtMatcherCreator::Matcher6507 Matcher(const T &expected) 6508 : ComparisonMatcherCreator<T>::Matcher(expected) { 6509 } 6510 matchesfakeit::internal::GtMatcherCreator::Matcher6511 virtual bool matches(const T &actual) const override { 6512 return actual > this->_expected; 6513 } 6514 formatfakeit::internal::GtMatcherCreator::Matcher6515 virtual std::string format() const override { 6516 return std::string(">") + TypeFormatter<T>::format(this->_expected); 6517 } 6518 }; 6519 createMatcherfakeit::internal::GtMatcherCreator6520 virtual TypedMatcher<T> *createMatcher() const override { 6521 return new Matcher(this->_expected); 6522 } 6523 }; 6524 6525 template<typename T> 6526 struct GeMatcherCreator : public ComparisonMatcherCreator<T> { 6527 6528 virtual ~GeMatcherCreator() = default; 6529 GeMatcherCreatorfakeit::internal::GeMatcherCreator6530 GeMatcherCreator(const T &expected) 6531 : ComparisonMatcherCreator<T>(expected) { 6532 } 6533 6534 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { Matcherfakeit::internal::GeMatcherCreator::Matcher6535 Matcher(const T &expected) 6536 : ComparisonMatcherCreator<T>::Matcher(expected) { 6537 } 6538 matchesfakeit::internal::GeMatcherCreator::Matcher6539 virtual bool matches(const T &actual) const override { 6540 return actual >= this->_expected; 6541 } 6542 formatfakeit::internal::GeMatcherCreator::Matcher6543 virtual std::string format() const override { 6544 return std::string(">=") + TypeFormatter<T>::format(this->_expected); 6545 } 6546 }; 6547 createMatcherfakeit::internal::GeMatcherCreator6548 virtual TypedMatcher<T> *createMatcher() const override { 6549 return new Matcher(this->_expected); 6550 } 6551 }; 6552 6553 template<typename T> 6554 struct LtMatcherCreator : public ComparisonMatcherCreator<T> { 6555 6556 virtual ~LtMatcherCreator() = default; 6557 LtMatcherCreatorfakeit::internal::LtMatcherCreator6558 LtMatcherCreator(const T &expected) 6559 : ComparisonMatcherCreator<T>(expected) { 6560 } 6561 6562 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { Matcherfakeit::internal::LtMatcherCreator::Matcher6563 Matcher(const T &expected) 6564 : ComparisonMatcherCreator<T>::Matcher(expected) { 6565 } 6566 matchesfakeit::internal::LtMatcherCreator::Matcher6567 virtual bool matches(const T &actual) const override { 6568 return actual < this->_expected; 6569 } 6570 formatfakeit::internal::LtMatcherCreator::Matcher6571 virtual std::string format() const override { 6572 return std::string("<") + TypeFormatter<T>::format(this->_expected); 6573 } 6574 }; 6575 createMatcherfakeit::internal::LtMatcherCreator6576 virtual TypedMatcher<T> *createMatcher() const override { 6577 return new Matcher(this->_expected); 6578 } 6579 6580 }; 6581 6582 template<typename T> 6583 struct LeMatcherCreator : public ComparisonMatcherCreator<T> { 6584 6585 virtual ~LeMatcherCreator() = default; 6586 LeMatcherCreatorfakeit::internal::LeMatcherCreator6587 LeMatcherCreator(const T &expected) 6588 : ComparisonMatcherCreator<T>(expected) { 6589 } 6590 6591 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { Matcherfakeit::internal::LeMatcherCreator::Matcher6592 Matcher(const T &expected) 6593 : ComparisonMatcherCreator<T>::Matcher(expected) { 6594 } 6595 matchesfakeit::internal::LeMatcherCreator::Matcher6596 virtual bool matches(const T &actual) const override { 6597 return actual <= this->_expected; 6598 } 6599 formatfakeit::internal::LeMatcherCreator::Matcher6600 virtual std::string format() const override { 6601 return std::string("<=") + TypeFormatter<T>::format(this->_expected); 6602 } 6603 }; 6604 createMatcherfakeit::internal::LeMatcherCreator6605 virtual TypedMatcher<T> *createMatcher() const override { 6606 return new Matcher(this->_expected); 6607 } 6608 6609 }; 6610 6611 template<typename T> 6612 struct NeMatcherCreator : public ComparisonMatcherCreator<T> { 6613 6614 virtual ~NeMatcherCreator() = default; 6615 NeMatcherCreatorfakeit::internal::NeMatcherCreator6616 NeMatcherCreator(const T &expected) 6617 : ComparisonMatcherCreator<T>(expected) { 6618 } 6619 6620 struct Matcher : public ComparisonMatcherCreator<T>::Matcher { Matcherfakeit::internal::NeMatcherCreator::Matcher6621 Matcher(const T &expected) 6622 : ComparisonMatcherCreator<T>::Matcher(expected) { 6623 } 6624 matchesfakeit::internal::NeMatcherCreator::Matcher6625 virtual bool matches(const T &actual) const override { 6626 return actual != this->_expected; 6627 } 6628 formatfakeit::internal::NeMatcherCreator::Matcher6629 virtual std::string format() const override { 6630 return std::string("!=") + TypeFormatter<T>::format(this->_expected); 6631 } 6632 6633 }; 6634 createMatcherfakeit::internal::NeMatcherCreator6635 virtual TypedMatcher<T> *createMatcher() const override { 6636 return new Matcher(this->_expected); 6637 } 6638 6639 }; 6640 } 6641 6642 struct AnyMatcher { 6643 } static _; 6644 6645 template<typename T> Any()6646 internal::TypedAnyMatcher<T> Any() { 6647 internal::TypedAnyMatcher<T> rv; 6648 return rv; 6649 } 6650 6651 template<typename T> Eq(const T & arg)6652 internal::EqMatcherCreator<T> Eq(const T &arg) { 6653 internal::EqMatcherCreator<T> rv(arg); 6654 return rv; 6655 } 6656 6657 template<typename T> Gt(const T & arg)6658 internal::GtMatcherCreator<T> Gt(const T &arg) { 6659 internal::GtMatcherCreator<T> rv(arg); 6660 return rv; 6661 } 6662 6663 template<typename T> Ge(const T & arg)6664 internal::GeMatcherCreator<T> Ge(const T &arg) { 6665 internal::GeMatcherCreator<T> rv(arg); 6666 return rv; 6667 } 6668 6669 template<typename T> Lt(const T & arg)6670 internal::LtMatcherCreator<T> Lt(const T &arg) { 6671 internal::LtMatcherCreator<T> rv(arg); 6672 return rv; 6673 } 6674 6675 template<typename T> Le(const T & arg)6676 internal::LeMatcherCreator<T> Le(const T &arg) { 6677 internal::LeMatcherCreator<T> rv(arg); 6678 return rv; 6679 } 6680 6681 template<typename T> Ne(const T & arg)6682 internal::NeMatcherCreator<T> Ne(const T &arg) { 6683 internal::NeMatcherCreator<T> rv(arg); 6684 return rv; 6685 } 6686 6687 } 6688 6689 namespace fakeit { 6690 6691 template<typename ... arglist> 6692 struct ArgumentsMatcherInvocationMatcher : public ActualInvocation<arglist...>::Matcher { 6693 ~ArgumentsMatcherInvocationMatcherfakeit::ArgumentsMatcherInvocationMatcher6694 virtual ~ArgumentsMatcherInvocationMatcher() { 6695 for (unsigned int i = 0; i < _matchers.size(); i++) 6696 delete _matchers[i]; 6697 } 6698 ArgumentsMatcherInvocationMatcherfakeit::ArgumentsMatcherInvocationMatcher6699 ArgumentsMatcherInvocationMatcher(const std::vector<Destructible *> &args) 6700 : _matchers(args) { 6701 } 6702 matchesfakeit::ArgumentsMatcherInvocationMatcher6703 virtual bool matches(ActualInvocation<arglist...> &invocation) override { 6704 if (invocation.getActualMatcher() == this) 6705 return true; 6706 return matches(invocation.getActualArguments()); 6707 } 6708 formatfakeit::ArgumentsMatcherInvocationMatcher6709 virtual std::string format() const override { 6710 std::ostringstream out; 6711 out << "("; 6712 for (unsigned int i = 0; i < _matchers.size(); i++) { 6713 if (i > 0) out << ", "; 6714 IMatcher *m = dynamic_cast<IMatcher *>(_matchers[i]); 6715 out << m->format(); 6716 } 6717 out << ")"; 6718 return out.str(); 6719 } 6720 6721 private: 6722 6723 struct MatchingLambda { MatchingLambdafakeit::ArgumentsMatcherInvocationMatcher::MatchingLambda6724 MatchingLambda(const std::vector<Destructible *> &matchers) 6725 : _matchers(matchers) { 6726 } 6727 6728 template<typename A> operator ()fakeit::ArgumentsMatcherInvocationMatcher::MatchingLambda6729 void operator()(int index, A &actualArg) { 6730 TypedMatcher<typename naked_type<A>::type> *matcher = 6731 dynamic_cast<TypedMatcher<typename naked_type<A>::type> *>(_matchers[index]); 6732 if (_matching) 6733 _matching = matcher->matches(actualArg); 6734 } 6735 isMatchingfakeit::ArgumentsMatcherInvocationMatcher::MatchingLambda6736 bool isMatching() { 6737 return _matching; 6738 } 6739 6740 private: 6741 bool _matching = true; 6742 const std::vector<Destructible *> &_matchers; 6743 }; 6744 matchesfakeit::ArgumentsMatcherInvocationMatcher6745 virtual bool matches(ArgumentsTuple<arglist...>& actualArguments) { 6746 MatchingLambda l(_matchers); 6747 fakeit::TupleDispatcher::for_each(actualArguments, l); 6748 return l.isMatching(); 6749 } 6750 6751 const std::vector<Destructible *> _matchers; 6752 }; 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 template<typename ... arglist> 6786 struct UserDefinedInvocationMatcher : ActualInvocation<arglist...>::Matcher { 6787 virtual ~UserDefinedInvocationMatcher() = default; 6788 UserDefinedInvocationMatcherfakeit::UserDefinedInvocationMatcher6789 UserDefinedInvocationMatcher(std::function<bool(arglist &...)> match) 6790 : matcher{match} { 6791 } 6792 matchesfakeit::UserDefinedInvocationMatcher6793 virtual bool matches(ActualInvocation<arglist...> &invocation) override { 6794 if (invocation.getActualMatcher() == this) 6795 return true; 6796 return matches(invocation.getActualArguments()); 6797 } 6798 formatfakeit::UserDefinedInvocationMatcher6799 virtual std::string format() const override { 6800 return {"( user defined matcher )"}; 6801 } 6802 6803 private: matchesfakeit::UserDefinedInvocationMatcher6804 virtual bool matches(ArgumentsTuple<arglist...>& actualArguments) { 6805 return TupleDispatcher::invoke<bool, typename tuple_arg<arglist>::type...>(matcher, actualArguments); 6806 } 6807 6808 const std::function<bool(arglist &...)> matcher; 6809 }; 6810 6811 template<typename ... arglist> 6812 struct DefaultInvocationMatcher : public ActualInvocation<arglist...>::Matcher { 6813 6814 virtual ~DefaultInvocationMatcher() = default; 6815 DefaultInvocationMatcherfakeit::DefaultInvocationMatcher6816 DefaultInvocationMatcher() { 6817 } 6818 matchesfakeit::DefaultInvocationMatcher6819 virtual bool matches(ActualInvocation<arglist...> &invocation) override { 6820 return matches(invocation.getActualArguments()); 6821 } 6822 formatfakeit::DefaultInvocationMatcher6823 virtual std::string format() const override { 6824 return {"( Any arguments )"}; 6825 } 6826 6827 private: 6828 matchesfakeit::DefaultInvocationMatcher6829 virtual bool matches(const ArgumentsTuple<arglist...>&) { 6830 return true; 6831 } 6832 }; 6833 6834 } 6835 6836 namespace fakeit { 6837 6838 6839 template<typename R, typename ... arglist> 6840 class RecordedMethodBody : public MethodInvocationHandler<R, arglist...>, public ActualInvocationsSource, public ActualInvocationsContainer { 6841 6842 struct MatchedInvocationHandler : ActualInvocationHandler<R, arglist...> { 6843 6844 virtual ~MatchedInvocationHandler() = default; 6845 MatchedInvocationHandlerfakeit::RecordedMethodBody::MatchedInvocationHandler6846 MatchedInvocationHandler(typename ActualInvocation<arglist...>::Matcher *matcher, 6847 ActualInvocationHandler<R, arglist...> *invocationHandler) : 6848 _matcher{matcher}, _invocationHandler{invocationHandler} { 6849 } 6850 handleMethodInvocationfakeit::RecordedMethodBody::MatchedInvocationHandler6851 virtual R handleMethodInvocation(ArgumentsTuple<arglist...> & args) override 6852 { 6853 Destructible &destructable = *_invocationHandler; 6854 ActualInvocationHandler<R, arglist...> &invocationHandler = dynamic_cast<ActualInvocationHandler<R, arglist...> &>(destructable); 6855 return invocationHandler.handleMethodInvocation(args); 6856 } 6857 getMatcherfakeit::RecordedMethodBody::MatchedInvocationHandler6858 typename ActualInvocation<arglist...>::Matcher &getMatcher() const { 6859 Destructible &destructable = *_matcher; 6860 typename ActualInvocation<arglist...>::Matcher &matcher = dynamic_cast<typename ActualInvocation<arglist...>::Matcher &>(destructable); 6861 return matcher; 6862 } 6863 6864 private: 6865 std::shared_ptr<Destructible> _matcher; 6866 std::shared_ptr<Destructible> _invocationHandler; 6867 }; 6868 6869 6870 FakeitContext &_fakeit; 6871 MethodInfo _method; 6872 6873 std::vector<std::shared_ptr<Destructible>> _invocationHandlers; 6874 std::vector<std::shared_ptr<Destructible>> _actualInvocations; 6875 buildMatchedInvocationHandler(typename ActualInvocation<arglist...>::Matcher * invocationMatcher,ActualInvocationHandler<R,arglist...> * invocationHandler)6876 MatchedInvocationHandler *buildMatchedInvocationHandler( 6877 typename ActualInvocation<arglist...>::Matcher *invocationMatcher, 6878 ActualInvocationHandler<R, arglist...> *invocationHandler) { 6879 return new MatchedInvocationHandler(invocationMatcher, invocationHandler); 6880 } 6881 getInvocationHandlerForActualArgs(ActualInvocation<arglist...> & invocation)6882 MatchedInvocationHandler *getInvocationHandlerForActualArgs(ActualInvocation<arglist...> &invocation) { 6883 for (auto i = _invocationHandlers.rbegin(); i != _invocationHandlers.rend(); ++i) { 6884 std::shared_ptr<Destructible> curr = *i; 6885 Destructible &destructable = *curr; 6886 MatchedInvocationHandler &im = asMatchedInvocationHandler(destructable); 6887 if (im.getMatcher().matches(invocation)) { 6888 return &im; 6889 } 6890 } 6891 return nullptr; 6892 } 6893 asMatchedInvocationHandler(Destructible & destructable)6894 MatchedInvocationHandler &asMatchedInvocationHandler(Destructible &destructable) { 6895 MatchedInvocationHandler &im = dynamic_cast<MatchedInvocationHandler &>(destructable); 6896 return im; 6897 } 6898 asActualInvocation(Destructible & destructable) const6899 ActualInvocation<arglist...> &asActualInvocation(Destructible &destructable) const { 6900 ActualInvocation<arglist...> &invocation = dynamic_cast<ActualInvocation<arglist...> &>(destructable); 6901 return invocation; 6902 } 6903 6904 public: 6905 RecordedMethodBody(FakeitContext & fakeit,std::string name)6906 RecordedMethodBody(FakeitContext &fakeit, std::string name) : 6907 _fakeit(fakeit), _method{MethodInfo::nextMethodOrdinal(), name} { } 6908 ~RecordedMethodBody()6909 virtual ~RecordedMethodBody() NO_THROWS { 6910 } 6911 getMethod()6912 MethodInfo &getMethod() { 6913 return _method; 6914 } 6915 isOfMethod(MethodInfo & method)6916 bool isOfMethod(MethodInfo &method) { 6917 6918 return method.id() == _method.id(); 6919 } 6920 addMethodInvocationHandler(typename ActualInvocation<arglist...>::Matcher * matcher,ActualInvocationHandler<R,arglist...> * invocationHandler)6921 void addMethodInvocationHandler(typename ActualInvocation<arglist...>::Matcher *matcher, 6922 ActualInvocationHandler<R, arglist...> *invocationHandler) { 6923 ActualInvocationHandler<R, arglist...> *mock = buildMatchedInvocationHandler(matcher, invocationHandler); 6924 std::shared_ptr<Destructible> destructable{mock}; 6925 _invocationHandlers.push_back(destructable); 6926 } 6927 reset()6928 void reset() { 6929 _invocationHandlers.clear(); 6930 _actualInvocations.clear(); 6931 } 6932 clear()6933 void clear() override { 6934 _actualInvocations.clear(); 6935 } 6936 handleMethodInvocation(const typename fakeit::production_arg<arglist>::type...args)6937 R handleMethodInvocation(const typename fakeit::production_arg<arglist>::type... args) override { 6938 unsigned int ordinal = Invocation::nextInvocationOrdinal(); 6939 MethodInfo &method = this->getMethod(); 6940 auto actualInvocation = new ActualInvocation<arglist...>(ordinal, method, std::forward<const typename fakeit::production_arg<arglist>::type>(args)...); 6941 6942 6943 std::shared_ptr<Destructible> actualInvocationDtor{actualInvocation}; 6944 6945 auto invocationHandler = getInvocationHandlerForActualArgs(*actualInvocation); 6946 if (invocationHandler) { 6947 auto &matcher = invocationHandler->getMatcher(); 6948 actualInvocation->setActualMatcher(&matcher); 6949 _actualInvocations.push_back(actualInvocationDtor); 6950 try { 6951 return invocationHandler->handleMethodInvocation(actualInvocation->getActualArguments()); 6952 } catch (NoMoreRecordedActionException &) { 6953 } 6954 } 6955 6956 UnexpectedMethodCallEvent event(UnexpectedType::Unmatched, *actualInvocation); 6957 _fakeit.handle(event); 6958 std::string format{_fakeit.format(event)}; 6959 UnexpectedMethodCallException e(format); 6960 throw e; 6961 } 6962 scanActualInvocations(const std::function<void (ActualInvocation<arglist...> &)> & scanner)6963 void scanActualInvocations(const std::function<void(ActualInvocation<arglist...> &)> &scanner) { 6964 for (auto destructablePtr : _actualInvocations) { 6965 ActualInvocation<arglist...> &invocation = asActualInvocation(*destructablePtr); 6966 scanner(invocation); 6967 } 6968 } 6969 getActualInvocations(std::unordered_set<Invocation * > & into) const6970 void getActualInvocations(std::unordered_set<Invocation *> &into) const override { 6971 for (auto destructablePtr : _actualInvocations) { 6972 Invocation &invocation = asActualInvocation(*destructablePtr); 6973 into.insert(&invocation); 6974 } 6975 } 6976 setMethodDetails(const std::string & mockName,const std::string & methodName)6977 void setMethodDetails(const std::string &mockName, const std::string &methodName) { 6978 const std::string fullName{mockName + "." + methodName}; 6979 _method.setName(fullName); 6980 } 6981 6982 }; 6983 6984 } 6985 #include <functional> 6986 #include <type_traits> 6987 #include <stdexcept> 6988 #include <utility> 6989 #include <functional> 6990 #include <type_traits> 6991 6992 namespace fakeit { 6993 6994 struct Quantity { Quantityfakeit::Quantity6995 Quantity(const int q) : 6996 quantity(q) { 6997 } 6998 6999 const int quantity; 7000 } static Once(1); 7001 7002 template<typename R> 7003 struct Quantifier : public Quantity { Quantifierfakeit::Quantifier7004 Quantifier(const int q, const R &val) : 7005 Quantity(q), value(val) { 7006 } 7007 7008 const R &value; 7009 }; 7010 7011 template<> 7012 struct Quantifier<void> : public Quantity { Quantifierfakeit::Quantifier7013 explicit Quantifier(const int q) : 7014 Quantity(q) { 7015 } 7016 }; 7017 7018 struct QuantifierFunctor : public Quantifier<void> { QuantifierFunctorfakeit::QuantifierFunctor7019 QuantifierFunctor(const int q) : 7020 Quantifier<void>(q) { 7021 } 7022 7023 template<typename R> operator ()fakeit::QuantifierFunctor7024 Quantifier<R> operator()(const R &value) { 7025 return Quantifier<R>(quantity, value); 7026 } 7027 }; 7028 7029 template<int q> 7030 struct Times : public Quantity { 7031 7032 Times<q>() : Quantity(q) { } 7033 7034 template<typename R> offakeit::Times7035 static Quantifier<R> of(const R &value) { 7036 return Quantifier<R>(q, value); 7037 } 7038 Voidfakeit::Times7039 static Quantifier<void> Void() { 7040 return Quantifier<void>(q); 7041 } 7042 }; 7043 7044 #if defined (__GNUG__) || (_MSC_VER >= 1900) 7045 operator ""_Times(unsigned long long n)7046 inline QuantifierFunctor operator 7047 "" 7048 7049 _Times(unsigned long long n) { 7050 return QuantifierFunctor((int) n); 7051 } 7052 operator ""_Time(unsigned long long n)7053 inline QuantifierFunctor operator 7054 "" 7055 7056 _Time(unsigned long long n) { 7057 if (n != 1) 7058 throw std::invalid_argument("Only 1_Time is supported. Use X_Times (with s) if X is bigger than 1"); 7059 return QuantifierFunctor((int) n); 7060 } 7061 7062 #endif 7063 7064 } 7065 #include <functional> 7066 #include <atomic> 7067 #include <tuple> 7068 #include <type_traits> 7069 7070 7071 namespace fakeit { 7072 7073 template<typename R, typename ... arglist> 7074 struct Action : Destructible { 7075 virtual R invoke(const ArgumentsTuple<arglist...> &) = 0; 7076 7077 virtual bool isDone() = 0; 7078 }; 7079 7080 template<typename R, typename ... arglist> 7081 struct Repeat : Action<R, arglist...> { 7082 virtual ~Repeat() = default; 7083 Repeatfakeit::Repeat7084 Repeat(std::function<R(typename fakeit::test_arg<arglist>::type...)> func) : 7085 f(func), times(1) { 7086 } 7087 Repeatfakeit::Repeat7088 Repeat(std::function<R(typename fakeit::test_arg<arglist>::type...)> func, long t) : 7089 f(func), times(t) { 7090 } 7091 invokefakeit::Repeat7092 virtual R invoke(const ArgumentsTuple<arglist...> & args) override { 7093 times--; 7094 return TupleDispatcher::invoke<R, arglist...>(f, args); 7095 } 7096 isDonefakeit::Repeat7097 virtual bool isDone() override { 7098 return times == 0; 7099 } 7100 7101 private: 7102 std::function<R(typename fakeit::test_arg<arglist>::type...)> f; 7103 long times; 7104 }; 7105 7106 template<typename R, typename ... arglist> 7107 struct RepeatForever : public Action<R, arglist...> { 7108 7109 virtual ~RepeatForever() = default; 7110 RepeatForeverfakeit::RepeatForever7111 RepeatForever(std::function<R(typename fakeit::test_arg<arglist>::type...)> func) : 7112 f(func) { 7113 } 7114 invokefakeit::RepeatForever7115 virtual R invoke(const ArgumentsTuple<arglist...> & args) override { 7116 return TupleDispatcher::invoke<R, arglist...>(f, args); 7117 } 7118 isDonefakeit::RepeatForever7119 virtual bool isDone() override { 7120 return false; 7121 } 7122 7123 private: 7124 std::function<R(typename fakeit::test_arg<arglist>::type...)> f; 7125 }; 7126 7127 template<typename R, typename ... arglist> 7128 struct ReturnDefaultValue : public Action<R, arglist...> { 7129 virtual ~ReturnDefaultValue() = default; 7130 invokefakeit::ReturnDefaultValue7131 virtual R invoke(const ArgumentsTuple<arglist...> &) override { 7132 return DefaultValue<R>::value(); 7133 } 7134 isDonefakeit::ReturnDefaultValue7135 virtual bool isDone() override { 7136 return false; 7137 } 7138 }; 7139 7140 template<typename R, typename ... arglist> 7141 struct ReturnDelegateValue : public Action<R, arglist...> { 7142 ReturnDelegateValuefakeit::ReturnDelegateValue7143 ReturnDelegateValue(std::function<R(const typename fakeit::test_arg<arglist>::type...)> delegate) : _delegate(delegate) { } 7144 7145 virtual ~ReturnDelegateValue() = default; 7146 invokefakeit::ReturnDelegateValue7147 virtual R invoke(const ArgumentsTuple<arglist...> & args) override { 7148 return TupleDispatcher::invoke<R, arglist...>(_delegate, args); 7149 } 7150 isDonefakeit::ReturnDelegateValue7151 virtual bool isDone() override { 7152 return false; 7153 } 7154 7155 private: 7156 std::function<R(const typename fakeit::test_arg<arglist>::type...)> _delegate; 7157 }; 7158 7159 } 7160 7161 namespace fakeit { 7162 7163 template<typename R, typename ... arglist> 7164 struct MethodStubbingProgress { 7165 ~MethodStubbingProgressfakeit::MethodStubbingProgress7166 virtual ~MethodStubbingProgress() THROWS { 7167 } 7168 7169 template<typename U = R> 7170 typename std::enable_if<!std::is_reference<U>::value, MethodStubbingProgress<R, arglist...> &>::type Returnfakeit::MethodStubbingProgress7171 Return(const R &r) { 7172 return Do([r](const typename fakeit::test_arg<arglist>::type...) -> R { return r; }); 7173 } 7174 7175 template<typename U = R> 7176 typename std::enable_if<std::is_reference<U>::value, MethodStubbingProgress<R, arglist...> &>::type Returnfakeit::MethodStubbingProgress7177 Return(const R &r) { 7178 return Do([&r](const typename fakeit::test_arg<arglist>::type...) -> R { return r; }); 7179 } 7180 7181 MethodStubbingProgress<R, arglist...> & Returnfakeit::MethodStubbingProgress7182 Return(const Quantifier<R> &q) { 7183 const R &value = q.value; 7184 auto method = [value](const arglist &...) -> R { return value; }; 7185 return DoImpl(new Repeat<R, arglist...>(method, q.quantity)); 7186 } 7187 7188 template<typename first, typename second, typename ... tail> 7189 MethodStubbingProgress<R, arglist...> & Returnfakeit::MethodStubbingProgress7190 Return(const first &f, const second &s, const tail &... t) { 7191 Return(f); 7192 return Return(s, t...); 7193 } 7194 7195 7196 template<typename U = R> 7197 typename std::enable_if<!std::is_reference<U>::value, void>::type AlwaysReturnfakeit::MethodStubbingProgress7198 AlwaysReturn(const R &r) { 7199 return AlwaysDo([r](const typename fakeit::test_arg<arglist>::type...) -> R { return r; }); 7200 } 7201 7202 template<typename U = R> 7203 typename std::enable_if<std::is_reference<U>::value, void>::type AlwaysReturnfakeit::MethodStubbingProgress7204 AlwaysReturn(const R &r) { 7205 return AlwaysDo([&r](const typename fakeit::test_arg<arglist>::type...) -> R { return r; }); 7206 } 7207 7208 MethodStubbingProgress<R, arglist...> & Returnfakeit::MethodStubbingProgress7209 Return() { 7210 return Do([](const typename fakeit::test_arg<arglist>::type...) -> R { return DefaultValue<R>::value(); }); 7211 } 7212 AlwaysReturnfakeit::MethodStubbingProgress7213 void AlwaysReturn() { 7214 return AlwaysDo([](const typename fakeit::test_arg<arglist>::type...) -> R { return DefaultValue<R>::value(); }); 7215 } 7216 7217 template<typename E> Throwfakeit::MethodStubbingProgress7218 MethodStubbingProgress<R, arglist...> &Throw(const E &e) { 7219 return Do([e](const typename fakeit::test_arg<arglist>::type...) -> R { throw e; }); 7220 } 7221 7222 template<typename E> 7223 MethodStubbingProgress<R, arglist...> & Throwfakeit::MethodStubbingProgress7224 Throw(const Quantifier<E> &q) { 7225 const E &value = q.value; 7226 auto method = [value](const arglist &...) -> R { throw value; }; 7227 return DoImpl(new Repeat<R, arglist...>(method, q.quantity)); 7228 } 7229 7230 template<typename first, typename second, typename ... tail> 7231 MethodStubbingProgress<R, arglist...> & Throwfakeit::MethodStubbingProgress7232 Throw(const first &f, const second &s, const tail &... t) { 7233 Throw(f); 7234 return Throw(s, t...); 7235 } 7236 7237 template<typename E> AlwaysThrowfakeit::MethodStubbingProgress7238 void AlwaysThrow(const E &e) { 7239 return AlwaysDo([e](const typename fakeit::test_arg<arglist>::type...) -> R { throw e; }); 7240 } 7241 7242 virtual MethodStubbingProgress<R, arglist...> & Dofakeit::MethodStubbingProgress7243 Do(std::function<R(const typename fakeit::test_arg<arglist>::type...)> method) { 7244 return DoImpl(new Repeat<R, arglist...>(method)); 7245 } 7246 7247 template<typename F> 7248 MethodStubbingProgress<R, arglist...> & Dofakeit::MethodStubbingProgress7249 Do(const Quantifier<F> &q) { 7250 return DoImpl(new Repeat<R, arglist...>(q.value, q.quantity)); 7251 } 7252 7253 template<typename first, typename second, typename ... tail> 7254 MethodStubbingProgress<R, arglist...> & Dofakeit::MethodStubbingProgress7255 Do(const first &f, const second &s, const tail &... t) { 7256 Do(f); 7257 return Do(s, t...); 7258 } 7259 AlwaysDofakeit::MethodStubbingProgress7260 virtual void AlwaysDo(std::function<R(const typename fakeit::test_arg<arglist>::type...)> method) { 7261 DoImpl(new RepeatForever<R, arglist...>(method)); 7262 } 7263 7264 protected: 7265 7266 virtual MethodStubbingProgress<R, arglist...> &DoImpl(Action<R, arglist...> *action) = 0; 7267 7268 private: 7269 MethodStubbingProgress &operator=(const MethodStubbingProgress &other) = delete; 7270 }; 7271 7272 7273 template<typename ... arglist> 7274 struct MethodStubbingProgress<void, arglist...> { 7275 ~MethodStubbingProgressfakeit::MethodStubbingProgress7276 virtual ~MethodStubbingProgress() THROWS { 7277 } 7278 Returnfakeit::MethodStubbingProgress7279 MethodStubbingProgress<void, arglist...> &Return() { 7280 auto lambda = [](const typename fakeit::test_arg<arglist>::type...) -> void { 7281 return DefaultValue<void>::value(); 7282 }; 7283 return Do(lambda); 7284 } 7285 Dofakeit::MethodStubbingProgress7286 virtual MethodStubbingProgress<void, arglist...> &Do( 7287 std::function<void(const typename fakeit::test_arg<arglist>::type...)> method) { 7288 return DoImpl(new Repeat<void, arglist...>(method)); 7289 } 7290 7291 AlwaysReturnfakeit::MethodStubbingProgress7292 void AlwaysReturn() { 7293 return AlwaysDo([](const typename fakeit::test_arg<arglist>::type...) -> void { return DefaultValue<void>::value(); }); 7294 } 7295 7296 MethodStubbingProgress<void, arglist...> & Returnfakeit::MethodStubbingProgress7297 Return(const Quantifier<void> &q) { 7298 auto method = [](const arglist &...) -> void { return DefaultValue<void>::value(); }; 7299 return DoImpl(new Repeat<void, arglist...>(method, q.quantity)); 7300 } 7301 7302 template<typename E> Throwfakeit::MethodStubbingProgress7303 MethodStubbingProgress<void, arglist...> &Throw(const E &e) { 7304 return Do([e](const typename fakeit::test_arg<arglist>::type...) -> void { throw e; }); 7305 } 7306 7307 template<typename E> 7308 MethodStubbingProgress<void, arglist...> & Throwfakeit::MethodStubbingProgress7309 Throw(const Quantifier<E> &q) { 7310 const E &value = q.value; 7311 auto method = [value](const typename fakeit::test_arg<arglist>::type...) -> void { throw value; }; 7312 return DoImpl(new Repeat<void, arglist...>(method, q.quantity)); 7313 } 7314 7315 template<typename first, typename second, typename ... tail> 7316 MethodStubbingProgress<void, arglist...> & Throwfakeit::MethodStubbingProgress7317 Throw(const first &f, const second &s, const tail &... t) { 7318 Throw(f); 7319 return Throw(s, t...); 7320 } 7321 7322 template<typename E> AlwaysThrowfakeit::MethodStubbingProgress7323 void AlwaysThrow(const E e) { 7324 return AlwaysDo([e](const typename fakeit::test_arg<arglist>::type...) -> void { throw e; }); 7325 } 7326 7327 template<typename F> 7328 MethodStubbingProgress<void, arglist...> & Dofakeit::MethodStubbingProgress7329 Do(const Quantifier<F> &q) { 7330 return DoImpl(new Repeat<void, arglist...>(q.value, q.quantity)); 7331 } 7332 7333 template<typename first, typename second, typename ... tail> 7334 MethodStubbingProgress<void, arglist...> & Dofakeit::MethodStubbingProgress7335 Do(const first &f, const second &s, const tail &... t) { 7336 Do(f); 7337 return Do(s, t...); 7338 } 7339 AlwaysDofakeit::MethodStubbingProgress7340 virtual void AlwaysDo(std::function<void(const typename fakeit::test_arg<arglist>::type...)> method) { 7341 DoImpl(new RepeatForever<void, arglist...>(method)); 7342 } 7343 7344 protected: 7345 7346 virtual MethodStubbingProgress<void, arglist...> &DoImpl(Action<void, arglist...> *action) = 0; 7347 7348 private: 7349 MethodStubbingProgress &operator=(const MethodStubbingProgress &other) = delete; 7350 }; 7351 7352 7353 } 7354 #include <vector> 7355 #include <functional> 7356 7357 namespace fakeit { 7358 7359 class Finally { 7360 private: 7361 std::function<void()> _finallyClause; 7362 7363 Finally(const Finally &); 7364 7365 Finally &operator=(const Finally &); 7366 7367 public: Finally(std::function<void ()> f)7368 explicit Finally(std::function<void()> f) : 7369 _finallyClause(f) { 7370 } 7371 ~Finally()7372 ~Finally() { 7373 _finallyClause(); 7374 } 7375 }; 7376 } 7377 7378 namespace fakeit { 7379 7380 7381 template<typename R, typename ... arglist> 7382 struct ActionSequence : ActualInvocationHandler<R,arglist...> { 7383 ActionSequencefakeit::ActionSequence7384 ActionSequence() { 7385 clear(); 7386 } 7387 AppendDofakeit::ActionSequence7388 void AppendDo(Action<R, arglist...> *action) { 7389 append(action); 7390 } 7391 handleMethodInvocationfakeit::ActionSequence7392 virtual R handleMethodInvocation(ArgumentsTuple<arglist...> & args) override 7393 { 7394 std::shared_ptr<Destructible> destructablePtr = _recordedActions.front(); 7395 Destructible &destructable = *destructablePtr; 7396 Action<R, arglist...> &action = dynamic_cast<Action<R, arglist...> &>(destructable); 7397 std::function<void()> finallyClause = [&]() -> void { 7398 if (action.isDone()) 7399 _recordedActions.erase(_recordedActions.begin()); 7400 }; 7401 Finally onExit(finallyClause); 7402 return action.invoke(args); 7403 } 7404 7405 private: 7406 7407 struct NoMoreRecordedAction : Action<R, arglist...> { 7408 7409 7410 7411 7412 7413 7414 invokefakeit::ActionSequence::NoMoreRecordedAction7415 virtual R invoke(const ArgumentsTuple<arglist...> &) override { 7416 throw NoMoreRecordedActionException(); 7417 } 7418 isDonefakeit::ActionSequence::NoMoreRecordedAction7419 virtual bool isDone() override { 7420 return false; 7421 } 7422 }; 7423 appendfakeit::ActionSequence7424 void append(Action<R, arglist...> *action) { 7425 std::shared_ptr<Destructible> destructable{action}; 7426 _recordedActions.insert(_recordedActions.end() - 1, destructable); 7427 } 7428 clearfakeit::ActionSequence7429 void clear() { 7430 _recordedActions.clear(); 7431 auto actionPtr = std::shared_ptr<Destructible> {new NoMoreRecordedAction()}; 7432 _recordedActions.push_back(actionPtr); 7433 } 7434 7435 std::vector<std::shared_ptr<Destructible>> _recordedActions; 7436 }; 7437 7438 } 7439 7440 namespace fakeit { 7441 7442 template<typename C, typename DATA_TYPE> 7443 class DataMemberStubbingRoot { 7444 private: 7445 7446 public: 7447 DataMemberStubbingRoot(const DataMemberStubbingRoot &) = default; 7448 7449 DataMemberStubbingRoot() = default; 7450 operator =(const DATA_TYPE &)7451 void operator=(const DATA_TYPE&) { 7452 } 7453 }; 7454 7455 } 7456 #include <functional> 7457 #include <utility> 7458 #include <type_traits> 7459 #include <tuple> 7460 #include <memory> 7461 #include <vector> 7462 #include <unordered_set> 7463 #include <set> 7464 #include <iosfwd> 7465 7466 namespace fakeit { 7467 7468 struct Xaction { 7469 virtual void commit() = 0; 7470 }; 7471 } 7472 7473 namespace fakeit { 7474 7475 7476 template<typename R, typename ... arglist> 7477 struct SpyingContext : Xaction { 7478 virtual void appendAction(Action<R, arglist...> *action) = 0; 7479 7480 virtual std::function<R(arglist&...)> getOriginalMethod() = 0; 7481 }; 7482 } 7483 namespace fakeit { 7484 7485 7486 template<typename R, typename ... arglist> 7487 struct StubbingContext : public Xaction { 7488 virtual void appendAction(Action<R, arglist...> *action) = 0; 7489 }; 7490 } 7491 #include <functional> 7492 #include <type_traits> 7493 #include <tuple> 7494 #include <memory> 7495 #include <vector> 7496 #include <unordered_set> 7497 7498 7499 namespace fakeit { 7500 7501 template<unsigned int index, typename ... arglist> 7502 class MatchersCollector { 7503 7504 std::vector<Destructible *> &_matchers; 7505 7506 public: 7507 7508 7509 template<std::size_t N> 7510 using ArgType = typename std::tuple_element<N, std::tuple<arglist...>>::type; 7511 7512 template<std::size_t N> 7513 using NakedArgType = typename naked_type<ArgType<index>>::type; 7514 7515 template<std::size_t N> 7516 using ArgMatcherCreatorType = decltype(std::declval<TypedMatcherCreator<NakedArgType<N>>>()); 7517 MatchersCollector(std::vector<Destructible * > & matchers)7518 MatchersCollector(std::vector<Destructible *> &matchers) 7519 : _matchers(matchers) { 7520 } 7521 CollectMatchers()7522 void CollectMatchers() { 7523 } 7524 7525 template<typename Head> 7526 typename std::enable_if< 7527 std::is_constructible<NakedArgType<index>, Head>::value, void> CollectMatchers(const Head & value)7528 ::type CollectMatchers(const Head &value) { 7529 7530 TypedMatcher<NakedArgType<index>> *d = Eq<NakedArgType<index>>(value).createMatcher(); 7531 _matchers.push_back(d); 7532 } 7533 7534 template<typename Head, typename ...Tail> 7535 typename std::enable_if< 7536 std::is_constructible<NakedArgType<index>, Head>::value 7537 , void> CollectMatchers(const Head & head,const Tail &...tail)7538 ::type CollectMatchers(const Head &head, const Tail &... tail) { 7539 CollectMatchers(head); 7540 MatchersCollector<index + 1, arglist...> c(_matchers); 7541 c.CollectMatchers(tail...); 7542 } 7543 7544 template<typename Head> 7545 typename std::enable_if< 7546 std::is_base_of<TypedMatcherCreator<NakedArgType<index>>, Head>::value, void> CollectMatchers(const Head & creator)7547 ::type CollectMatchers(const Head &creator) { 7548 TypedMatcher<NakedArgType<index>> *d = creator.createMatcher(); 7549 _matchers.push_back(d); 7550 } 7551 7552 template<typename Head, typename ...Tail> 7553 7554 typename std::enable_if< 7555 std::is_base_of<TypedMatcherCreator<NakedArgType<index>>, Head>::value, void> CollectMatchers(const Head & head,const Tail &...tail)7556 ::type CollectMatchers(const Head &head, const Tail &... tail) { 7557 CollectMatchers(head); 7558 MatchersCollector<index + 1, arglist...> c(_matchers); 7559 c.CollectMatchers(tail...); 7560 } 7561 7562 template<typename Head> 7563 typename std::enable_if< 7564 std::is_same<AnyMatcher, Head>::value, void> CollectMatchers(const Head &)7565 ::type CollectMatchers(const Head &) { 7566 TypedMatcher<NakedArgType<index>> *d = Any<NakedArgType<index>>().createMatcher(); 7567 _matchers.push_back(d); 7568 } 7569 7570 template<typename Head, typename ...Tail> 7571 typename std::enable_if< 7572 std::is_same<AnyMatcher, Head>::value, void> CollectMatchers(const Head & head,const Tail &...tail)7573 ::type CollectMatchers(const Head &head, const Tail &... tail) { 7574 CollectMatchers(head); 7575 MatchersCollector<index + 1, arglist...> c(_matchers); 7576 c.CollectMatchers(tail...); 7577 } 7578 7579 }; 7580 7581 } 7582 7583 namespace fakeit { 7584 7585 template<typename R, typename ... arglist> 7586 class MethodMockingContext : 7587 public Sequence, 7588 public ActualInvocationsSource, 7589 public virtual StubbingContext<R, arglist...>, 7590 public virtual SpyingContext<R, arglist...>, 7591 private Invocation::Matcher { 7592 public: 7593 7594 struct Context : Destructible { 7595 7596 7597 virtual typename std::function<R(arglist&...)> getOriginalMethod() = 0; 7598 7599 virtual std::string getMethodName() = 0; 7600 7601 virtual void addMethodInvocationHandler(typename ActualInvocation<arglist...>::Matcher *matcher, 7602 ActualInvocationHandler<R, arglist...> *invocationHandler) = 0; 7603 7604 virtual void scanActualInvocations(const std::function<void(ActualInvocation<arglist...> &)> &scanner) = 0; 7605 7606 virtual void setMethodDetails(std::string mockName, std::string methodName) = 0; 7607 7608 virtual bool isOfMethod(MethodInfo &method) = 0; 7609 7610 virtual ActualInvocationsSource &getInvolvedMock() = 0; 7611 }; 7612 7613 private: 7614 class Implementation { 7615 7616 Context *_stubbingContext; 7617 ActionSequence<R, arglist...> *_recordedActionSequence; 7618 typename ActualInvocation<arglist...>::Matcher *_invocationMatcher; 7619 bool _commited; 7620 getStubbingContext() const7621 Context &getStubbingContext() const { 7622 return *_stubbingContext; 7623 } 7624 7625 public: 7626 Implementation(Context * stubbingContext)7627 Implementation(Context *stubbingContext) 7628 : _stubbingContext(stubbingContext), 7629 _recordedActionSequence(new ActionSequence<R, arglist...>()), 7630 _invocationMatcher 7631 { 7632 new DefaultInvocationMatcher<arglist...>()}, _commited(false) { 7633 } 7634 ~Implementation()7635 ~Implementation() { 7636 delete _stubbingContext; 7637 if (!_commited) { 7638 7639 delete _recordedActionSequence; 7640 delete _invocationMatcher; 7641 } 7642 } 7643 getRecordedActionSequence()7644 ActionSequence<R, arglist...> &getRecordedActionSequence() { 7645 return *_recordedActionSequence; 7646 } 7647 format() const7648 std::string format() const { 7649 std::string s = getStubbingContext().getMethodName(); 7650 s += _invocationMatcher->format(); 7651 return s; 7652 } 7653 getActualInvocations(std::unordered_set<Invocation * > & into) const7654 void getActualInvocations(std::unordered_set<Invocation *> &into) const { 7655 auto scanner = [&](ActualInvocation<arglist...> &a) { 7656 if (_invocationMatcher->matches(a)) { 7657 into.insert(&a); 7658 } 7659 }; 7660 getStubbingContext().scanActualInvocations(scanner); 7661 } 7662 7663 matches(Invocation & invocation)7664 bool matches(Invocation &invocation) { 7665 MethodInfo &actualMethod = invocation.getMethod(); 7666 if (!getStubbingContext().isOfMethod(actualMethod)) { 7667 return false; 7668 } 7669 7670 ActualInvocation<arglist...> &actualInvocation = dynamic_cast<ActualInvocation<arglist...> &>(invocation); 7671 return _invocationMatcher->matches(actualInvocation); 7672 } 7673 commit()7674 void commit() { 7675 getStubbingContext().addMethodInvocationHandler(_invocationMatcher, _recordedActionSequence); 7676 _commited = true; 7677 } 7678 appendAction(Action<R,arglist...> * action)7679 void appendAction(Action<R, arglist...> *action) { 7680 getRecordedActionSequence().AppendDo(action); 7681 } 7682 setMethodBodyByAssignment(std::function<R (const typename fakeit::test_arg<arglist>::type...)> method)7683 void setMethodBodyByAssignment(std::function<R(const typename fakeit::test_arg<arglist>::type...)> method) { 7684 appendAction(new RepeatForever<R, arglist...>(method)); 7685 commit(); 7686 } 7687 setMethodDetails(std::string mockName,std::string methodName)7688 void setMethodDetails(std::string mockName, std::string methodName) { 7689 getStubbingContext().setMethodDetails(mockName, methodName); 7690 } 7691 getInvolvedMocks(std::vector<ActualInvocationsSource * > & into) const7692 void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const { 7693 into.push_back(&getStubbingContext().getInvolvedMock()); 7694 } 7695 getOriginalMethod()7696 typename std::function<R(arglist &...)> getOriginalMethod() { 7697 return getStubbingContext().getOriginalMethod(); 7698 } 7699 setInvocationMatcher(typename ActualInvocation<arglist...>::Matcher * matcher)7700 void setInvocationMatcher(typename ActualInvocation<arglist...>::Matcher *matcher) { 7701 delete _invocationMatcher; 7702 _invocationMatcher = matcher; 7703 } 7704 }; 7705 7706 protected: 7707 MethodMockingContext(Context * stubbingContext)7708 MethodMockingContext(Context *stubbingContext) 7709 : _impl{new Implementation(stubbingContext)} { 7710 } 7711 7712 MethodMockingContext(MethodMockingContext &) = default; 7713 7714 7715 MethodMockingContext(MethodMockingContext && other)7716 MethodMockingContext(MethodMockingContext &&other) 7717 : _impl(std::move(other._impl)) { 7718 } 7719 ~MethodMockingContext()7720 virtual ~MethodMockingContext() NO_THROWS { } 7721 format() const7722 std::string format() const override { 7723 return _impl->format(); 7724 } 7725 size() const7726 unsigned int size() const override { 7727 return 1; 7728 } 7729 7730 getInvolvedMocks(std::vector<ActualInvocationsSource * > & into) const7731 void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const override { 7732 _impl->getInvolvedMocks(into); 7733 } 7734 getExpectedSequence(std::vector<Invocation::Matcher * > & into) const7735 void getExpectedSequence(std::vector<Invocation::Matcher *> &into) const override { 7736 const Invocation::Matcher *b = this; 7737 Invocation::Matcher *c = const_cast<Invocation::Matcher *>(b); 7738 into.push_back(c); 7739 } 7740 7741 getActualInvocations(std::unordered_set<Invocation * > & into) const7742 void getActualInvocations(std::unordered_set<Invocation *> &into) const override { 7743 _impl->getActualInvocations(into); 7744 } 7745 7746 matches(Invocation & invocation)7747 bool matches(Invocation &invocation) override { 7748 return _impl->matches(invocation); 7749 } 7750 commit()7751 void commit() override { 7752 _impl->commit(); 7753 } 7754 setMethodDetails(std::string mockName,std::string methodName)7755 void setMethodDetails(std::string mockName, std::string methodName) { 7756 _impl->setMethodDetails(mockName, methodName); 7757 } 7758 setMatchingCriteria(std::function<bool (arglist &...)> predicate)7759 void setMatchingCriteria(std::function<bool(arglist &...)> predicate) { 7760 typename ActualInvocation<arglist...>::Matcher *matcher{ 7761 new UserDefinedInvocationMatcher<arglist...>(predicate)}; 7762 _impl->setInvocationMatcher(matcher); 7763 } 7764 setMatchingCriteria(const std::vector<Destructible * > & matchers)7765 void setMatchingCriteria(const std::vector<Destructible *> &matchers) { 7766 typename ActualInvocation<arglist...>::Matcher *matcher{ 7767 new ArgumentsMatcherInvocationMatcher<arglist...>(matchers)}; 7768 _impl->setInvocationMatcher(matcher); 7769 } 7770 7771 appendAction(Action<R,arglist...> * action)7772 void appendAction(Action<R, arglist...> *action) override { 7773 _impl->appendAction(action); 7774 } 7775 setMethodBodyByAssignment(std::function<R (const typename fakeit::test_arg<arglist>::type...)> method)7776 void setMethodBodyByAssignment(std::function<R(const typename fakeit::test_arg<arglist>::type...)> method) { 7777 _impl->setMethodBodyByAssignment(method); 7778 } 7779 7780 template<class ...matcherCreators, class = typename std::enable_if< 7781 sizeof...(matcherCreators) == sizeof...(arglist)>::type> setMatchingCriteria(const matcherCreators &...matcherCreator)7782 void setMatchingCriteria(const matcherCreators &... matcherCreator) { 7783 std::vector<Destructible *> matchers; 7784 7785 MatchersCollector<0, arglist...> c(matchers); 7786 c.CollectMatchers(matcherCreator...); 7787 7788 MethodMockingContext<R, arglist...>::setMatchingCriteria(matchers); 7789 } 7790 7791 private: 7792 getOriginalMethod()7793 typename std::function<R(arglist&...)> getOriginalMethod() override { 7794 return _impl->getOriginalMethod(); 7795 } 7796 7797 std::shared_ptr<Implementation> _impl; 7798 }; 7799 7800 template<typename R, typename ... arglist> 7801 class MockingContext : 7802 public MethodMockingContext<R, arglist...> { 7803 MockingContext &operator=(const MockingContext &) = delete; 7804 7805 public: 7806 MockingContext(typename MethodMockingContext<R,arglist...>::Context * stubbingContext)7807 MockingContext(typename MethodMockingContext<R, arglist...>::Context *stubbingContext) 7808 : MethodMockingContext<R, arglist...>(stubbingContext) { 7809 } 7810 7811 MockingContext(MockingContext &) = default; 7812 MockingContext(MockingContext && other)7813 MockingContext(MockingContext &&other) 7814 : MethodMockingContext<R, arglist...>(std::move(other)) { 7815 } 7816 setMethodDetails(std::string mockName,std::string methodName)7817 MockingContext<R, arglist...> &setMethodDetails(std::string mockName, std::string methodName) { 7818 MethodMockingContext<R, arglist...>::setMethodDetails(mockName, methodName); 7819 return *this; 7820 } 7821 Using(const arglist &...args)7822 MockingContext<R, arglist...> &Using(const arglist &... args) { 7823 MethodMockingContext<R, arglist...>::setMatchingCriteria(args...); 7824 return *this; 7825 } 7826 7827 template<class ...arg_matcher> Using(const arg_matcher &...arg_matchers)7828 MockingContext<R, arglist...> &Using(const arg_matcher &... arg_matchers) { 7829 MethodMockingContext<R, arglist...>::setMatchingCriteria(arg_matchers...); 7830 return *this; 7831 } 7832 Matching(std::function<bool (arglist &...)> matcher)7833 MockingContext<R, arglist...> &Matching(std::function<bool(arglist &...)> matcher) { 7834 MethodMockingContext<R, arglist...>::setMatchingCriteria(matcher); 7835 return *this; 7836 } 7837 operator ()(const arglist &...args)7838 MockingContext<R, arglist...> &operator()(const arglist &... args) { 7839 MethodMockingContext<R, arglist...>::setMatchingCriteria(args...); 7840 return *this; 7841 } 7842 operator ()(std::function<bool (arglist &...)> matcher)7843 MockingContext<R, arglist...> &operator()(std::function<bool(arglist &...)> matcher) { 7844 MethodMockingContext<R, arglist...>::setMatchingCriteria(matcher); 7845 return *this; 7846 } 7847 operator =(std::function<R (arglist &...)> method)7848 void operator=(std::function<R(arglist &...)> method) { 7849 MethodMockingContext<R, arglist...>::setMethodBodyByAssignment(method); 7850 } 7851 7852 template<typename U = R> operator =(const R & r)7853 typename std::enable_if<!std::is_reference<U>::value, void>::type operator=(const R &r) { 7854 auto method = [r](const typename fakeit::test_arg<arglist>::type...) -> R { return r; }; 7855 MethodMockingContext<R, arglist...>::setMethodBodyByAssignment(method); 7856 } 7857 7858 template<typename U = R> operator =(const R & r)7859 typename std::enable_if<std::is_reference<U>::value, void>::type operator=(const R &r) { 7860 auto method = [&r](const typename fakeit::test_arg<arglist>::type...) -> R { return r; }; 7861 MethodMockingContext<R, arglist...>::setMethodBodyByAssignment(method); 7862 } 7863 }; 7864 7865 template<typename ... arglist> 7866 class MockingContext<void, arglist...> : 7867 public MethodMockingContext<void, arglist...> { 7868 MockingContext &operator=(const MockingContext &) = delete; 7869 7870 public: 7871 MockingContext(typename MethodMockingContext<void,arglist...>::Context * stubbingContext)7872 MockingContext(typename MethodMockingContext<void, arglist...>::Context *stubbingContext) 7873 : MethodMockingContext<void, arglist...>(stubbingContext) { 7874 } 7875 7876 MockingContext(MockingContext &) = default; 7877 MockingContext(MockingContext && other)7878 MockingContext(MockingContext &&other) 7879 : MethodMockingContext<void, arglist...>(std::move(other)) { 7880 } 7881 setMethodDetails(std::string mockName,std::string methodName)7882 MockingContext<void, arglist...> &setMethodDetails(std::string mockName, std::string methodName) { 7883 MethodMockingContext<void, arglist...>::setMethodDetails(mockName, methodName); 7884 return *this; 7885 } 7886 Using(const arglist &...args)7887 MockingContext<void, arglist...> &Using(const arglist &... args) { 7888 MethodMockingContext<void, arglist...>::setMatchingCriteria(args...); 7889 return *this; 7890 } 7891 7892 template<class ...arg_matcher> Using(const arg_matcher &...arg_matchers)7893 MockingContext<void, arglist...> &Using(const arg_matcher &... arg_matchers) { 7894 MethodMockingContext<void, arglist...>::setMatchingCriteria(arg_matchers...); 7895 return *this; 7896 } 7897 Matching(std::function<bool (arglist &...)> matcher)7898 MockingContext<void, arglist...> &Matching(std::function<bool(arglist &...)> matcher) { 7899 MethodMockingContext<void, arglist...>::setMatchingCriteria(matcher); 7900 return *this; 7901 } 7902 operator ()(const arglist &...args)7903 MockingContext<void, arglist...> &operator()(const arglist &... args) { 7904 MethodMockingContext<void, arglist...>::setMatchingCriteria(args...); 7905 return *this; 7906 } 7907 operator ()(std::function<bool (arglist &...)> matcher)7908 MockingContext<void, arglist...> &operator()(std::function<bool(arglist &...)> matcher) { 7909 MethodMockingContext<void, arglist...>::setMatchingCriteria(matcher); 7910 return *this; 7911 } 7912 operator =(std::function<void (arglist &...)> method)7913 void operator=(std::function<void(arglist &...)> method) { 7914 MethodMockingContext<void, arglist...>::setMethodBodyByAssignment(method); 7915 } 7916 7917 }; 7918 7919 class DtorMockingContext : public MethodMockingContext<void> { 7920 public: 7921 DtorMockingContext(MethodMockingContext<void>::Context * stubbingContext)7922 DtorMockingContext(MethodMockingContext<void>::Context *stubbingContext) 7923 : MethodMockingContext<void>(stubbingContext) { 7924 } 7925 DtorMockingContext(DtorMockingContext & other)7926 DtorMockingContext(DtorMockingContext &other) : MethodMockingContext<void>(other) { 7927 } 7928 DtorMockingContext(DtorMockingContext && other)7929 DtorMockingContext(DtorMockingContext &&other) : MethodMockingContext<void>(std::move(other)) { 7930 } 7931 operator =(std::function<void ()> method)7932 void operator=(std::function<void()> method) { 7933 MethodMockingContext<void>::setMethodBodyByAssignment(method); 7934 } 7935 setMethodDetails(std::string mockName,std::string methodName)7936 DtorMockingContext &setMethodDetails(std::string mockName, std::string methodName) { 7937 MethodMockingContext<void>::setMethodDetails(mockName, methodName); 7938 return *this; 7939 } 7940 }; 7941 7942 } 7943 7944 namespace fakeit { 7945 7946 7947 template<typename C, typename ... baseclasses> 7948 class MockImpl : private MockObject<C>, public virtual ActualInvocationsSource { 7949 public: 7950 MockImpl(FakeitContext & fakeit,C & obj)7951 MockImpl(FakeitContext &fakeit, C &obj) 7952 : MockImpl<C, baseclasses...>(fakeit, obj, true) { 7953 } 7954 MockImpl(FakeitContext & fakeit)7955 MockImpl(FakeitContext &fakeit) 7956 : MockImpl<C, baseclasses...>(fakeit, *(createFakeInstance()), false){ 7957 FakeObject<C, baseclasses...> *fake = asFakeObject(_instanceOwner.get()); 7958 fake->getVirtualTable().setCookie(1, this); 7959 } 7960 ~MockImpl()7961 virtual ~MockImpl() NO_THROWS { 7962 _proxy.detach(); 7963 } 7964 7965 getActualInvocations(std::unordered_set<Invocation * > & into) const7966 void getActualInvocations(std::unordered_set<Invocation *> &into) const override { 7967 std::vector<ActualInvocationsSource *> vec; 7968 _proxy.getMethodMocks(vec); 7969 for (ActualInvocationsSource *s : vec) { 7970 s->getActualInvocations(into); 7971 } 7972 } 7973 initDataMembersIfOwner()7974 void initDataMembersIfOwner() 7975 { 7976 if (isOwner()) { 7977 FakeObject<C, baseclasses...> *fake = asFakeObject(_instanceOwner.get()); 7978 fake->initializeDataMembersArea(); 7979 } 7980 } 7981 reset()7982 void reset() { 7983 _proxy.Reset(); 7984 initDataMembersIfOwner(); 7985 } 7986 clear()7987 void clear() 7988 { 7989 std::vector<ActualInvocationsContainer *> vec; 7990 _proxy.getMethodMocks(vec); 7991 for (ActualInvocationsContainer *s : vec) { 7992 s->clear(); 7993 } 7994 initDataMembersIfOwner(); 7995 } 7996 get()7997 virtual C &get() override { 7998 return _proxy.get(); 7999 } 8000 getFakeIt()8001 virtual FakeitContext &getFakeIt() override { 8002 return _fakeit; 8003 } 8004 8005 template<class DATA_TYPE, typename T, typename ... arglist, class = typename std::enable_if<std::is_base_of<T, C>::value>::type> stubDataMember(DATA_TYPE T::* member,const arglist &...ctorargs)8006 DataMemberStubbingRoot<C, DATA_TYPE> stubDataMember(DATA_TYPE T::*member, const arglist &... ctorargs) { 8007 _proxy.stubDataMember(member, ctorargs...); 8008 return DataMemberStubbingRoot<T, DATA_TYPE>(); 8009 } 8010 8011 template<int id, typename R, typename T, typename ... arglist, class = typename std::enable_if<std::is_base_of<T, C>::value>::type> stubMethod(R (T::* vMethod)(arglist...))8012 MockingContext<R, arglist...> stubMethod(R(T::*vMethod)(arglist...)) { 8013 return MockingContext<R, arglist...>(new UniqueMethodMockingContextImpl < id, R, arglist... > 8014 (*this, vMethod)); 8015 } 8016 stubDtor()8017 DtorMockingContext stubDtor() { 8018 return DtorMockingContext(new DtorMockingContextImpl(*this)); 8019 } 8020 8021 8022 8023 8024 8025 8026 8027 private: 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 std::shared_ptr<FakeObject<C, baseclasses...>> _instanceOwner; 8038 DynamicProxy<C, baseclasses...> _proxy; 8039 FakeitContext &_fakeit; 8040 MockImpl(FakeitContext & fakeit,C & obj,bool isSpy)8041 MockImpl(FakeitContext &fakeit, C &obj, bool isSpy) 8042 : _instanceOwner(isSpy ? nullptr : asFakeObject(&obj)) 8043 , _proxy{obj} 8044 , _fakeit(fakeit) {} 8045 asFakeObject(void * instance)8046 static FakeObject<C, baseclasses...>* asFakeObject(void* instance){ 8047 return reinterpret_cast<FakeObject<C, baseclasses...> *>(instance); 8048 } 8049 8050 template<typename R, typename ... arglist> 8051 class MethodMockingContextBase : public MethodMockingContext<R, arglist...>::Context { 8052 protected: 8053 MockImpl<C, baseclasses...> &_mock; 8054 8055 virtual RecordedMethodBody<R, arglist...> &getRecordedMethodBody() = 0; 8056 8057 public: MethodMockingContextBase(MockImpl<C,baseclasses...> & mock)8058 MethodMockingContextBase(MockImpl<C, baseclasses...> &mock) : _mock(mock) { } 8059 8060 virtual ~MethodMockingContextBase() = default; 8061 addMethodInvocationHandler(typename ActualInvocation<arglist...>::Matcher * matcher,ActualInvocationHandler<R,arglist...> * invocationHandler)8062 void addMethodInvocationHandler(typename ActualInvocation<arglist...>::Matcher *matcher, 8063 ActualInvocationHandler<R, arglist...> *invocationHandler) { 8064 getRecordedMethodBody().addMethodInvocationHandler(matcher, invocationHandler); 8065 } 8066 scanActualInvocations(const std::function<void (ActualInvocation<arglist...> &)> & scanner)8067 void scanActualInvocations(const std::function<void(ActualInvocation<arglist...> &)> &scanner) { 8068 getRecordedMethodBody().scanActualInvocations(scanner); 8069 } 8070 setMethodDetails(std::string mockName,std::string methodName)8071 void setMethodDetails(std::string mockName, std::string methodName) { 8072 getRecordedMethodBody().setMethodDetails(mockName, methodName); 8073 } 8074 isOfMethod(MethodInfo & method)8075 bool isOfMethod(MethodInfo &method) { 8076 return getRecordedMethodBody().isOfMethod(method); 8077 } 8078 getInvolvedMock()8079 ActualInvocationsSource &getInvolvedMock() { 8080 return _mock; 8081 } 8082 getMethodName()8083 std::string getMethodName() { 8084 return getRecordedMethodBody().getMethod().name(); 8085 } 8086 8087 }; 8088 8089 template<typename R, typename ... arglist> 8090 class MethodMockingContextImpl : public MethodMockingContextBase<R, arglist...> { 8091 protected: 8092 8093 R (C::*_vMethod)(arglist...); 8094 8095 public: 8096 virtual ~MethodMockingContextImpl() = default; 8097 MethodMockingContextImpl(MockImpl<C,baseclasses...> & mock,R (C::* vMethod)(arglist...))8098 MethodMockingContextImpl(MockImpl<C, baseclasses...> &mock, R (C::*vMethod)(arglist...)) 8099 : MethodMockingContextBase<R, arglist...>(mock), _vMethod(vMethod) { 8100 } 8101 8102 getOriginalMethod()8103 virtual std::function<R(arglist&...)> getOriginalMethod() override { 8104 void *mPtr = MethodMockingContextBase<R, arglist...>::_mock.getOriginalMethod(_vMethod); 8105 C * instance = &(MethodMockingContextBase<R, arglist...>::_mock.get()); 8106 return [=](arglist&... args) -> R { 8107 auto m = union_cast<typename VTableMethodType<R,arglist...>::type>(mPtr); 8108 return m(instance, std::forward<arglist>(args)...); 8109 }; 8110 } 8111 }; 8112 8113 8114 template<int id, typename R, typename ... arglist> 8115 class UniqueMethodMockingContextImpl : public MethodMockingContextImpl<R, arglist...> { 8116 protected: 8117 getRecordedMethodBody()8118 virtual RecordedMethodBody<R, arglist...> &getRecordedMethodBody() override { 8119 return MethodMockingContextBase<R, arglist...>::_mock.template stubMethodIfNotStubbed<id>( 8120 MethodMockingContextBase<R, arglist...>::_mock._proxy, 8121 MethodMockingContextImpl<R, arglist...>::_vMethod); 8122 } 8123 8124 public: 8125 UniqueMethodMockingContextImpl(MockImpl<C,baseclasses...> & mock,R (C::* vMethod)(arglist...))8126 UniqueMethodMockingContextImpl(MockImpl<C, baseclasses...> &mock, R (C::*vMethod)(arglist...)) 8127 : MethodMockingContextImpl<R, arglist...>(mock, vMethod) { 8128 } 8129 }; 8130 8131 class DtorMockingContextImpl : public MethodMockingContextBase<void> { 8132 8133 protected: 8134 getRecordedMethodBody()8135 virtual RecordedMethodBody<void> &getRecordedMethodBody() override { 8136 return MethodMockingContextBase<void>::_mock.stubDtorIfNotStubbed( 8137 MethodMockingContextBase<void>::_mock._proxy); 8138 } 8139 8140 public: 8141 virtual ~DtorMockingContextImpl() = default; 8142 DtorMockingContextImpl(MockImpl<C,baseclasses...> & mock)8143 DtorMockingContextImpl(MockImpl<C, baseclasses...> &mock) 8144 : MethodMockingContextBase<void>(mock) { 8145 } 8146 getOriginalMethod()8147 virtual std::function<void()> getOriginalMethod() override { 8148 C &instance = MethodMockingContextBase<void>::_mock.get(); 8149 return [=, &instance]() -> void { 8150 }; 8151 } 8152 8153 }; 8154 getMockImpl(void * instance)8155 static MockImpl<C, baseclasses...> *getMockImpl(void *instance) { 8156 FakeObject<C, baseclasses...> *fake = asFakeObject(instance); 8157 MockImpl<C, baseclasses...> *mock = reinterpret_cast<MockImpl<C, baseclasses...> *>(fake->getVirtualTable().getCookie( 8158 1)); 8159 return mock; 8160 } 8161 isOwner()8162 bool isOwner(){ return _instanceOwner != nullptr;} 8163 unmockedDtor()8164 void unmockedDtor() {} 8165 unmocked()8166 void unmocked() { 8167 ActualInvocation<> invocation(Invocation::nextInvocationOrdinal(), UnknownMethod::instance()); 8168 UnexpectedMethodCallEvent event(UnexpectedType::Unmocked, invocation); 8169 auto &fakeit = getMockImpl(this)->_fakeit; 8170 fakeit.handle(event); 8171 8172 std::string format = fakeit.format(event); 8173 UnexpectedMethodCallException e(format); 8174 throw e; 8175 } 8176 createFakeInstance()8177 static C *createFakeInstance() { 8178 FakeObject<C, baseclasses...> *fake = new FakeObject<C, baseclasses...>(); 8179 void *unmockedMethodStubPtr = union_cast<void *>(&MockImpl<C, baseclasses...>::unmocked); 8180 void *unmockedDtorStubPtr = union_cast<void *>(&MockImpl<C, baseclasses...>::unmockedDtor); 8181 fake->getVirtualTable().initAll(unmockedMethodStubPtr); 8182 if (VTUtils::hasVirtualDestructor<C>()) 8183 fake->setDtor(unmockedDtorStubPtr); 8184 return reinterpret_cast<C *>(fake); 8185 } 8186 8187 template<typename R, typename ... arglist> getOriginalMethod(R (C::* vMethod)(arglist...))8188 void *getOriginalMethod(R (C::*vMethod)(arglist...)) { 8189 auto vt = _proxy.getOriginalVT(); 8190 auto offset = VTUtils::getOffset(vMethod); 8191 void *origMethodPtr = vt.getMethod(offset); 8192 return origMethodPtr; 8193 } 8194 getOriginalDtor()8195 void *getOriginalDtor() { 8196 auto vt = _proxy.getOriginalVT(); 8197 auto offset = VTUtils::getDestructorOffset<C>(); 8198 void *origMethodPtr = vt.getMethod(offset); 8199 return origMethodPtr; 8200 } 8201 8202 template<unsigned int id, typename R, typename ... arglist> stubMethodIfNotStubbed(DynamicProxy<C,baseclasses...> & proxy,R (C::* vMethod)(arglist...))8203 RecordedMethodBody<R, arglist...> &stubMethodIfNotStubbed(DynamicProxy<C, baseclasses...> &proxy, 8204 R (C::*vMethod)(arglist...)) { 8205 if (!proxy.isMethodStubbed(vMethod)) { 8206 proxy.template stubMethod<id>(vMethod, createRecordedMethodBody < R, arglist... > (*this, vMethod)); 8207 } 8208 Destructible *d = proxy.getMethodMock(vMethod); 8209 RecordedMethodBody<R, arglist...> *methodMock = dynamic_cast<RecordedMethodBody<R, arglist...> *>(d); 8210 return *methodMock; 8211 } 8212 stubDtorIfNotStubbed(DynamicProxy<C,baseclasses...> & proxy)8213 RecordedMethodBody<void> &stubDtorIfNotStubbed(DynamicProxy<C, baseclasses...> &proxy) { 8214 if (!proxy.isDtorStubbed()) { 8215 proxy.stubDtor(createRecordedDtorBody(*this)); 8216 } 8217 Destructible *d = proxy.getDtorMock(); 8218 RecordedMethodBody<void> *dtorMock = dynamic_cast<RecordedMethodBody<void> *>(d); 8219 return *dtorMock; 8220 } 8221 8222 template<typename R, typename ... arglist> createRecordedMethodBody(MockObject<C> & mock,R (C::* vMethod)(arglist...))8223 static RecordedMethodBody<R, arglist...> *createRecordedMethodBody(MockObject<C> &mock, 8224 R(C::*vMethod)(arglist...)) { 8225 return new RecordedMethodBody<R, arglist...>(mock.getFakeIt(), typeid(vMethod).name()); 8226 } 8227 createRecordedDtorBody(MockObject<C> & mock)8228 static RecordedMethodBody<void> *createRecordedDtorBody(MockObject<C> &mock) { 8229 return new RecordedMethodBody<void>(mock.getFakeIt(), "dtor"); 8230 } 8231 }; 8232 } 8233 namespace fakeit { 8234 8235 template<typename R, typename... Args> 8236 struct Prototype; 8237 8238 template<typename R, typename... Args> 8239 struct Prototype<R(Args...)> { 8240 8241 typedef R Type(Args...); 8242 8243 typedef R ConstType(Args...) const; 8244 8245 template<class C> 8246 struct MemberType { 8247 8248 typedef Type(C::*type); 8249 typedef ConstType(C::*cosntType); 8250 getfakeit::Prototype::MemberType8251 static type get(type t) { 8252 return t; 8253 } 8254 getconstfakeit::Prototype::MemberType8255 static cosntType getconst(cosntType t) { 8256 return t; 8257 } 8258 8259 }; 8260 8261 }; 8262 8263 template<int X, typename R, typename C, typename... arglist> 8264 struct UniqueMethod { 8265 R (C::*method)(arglist...); 8266 UniqueMethodfakeit::UniqueMethod8267 UniqueMethod(R (C::*vMethod)(arglist...)) : method(vMethod) { } 8268 uniqueIdfakeit::UniqueMethod8269 int uniqueId() { 8270 return X; 8271 } 8272 8273 8274 8275 8276 }; 8277 8278 } 8279 8280 8281 namespace fakeit { 8282 namespace internal { 8283 } 8284 using namespace fakeit::internal; 8285 8286 template<typename C, typename ... baseclasses> 8287 class Mock : public ActualInvocationsSource { 8288 MockImpl<C, baseclasses...> impl; 8289 public: 8290 virtual ~Mock() = default; 8291 8292 static_assert(std::is_polymorphic<C>::value, "Can only mock a polymorphic type"); 8293 Mock()8294 Mock() : impl(Fakeit) { 8295 } 8296 Mock(C & obj)8297 explicit Mock(C &obj) : impl(Fakeit, obj) { 8298 } 8299 get()8300 virtual C &get() { 8301 return impl.get(); 8302 } 8303 8304 8305 8306 8307 operator ()()8308 C &operator()() { 8309 return get(); 8310 } 8311 Reset()8312 void Reset() { 8313 impl.reset(); 8314 } 8315 ClearInvocationHistory()8316 void ClearInvocationHistory() { 8317 impl.clear(); 8318 } 8319 8320 template<class DATA_TYPE, typename ... arglist, 8321 class = typename std::enable_if<std::is_member_object_pointer<DATA_TYPE C::*>::value>::type> Stub(DATA_TYPE C::* member,const arglist &...ctorargs)8322 DataMemberStubbingRoot<C, DATA_TYPE> Stub(DATA_TYPE C::* member, const arglist &... ctorargs) { 8323 return impl.stubDataMember(member, ctorargs...); 8324 } 8325 8326 template<int id, typename R, typename T, typename ... arglist, class = typename std::enable_if< 8327 !std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...)const)8328 MockingContext<R, arglist...> stub(R (T::*vMethod)(arglist...) const) { 8329 auto methodWithoutConstVolatile = reinterpret_cast<R (T::*)(arglist...)>(vMethod); 8330 return impl.template stubMethod<id>(methodWithoutConstVolatile); 8331 } 8332 8333 template<int id, typename R, typename T, typename... arglist, class = typename std::enable_if< 8334 !std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...)volatile)8335 MockingContext<R, arglist...> stub(R(T::*vMethod)(arglist...) volatile) { 8336 auto methodWithoutConstVolatile = reinterpret_cast<R(T::*)(arglist...)>(vMethod); 8337 return impl.template stubMethod<id>(methodWithoutConstVolatile); 8338 } 8339 8340 template<int id, typename R, typename T, typename... arglist, class = typename std::enable_if< 8341 !std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...)const volatile)8342 MockingContext<R, arglist...> stub(R(T::*vMethod)(arglist...) const volatile) { 8343 auto methodWithoutConstVolatile = reinterpret_cast<R(T::*)(arglist...)>(vMethod); 8344 return impl.template stubMethod<id>(methodWithoutConstVolatile); 8345 } 8346 8347 template<int id, typename R, typename T, typename... arglist, class = typename std::enable_if< 8348 !std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...))8349 MockingContext<R, arglist...> stub(R(T::*vMethod)(arglist...)) { 8350 return impl.template stubMethod<id>(vMethod); 8351 } 8352 8353 template<int id, typename R, typename T, typename... arglist, class = typename std::enable_if< 8354 std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...)const)8355 MockingContext<void, arglist...> stub(R(T::*vMethod)(arglist...) const) { 8356 auto methodWithoutConstVolatile = reinterpret_cast<void (T::*)(arglist...)>(vMethod); 8357 return impl.template stubMethod<id>(methodWithoutConstVolatile); 8358 } 8359 8360 template<int id, typename R, typename T, typename... arglist, class = typename std::enable_if< 8361 std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...)volatile)8362 MockingContext<void, arglist...> stub(R(T::*vMethod)(arglist...) volatile) { 8363 auto methodWithoutConstVolatile = reinterpret_cast<void (T::*)(arglist...)>(vMethod); 8364 return impl.template stubMethod<id>(methodWithoutConstVolatile); 8365 } 8366 8367 template<int id, typename R, typename T, typename... arglist, class = typename std::enable_if< 8368 std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...)const volatile)8369 MockingContext<void, arglist...> stub(R(T::*vMethod)(arglist...) const volatile) { 8370 auto methodWithoutConstVolatile = reinterpret_cast<void (T::*)(arglist...)>(vMethod); 8371 return impl.template stubMethod<id>(methodWithoutConstVolatile); 8372 } 8373 8374 template<int id, typename R, typename T, typename... arglist, class = typename std::enable_if< 8375 std::is_void<R>::value && std::is_base_of<T, C>::value>::type> stub(R (T::* vMethod)(arglist...))8376 MockingContext<void, arglist...> stub(R(T::*vMethod)(arglist...)) { 8377 auto methodWithoutConstVolatile = reinterpret_cast<void (T::*)(arglist...)>(vMethod); 8378 return impl.template stubMethod<id>(methodWithoutConstVolatile); 8379 } 8380 dtor()8381 DtorMockingContext dtor() { 8382 return impl.stubDtor(); 8383 } 8384 getActualInvocations(std::unordered_set<Invocation * > & into) const8385 void getActualInvocations(std::unordered_set<Invocation *> &into) const override { 8386 impl.getActualInvocations(into); 8387 } 8388 8389 }; 8390 8391 } 8392 8393 #include <exception> 8394 8395 namespace fakeit { 8396 8397 class RefCount { 8398 private: 8399 int count; 8400 8401 public: AddRef()8402 void AddRef() { 8403 count++; 8404 } 8405 Release()8406 int Release() { 8407 return --count; 8408 } 8409 }; 8410 8411 template<typename T> 8412 class smart_ptr { 8413 private: 8414 T *pData; 8415 RefCount *reference; 8416 8417 public: smart_ptr()8418 smart_ptr() : pData(0), reference(0) { 8419 reference = new RefCount(); 8420 reference->AddRef(); 8421 } 8422 smart_ptr(T * pValue)8423 smart_ptr(T *pValue) : pData(pValue), reference(0) { 8424 reference = new RefCount(); 8425 reference->AddRef(); 8426 } 8427 smart_ptr(const smart_ptr<T> & sp)8428 smart_ptr(const smart_ptr<T> &sp) : pData(sp.pData), reference(sp.reference) { 8429 reference->AddRef(); 8430 } 8431 ~smart_ptr()8432 ~smart_ptr() THROWS { 8433 if (reference->Release() == 0) { 8434 delete reference; 8435 delete pData; 8436 } 8437 } 8438 operator *()8439 T &operator*() { 8440 return *pData; 8441 } 8442 operator ->()8443 T *operator->() { 8444 return pData; 8445 } 8446 operator =(const smart_ptr<T> & sp)8447 smart_ptr<T> &operator=(const smart_ptr<T> &sp) { 8448 if (this != &sp) { 8449 8450 8451 if (reference->Release() == 0) { 8452 delete reference; 8453 delete pData; 8454 } 8455 8456 8457 8458 pData = sp.pData; 8459 reference = sp.reference; 8460 reference->AddRef(); 8461 } 8462 return *this; 8463 } 8464 }; 8465 8466 } 8467 8468 namespace fakeit { 8469 8470 class WhenFunctor { 8471 8472 struct StubbingChange { 8473 8474 friend class WhenFunctor; 8475 ~StubbingChangefakeit::WhenFunctor::StubbingChange8476 virtual ~StubbingChange() THROWS { 8477 8478 if (std::uncaught_exception()) { 8479 return; 8480 } 8481 8482 _xaction.commit(); 8483 } 8484 StubbingChangefakeit::WhenFunctor::StubbingChange8485 StubbingChange(StubbingChange &other) : 8486 _xaction(other._xaction) { 8487 } 8488 8489 private: 8490 StubbingChangefakeit::WhenFunctor::StubbingChange8491 StubbingChange(Xaction &xaction) 8492 : _xaction(xaction) { 8493 } 8494 8495 Xaction &_xaction; 8496 }; 8497 8498 public: 8499 8500 template<typename R, typename ... arglist> 8501 struct MethodProgress : MethodStubbingProgress<R, arglist...> { 8502 8503 friend class WhenFunctor; 8504 8505 virtual ~MethodProgress() override = default; 8506 MethodProgressfakeit::WhenFunctor::MethodProgress8507 MethodProgress(MethodProgress &other) : 8508 _progress(other._progress), _context(other._context) { 8509 } 8510 MethodProgressfakeit::WhenFunctor::MethodProgress8511 MethodProgress(StubbingContext<R, arglist...> &xaction) : 8512 _progress(new StubbingChange(xaction)), _context(xaction) { 8513 } 8514 8515 protected: 8516 DoImplfakeit::WhenFunctor::MethodProgress8517 virtual MethodStubbingProgress<R, arglist...> &DoImpl(Action<R, arglist...> *action) override { 8518 _context.appendAction(action); 8519 return *this; 8520 } 8521 8522 private: 8523 smart_ptr<StubbingChange> _progress; 8524 StubbingContext<R, arglist...> &_context; 8525 }; 8526 8527 WhenFunctor()8528 WhenFunctor() { 8529 } 8530 8531 template<typename R, typename ... arglist> operator ()(const StubbingContext<R,arglist...> & stubbingContext)8532 MethodProgress<R, arglist...> operator()(const StubbingContext<R, arglist...> &stubbingContext) { 8533 StubbingContext<R, arglist...> &rootWithoutConst = const_cast<StubbingContext<R, arglist...> &>(stubbingContext); 8534 MethodProgress<R, arglist...> progress(rootWithoutConst); 8535 return progress; 8536 } 8537 8538 }; 8539 8540 } 8541 namespace fakeit { 8542 8543 class FakeFunctor { 8544 private: 8545 template<typename R, typename ... arglist> fake(const StubbingContext<R,arglist...> & root)8546 void fake(const StubbingContext<R, arglist...> &root) { 8547 StubbingContext<R, arglist...> &rootWithoutConst = const_cast<StubbingContext<R, arglist...> &>(root); 8548 rootWithoutConst.appendAction(new ReturnDefaultValue<R, arglist...>()); 8549 rootWithoutConst.commit(); 8550 } 8551 operator ()()8552 void operator()() { 8553 } 8554 8555 public: 8556 8557 template<typename H, typename ... M> operator ()(const H & head,const M &...tail)8558 void operator()(const H &head, const M &... tail) { 8559 fake(head); 8560 this->operator()(tail...); 8561 } 8562 8563 }; 8564 8565 } 8566 #include <set> 8567 #include <set> 8568 8569 8570 namespace fakeit { 8571 8572 struct InvocationUtils { 8573 sortByInvocationOrderfakeit::InvocationUtils8574 static void sortByInvocationOrder(std::unordered_set<Invocation *> &ivocations, 8575 std::vector<Invocation *> &result) { 8576 auto comparator = [](Invocation *a, Invocation *b) -> bool { 8577 return a->getOrdinal() < b->getOrdinal(); 8578 }; 8579 std::set<Invocation *, bool (*)(Invocation *a, Invocation *b)> sortedIvocations(comparator); 8580 for (auto i : ivocations) 8581 sortedIvocations.insert(i); 8582 8583 for (auto i : sortedIvocations) 8584 result.push_back(i); 8585 } 8586 collectActualInvocationsfakeit::InvocationUtils8587 static void collectActualInvocations(std::unordered_set<Invocation *> &actualInvocations, 8588 std::vector<ActualInvocationsSource *> &invocationSources) { 8589 for (auto source : invocationSources) { 8590 source->getActualInvocations(actualInvocations); 8591 } 8592 } 8593 selectNonVerifiedInvocationsfakeit::InvocationUtils8594 static void selectNonVerifiedInvocations(std::unordered_set<Invocation *> &actualInvocations, 8595 std::unordered_set<Invocation *> &into) { 8596 for (auto invocation : actualInvocations) { 8597 if (!invocation->isVerified()) { 8598 into.insert(invocation); 8599 } 8600 } 8601 } 8602 collectInvocationSourcesfakeit::InvocationUtils8603 static void collectInvocationSources(std::vector<ActualInvocationsSource *> &) { 8604 } 8605 8606 template<typename ... list> collectInvocationSourcesfakeit::InvocationUtils8607 static void collectInvocationSources(std::vector<ActualInvocationsSource *> &into, 8608 const ActualInvocationsSource &mock, 8609 const list &... tail) { 8610 into.push_back(const_cast<ActualInvocationsSource *>(&mock)); 8611 collectInvocationSources(into, tail...); 8612 } 8613 collectSequencesfakeit::InvocationUtils8614 static void collectSequences(std::vector<Sequence *> &) { 8615 } 8616 8617 template<typename ... list> collectSequencesfakeit::InvocationUtils8618 static void collectSequences(std::vector<Sequence *> &vec, const Sequence &sequence, const list &... tail) { 8619 vec.push_back(&const_cast<Sequence &>(sequence)); 8620 collectSequences(vec, tail...); 8621 } 8622 collectInvolvedMocksfakeit::InvocationUtils8623 static void collectInvolvedMocks(std::vector<Sequence *> &allSequences, 8624 std::vector<ActualInvocationsSource *> &involvedMocks) { 8625 for (auto sequence : allSequences) { 8626 sequence->getInvolvedMocks(involvedMocks); 8627 } 8628 } 8629 8630 template<class T> remove_constfakeit::InvocationUtils8631 static T &remove_const(const T &s) { 8632 return const_cast<T &>(s); 8633 } 8634 8635 }; 8636 8637 } 8638 8639 #include <memory> 8640 8641 #include <vector> 8642 #include <unordered_set> 8643 8644 namespace fakeit { 8645 struct MatchAnalysis { 8646 std::vector<Invocation *> actualSequence; 8647 std::vector<Invocation *> matchedInvocations; 8648 int count; 8649 runfakeit::MatchAnalysis8650 void run(InvocationsSourceProxy &involvedInvocationSources, std::vector<Sequence *> &expectedPattern) { 8651 getActualInvocationSequence(involvedInvocationSources, actualSequence); 8652 count = countMatches(expectedPattern, actualSequence, matchedInvocations); 8653 } 8654 8655 private: getActualInvocationSequencefakeit::MatchAnalysis8656 static void getActualInvocationSequence(InvocationsSourceProxy &involvedMocks, 8657 std::vector<Invocation *> &actualSequence) { 8658 std::unordered_set<Invocation *> actualInvocations; 8659 collectActualInvocations(involvedMocks, actualInvocations); 8660 InvocationUtils::sortByInvocationOrder(actualInvocations, actualSequence); 8661 } 8662 countMatchesfakeit::MatchAnalysis8663 static int countMatches(std::vector<Sequence *> &pattern, std::vector<Invocation *> &actualSequence, 8664 std::vector<Invocation *> &matchedInvocations) { 8665 int end = -1; 8666 int count = 0; 8667 int startSearchIndex = 0; 8668 while (findNextMatch(pattern, actualSequence, startSearchIndex, end, matchedInvocations)) { 8669 count++; 8670 startSearchIndex = end; 8671 } 8672 return count; 8673 } 8674 collectActualInvocationsfakeit::MatchAnalysis8675 static void collectActualInvocations(InvocationsSourceProxy &involvedMocks, 8676 std::unordered_set<Invocation *> &actualInvocations) { 8677 involvedMocks.getActualInvocations(actualInvocations); 8678 } 8679 findNextMatchfakeit::MatchAnalysis8680 static bool findNextMatch(std::vector<Sequence *> &pattern, std::vector<Invocation *> &actualSequence, 8681 int startSearchIndex, int &end, 8682 std::vector<Invocation *> &matchedInvocations) { 8683 for (auto sequence : pattern) { 8684 int index = findNextMatch(sequence, actualSequence, startSearchIndex); 8685 if (index == -1) { 8686 return false; 8687 } 8688 collectMatchedInvocations(actualSequence, matchedInvocations, index, sequence->size()); 8689 startSearchIndex = index + sequence->size(); 8690 } 8691 end = startSearchIndex; 8692 return true; 8693 } 8694 8695 collectMatchedInvocationsfakeit::MatchAnalysis8696 static void collectMatchedInvocations(std::vector<Invocation *> &actualSequence, 8697 std::vector<Invocation *> &matchedInvocations, int start, 8698 int length) { 8699 int indexAfterMatchedPattern = start + length; 8700 for (; start < indexAfterMatchedPattern; start++) { 8701 matchedInvocations.push_back(actualSequence[start]); 8702 } 8703 } 8704 8705 isMatchfakeit::MatchAnalysis8706 static bool isMatch(std::vector<Invocation *> &actualSequence, 8707 std::vector<Invocation::Matcher *> &expectedSequence, int start) { 8708 bool found = true; 8709 for (unsigned int j = 0; found && j < expectedSequence.size(); j++) { 8710 Invocation *actual = actualSequence[start + j]; 8711 Invocation::Matcher *expected = expectedSequence[j]; 8712 found = found && expected->matches(*actual); 8713 } 8714 return found; 8715 } 8716 findNextMatchfakeit::MatchAnalysis8717 static int findNextMatch(Sequence *&pattern, std::vector<Invocation *> &actualSequence, int startSearchIndex) { 8718 std::vector<Invocation::Matcher *> expectedSequence; 8719 pattern->getExpectedSequence(expectedSequence); 8720 for (int i = startSearchIndex; i < ((int) actualSequence.size() - (int) expectedSequence.size() + 1); i++) { 8721 if (isMatch(actualSequence, expectedSequence, i)) { 8722 return i; 8723 } 8724 } 8725 return -1; 8726 } 8727 8728 }; 8729 } 8730 8731 namespace fakeit { 8732 8733 struct SequenceVerificationExpectation { 8734 8735 friend class SequenceVerificationProgress; 8736 ~SequenceVerificationExpectationfakeit::SequenceVerificationExpectation8737 ~SequenceVerificationExpectation() THROWS { 8738 if (std::uncaught_exception()) { 8739 return; 8740 } 8741 VerifyExpectation(_fakeit); 8742 } 8743 setExpectedPatternfakeit::SequenceVerificationExpectation8744 void setExpectedPattern(std::vector<Sequence *> expectedPattern) { 8745 _expectedPattern = expectedPattern; 8746 } 8747 setExpectedCountfakeit::SequenceVerificationExpectation8748 void setExpectedCount(const int count) { 8749 _expectedCount = count; 8750 } 8751 setFileInfofakeit::SequenceVerificationExpectation8752 void setFileInfo(const char * file, int line, const char * callingMethod) { 8753 _file = file; 8754 _line = line; 8755 _testMethod = callingMethod; 8756 } 8757 8758 private: 8759 8760 VerificationEventHandler &_fakeit; 8761 InvocationsSourceProxy _involvedInvocationSources; 8762 std::vector<Sequence *> _expectedPattern; 8763 int _expectedCount; 8764 8765 const char * _file; 8766 int _line; 8767 const char * _testMethod; 8768 bool _isVerified; 8769 SequenceVerificationExpectationfakeit::SequenceVerificationExpectation8770 SequenceVerificationExpectation( 8771 VerificationEventHandler &fakeit, 8772 InvocationsSourceProxy mocks, 8773 std::vector<Sequence *> &expectedPattern) : 8774 _fakeit(fakeit), 8775 _involvedInvocationSources(mocks), 8776 _expectedPattern(expectedPattern), 8777 _expectedCount(-1), 8778 _line(0), 8779 _isVerified(false) { 8780 } 8781 8782 VerifyExpectationfakeit::SequenceVerificationExpectation8783 void VerifyExpectation(VerificationEventHandler &verificationErrorHandler) { 8784 if (_isVerified) 8785 return; 8786 _isVerified = true; 8787 8788 MatchAnalysis ma; 8789 ma.run(_involvedInvocationSources, _expectedPattern); 8790 8791 if (isAtLeastVerification() && atLeastLimitNotReached(ma.count)) { 8792 return handleAtLeastVerificationEvent(verificationErrorHandler, ma.actualSequence, ma.count); 8793 } 8794 8795 if (isExactVerification() && exactLimitNotMatched(ma.count)) { 8796 return handleExactVerificationEvent(verificationErrorHandler, ma.actualSequence, ma.count); 8797 } 8798 8799 markAsVerified(ma.matchedInvocations); 8800 } 8801 collectSequencesfakeit::SequenceVerificationExpectation8802 std::vector<Sequence *> &collectSequences(std::vector<Sequence *> &vec) { 8803 return vec; 8804 } 8805 8806 template<typename ... list> collectSequencesfakeit::SequenceVerificationExpectation8807 std::vector<Sequence *> &collectSequences(std::vector<Sequence *> &vec, const Sequence &sequence, 8808 const list &... tail) { 8809 vec.push_back(&const_cast<Sequence &>(sequence)); 8810 return collectSequences(vec, tail...); 8811 } 8812 8813 markAsVerifiedfakeit::SequenceVerificationExpectation8814 static void markAsVerified(std::vector<Invocation *> &matchedInvocations) { 8815 for (auto i : matchedInvocations) { 8816 i->markAsVerified(); 8817 } 8818 } 8819 isAtLeastVerificationfakeit::SequenceVerificationExpectation8820 bool isAtLeastVerification() { 8821 8822 return _expectedCount < 0; 8823 } 8824 isExactVerificationfakeit::SequenceVerificationExpectation8825 bool isExactVerification() { 8826 return !isAtLeastVerification(); 8827 } 8828 atLeastLimitNotReachedfakeit::SequenceVerificationExpectation8829 bool atLeastLimitNotReached(int actualCount) { 8830 return actualCount < -_expectedCount; 8831 } 8832 exactLimitNotMatchedfakeit::SequenceVerificationExpectation8833 bool exactLimitNotMatched(int actualCount) { 8834 return actualCount != _expectedCount; 8835 } 8836 handleExactVerificationEventfakeit::SequenceVerificationExpectation8837 void handleExactVerificationEvent(VerificationEventHandler &verificationErrorHandler, 8838 std::vector<Invocation *> actualSequence, int count) { 8839 SequenceVerificationEvent evt(VerificationType::Exact, _expectedPattern, actualSequence, _expectedCount, 8840 count); 8841 evt.setFileInfo(_file, _line, _testMethod); 8842 return verificationErrorHandler.handle(evt); 8843 } 8844 handleAtLeastVerificationEventfakeit::SequenceVerificationExpectation8845 void handleAtLeastVerificationEvent(VerificationEventHandler &verificationErrorHandler, 8846 std::vector<Invocation *> actualSequence, int count) { 8847 SequenceVerificationEvent evt(VerificationType::AtLeast, _expectedPattern, actualSequence, -_expectedCount, 8848 count); 8849 evt.setFileInfo(_file, _line, _testMethod); 8850 return verificationErrorHandler.handle(evt); 8851 } 8852 8853 }; 8854 8855 } 8856 namespace fakeit { 8857 class ThrowFalseEventHandler : public VerificationEventHandler { 8858 handle(const SequenceVerificationEvent &)8859 void handle(const SequenceVerificationEvent &) override { 8860 throw false; 8861 } 8862 handle(const NoMoreInvocationsVerificationEvent &)8863 void handle(const NoMoreInvocationsVerificationEvent &) override { 8864 throw false; 8865 } 8866 }; 8867 } 8868 8869 8870 namespace fakeit { 8871 8872 struct FakeitContext; 8873 8874 class SequenceVerificationProgress { 8875 8876 friend class UsingFunctor; 8877 8878 friend class VerifyFunctor; 8879 8880 friend class UsingProgress; 8881 8882 smart_ptr<SequenceVerificationExpectation> _expectationPtr; 8883 SequenceVerificationProgress(SequenceVerificationExpectation * ptr)8884 SequenceVerificationProgress(SequenceVerificationExpectation *ptr) : _expectationPtr(ptr) { 8885 } 8886 SequenceVerificationProgress(FakeitContext & fakeit,InvocationsSourceProxy sources,std::vector<Sequence * > & allSequences)8887 SequenceVerificationProgress( 8888 FakeitContext &fakeit, 8889 InvocationsSourceProxy sources, 8890 std::vector<Sequence *> &allSequences) : 8891 SequenceVerificationProgress(new SequenceVerificationExpectation(fakeit, sources, allSequences)) { 8892 } 8893 verifyInvocations(const int times)8894 virtual void verifyInvocations(const int times) { 8895 _expectationPtr->setExpectedCount(times); 8896 } 8897 8898 class Terminator { 8899 smart_ptr<SequenceVerificationExpectation> _expectationPtr; 8900 toBool()8901 bool toBool() { 8902 try { 8903 ThrowFalseEventHandler eh; 8904 _expectationPtr->VerifyExpectation(eh); 8905 return true; 8906 } 8907 catch (bool e) { 8908 return e; 8909 } 8910 } 8911 8912 public: Terminator(smart_ptr<SequenceVerificationExpectation> expectationPtr)8913 Terminator(smart_ptr<SequenceVerificationExpectation> expectationPtr) : _expectationPtr(expectationPtr) { }; 8914 operator bool()8915 operator bool() { 8916 return toBool(); 8917 } 8918 operator !() const8919 bool operator!() const { return !const_cast<Terminator *>(this)->toBool(); } 8920 }; 8921 8922 public: 8923 ~SequenceVerificationProgress()8924 ~SequenceVerificationProgress() THROWS { }; 8925 operator bool() const8926 operator bool() const { 8927 return Terminator(_expectationPtr); 8928 } 8929 operator !() const8930 bool operator!() const { return !Terminator(_expectationPtr); } 8931 Never()8932 Terminator Never() { 8933 Exactly(0); 8934 return Terminator(_expectationPtr); 8935 } 8936 Once()8937 Terminator Once() { 8938 Exactly(1); 8939 return Terminator(_expectationPtr); 8940 } 8941 Twice()8942 Terminator Twice() { 8943 Exactly(2); 8944 return Terminator(_expectationPtr); 8945 } 8946 AtLeastOnce()8947 Terminator AtLeastOnce() { 8948 verifyInvocations(-1); 8949 return Terminator(_expectationPtr); 8950 } 8951 Exactly(const int times)8952 Terminator Exactly(const int times) { 8953 if (times < 0) { 8954 throw std::invalid_argument(std::string("bad argument times:").append(fakeit::to_string(times))); 8955 } 8956 verifyInvocations(times); 8957 return Terminator(_expectationPtr); 8958 } 8959 Exactly(const Quantity & q)8960 Terminator Exactly(const Quantity &q) { 8961 Exactly(q.quantity); 8962 return Terminator(_expectationPtr); 8963 } 8964 AtLeast(const int times)8965 Terminator AtLeast(const int times) { 8966 if (times < 0) { 8967 throw std::invalid_argument(std::string("bad argument times:").append(fakeit::to_string(times))); 8968 } 8969 verifyInvocations(-times); 8970 return Terminator(_expectationPtr); 8971 } 8972 AtLeast(const Quantity & q)8973 Terminator AtLeast(const Quantity &q) { 8974 AtLeast(q.quantity); 8975 return Terminator(_expectationPtr); 8976 } 8977 setFileInfo(const char * file,int line,const char * callingMethod)8978 SequenceVerificationProgress setFileInfo(const char * file, int line, const char * callingMethod) { 8979 _expectationPtr->setFileInfo(file, line, callingMethod); 8980 return *this; 8981 } 8982 }; 8983 } 8984 8985 namespace fakeit { 8986 8987 class UsingProgress { 8988 fakeit::FakeitContext &_fakeit; 8989 InvocationsSourceProxy _sources; 8990 collectSequences(std::vector<fakeit::Sequence * > &)8991 void collectSequences(std::vector<fakeit::Sequence *> &) { 8992 } 8993 8994 template<typename ... list> collectSequences(std::vector<fakeit::Sequence * > & vec,const fakeit::Sequence & sequence,const list &...tail)8995 void collectSequences(std::vector<fakeit::Sequence *> &vec, const fakeit::Sequence &sequence, 8996 const list &... tail) { 8997 vec.push_back(&const_cast<fakeit::Sequence &>(sequence)); 8998 collectSequences(vec, tail...); 8999 } 9000 9001 public: 9002 UsingProgress(fakeit::FakeitContext & fakeit,InvocationsSourceProxy source)9003 UsingProgress(fakeit::FakeitContext &fakeit, InvocationsSourceProxy source) : 9004 _fakeit(fakeit), 9005 _sources(source) { 9006 } 9007 9008 template<typename ... list> Verify(const fakeit::Sequence & sequence,const list &...tail)9009 SequenceVerificationProgress Verify(const fakeit::Sequence &sequence, const list &... tail) { 9010 std::vector<fakeit::Sequence *> allSequences; 9011 collectSequences(allSequences, sequence, tail...); 9012 SequenceVerificationProgress progress(_fakeit, _sources, allSequences); 9013 return progress; 9014 } 9015 9016 }; 9017 } 9018 9019 namespace fakeit { 9020 9021 class UsingFunctor { 9022 9023 friend class VerifyFunctor; 9024 9025 FakeitContext &_fakeit; 9026 9027 public: 9028 UsingFunctor(FakeitContext & fakeit)9029 UsingFunctor(FakeitContext &fakeit) : _fakeit(fakeit) { 9030 } 9031 9032 template<typename ... list> operator ()(const ActualInvocationsSource & head,const list &...tail)9033 UsingProgress operator()(const ActualInvocationsSource &head, const list &... tail) { 9034 std::vector<ActualInvocationsSource *> allMocks{&InvocationUtils::remove_const(head), 9035 &InvocationUtils::remove_const(tail)...}; 9036 InvocationsSourceProxy aggregateInvocationsSource{new AggregateInvocationsSource(allMocks)}; 9037 UsingProgress progress(_fakeit, aggregateInvocationsSource); 9038 return progress; 9039 } 9040 9041 }; 9042 } 9043 #include <set> 9044 9045 namespace fakeit { 9046 9047 class VerifyFunctor { 9048 9049 FakeitContext &_fakeit; 9050 9051 9052 public: 9053 VerifyFunctor(FakeitContext & fakeit)9054 VerifyFunctor(FakeitContext &fakeit) : _fakeit(fakeit) { 9055 } 9056 9057 template<typename ... list> operator ()(const Sequence & sequence,const list &...tail)9058 SequenceVerificationProgress operator()(const Sequence &sequence, const list &... tail) { 9059 std::vector<Sequence *> allSequences{&InvocationUtils::remove_const(sequence), 9060 &InvocationUtils::remove_const(tail)...}; 9061 9062 std::vector<ActualInvocationsSource *> involvedSources; 9063 InvocationUtils::collectInvolvedMocks(allSequences, involvedSources); 9064 InvocationsSourceProxy aggregateInvocationsSource{new AggregateInvocationsSource(involvedSources)}; 9065 9066 UsingProgress usingProgress(_fakeit, aggregateInvocationsSource); 9067 return usingProgress.Verify(sequence, tail...); 9068 } 9069 9070 }; 9071 9072 } 9073 #include <set> 9074 #include <memory> 9075 namespace fakeit { 9076 9077 class VerifyNoOtherInvocationsVerificationProgress { 9078 9079 friend class VerifyNoOtherInvocationsFunctor; 9080 9081 struct VerifyNoOtherInvocationsExpectation { 9082 9083 friend class VerifyNoOtherInvocationsVerificationProgress; 9084 ~VerifyNoOtherInvocationsExpectationfakeit::VerifyNoOtherInvocationsVerificationProgress::VerifyNoOtherInvocationsExpectation9085 ~VerifyNoOtherInvocationsExpectation() THROWS { 9086 if (std::uncaught_exception()) { 9087 return; 9088 } 9089 9090 VerifyExpectation(_fakeit); 9091 } 9092 setFileInfofakeit::VerifyNoOtherInvocationsVerificationProgress::VerifyNoOtherInvocationsExpectation9093 void setFileInfo(const char * file, int line, const char * callingMethod) { 9094 _file = file; 9095 _line = line; 9096 _callingMethod = callingMethod; 9097 } 9098 9099 private: 9100 9101 VerificationEventHandler &_fakeit; 9102 std::vector<ActualInvocationsSource *> _mocks; 9103 9104 const char * _file; 9105 int _line; 9106 const char * _callingMethod; 9107 bool _isVerified; 9108 VerifyNoOtherInvocationsExpectationfakeit::VerifyNoOtherInvocationsVerificationProgress::VerifyNoOtherInvocationsExpectation9109 VerifyNoOtherInvocationsExpectation(VerificationEventHandler &fakeit, 9110 std::vector<ActualInvocationsSource *> mocks) : 9111 _fakeit(fakeit), 9112 _mocks(mocks), 9113 _line(0), 9114 _isVerified(false) { 9115 } 9116 9117 VerifyNoOtherInvocationsExpectation(VerifyNoOtherInvocationsExpectation &other) = default; 9118 VerifyExpectationfakeit::VerifyNoOtherInvocationsVerificationProgress::VerifyNoOtherInvocationsExpectation9119 void VerifyExpectation(VerificationEventHandler &verificationErrorHandler) { 9120 if (_isVerified) 9121 return; 9122 _isVerified = true; 9123 9124 std::unordered_set<Invocation *> actualInvocations; 9125 InvocationUtils::collectActualInvocations(actualInvocations, _mocks); 9126 9127 std::unordered_set<Invocation *> nonVerifiedInvocations; 9128 InvocationUtils::selectNonVerifiedInvocations(actualInvocations, nonVerifiedInvocations); 9129 9130 if (nonVerifiedInvocations.size() > 0) { 9131 std::vector<Invocation *> sortedNonVerifiedInvocations; 9132 InvocationUtils::sortByInvocationOrder(nonVerifiedInvocations, sortedNonVerifiedInvocations); 9133 9134 std::vector<Invocation *> sortedActualInvocations; 9135 InvocationUtils::sortByInvocationOrder(actualInvocations, sortedActualInvocations); 9136 9137 NoMoreInvocationsVerificationEvent evt(sortedActualInvocations, sortedNonVerifiedInvocations); 9138 evt.setFileInfo(_file, _line, _callingMethod); 9139 return verificationErrorHandler.handle(evt); 9140 } 9141 } 9142 9143 }; 9144 9145 fakeit::smart_ptr<VerifyNoOtherInvocationsExpectation> _ptr; 9146 VerifyNoOtherInvocationsVerificationProgress(VerifyNoOtherInvocationsExpectation * ptr)9147 VerifyNoOtherInvocationsVerificationProgress(VerifyNoOtherInvocationsExpectation *ptr) : 9148 _ptr(ptr) { 9149 } 9150 VerifyNoOtherInvocationsVerificationProgress(FakeitContext & fakeit,std::vector<ActualInvocationsSource * > & invocationSources)9151 VerifyNoOtherInvocationsVerificationProgress(FakeitContext &fakeit, 9152 std::vector<ActualInvocationsSource *> &invocationSources) 9153 : VerifyNoOtherInvocationsVerificationProgress( 9154 new VerifyNoOtherInvocationsExpectation(fakeit, invocationSources) 9155 ) { 9156 } 9157 toBool()9158 bool toBool() { 9159 try { 9160 ThrowFalseEventHandler ev; 9161 _ptr->VerifyExpectation(ev); 9162 return true; 9163 } 9164 catch (bool e) { 9165 return e; 9166 } 9167 } 9168 9169 public: 9170 9171 ~VerifyNoOtherInvocationsVerificationProgress()9172 ~VerifyNoOtherInvocationsVerificationProgress() THROWS { 9173 }; 9174 setFileInfo(const char * file,int line,const char * callingMethod)9175 VerifyNoOtherInvocationsVerificationProgress setFileInfo(const char * file, int line, 9176 const char * callingMethod) { 9177 _ptr->setFileInfo(file, line, callingMethod); 9178 return *this; 9179 } 9180 operator bool() const9181 operator bool() const { 9182 return const_cast<VerifyNoOtherInvocationsVerificationProgress *>(this)->toBool(); 9183 } 9184 operator !() const9185 bool operator!() const { return !const_cast<VerifyNoOtherInvocationsVerificationProgress *>(this)->toBool(); } 9186 9187 }; 9188 9189 } 9190 9191 9192 namespace fakeit { 9193 class VerifyNoOtherInvocationsFunctor { 9194 9195 FakeitContext &_fakeit; 9196 9197 public: 9198 VerifyNoOtherInvocationsFunctor(FakeitContext & fakeit)9199 VerifyNoOtherInvocationsFunctor(FakeitContext &fakeit) : _fakeit(fakeit) { 9200 } 9201 operator ()()9202 void operator()() { 9203 } 9204 9205 template<typename ... list> operator ()(const ActualInvocationsSource & head,const list &...tail)9206 VerifyNoOtherInvocationsVerificationProgress operator()(const ActualInvocationsSource &head, 9207 const list &... tail) { 9208 std::vector<ActualInvocationsSource *> invocationSources{&InvocationUtils::remove_const(head), 9209 &InvocationUtils::remove_const(tail)...}; 9210 VerifyNoOtherInvocationsVerificationProgress progress{_fakeit, invocationSources}; 9211 return progress; 9212 } 9213 }; 9214 9215 } 9216 namespace fakeit { 9217 9218 class SpyFunctor { 9219 private: 9220 9221 template<typename R, typename ... arglist> spy(const SpyingContext<R,arglist...> & root)9222 void spy(const SpyingContext<R, arglist...> &root) { 9223 SpyingContext<R, arglist...> &rootWithoutConst = const_cast<SpyingContext<R, arglist...> &>(root); 9224 auto methodFromOriginalVT = rootWithoutConst.getOriginalMethod(); 9225 rootWithoutConst.appendAction(new ReturnDelegateValue<R, arglist...>(methodFromOriginalVT)); 9226 rootWithoutConst.commit(); 9227 } 9228 operator ()()9229 void operator()() { 9230 } 9231 9232 public: 9233 9234 template<typename H, typename ... M> operator ()(const H & head,const M &...tail)9235 void operator()(const H &head, const M &... tail) { 9236 spy(head); 9237 this->operator()(tail...); 9238 } 9239 9240 }; 9241 9242 } 9243 9244 #include <vector> 9245 #include <set> 9246 9247 namespace fakeit { 9248 class VerifyUnverifiedFunctor { 9249 9250 FakeitContext &_fakeit; 9251 9252 public: 9253 VerifyUnverifiedFunctor(FakeitContext & fakeit)9254 VerifyUnverifiedFunctor(FakeitContext &fakeit) : _fakeit(fakeit) { 9255 } 9256 9257 template<typename ... list> operator ()(const Sequence & sequence,const list &...tail)9258 SequenceVerificationProgress operator()(const Sequence &sequence, const list &... tail) { 9259 std::vector<Sequence *> allSequences{&InvocationUtils::remove_const(sequence), 9260 &InvocationUtils::remove_const(tail)...}; 9261 9262 std::vector<ActualInvocationsSource *> involvedSources; 9263 InvocationUtils::collectInvolvedMocks(allSequences, involvedSources); 9264 9265 InvocationsSourceProxy aggregateInvocationsSource{new AggregateInvocationsSource(involvedSources)}; 9266 InvocationsSourceProxy unverifiedInvocationsSource{ 9267 new UnverifiedInvocationsSource(aggregateInvocationsSource)}; 9268 9269 UsingProgress usingProgress(_fakeit, unverifiedInvocationsSource); 9270 return usingProgress.Verify(sequence, tail...); 9271 } 9272 9273 }; 9274 9275 class UnverifiedFunctor { 9276 public: UnverifiedFunctor(FakeitContext & fakeit)9277 UnverifiedFunctor(FakeitContext &fakeit) : Verify(fakeit) { 9278 } 9279 9280 VerifyUnverifiedFunctor Verify; 9281 9282 template<typename ... list> operator ()(const ActualInvocationsSource & head,const list &...tail)9283 UnverifiedInvocationsSource operator()(const ActualInvocationsSource &head, const list &... tail) { 9284 std::vector<ActualInvocationsSource *> allMocks{&InvocationUtils::remove_const(head), 9285 &InvocationUtils::remove_const(tail)...}; 9286 InvocationsSourceProxy aggregateInvocationsSource{new AggregateInvocationsSource(allMocks)}; 9287 UnverifiedInvocationsSource unverifiedInvocationsSource{aggregateInvocationsSource}; 9288 return unverifiedInvocationsSource; 9289 } 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 }; 9304 } 9305 9306 namespace fakeit { 9307 9308 static UsingFunctor Using(Fakeit); 9309 static VerifyFunctor Verify(Fakeit); 9310 static VerifyNoOtherInvocationsFunctor VerifyNoOtherInvocations(Fakeit); 9311 static UnverifiedFunctor Unverified(Fakeit); 9312 static SpyFunctor Spy; 9313 static FakeFunctor Fake; 9314 static WhenFunctor When; 9315 9316 template<class T> 9317 class SilenceUnusedVariableWarnings { 9318 use(void *)9319 void use(void *) { 9320 } 9321 SilenceUnusedVariableWarnings()9322 SilenceUnusedVariableWarnings() { 9323 use(&Fake); 9324 use(&When); 9325 use(&Spy); 9326 use(&Using); 9327 use(&Verify); 9328 use(&VerifyNoOtherInvocations); 9329 use(&_); 9330 } 9331 }; 9332 9333 } 9334 #ifdef _MSC_VER 9335 #define __func__ __FUNCTION__ 9336 #endif 9337 9338 #define MOCK_TYPE(mock) \ 9339 std::remove_reference<decltype(mock.get())>::type 9340 9341 #define OVERLOADED_METHOD_PTR(mock, method, prototype) \ 9342 fakeit::Prototype<prototype>::MemberType<MOCK_TYPE(mock)>::get(&MOCK_TYPE(mock)::method) 9343 9344 #define CONST_OVERLOADED_METHOD_PTR(mock, method, prototype) \ 9345 fakeit::Prototype<prototype>::MemberType<MOCK_TYPE(mock)>::getconst(&MOCK_TYPE(mock)::method) 9346 9347 #define Dtor(mock) \ 9348 mock.dtor().setMethodDetails(#mock,"destructor") 9349 9350 #define Method(mock, method) \ 9351 mock.template stub<__COUNTER__>(&MOCK_TYPE(mock)::method).setMethodDetails(#mock,#method) 9352 9353 #define OverloadedMethod(mock, method, prototype) \ 9354 mock.template stub<__COUNTER__>(OVERLOADED_METHOD_PTR( mock , method, prototype )).setMethodDetails(#mock,#method) 9355 9356 #define ConstOverloadedMethod(mock, method, prototype) \ 9357 mock.template stub<__COUNTER__>(CONST_OVERLOADED_METHOD_PTR( mock , method, prototype )).setMethodDetails(#mock,#method) 9358 9359 #define Verify(...) \ 9360 Verify( __VA_ARGS__ ).setFileInfo(__FILE__, __LINE__, __func__) 9361 9362 #define Using(...) \ 9363 Using( __VA_ARGS__ ) 9364 9365 #define VerifyNoOtherInvocations(...) \ 9366 VerifyNoOtherInvocations( __VA_ARGS__ ).setFileInfo(__FILE__, __LINE__, __func__) 9367 9368 #define Fake(...) \ 9369 Fake( __VA_ARGS__ ) 9370 9371 #define When(call) \ 9372 When(call) 9373 9374 9375 #endif 9376