From cb6204b3993bf9c9f0d603de8337714908775d13 Mon Sep 17 00:00:00 2001 From: mat007 Date: Thu, 14 Jun 2012 21:13:32 +0000 Subject: [PATCH] Removed obsolete test applications git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@458 860be788-9bd5-4423-9f1e-828f051e677b --- build/vc80/boost_test.vcproj | 201 - build/vc80/hippomocks_test.vcproj | 206 - build/vc80/pch_test.vcproj | 221 - build/vc80/turtle.sln | 18 - src/tests/boost_test/static_test.cpp | 48 - src/tests/hippomocks_test/hippomocks.h | 6351 ------------------------ src/tests/hippomocks_test/test.cpp | 48 - src/tests/pch_test/pch_test.cpp | 15 - src/tests/pch_test/pch_test.h | 56 - 9 files changed, 7164 deletions(-) delete mode 100644 build/vc80/boost_test.vcproj delete mode 100644 build/vc80/hippomocks_test.vcproj delete mode 100644 build/vc80/pch_test.vcproj delete mode 100644 src/tests/boost_test/static_test.cpp delete mode 100644 src/tests/hippomocks_test/hippomocks.h delete mode 100644 src/tests/hippomocks_test/test.cpp delete mode 100644 src/tests/pch_test/pch_test.cpp delete mode 100644 src/tests/pch_test/pch_test.h diff --git a/build/vc80/boost_test.vcproj b/build/vc80/boost_test.vcproj deleted file mode 100644 index 829be11..0000000 --- a/build/vc80/boost_test.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/vc80/hippomocks_test.vcproj b/build/vc80/hippomocks_test.vcproj deleted file mode 100644 index bf35929..0000000 --- a/build/vc80/hippomocks_test.vcproj +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/vc80/pch_test.vcproj b/build/vc80/pch_test.vcproj deleted file mode 100644 index 00cf533..0000000 --- a/build/vc80/pch_test.vcproj +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/vc80/turtle.sln b/build/vc80/turtle.sln index 003f732..7905ec4 100644 --- a/build/vc80/turtle.sln +++ b/build/vc80/turtle.sln @@ -4,16 +4,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turtle", "turtle.vcproj", " EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turtle_test", "turtle_test.vcproj", "{74810A2A-33D8-47D6-9A50-71261F1683F5}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pch_test", "pch_test.vcproj", "{121C87D6-DBCC-4A73-99DE-9A0759FD04B6}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_test", "bench_test.vcproj", "{2D607783-30B9-46DE-81E2-28513B31D5D2}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_test", "boost_test.vcproj", "{C4D5F5D6-87FB-4A1F-8C9E-F2871E1A8DF1}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "errors_test", "errors_test.vcproj", "{231E907C-7B55-4128-B9EF-AB5B8042898D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hippomocks_test", "hippomocks_test.vcproj", "{ED2540E2-411B-4E25-95D2-5C8FA017B806}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution debug|Win32 = debug|Win32 @@ -28,26 +22,14 @@ Global {74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|Win32.Build.0 = debug|Win32 {74810A2A-33D8-47D6-9A50-71261F1683F5}.release|Win32.ActiveCfg = release|Win32 {74810A2A-33D8-47D6-9A50-71261F1683F5}.release|Win32.Build.0 = release|Win32 - {121C87D6-DBCC-4A73-99DE-9A0759FD04B6}.debug|Win32.ActiveCfg = debug|Win32 - {121C87D6-DBCC-4A73-99DE-9A0759FD04B6}.debug|Win32.Build.0 = debug|Win32 - {121C87D6-DBCC-4A73-99DE-9A0759FD04B6}.release|Win32.ActiveCfg = release|Win32 - {121C87D6-DBCC-4A73-99DE-9A0759FD04B6}.release|Win32.Build.0 = release|Win32 {2D607783-30B9-46DE-81E2-28513B31D5D2}.debug|Win32.ActiveCfg = debug|Win32 {2D607783-30B9-46DE-81E2-28513B31D5D2}.debug|Win32.Build.0 = debug|Win32 {2D607783-30B9-46DE-81E2-28513B31D5D2}.release|Win32.ActiveCfg = release|Win32 {2D607783-30B9-46DE-81E2-28513B31D5D2}.release|Win32.Build.0 = release|Win32 - {C4D5F5D6-87FB-4A1F-8C9E-F2871E1A8DF1}.debug|Win32.ActiveCfg = debug|Win32 - {C4D5F5D6-87FB-4A1F-8C9E-F2871E1A8DF1}.debug|Win32.Build.0 = debug|Win32 - {C4D5F5D6-87FB-4A1F-8C9E-F2871E1A8DF1}.release|Win32.ActiveCfg = release|Win32 - {C4D5F5D6-87FB-4A1F-8C9E-F2871E1A8DF1}.release|Win32.Build.0 = release|Win32 {231E907C-7B55-4128-B9EF-AB5B8042898D}.debug|Win32.ActiveCfg = debug|Win32 {231E907C-7B55-4128-B9EF-AB5B8042898D}.debug|Win32.Build.0 = debug|Win32 {231E907C-7B55-4128-B9EF-AB5B8042898D}.release|Win32.ActiveCfg = release|Win32 {231E907C-7B55-4128-B9EF-AB5B8042898D}.release|Win32.Build.0 = release|Win32 - {ED2540E2-411B-4E25-95D2-5C8FA017B806}.debug|Win32.ActiveCfg = debug|Win32 - {ED2540E2-411B-4E25-95D2-5C8FA017B806}.debug|Win32.Build.0 = debug|Win32 - {ED2540E2-411B-4E25-95D2-5C8FA017B806}.release|Win32.ActiveCfg = release|Win32 - {ED2540E2-411B-4E25-95D2-5C8FA017B806}.release|Win32.Build.0 = release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/tests/boost_test/static_test.cpp b/src/tests/boost_test/static_test.cpp deleted file mode 100644 index 12be231..0000000 --- a/src/tests/boost_test/static_test.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright Mathieu Champlon 2011 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://turtle.sf.net for documentation. - -#define BOOST_AUTO_TEST_MAIN -#include -#define BOOST_LIB_NAME boost_unit_test_framework -#include -#include -#include - -namespace -{ - struct fixture - { - fixture() - { - std::cout << __FUNCTION__ << std::endl; - BOOST_FAIL( "oups" ); - } - ~fixture() - { - std::cout << __FUNCTION__ << std::endl; - BOOST_FAIL( "oups" ); - } - }; - BOOST_GLOBAL_FIXTURE( fixture ); - - struct s - { - MOCK_METHOD_EXT( f, 0, void(), f ) - }; - s s1; -} - -BOOST_AUTO_TEST_CASE( some_test ) -{ - MOCK_EXPECT( s1.f ).once(); -} - -BOOST_AUTO_TEST_CASE( some_other_test ) -{ -} diff --git a/src/tests/hippomocks_test/hippomocks.h b/src/tests/hippomocks_test/hippomocks.h deleted file mode 100644 index cb86a9f..0000000 --- a/src/tests/hippomocks_test/hippomocks.h +++ /dev/null @@ -1,6351 +0,0 @@ -// HippoMocks, a library for using mocks in unit testing of C++ code. -// Copyright (C) 2008, Bas van Tiel, Christian Rexwinkel, Mike Looijmans, -// Peter Bindels -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// -// You can also retrieve it from http://www.gnu.org/licenses/lgpl-2.1.html - -#ifndef HIPPOMOCKS_H -#define HIPPOMOCKS_H - -// If you want to put all HippoMocks symbols into the global namespace, use the define below. -//#define NO_HIPPOMOCKS_NAMESPACE - -// The DEFAULT_AUTOEXPECT is an option that determines whether tests are, by default, under- or -// overspecified. Auto-expect, by function, adds an expectation to the current ExpectCall that -// it will happen after the previous ExpectCall. For many people this is an intuitive and logical -// thing when writing a C++ program. Usually, this makes your test workable but overspecified. -// Overspecified means that your test will fail on working code that does things in a different -// order. The alternative, underspecified, allows code to pass your test that does things in a -// different order, where that different order should be considered wrong. Consider reading a -// file, where it needs to be first opened, then read and then closed. -// -// The default is to make tests overspecified. At least it prevents faulty code from passing -// unit tests. To locally disable (or enable) this behaviour, set the boolean autoExpect on your -// MockRepository to false (or true). -#define DEFAULT_AUTOEXPECT true - -#ifdef NO_HIPPOMOCKS_NAMESPACE -#define HM_NS -#else -#define HM_NS HippoMocks:: -#endif - -#ifndef DEBUGBREAK -#ifdef _MSC_VER -__declspec(dllimport) int __stdcall IsDebuggerPresent(); -void __stdcall DebugBreak(); -#define DEBUGBREAK() /*if (IsDebuggerPresent()) DebugBreak(); else (void)0*/ -#else -#define DEBUGBREAK() -#endif -#endif - -#ifndef DONTCARE_NAME -#define DONTCARE_NAME _ -#endif - -#ifndef VIRT_FUNC_LIMIT -#define VIRT_FUNC_LIMIT 1024 -#elif VIRT_FUNC_LIMIT > 1024 -#error Adjust the code to support more than 1024 virtual functions before setting the VIRT_FUNC_LIMIT above 1024 -#endif - -#ifdef __GNUC__ -#define EXTRA_DESTRUCTOR -#endif - -#ifdef __EDG__ -#define FUNCTION_BASE 3 -#define FUNCTION_STRIDE 2 -#else -#define FUNCTION_BASE 0 -#define FUNCTION_STRIDE 1 -#endif - -#if defined(_WIN32) && defined(_MSC_VER) && defined(_M_IX86) -#define ENABLE_CFUNC_MOCKING_SUPPORT -#elif defined(__linux__) && defined(__GNUC__) && defined(__i386__) -#define ENABLE_CFUNC_MOCKING_SUPPORT -#endif - -#if defined(__GNUC__) && !defined(__EXCEPTIONS) -#define HM_NO_EXCEPTIONS -class X{}; -#define BASE_EXCEPTION X -#else -#ifndef BASE_EXCEPTION -#define BASE_EXCEPTION std::exception -#include -#endif -#endif - - -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER -// these warnings are pointless and huge, and will confuse new users. -#pragma warning(push) -// If you can't generate an assignment operator the least you can do is shut up. -#pragma warning(disable: 4512) -// Alignment not right in a union? -#pragma warning(disable: 4121) -// No deprecated warnings on functions that really aren't deprecated at all. -#pragma warning(disable: 4996) - -// Tell Microsoft to conform to C++ (as far as is possible...) -#pragma pointers_to_members(full_generality, virtual_inheritance) -#endif - -#ifndef NO_HIPPOMOCKS_NAMESPACE -namespace HippoMocks -{ -#endif - -//Type-safe exception wrapping -class ExceptionHolder -{ -public: - virtual ~ExceptionHolder() {} - virtual void rethrow() = 0; - template - static ExceptionHolder *Create(T ex); -}; - -template -class ExceptionWrapper : public ExceptionHolder { - T exception; -public: - ExceptionWrapper(T exception) : exception(exception) {} - void rethrow() { throw exception; } -}; - -template -ExceptionHolder *ExceptionHolder::Create(T ex) -{ - return new ExceptionWrapper(ex); -} - -#ifdef HM_NO_EXCEPTIONS -#define RAISEEXCEPTION(e) { std::string err = e.what(); DEBUGBREAK(); printf("Mock error found - Fatal due to no exception support:\n"); \ - printf("%s\n", err); \ - abort(); exit(-1); } -#define RAISELATENTEXCEPTION(e) { std::string err = e.what(); DEBUGBREAK(); printf("Mock error found - Fatal due to no exception support:\n"); \ - printf("%s\n", err); \ - abort(); exit(-1); } -#else -#define RAISEEXCEPTION(e) { DEBUGBREAK(); throw e; } -#define RAISELATENTEXCEPTION(e) { DEBUGBREAK(); if (std::uncaught_exception()) \ - MockRepoInstanceHolder<0>::instance->SetLatentException(ExceptionHolder::Create(e)); \ - else throw e; } -#endif - -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT -#include - -#if defined(_WIN32) -#include - -class Unprotect -{ -public: - Unprotect(void *location, size_t byteCount) - : origFunc(location) - , byteCount(byteCount) - { - VirtualProtect(origFunc, byteCount, PAGE_EXECUTE_READWRITE, &oldprotect); - } - ~Unprotect() - { - unsigned long dontcare; - VirtualProtect(origFunc, byteCount, oldprotect, &dontcare); - } -private: - void *origFunc; - size_t byteCount; - unsigned long oldprotect; -}; -#elif defined(__linux__) -#include -#include - -class Unprotect -{ -public: - Unprotect(void *location, size_t byteCount) - : origFunc((intptr_t)location & (~0xFFF)) - , byteCount(byteCount + ((intptr_t)location - origFunc)) - { - mprotect((void *)origFunc, this->byteCount, PROT_READ|PROT_WRITE|PROT_EXEC); - }; - ~Unprotect() - { - mprotect((void *)origFunc, byteCount, PROT_READ|PROT_EXEC); - } -private: - intptr_t origFunc; - int byteCount; -}; -#endif - -typedef unsigned int e9ptrsize_t; - -template -T horrible_cast(U u) -{ - union { T t; U u; } un; - un.u = u; - return un.t; -} - -class Replace -{ -private: - void *origFunc; - char backupData[sizeof(e9ptrsize_t) + 1]; -public: - template - Replace(T funcptr, T replacement) - : origFunc(horrible_cast(funcptr)) - { - Unprotect _allow_write(origFunc, sizeof(e9ptrsize_t) + 1); - memcpy(backupData, origFunc, sizeof(backupData)); - *(unsigned char *)origFunc = 0xE9; - *(e9ptrsize_t*)(horrible_cast(origFunc) + 1) = (e9ptrsize_t)(horrible_cast(replacement) - horrible_cast(origFunc) - sizeof(e9ptrsize_t) - 1); - } - ~Replace() - { - Unprotect _allow_write(origFunc, sizeof(e9ptrsize_t) + 1); - memcpy(origFunc, backupData, sizeof(backupData)); - } -}; -#endif - -class MockRepository; - -enum RegistrationType { - Never, - Once, - Any -}; - -// base type -class base_mock { -public: - void destroy() { unwriteVft(); delete this; } - virtual ~base_mock() {} - void *rewriteVft(void *newVf) - { - void *oldVf = *(void **)this; - *(void **)this = newVf; - return oldVf; - } - void reset() - { - unwriteVft(); - mock_reset(); - } - virtual void mock_reset() = 0; - void unwriteVft() - { - *(void **)this = (*(void ***)this)[VIRT_FUNC_LIMIT+1]; - } -}; - -class NullType -{ -public: - bool operator==(const NullType &) const - { - return true; - } -}; - -class DontCare {}; -static DontCare DONTCARE_NAME; -static void _notused() { - if (&DONTCARE_NAME > 0) return; - _notused(); -} - -template -struct OutParam: public DontCare -{ - explicit OutParam(T value): value(value) {} - T value; -}; - -template -OutParam Out(T t) { return OutParam(t); } - -template -struct InParam; - -template -struct InParam: public DontCare -{ - explicit InParam(T& value): value(value) - { - } - T& value; -}; - -template -struct InParam: public DontCare -{ - explicit InParam(T*& value): value(value) - { - } - T*& value; -}; - -template -InParam In(T& t) { return InParam(t); } - -template -InParam In(T*& t) { return InParam(t); } - -struct NotPrintable { template NotPrintable(T const&) {} }; - -inline std::ostream &operator<<(std::ostream &os, NotPrintable const&) -{ - os << "???"; - return os; -} - -inline std::ostream &operator<<(std::ostream &os, DontCare const&) -{ - os << "_"; - return os; -} - -template -struct printArg -{ - static inline void print(std::ostream &os, T arg, bool withComma) - { - if (withComma) - os << ","; - os << arg; - } -}; - -template <> -struct printArg -{ - static void print(std::ostream &, NullType , bool) - { - } -}; - -class base_tuple -{ -protected: - base_tuple() - { - } -public: - virtual ~base_tuple() - { - } - virtual void printTo(std::ostream &os) const = 0; -}; - -template -struct no_cref { typedef X type; }; - -template -struct no_cref { typedef X type; }; - -template struct with_const { typedef const A type; }; -template struct with_const { typedef const A &type; }; -template struct with_const { typedef const A type; }; -template struct with_const { typedef const A &type; }; - -template struct base_type { typedef T type; }; -template struct base_type { typedef T type; }; -template struct base_type { typedef T type; }; -template struct base_type { typedef T type; }; - -template -struct comparer -{ - static inline bool compare(typename with_const::type a, typename with_const::type b) - { - return a == b; - } - static inline bool compare(DontCare, typename with_const::type) - { - return true; - } -}; - -template -struct IsOutParamType { enum { value = false }; }; -template -struct IsOutParamType > { enum { value = true }; }; - -template -struct IsInParamType { enum { value = false }; }; -template -struct IsInParamType > { enum { value = true }; }; -template -struct IsInParamType > { enum { value = true }; }; - -template -struct do_assign; - -template -struct do_assign -{ - static void assign_to(T1 outparam, T2 *refparam) - { - *refparam = outparam.value; - } - static void assign_from(T1 inparam, T2 *refparam) - { - inparam.value = refparam; - } -}; - -template -struct do_assign -{ - static void assign_to(T1 outparam, T2 &refparam) - { - refparam = outparam.value; - } - static void assign_from(T1 inparam, T2 &refparam) - { - inparam.value = refparam; - } -}; - -template -struct do_assign -{ - static void assign_to(T1, T2) {} - static void assign_from(T1, T2) {} -}; - -template -void out_assign(T1 a, T2 b) -{ - do_assign::type>::value >::assign_to(a, b); -} - -template -void in_assign(T1 a, T2 b) -{ - do_assign::type>::value >::assign_from(a, b); -} - -template -class ref_tuple : public base_tuple -{ -public: - A a; - B b; - C c; - D d; - E e; - F f; - G g; - H h; - I i; - J j; - K k; - L l; - M m; - N n; - O o; - P p; - ref_tuple(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) - : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h), i(i), j(j), k(k), l(l), m(m), n(n), o(o), p(p) - {} - virtual void printTo(std::ostream &os) const - { - os << "("; - printArg::print(os, a, false); - printArg::print(os, b, true); - printArg::print(os, c, true); - printArg::print(os, d, true); - printArg::print(os, e, true); - printArg::print(os, f, true); - printArg::print(os, g, true); - printArg::print(os, h, true); - printArg::print(os, i, true); - printArg::print(os, j, true); - printArg::print(os, k, true); - printArg::print(os, l, true); - printArg::print(os, m, true); - printArg::print(os, n, true); - printArg::print(os, o, true); - printArg

::compare(p, to.p)); - } - void assign_from(ref_tuple &from) - { - in_assign< typename with_ref::type, A>(a, from.a); - in_assign< typename with_ref::type, B>(b, from.b); - in_assign< typename with_ref::type, C>(c, from.c); - in_assign< typename with_ref::type, D>(d, from.d); - in_assign< typename with_ref::type, E>(e, from.e); - in_assign< typename with_ref::type, F>(f, from.f); - in_assign< typename with_ref::type, G>(g, from.g); - in_assign< typename with_ref::type, H>(h, from.h); - in_assign< typename with_ref::type, I>(i, from.i); - in_assign< typename with_ref::type, J>(j, from.j); - in_assign< typename with_ref::type, K>(k, from.k); - in_assign< typename with_ref::type, L>(l, from.l); - in_assign< typename with_ref::type, M>(m, from.m); - in_assign< typename with_ref::type, N>(n, from.n); - in_assign< typename with_ref::type, O>(o, from.o); - in_assign< typename with_ref::type, P>(p, from.p); - } - void assign_to(ref_tuple &to) - { - out_assign< typename with_ref::type, A>(a, to.a); - out_assign< typename with_ref::type, B>(b, to.b); - out_assign< typename with_ref::type, C>(c, to.c); - out_assign< typename with_ref::type, D>(d, to.d); - out_assign< typename with_ref::type, E>(e, to.e); - out_assign< typename with_ref::type, F>(f, to.f); - out_assign< typename with_ref::type, G>(g, to.g); - out_assign< typename with_ref::type, H>(h, to.h); - out_assign< typename with_ref::type, I>(i, to.i); - out_assign< typename with_ref::type, J>(j, to.j); - out_assign< typename with_ref::type, K>(k, to.k); - out_assign< typename with_ref::type, L>(l, to.l); - out_assign< typename with_ref::type, M>(m, to.m); - out_assign< typename with_ref::type, N>(n, to.n); - out_assign< typename with_ref::type, O>(o, to.o); - out_assign< typename with_ref::type, P>(p, to.p); - } - virtual void printTo(std::ostream &os) const - { - os << "("; - printArg::type>::print(os, a, false); - printArg::type>::print(os, b, true); - printArg::type>::print(os, c, true); - printArg::type>::print(os, d, true); - printArg::type>::print(os, e, true); - printArg::type>::print(os, f, true); - printArg::type>::print(os, g, true); - printArg::type>::print(os, h, true); - printArg::type>::print(os, i, true); - printArg::type>::print(os, j, true); - printArg::type>::print(os, k, true); - printArg::type>::print(os, l, true); - printArg::type>::print(os, m, true); - printArg::type>::print(os, n, true); - printArg::type>::print(os, o, true); - printArg::type>::print(os, p, true); - os << ")"; - } -}; - -inline std::ostream &operator<<(std::ostream &os, const MockRepository &repo); - -class BaseException -#ifndef HM_NO_EXCEPTIONS - : public BASE_EXCEPTION -#endif -{ -public: - ~BaseException() throw() {} - const char *what() const throw() { return txt.c_str(); } -protected: - std::string txt; -}; - -// exception types -class ExpectationException : public BaseException { -public: - ExpectationException(MockRepository *repo, const base_tuple *tuple, const char *funcName) - { - std::stringstream text; - text << "Function "; - text << funcName; - if (tuple) - tuple->printTo(text); - else - text << "(...)"; - text << " called with mismatching expectation!" << std::endl; - text << *repo; - txt = text.str(); - } -}; - -#ifdef LINUX_TARGET -#include -#endif - -class NotImplementedException : public BaseException { -public: - NotImplementedException(MockRepository *repo) - { - std::stringstream text; - text << "Function called without expectation!" << std::endl; - text << *repo; - -#ifdef LINUX_TARGET - void* stacktrace[256]; - size_t size = backtrace( stacktrace, sizeof(stacktrace) ); - if( size > 0 ) - { - text << "Stackdump:" << std::endl; - char **symbols = backtrace_symbols( stacktrace, size ); - for( size_t i = 0; i < size; i = i + 1 ) - { - text << symbols[i] << std::endl; - } - free( symbols ); - } -#endif - - txt = text.str(); - } -}; - -class CallMissingException : public BaseException { -public: - CallMissingException(MockRepository *repo) - { - std::stringstream text; - text << "Function with expectation not called!" << std::endl; - text << *repo; - txt = text.str(); - } -}; - -class ZombieMockException : public BaseException { -public: - ZombieMockException(MockRepository *repo) - { - std::stringstream text; - text << "Function called on mock that has already been destroyed!" << std::endl; - text << *repo; - -#ifdef LINUX_TARGET - void* stacktrace[256]; - size_t size = backtrace( stacktrace, sizeof(stacktrace) ); - if( size > 0 ) - { - text << "Stackdump:" << std::endl; - char **symbols = backtrace_symbols( stacktrace, size ); - for( size_t i = 0; i < size; i = i + 1 ) - { - text << symbols[i] << std::endl; - } - free( symbols ); - } -#endif - - txt = text.str(); - } -}; - -class NoResultSetUpException : public BaseException { -public: - NoResultSetUpException(MockRepository *repo, const base_tuple *tuple, const char *funcName) - { - std::stringstream text; - text << "No result set up on call to "; - text << funcName; - if (tuple) - tuple->printTo(text); - else - text << "(...)"; - text << std::endl; - text << *repo; - -#ifdef LINUX_TARGET - void* stacktrace[256]; - size_t size = backtrace( stacktrace, sizeof(stacktrace) ); - if( size > 0 ) - { - text << "Stackdump:" << std::endl; - char **symbols = backtrace_symbols( stacktrace, size ); - for( size_t i = 0; i < size; i = i + 1 ) - { - text << symbols[i] << std::endl; - } - free( symbols ); - } -#endif - - txt = text.str(); - } -}; - -// function-index-of-type -class func_index { -public: - int lci; - virtual int f0(int) { return lci=0; } virtual int f1(int) { return lci=1; } virtual int f2(int) { return lci=2; } virtual int f3(int) { return lci=3; } - virtual int f4(int) { return lci=4; } virtual int f5(int) { return lci=5; } virtual int f6(int) { return lci=6; } virtual int f7(int) { return lci=7; } - virtual int f8(int) { return lci=8; } virtual int f9(int) { return lci=9; } virtual int f10(int) { return lci=10; } virtual int f11(int) { return lci=11; } - virtual int f12(int) { return lci=12; } virtual int f13(int) { return lci=13; } virtual int f14(int) { return lci=14; } virtual int f15(int) { return lci=15; } - virtual int f16(int) { return lci=16; } virtual int f17(int) { return lci=17; } virtual int f18(int) { return lci=18; } virtual int f19(int) { return lci=19; } - virtual int f20(int) { return lci=20; } virtual int f21(int) { return lci=21; } virtual int f22(int) { return lci=22; } virtual int f23(int) { return lci=23; } - virtual int f24(int) { return lci=24; } virtual int f25(int) { return lci=25; } virtual int f26(int) { return lci=26; } virtual int f27(int) { return lci=27; } - virtual int f28(int) { return lci=28; } virtual int f29(int) { return lci=29; } virtual int f30(int) { return lci=30; } virtual int f31(int) { return lci=31; } - virtual int f32(int) { return lci=32; } virtual int f33(int) { return lci=33; } virtual int f34(int) { return lci=34; } virtual int f35(int) { return lci=35; } - virtual int f36(int) { return lci=36; } virtual int f37(int) { return lci=37; } virtual int f38(int) { return lci=38; } virtual int f39(int) { return lci=39; } - virtual int f40(int) { return lci=40; } virtual int f41(int) { return lci=41; } virtual int f42(int) { return lci=42; } virtual int f43(int) { return lci=43; } - virtual int f44(int) { return lci=44; } virtual int f45(int) { return lci=45; } virtual int f46(int) { return lci=46; } virtual int f47(int) { return lci=47; } - virtual int f48(int) { return lci=48; } virtual int f49(int) { return lci=49; } virtual int f50(int) { return lci=50; } virtual int f51(int) { return lci=51; } - virtual int f52(int) { return lci=52; } virtual int f53(int) { return lci=53; } virtual int f54(int) { return lci=54; } virtual int f55(int) { return lci=55; } - virtual int f56(int) { return lci=56; } virtual int f57(int) { return lci=57; } virtual int f58(int) { return lci=58; } virtual int f59(int) { return lci=59; } - virtual int f60(int) { return lci=60; } virtual int f61(int) { return lci=61; } virtual int f62(int) { return lci=62; } virtual int f63(int) { return lci=63; } - virtual int f64(int) { return lci=64; } virtual int f65(int) { return lci=65; } virtual int f66(int) { return lci=66; } virtual int f67(int) { return lci=67; } - virtual int f68(int) { return lci=68; } virtual int f69(int) { return lci=69; } virtual int f70(int) { return lci=70; } virtual int f71(int) { return lci=71; } - virtual int f72(int) { return lci=72; } virtual int f73(int) { return lci=73; } virtual int f74(int) { return lci=74; } virtual int f75(int) { return lci=75; } - virtual int f76(int) { return lci=76; } virtual int f77(int) { return lci=77; } virtual int f78(int) { return lci=78; } virtual int f79(int) { return lci=79; } - virtual int f80(int) { return lci=80; } virtual int f81(int) { return lci=81; } virtual int f82(int) { return lci=82; } virtual int f83(int) { return lci=83; } - virtual int f84(int) { return lci=84; } virtual int f85(int) { return lci=85; } virtual int f86(int) { return lci=86; } virtual int f87(int) { return lci=87; } - virtual int f88(int) { return lci=88; } virtual int f89(int) { return lci=89; } virtual int f90(int) { return lci=90; } virtual int f91(int) { return lci=91; } - virtual int f92(int) { return lci=92; } virtual int f93(int) { return lci=93; } virtual int f94(int) { return lci=94; } virtual int f95(int) { return lci=95; } - virtual int f96(int) { return lci=96; } virtual int f97(int) { return lci=97; } virtual int f98(int) { return lci=98; } virtual int f99(int) { return lci=99; } - virtual int f100(int) { return lci=100; } virtual int f101(int) { return lci=101; } virtual int f102(int) { return lci=102; } virtual int f103(int) { return lci=103; } - virtual int f104(int) { return lci=104; } virtual int f105(int) { return lci=105; } virtual int f106(int) { return lci=106; } virtual int f107(int) { return lci=107; } - virtual int f108(int) { return lci=108; } virtual int f109(int) { return lci=109; } virtual int f110(int) { return lci=110; } virtual int f111(int) { return lci=111; } - virtual int f112(int) { return lci=112; } virtual int f113(int) { return lci=113; } virtual int f114(int) { return lci=114; } virtual int f115(int) { return lci=115; } - virtual int f116(int) { return lci=116; } virtual int f117(int) { return lci=117; } virtual int f118(int) { return lci=118; } virtual int f119(int) { return lci=119; } - virtual int f120(int) { return lci=120; } virtual int f121(int) { return lci=121; } virtual int f122(int) { return lci=122; } virtual int f123(int) { return lci=123; } - virtual int f124(int) { return lci=124; } virtual int f125(int) { return lci=125; } virtual int f126(int) { return lci=126; } virtual int f127(int) { return lci=127; } - virtual int f128(int) { return lci=128; } virtual int f129(int) { return lci=129; } virtual int f130(int) { return lci=130; } virtual int f131(int) { return lci=131; } - virtual int f132(int) { return lci=132; } virtual int f133(int) { return lci=133; } virtual int f134(int) { return lci=134; } virtual int f135(int) { return lci=135; } - virtual int f136(int) { return lci=136; } virtual int f137(int) { return lci=137; } virtual int f138(int) { return lci=138; } virtual int f139(int) { return lci=139; } - virtual int f140(int) { return lci=140; } virtual int f141(int) { return lci=141; } virtual int f142(int) { return lci=142; } virtual int f143(int) { return lci=143; } - virtual int f144(int) { return lci=144; } virtual int f145(int) { return lci=145; } virtual int f146(int) { return lci=146; } virtual int f147(int) { return lci=147; } - virtual int f148(int) { return lci=148; } virtual int f149(int) { return lci=149; } virtual int f150(int) { return lci=150; } virtual int f151(int) { return lci=151; } - virtual int f152(int) { return lci=152; } virtual int f153(int) { return lci=153; } virtual int f154(int) { return lci=154; } virtual int f155(int) { return lci=155; } - virtual int f156(int) { return lci=156; } virtual int f157(int) { return lci=157; } virtual int f158(int) { return lci=158; } virtual int f159(int) { return lci=159; } - virtual int f160(int) { return lci=160; } virtual int f161(int) { return lci=161; } virtual int f162(int) { return lci=162; } virtual int f163(int) { return lci=163; } - virtual int f164(int) { return lci=164; } virtual int f165(int) { return lci=165; } virtual int f166(int) { return lci=166; } virtual int f167(int) { return lci=167; } - virtual int f168(int) { return lci=168; } virtual int f169(int) { return lci=169; } virtual int f170(int) { return lci=170; } virtual int f171(int) { return lci=171; } - virtual int f172(int) { return lci=172; } virtual int f173(int) { return lci=173; } virtual int f174(int) { return lci=174; } virtual int f175(int) { return lci=175; } - virtual int f176(int) { return lci=176; } virtual int f177(int) { return lci=177; } virtual int f178(int) { return lci=178; } virtual int f179(int) { return lci=179; } - virtual int f180(int) { return lci=180; } virtual int f181(int) { return lci=181; } virtual int f182(int) { return lci=182; } virtual int f183(int) { return lci=183; } - virtual int f184(int) { return lci=184; } virtual int f185(int) { return lci=185; } virtual int f186(int) { return lci=186; } virtual int f187(int) { return lci=187; } - virtual int f188(int) { return lci=188; } virtual int f189(int) { return lci=189; } virtual int f190(int) { return lci=190; } virtual int f191(int) { return lci=191; } - virtual int f192(int) { return lci=192; } virtual int f193(int) { return lci=193; } virtual int f194(int) { return lci=194; } virtual int f195(int) { return lci=195; } - virtual int f196(int) { return lci=196; } virtual int f197(int) { return lci=197; } virtual int f198(int) { return lci=198; } virtual int f199(int) { return lci=199; } - virtual int f200(int) { return lci=200; } virtual int f201(int) { return lci=201; } virtual int f202(int) { return lci=202; } virtual int f203(int) { return lci=203; } - virtual int f204(int) { return lci=204; } virtual int f205(int) { return lci=205; } virtual int f206(int) { return lci=206; } virtual int f207(int) { return lci=207; } - virtual int f208(int) { return lci=208; } virtual int f209(int) { return lci=209; } virtual int f210(int) { return lci=210; } virtual int f211(int) { return lci=211; } - virtual int f212(int) { return lci=212; } virtual int f213(int) { return lci=213; } virtual int f214(int) { return lci=214; } virtual int f215(int) { return lci=215; } - virtual int f216(int) { return lci=216; } virtual int f217(int) { return lci=217; } virtual int f218(int) { return lci=218; } virtual int f219(int) { return lci=219; } - virtual int f220(int) { return lci=220; } virtual int f221(int) { return lci=221; } virtual int f222(int) { return lci=222; } virtual int f223(int) { return lci=223; } - virtual int f224(int) { return lci=224; } virtual int f225(int) { return lci=225; } virtual int f226(int) { return lci=226; } virtual int f227(int) { return lci=227; } - virtual int f228(int) { return lci=228; } virtual int f229(int) { return lci=229; } virtual int f230(int) { return lci=230; } virtual int f231(int) { return lci=231; } - virtual int f232(int) { return lci=232; } virtual int f233(int) { return lci=233; } virtual int f234(int) { return lci=234; } virtual int f235(int) { return lci=235; } - virtual int f236(int) { return lci=236; } virtual int f237(int) { return lci=237; } virtual int f238(int) { return lci=238; } virtual int f239(int) { return lci=239; } - virtual int f240(int) { return lci=240; } virtual int f241(int) { return lci=241; } virtual int f242(int) { return lci=242; } virtual int f243(int) { return lci=243; } - virtual int f244(int) { return lci=244; } virtual int f245(int) { return lci=245; } virtual int f246(int) { return lci=246; } virtual int f247(int) { return lci=247; } - virtual int f248(int) { return lci=248; } virtual int f249(int) { return lci=249; } virtual int f250(int) { return lci=250; } virtual int f251(int) { return lci=251; } - virtual int f252(int) { return lci=252; } virtual int f253(int) { return lci=253; } virtual int f254(int) { return lci=254; } virtual int f255(int) { return lci=255; } - virtual int f256(int) { return lci=256; } virtual int f257(int) { return lci=257; } virtual int f258(int) { return lci=258; } virtual int f259(int) { return lci=259; } - virtual int f260(int) { return lci=260; } virtual int f261(int) { return lci=261; } virtual int f262(int) { return lci=262; } virtual int f263(int) { return lci=263; } - virtual int f264(int) { return lci=264; } virtual int f265(int) { return lci=265; } virtual int f266(int) { return lci=266; } virtual int f267(int) { return lci=267; } - virtual int f268(int) { return lci=268; } virtual int f269(int) { return lci=269; } virtual int f270(int) { return lci=270; } virtual int f271(int) { return lci=271; } - virtual int f272(int) { return lci=272; } virtual int f273(int) { return lci=273; } virtual int f274(int) { return lci=274; } virtual int f275(int) { return lci=275; } - virtual int f276(int) { return lci=276; } virtual int f277(int) { return lci=277; } virtual int f278(int) { return lci=278; } virtual int f279(int) { return lci=279; } - virtual int f280(int) { return lci=280; } virtual int f281(int) { return lci=281; } virtual int f282(int) { return lci=282; } virtual int f283(int) { return lci=283; } - virtual int f284(int) { return lci=284; } virtual int f285(int) { return lci=285; } virtual int f286(int) { return lci=286; } virtual int f287(int) { return lci=287; } - virtual int f288(int) { return lci=288; } virtual int f289(int) { return lci=289; } virtual int f290(int) { return lci=290; } virtual int f291(int) { return lci=291; } - virtual int f292(int) { return lci=292; } virtual int f293(int) { return lci=293; } virtual int f294(int) { return lci=294; } virtual int f295(int) { return lci=295; } - virtual int f296(int) { return lci=296; } virtual int f297(int) { return lci=297; } virtual int f298(int) { return lci=298; } virtual int f299(int) { return lci=299; } - virtual int f300(int) { return lci=300; } virtual int f301(int) { return lci=301; } virtual int f302(int) { return lci=302; } virtual int f303(int) { return lci=303; } - virtual int f304(int) { return lci=304; } virtual int f305(int) { return lci=305; } virtual int f306(int) { return lci=306; } virtual int f307(int) { return lci=307; } - virtual int f308(int) { return lci=308; } virtual int f309(int) { return lci=309; } virtual int f310(int) { return lci=310; } virtual int f311(int) { return lci=311; } - virtual int f312(int) { return lci=312; } virtual int f313(int) { return lci=313; } virtual int f314(int) { return lci=314; } virtual int f315(int) { return lci=315; } - virtual int f316(int) { return lci=316; } virtual int f317(int) { return lci=317; } virtual int f318(int) { return lci=318; } virtual int f319(int) { return lci=319; } - virtual int f320(int) { return lci=320; } virtual int f321(int) { return lci=321; } virtual int f322(int) { return lci=322; } virtual int f323(int) { return lci=323; } - virtual int f324(int) { return lci=324; } virtual int f325(int) { return lci=325; } virtual int f326(int) { return lci=326; } virtual int f327(int) { return lci=327; } - virtual int f328(int) { return lci=328; } virtual int f329(int) { return lci=329; } virtual int f330(int) { return lci=330; } virtual int f331(int) { return lci=331; } - virtual int f332(int) { return lci=332; } virtual int f333(int) { return lci=333; } virtual int f334(int) { return lci=334; } virtual int f335(int) { return lci=335; } - virtual int f336(int) { return lci=336; } virtual int f337(int) { return lci=337; } virtual int f338(int) { return lci=338; } virtual int f339(int) { return lci=339; } - virtual int f340(int) { return lci=340; } virtual int f341(int) { return lci=341; } virtual int f342(int) { return lci=342; } virtual int f343(int) { return lci=343; } - virtual int f344(int) { return lci=344; } virtual int f345(int) { return lci=345; } virtual int f346(int) { return lci=346; } virtual int f347(int) { return lci=347; } - virtual int f348(int) { return lci=348; } virtual int f349(int) { return lci=349; } virtual int f350(int) { return lci=350; } virtual int f351(int) { return lci=351; } - virtual int f352(int) { return lci=352; } virtual int f353(int) { return lci=353; } virtual int f354(int) { return lci=354; } virtual int f355(int) { return lci=355; } - virtual int f356(int) { return lci=356; } virtual int f357(int) { return lci=357; } virtual int f358(int) { return lci=358; } virtual int f359(int) { return lci=359; } - virtual int f360(int) { return lci=360; } virtual int f361(int) { return lci=361; } virtual int f362(int) { return lci=362; } virtual int f363(int) { return lci=363; } - virtual int f364(int) { return lci=364; } virtual int f365(int) { return lci=365; } virtual int f366(int) { return lci=366; } virtual int f367(int) { return lci=367; } - virtual int f368(int) { return lci=368; } virtual int f369(int) { return lci=369; } virtual int f370(int) { return lci=370; } virtual int f371(int) { return lci=371; } - virtual int f372(int) { return lci=372; } virtual int f373(int) { return lci=373; } virtual int f374(int) { return lci=374; } virtual int f375(int) { return lci=375; } - virtual int f376(int) { return lci=376; } virtual int f377(int) { return lci=377; } virtual int f378(int) { return lci=378; } virtual int f379(int) { return lci=379; } - virtual int f380(int) { return lci=380; } virtual int f381(int) { return lci=381; } virtual int f382(int) { return lci=382; } virtual int f383(int) { return lci=383; } - virtual int f384(int) { return lci=384; } virtual int f385(int) { return lci=385; } virtual int f386(int) { return lci=386; } virtual int f387(int) { return lci=387; } - virtual int f388(int) { return lci=388; } virtual int f389(int) { return lci=389; } virtual int f390(int) { return lci=390; } virtual int f391(int) { return lci=391; } - virtual int f392(int) { return lci=392; } virtual int f393(int) { return lci=393; } virtual int f394(int) { return lci=394; } virtual int f395(int) { return lci=395; } - virtual int f396(int) { return lci=396; } virtual int f397(int) { return lci=397; } virtual int f398(int) { return lci=398; } virtual int f399(int) { return lci=399; } - virtual int f400(int) { return lci=400; } virtual int f401(int) { return lci=401; } virtual int f402(int) { return lci=402; } virtual int f403(int) { return lci=403; } - virtual int f404(int) { return lci=404; } virtual int f405(int) { return lci=405; } virtual int f406(int) { return lci=406; } virtual int f407(int) { return lci=407; } - virtual int f408(int) { return lci=408; } virtual int f409(int) { return lci=409; } virtual int f410(int) { return lci=410; } virtual int f411(int) { return lci=411; } - virtual int f412(int) { return lci=412; } virtual int f413(int) { return lci=413; } virtual int f414(int) { return lci=414; } virtual int f415(int) { return lci=415; } - virtual int f416(int) { return lci=416; } virtual int f417(int) { return lci=417; } virtual int f418(int) { return lci=418; } virtual int f419(int) { return lci=419; } - virtual int f420(int) { return lci=420; } virtual int f421(int) { return lci=421; } virtual int f422(int) { return lci=422; } virtual int f423(int) { return lci=423; } - virtual int f424(int) { return lci=424; } virtual int f425(int) { return lci=425; } virtual int f426(int) { return lci=426; } virtual int f427(int) { return lci=427; } - virtual int f428(int) { return lci=428; } virtual int f429(int) { return lci=429; } virtual int f430(int) { return lci=430; } virtual int f431(int) { return lci=431; } - virtual int f432(int) { return lci=432; } virtual int f433(int) { return lci=433; } virtual int f434(int) { return lci=434; } virtual int f435(int) { return lci=435; } - virtual int f436(int) { return lci=436; } virtual int f437(int) { return lci=437; } virtual int f438(int) { return lci=438; } virtual int f439(int) { return lci=439; } - virtual int f440(int) { return lci=440; } virtual int f441(int) { return lci=441; } virtual int f442(int) { return lci=442; } virtual int f443(int) { return lci=443; } - virtual int f444(int) { return lci=444; } virtual int f445(int) { return lci=445; } virtual int f446(int) { return lci=446; } virtual int f447(int) { return lci=447; } - virtual int f448(int) { return lci=448; } virtual int f449(int) { return lci=449; } virtual int f450(int) { return lci=450; } virtual int f451(int) { return lci=451; } - virtual int f452(int) { return lci=452; } virtual int f453(int) { return lci=453; } virtual int f454(int) { return lci=454; } virtual int f455(int) { return lci=455; } - virtual int f456(int) { return lci=456; } virtual int f457(int) { return lci=457; } virtual int f458(int) { return lci=458; } virtual int f459(int) { return lci=459; } - virtual int f460(int) { return lci=460; } virtual int f461(int) { return lci=461; } virtual int f462(int) { return lci=462; } virtual int f463(int) { return lci=463; } - virtual int f464(int) { return lci=464; } virtual int f465(int) { return lci=465; } virtual int f466(int) { return lci=466; } virtual int f467(int) { return lci=467; } - virtual int f468(int) { return lci=468; } virtual int f469(int) { return lci=469; } virtual int f470(int) { return lci=470; } virtual int f471(int) { return lci=471; } - virtual int f472(int) { return lci=472; } virtual int f473(int) { return lci=473; } virtual int f474(int) { return lci=474; } virtual int f475(int) { return lci=475; } - virtual int f476(int) { return lci=476; } virtual int f477(int) { return lci=477; } virtual int f478(int) { return lci=478; } virtual int f479(int) { return lci=479; } - virtual int f480(int) { return lci=480; } virtual int f481(int) { return lci=481; } virtual int f482(int) { return lci=482; } virtual int f483(int) { return lci=483; } - virtual int f484(int) { return lci=484; } virtual int f485(int) { return lci=485; } virtual int f486(int) { return lci=486; } virtual int f487(int) { return lci=487; } - virtual int f488(int) { return lci=488; } virtual int f489(int) { return lci=489; } virtual int f490(int) { return lci=490; } virtual int f491(int) { return lci=491; } - virtual int f492(int) { return lci=492; } virtual int f493(int) { return lci=493; } virtual int f494(int) { return lci=494; } virtual int f495(int) { return lci=495; } - virtual int f496(int) { return lci=496; } virtual int f497(int) { return lci=497; } virtual int f498(int) { return lci=498; } virtual int f499(int) { return lci=499; } - virtual int f500(int) { return lci=500; } virtual int f501(int) { return lci=501; } virtual int f502(int) { return lci=502; } virtual int f503(int) { return lci=503; } - virtual int f504(int) { return lci=504; } virtual int f505(int) { return lci=505; } virtual int f506(int) { return lci=506; } virtual int f507(int) { return lci=507; } - virtual int f508(int) { return lci=508; } virtual int f509(int) { return lci=509; } virtual int f510(int) { return lci=510; } virtual int f511(int) { return lci=511; } - virtual int f512(int) { return lci=512; } virtual int f513(int) { return lci=513; } virtual int f514(int) { return lci=514; } virtual int f515(int) { return lci=515; } - virtual int f516(int) { return lci=516; } virtual int f517(int) { return lci=517; } virtual int f518(int) { return lci=518; } virtual int f519(int) { return lci=519; } - virtual int f520(int) { return lci=520; } virtual int f521(int) { return lci=521; } virtual int f522(int) { return lci=522; } virtual int f523(int) { return lci=523; } - virtual int f524(int) { return lci=524; } virtual int f525(int) { return lci=525; } virtual int f526(int) { return lci=526; } virtual int f527(int) { return lci=527; } - virtual int f528(int) { return lci=528; } virtual int f529(int) { return lci=529; } virtual int f530(int) { return lci=530; } virtual int f531(int) { return lci=531; } - virtual int f532(int) { return lci=532; } virtual int f533(int) { return lci=533; } virtual int f534(int) { return lci=534; } virtual int f535(int) { return lci=535; } - virtual int f536(int) { return lci=536; } virtual int f537(int) { return lci=537; } virtual int f538(int) { return lci=538; } virtual int f539(int) { return lci=539; } - virtual int f540(int) { return lci=540; } virtual int f541(int) { return lci=541; } virtual int f542(int) { return lci=542; } virtual int f543(int) { return lci=543; } - virtual int f544(int) { return lci=544; } virtual int f545(int) { return lci=545; } virtual int f546(int) { return lci=546; } virtual int f547(int) { return lci=547; } - virtual int f548(int) { return lci=548; } virtual int f549(int) { return lci=549; } virtual int f550(int) { return lci=550; } virtual int f551(int) { return lci=551; } - virtual int f552(int) { return lci=552; } virtual int f553(int) { return lci=553; } virtual int f554(int) { return lci=554; } virtual int f555(int) { return lci=555; } - virtual int f556(int) { return lci=556; } virtual int f557(int) { return lci=557; } virtual int f558(int) { return lci=558; } virtual int f559(int) { return lci=559; } - virtual int f560(int) { return lci=560; } virtual int f561(int) { return lci=561; } virtual int f562(int) { return lci=562; } virtual int f563(int) { return lci=563; } - virtual int f564(int) { return lci=564; } virtual int f565(int) { return lci=565; } virtual int f566(int) { return lci=566; } virtual int f567(int) { return lci=567; } - virtual int f568(int) { return lci=568; } virtual int f569(int) { return lci=569; } virtual int f570(int) { return lci=570; } virtual int f571(int) { return lci=571; } - virtual int f572(int) { return lci=572; } virtual int f573(int) { return lci=573; } virtual int f574(int) { return lci=574; } virtual int f575(int) { return lci=575; } - virtual int f576(int) { return lci=576; } virtual int f577(int) { return lci=577; } virtual int f578(int) { return lci=578; } virtual int f579(int) { return lci=579; } - virtual int f580(int) { return lci=580; } virtual int f581(int) { return lci=581; } virtual int f582(int) { return lci=582; } virtual int f583(int) { return lci=583; } - virtual int f584(int) { return lci=584; } virtual int f585(int) { return lci=585; } virtual int f586(int) { return lci=586; } virtual int f587(int) { return lci=587; } - virtual int f588(int) { return lci=588; } virtual int f589(int) { return lci=589; } virtual int f590(int) { return lci=590; } virtual int f591(int) { return lci=591; } - virtual int f592(int) { return lci=592; } virtual int f593(int) { return lci=593; } virtual int f594(int) { return lci=594; } virtual int f595(int) { return lci=595; } - virtual int f596(int) { return lci=596; } virtual int f597(int) { return lci=597; } virtual int f598(int) { return lci=598; } virtual int f599(int) { return lci=599; } - virtual int f600(int) { return lci=600; } virtual int f601(int) { return lci=601; } virtual int f602(int) { return lci=602; } virtual int f603(int) { return lci=603; } - virtual int f604(int) { return lci=604; } virtual int f605(int) { return lci=605; } virtual int f606(int) { return lci=606; } virtual int f607(int) { return lci=607; } - virtual int f608(int) { return lci=608; } virtual int f609(int) { return lci=609; } virtual int f610(int) { return lci=610; } virtual int f611(int) { return lci=611; } - virtual int f612(int) { return lci=612; } virtual int f613(int) { return lci=613; } virtual int f614(int) { return lci=614; } virtual int f615(int) { return lci=615; } - virtual int f616(int) { return lci=616; } virtual int f617(int) { return lci=617; } virtual int f618(int) { return lci=618; } virtual int f619(int) { return lci=619; } - virtual int f620(int) { return lci=620; } virtual int f621(int) { return lci=621; } virtual int f622(int) { return lci=622; } virtual int f623(int) { return lci=623; } - virtual int f624(int) { return lci=624; } virtual int f625(int) { return lci=625; } virtual int f626(int) { return lci=626; } virtual int f627(int) { return lci=627; } - virtual int f628(int) { return lci=628; } virtual int f629(int) { return lci=629; } virtual int f630(int) { return lci=630; } virtual int f631(int) { return lci=631; } - virtual int f632(int) { return lci=632; } virtual int f633(int) { return lci=633; } virtual int f634(int) { return lci=634; } virtual int f635(int) { return lci=635; } - virtual int f636(int) { return lci=636; } virtual int f637(int) { return lci=637; } virtual int f638(int) { return lci=638; } virtual int f639(int) { return lci=639; } - virtual int f640(int) { return lci=640; } virtual int f641(int) { return lci=641; } virtual int f642(int) { return lci=642; } virtual int f643(int) { return lci=643; } - virtual int f644(int) { return lci=644; } virtual int f645(int) { return lci=645; } virtual int f646(int) { return lci=646; } virtual int f647(int) { return lci=647; } - virtual int f648(int) { return lci=648; } virtual int f649(int) { return lci=649; } virtual int f650(int) { return lci=650; } virtual int f651(int) { return lci=651; } - virtual int f652(int) { return lci=652; } virtual int f653(int) { return lci=653; } virtual int f654(int) { return lci=654; } virtual int f655(int) { return lci=655; } - virtual int f656(int) { return lci=656; } virtual int f657(int) { return lci=657; } virtual int f658(int) { return lci=658; } virtual int f659(int) { return lci=659; } - virtual int f660(int) { return lci=660; } virtual int f661(int) { return lci=661; } virtual int f662(int) { return lci=662; } virtual int f663(int) { return lci=663; } - virtual int f664(int) { return lci=664; } virtual int f665(int) { return lci=665; } virtual int f666(int) { return lci=666; } virtual int f667(int) { return lci=667; } - virtual int f668(int) { return lci=668; } virtual int f669(int) { return lci=669; } virtual int f670(int) { return lci=670; } virtual int f671(int) { return lci=671; } - virtual int f672(int) { return lci=672; } virtual int f673(int) { return lci=673; } virtual int f674(int) { return lci=674; } virtual int f675(int) { return lci=675; } - virtual int f676(int) { return lci=676; } virtual int f677(int) { return lci=677; } virtual int f678(int) { return lci=678; } virtual int f679(int) { return lci=679; } - virtual int f680(int) { return lci=680; } virtual int f681(int) { return lci=681; } virtual int f682(int) { return lci=682; } virtual int f683(int) { return lci=683; } - virtual int f684(int) { return lci=684; } virtual int f685(int) { return lci=685; } virtual int f686(int) { return lci=686; } virtual int f687(int) { return lci=687; } - virtual int f688(int) { return lci=688; } virtual int f689(int) { return lci=689; } virtual int f690(int) { return lci=690; } virtual int f691(int) { return lci=691; } - virtual int f692(int) { return lci=692; } virtual int f693(int) { return lci=693; } virtual int f694(int) { return lci=694; } virtual int f695(int) { return lci=695; } - virtual int f696(int) { return lci=696; } virtual int f697(int) { return lci=697; } virtual int f698(int) { return lci=698; } virtual int f699(int) { return lci=699; } - virtual int f700(int) { return lci=700; } virtual int f701(int) { return lci=701; } virtual int f702(int) { return lci=702; } virtual int f703(int) { return lci=703; } - virtual int f704(int) { return lci=704; } virtual int f705(int) { return lci=705; } virtual int f706(int) { return lci=706; } virtual int f707(int) { return lci=707; } - virtual int f708(int) { return lci=708; } virtual int f709(int) { return lci=709; } virtual int f710(int) { return lci=710; } virtual int f711(int) { return lci=711; } - virtual int f712(int) { return lci=712; } virtual int f713(int) { return lci=713; } virtual int f714(int) { return lci=714; } virtual int f715(int) { return lci=715; } - virtual int f716(int) { return lci=716; } virtual int f717(int) { return lci=717; } virtual int f718(int) { return lci=718; } virtual int f719(int) { return lci=719; } - virtual int f720(int) { return lci=720; } virtual int f721(int) { return lci=721; } virtual int f722(int) { return lci=722; } virtual int f723(int) { return lci=723; } - virtual int f724(int) { return lci=724; } virtual int f725(int) { return lci=725; } virtual int f726(int) { return lci=726; } virtual int f727(int) { return lci=727; } - virtual int f728(int) { return lci=728; } virtual int f729(int) { return lci=729; } virtual int f730(int) { return lci=730; } virtual int f731(int) { return lci=731; } - virtual int f732(int) { return lci=732; } virtual int f733(int) { return lci=733; } virtual int f734(int) { return lci=734; } virtual int f735(int) { return lci=735; } - virtual int f736(int) { return lci=736; } virtual int f737(int) { return lci=737; } virtual int f738(int) { return lci=738; } virtual int f739(int) { return lci=739; } - virtual int f740(int) { return lci=740; } virtual int f741(int) { return lci=741; } virtual int f742(int) { return lci=742; } virtual int f743(int) { return lci=743; } - virtual int f744(int) { return lci=744; } virtual int f745(int) { return lci=745; } virtual int f746(int) { return lci=746; } virtual int f747(int) { return lci=747; } - virtual int f748(int) { return lci=748; } virtual int f749(int) { return lci=749; } virtual int f750(int) { return lci=750; } virtual int f751(int) { return lci=751; } - virtual int f752(int) { return lci=752; } virtual int f753(int) { return lci=753; } virtual int f754(int) { return lci=754; } virtual int f755(int) { return lci=755; } - virtual int f756(int) { return lci=756; } virtual int f757(int) { return lci=757; } virtual int f758(int) { return lci=758; } virtual int f759(int) { return lci=759; } - virtual int f760(int) { return lci=760; } virtual int f761(int) { return lci=761; } virtual int f762(int) { return lci=762; } virtual int f763(int) { return lci=763; } - virtual int f764(int) { return lci=764; } virtual int f765(int) { return lci=765; } virtual int f766(int) { return lci=766; } virtual int f767(int) { return lci=767; } - virtual int f768(int) { return lci=768; } virtual int f769(int) { return lci=769; } virtual int f770(int) { return lci=770; } virtual int f771(int) { return lci=771; } - virtual int f772(int) { return lci=772; } virtual int f773(int) { return lci=773; } virtual int f774(int) { return lci=774; } virtual int f775(int) { return lci=775; } - virtual int f776(int) { return lci=776; } virtual int f777(int) { return lci=777; } virtual int f778(int) { return lci=778; } virtual int f779(int) { return lci=779; } - virtual int f780(int) { return lci=780; } virtual int f781(int) { return lci=781; } virtual int f782(int) { return lci=782; } virtual int f783(int) { return lci=783; } - virtual int f784(int) { return lci=784; } virtual int f785(int) { return lci=785; } virtual int f786(int) { return lci=786; } virtual int f787(int) { return lci=787; } - virtual int f788(int) { return lci=788; } virtual int f789(int) { return lci=789; } virtual int f790(int) { return lci=790; } virtual int f791(int) { return lci=791; } - virtual int f792(int) { return lci=792; } virtual int f793(int) { return lci=793; } virtual int f794(int) { return lci=794; } virtual int f795(int) { return lci=795; } - virtual int f796(int) { return lci=796; } virtual int f797(int) { return lci=797; } virtual int f798(int) { return lci=798; } virtual int f799(int) { return lci=799; } - virtual int f800(int) { return lci=800; } virtual int f801(int) { return lci=801; } virtual int f802(int) { return lci=802; } virtual int f803(int) { return lci=803; } - virtual int f804(int) { return lci=804; } virtual int f805(int) { return lci=805; } virtual int f806(int) { return lci=806; } virtual int f807(int) { return lci=807; } - virtual int f808(int) { return lci=808; } virtual int f809(int) { return lci=809; } virtual int f810(int) { return lci=810; } virtual int f811(int) { return lci=811; } - virtual int f812(int) { return lci=812; } virtual int f813(int) { return lci=813; } virtual int f814(int) { return lci=814; } virtual int f815(int) { return lci=815; } - virtual int f816(int) { return lci=816; } virtual int f817(int) { return lci=817; } virtual int f818(int) { return lci=818; } virtual int f819(int) { return lci=819; } - virtual int f820(int) { return lci=820; } virtual int f821(int) { return lci=821; } virtual int f822(int) { return lci=822; } virtual int f823(int) { return lci=823; } - virtual int f824(int) { return lci=824; } virtual int f825(int) { return lci=825; } virtual int f826(int) { return lci=826; } virtual int f827(int) { return lci=827; } - virtual int f828(int) { return lci=828; } virtual int f829(int) { return lci=829; } virtual int f830(int) { return lci=830; } virtual int f831(int) { return lci=831; } - virtual int f832(int) { return lci=832; } virtual int f833(int) { return lci=833; } virtual int f834(int) { return lci=834; } virtual int f835(int) { return lci=835; } - virtual int f836(int) { return lci=836; } virtual int f837(int) { return lci=837; } virtual int f838(int) { return lci=838; } virtual int f839(int) { return lci=839; } - virtual int f840(int) { return lci=840; } virtual int f841(int) { return lci=841; } virtual int f842(int) { return lci=842; } virtual int f843(int) { return lci=843; } - virtual int f844(int) { return lci=844; } virtual int f845(int) { return lci=845; } virtual int f846(int) { return lci=846; } virtual int f847(int) { return lci=847; } - virtual int f848(int) { return lci=848; } virtual int f849(int) { return lci=849; } virtual int f850(int) { return lci=850; } virtual int f851(int) { return lci=851; } - virtual int f852(int) { return lci=852; } virtual int f853(int) { return lci=853; } virtual int f854(int) { return lci=854; } virtual int f855(int) { return lci=855; } - virtual int f856(int) { return lci=856; } virtual int f857(int) { return lci=857; } virtual int f858(int) { return lci=858; } virtual int f859(int) { return lci=859; } - virtual int f860(int) { return lci=860; } virtual int f861(int) { return lci=861; } virtual int f862(int) { return lci=862; } virtual int f863(int) { return lci=863; } - virtual int f864(int) { return lci=864; } virtual int f865(int) { return lci=865; } virtual int f866(int) { return lci=866; } virtual int f867(int) { return lci=867; } - virtual int f868(int) { return lci=868; } virtual int f869(int) { return lci=869; } virtual int f870(int) { return lci=870; } virtual int f871(int) { return lci=871; } - virtual int f872(int) { return lci=872; } virtual int f873(int) { return lci=873; } virtual int f874(int) { return lci=874; } virtual int f875(int) { return lci=875; } - virtual int f876(int) { return lci=876; } virtual int f877(int) { return lci=877; } virtual int f878(int) { return lci=878; } virtual int f879(int) { return lci=879; } - virtual int f880(int) { return lci=880; } virtual int f881(int) { return lci=881; } virtual int f882(int) { return lci=882; } virtual int f883(int) { return lci=883; } - virtual int f884(int) { return lci=884; } virtual int f885(int) { return lci=885; } virtual int f886(int) { return lci=886; } virtual int f887(int) { return lci=887; } - virtual int f888(int) { return lci=888; } virtual int f889(int) { return lci=889; } virtual int f890(int) { return lci=890; } virtual int f891(int) { return lci=891; } - virtual int f892(int) { return lci=892; } virtual int f893(int) { return lci=893; } virtual int f894(int) { return lci=894; } virtual int f895(int) { return lci=895; } - virtual int f896(int) { return lci=896; } virtual int f897(int) { return lci=897; } virtual int f898(int) { return lci=898; } virtual int f899(int) { return lci=899; } - virtual int f900(int) { return lci=900; } virtual int f901(int) { return lci=901; } virtual int f902(int) { return lci=902; } virtual int f903(int) { return lci=903; } - virtual int f904(int) { return lci=904; } virtual int f905(int) { return lci=905; } virtual int f906(int) { return lci=906; } virtual int f907(int) { return lci=907; } - virtual int f908(int) { return lci=908; } virtual int f909(int) { return lci=909; } virtual int f910(int) { return lci=910; } virtual int f911(int) { return lci=911; } - virtual int f912(int) { return lci=912; } virtual int f913(int) { return lci=913; } virtual int f914(int) { return lci=914; } virtual int f915(int) { return lci=915; } - virtual int f916(int) { return lci=916; } virtual int f917(int) { return lci=917; } virtual int f918(int) { return lci=918; } virtual int f919(int) { return lci=919; } - virtual int f920(int) { return lci=920; } virtual int f921(int) { return lci=921; } virtual int f922(int) { return lci=922; } virtual int f923(int) { return lci=923; } - virtual int f924(int) { return lci=924; } virtual int f925(int) { return lci=925; } virtual int f926(int) { return lci=926; } virtual int f927(int) { return lci=927; } - virtual int f928(int) { return lci=928; } virtual int f929(int) { return lci=929; } virtual int f930(int) { return lci=930; } virtual int f931(int) { return lci=931; } - virtual int f932(int) { return lci=932; } virtual int f933(int) { return lci=933; } virtual int f934(int) { return lci=934; } virtual int f935(int) { return lci=935; } - virtual int f936(int) { return lci=936; } virtual int f937(int) { return lci=937; } virtual int f938(int) { return lci=938; } virtual int f939(int) { return lci=939; } - virtual int f940(int) { return lci=940; } virtual int f941(int) { return lci=941; } virtual int f942(int) { return lci=942; } virtual int f943(int) { return lci=943; } - virtual int f944(int) { return lci=944; } virtual int f945(int) { return lci=945; } virtual int f946(int) { return lci=946; } virtual int f947(int) { return lci=947; } - virtual int f948(int) { return lci=948; } virtual int f949(int) { return lci=949; } virtual int f950(int) { return lci=950; } virtual int f951(int) { return lci=951; } - virtual int f952(int) { return lci=952; } virtual int f953(int) { return lci=953; } virtual int f954(int) { return lci=954; } virtual int f955(int) { return lci=955; } - virtual int f956(int) { return lci=956; } virtual int f957(int) { return lci=957; } virtual int f958(int) { return lci=958; } virtual int f959(int) { return lci=959; } - virtual int f960(int) { return lci=960; } virtual int f961(int) { return lci=961; } virtual int f962(int) { return lci=962; } virtual int f963(int) { return lci=963; } - virtual int f964(int) { return lci=964; } virtual int f965(int) { return lci=965; } virtual int f966(int) { return lci=966; } virtual int f967(int) { return lci=967; } - virtual int f968(int) { return lci=968; } virtual int f969(int) { return lci=969; } virtual int f970(int) { return lci=970; } virtual int f971(int) { return lci=971; } - virtual int f972(int) { return lci=972; } virtual int f973(int) { return lci=973; } virtual int f974(int) { return lci=974; } virtual int f975(int) { return lci=975; } - virtual int f976(int) { return lci=976; } virtual int f977(int) { return lci=977; } virtual int f978(int) { return lci=978; } virtual int f979(int) { return lci=979; } - virtual int f980(int) { return lci=980; } virtual int f981(int) { return lci=981; } virtual int f982(int) { return lci=982; } virtual int f983(int) { return lci=983; } - virtual int f984(int) { return lci=984; } virtual int f985(int) { return lci=985; } virtual int f986(int) { return lci=986; } virtual int f987(int) { return lci=987; } - virtual int f988(int) { return lci=988; } virtual int f989(int) { return lci=989; } virtual int f990(int) { return lci=990; } virtual int f991(int) { return lci=991; } - virtual int f992(int) { return lci=992; } virtual int f993(int) { return lci=993; } virtual int f994(int) { return lci=994; } virtual int f995(int) { return lci=995; } - virtual int f996(int) { return lci=996; } virtual int f997(int) { return lci=997; } virtual int f998(int) { return lci=998; } virtual int f999(int) { return lci=999; } - virtual int f1000(int) { return lci=1000; } virtual int f1001(int) { return lci=1001; } virtual int f1002(int) { return lci=1002; } virtual int f1003(int) { return lci=1003; } - virtual int f1004(int) { return lci=1004; } virtual int f1005(int) { return lci=1005; } virtual int f1006(int) { return lci=1006; } virtual int f1007(int) { return lci=1007; } - virtual int f1008(int) { return lci=1008; } virtual int f1009(int) { return lci=1009; } virtual int f1010(int) { return lci=1010; } virtual int f1011(int) { return lci=1011; } - virtual int f1012(int) { return lci=1012; } virtual int f1013(int) { return lci=1013; } virtual int f1014(int) { return lci=1014; } virtual int f1015(int) { return lci=1015; } - virtual int f1016(int) { return lci=1016; } virtual int f1017(int) { return lci=1017; } virtual int f1018(int) { return lci=1018; } virtual int f1019(int) { return lci=1019; } - virtual int f1020(int) { return lci=1020; } virtual int f1021(int) { return lci=1021; } virtual int f1022(int) { return lci=1022; } virtual int f1023(int) { return lci=1023; } - virtual ~func_index() {} -}; - -#ifdef _MSC_VER -template -int virtual_function_index(unsigned char *func) { - if (*func == 0xE9) - { - return virtual_function_index<0>(func + 5 + *(unsigned int *)(func+1)); - } - else - { - switch(*(unsigned int *)func) - { // mov ecx, this; jump [eax + v/Ib/Iw] - case 0x20ff018b: return 0; - case 0x60ff018b: return *(unsigned char *)(func + 4) / 4; - case 0xA0ff018b: return *(unsigned long *)(func + 4) / 4; - default: return -1; - } - } -} -#endif - -template -std::pair virtual_index(T t) -{ -#if defined(__GNUG__) - union { - T t; - struct - { - unsigned long value; - unsigned long baseoffs; - } u; - } conv; - conv.t = t; - - // simple implementation - if (conv.u.value & 1) - return std::pair(conv.u.baseoffs / sizeof(void*), conv.u.value / sizeof(void *)); -#elif defined(_MSC_VER) - union { - T t; - struct - { - unsigned char *value; - unsigned long baseoffs; - } u; - } conv; - conv.t = t; - - int value = virtual_function_index<0>((unsigned char *)conv.u.value); - if (value != -1) - return std::pair(conv.u.baseoffs/sizeof(void*), value); -#elif defined(__EDG__) - union { - T t; - struct { - short delta; - short vindex; - long vtordisp; - } u; - } conv; - conv.t = t; - - if (conv.u.vindex != 0) - return std::pair((conv.u.delta + conv.u.vtordisp)/sizeof(void*), conv.u.vindex * 2 + 1); -#else -#error No virtual indexing found for this compiler! Please contact the maintainers of HippoMocks -#endif - - return std::pair(-1, 0); -} - -template -T getNonvirtualMemberFunctionAddress(U u) -{ -#ifdef __EDG__ - // Edison Design Group C++ frontend (Comeau, Portland Group, Greenhills, etc) - union { - struct { - short delta; - short vindex; - T t; - } mfp_structure; - U u; - } conv; -#else - // Visual Studio, GCC, others - union { - struct { - T t; - } mfp_structure; - U u; - } conv; -#endif - conv.u = u; - return conv.mfp_structure.t; -} - -class TypeDestructable { -public: - virtual ~TypeDestructable() {} -}; - -template -class MemberWrap : public TypeDestructable { -private: - A *member; -public: - MemberWrap(A *member) - : member(member) - { - new (member) A(); - } - ~MemberWrap() - { - member->~A(); - } -}; - -// mock types -template -class mock : public base_mock -{ - typedef void (*funcptr)(); - friend class MockRepository; - unsigned char remaining[sizeof(T)]; - void NotImplemented() { - mock *realMock = getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - RAISEEXCEPTION(:: HM_NS NotImplementedException(repo)); - } -protected: - std::map funcTables; - void (*notimplementedfuncs[VIRT_FUNC_LIMIT])(); -public: - bool isZombie; - std::list members; - MockRepository *repo; - std::map, int> funcMap; - mock(MockRepository *repo) - : isZombie(false) - , repo(repo) - { - for (int i = 0; i < VIRT_FUNC_LIMIT; i++) - { - notimplementedfuncs[i] = getNonvirtualMemberFunctionAddress(&mock::NotImplemented); - } - funcptr *funcTable = new funcptr[VIRT_FUNC_LIMIT+2]; - memcpy(funcTable, notimplementedfuncs, sizeof(funcptr) * VIRT_FUNC_LIMIT); - ((void **)funcTable)[VIRT_FUNC_LIMIT] = this; - ((void **)funcTable)[VIRT_FUNC_LIMIT+1] = *(void **)this; - funcTables[0] = funcTable; - *(void **)this = funcTable; - for (unsigned int i = 1; i < sizeof(remaining) / sizeof(funcptr); i++) - { - ((void **)this)[i] = (void *)notimplementedfuncs; - } - } - ~mock() - { - for (std::list::iterator i = members.begin(); i != members.end(); ++i) - { - delete *i; - } - for (std::map::iterator i = funcTables.begin(); i != funcTables.end(); ++i) - { - delete [] i->second; - } - } - void mock_reset() - { - MockRepository *repo = this->repo; - // ugly but simple - this->~mock(); - new (this) mock(repo); - } - mock *getRealThis() - { - void ***base = (void ***)this; - return (mock *)((*base)[VIRT_FUNC_LIMIT]); - } - std::pair translateX(int x) - { - for (std::map, int>::iterator i = funcMap.begin(); i != funcMap.end(); ++i) - { - if (i->second == x+1) return i->first; - } - return std::pair(-1, 0); - } - template - void mockedDestructor(int); -}; - -// Do() function wrapping -class VirtualDestructable { public: virtual ~VirtualDestructable() {} }; - -template -class TupleInvocable : public VirtualDestructable -{ -public: - virtual Y operator()(const base_tuple &tupl) = 0; -}; - -template -class Invocable : public TupleInvocable -{ -public: - virtual Y operator()(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) = 0; - virtual Y operator()(const base_tuple &tupl) { - const ref_tuple &rTupl = reinterpret_cast &>(tupl); - return (*this)(rTupl.a, rTupl.b, rTupl.c, rTupl.d, rTupl.e, rTupl.f, rTupl.g, rTupl.h, - rTupl.i, rTupl.j, rTupl.k, rTupl.l, rTupl.m, rTupl.n, rTupl.o, rTupl.p); - } -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) - { - return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, NullType) - { - return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, NullType, NullType) - { - return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f,g,h,i,j,k,l,m); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f,g,h,i,j,k,l); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f,g,h,i,j,k); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f,g,h,i,j); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable{ - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f,g,h,i); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f,g,h); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f,g); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, F f, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e,f); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, E e, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d,e); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, D d, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c,d); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, C c, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b,c); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, B b, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a,b); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(A a, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(a); - } - using Invocable::operator(); -}; -template -class DoWrapper : public Invocable { - T &t; -public: - DoWrapper(T &t) : t(t) {} - virtual Y operator()(NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) - { - return t(); - } - using Invocable::operator(); -}; - -class ReturnValueHolder { -public: - virtual ~ReturnValueHolder() {} -}; - -template -class ReturnValueWrapper : public ReturnValueHolder { -public: - typename no_cref::type rv; - ReturnValueWrapper(T rv) : rv(rv) {} -}; - -//Call wrapping -class Call { -public: - virtual bool matchesArgs(const base_tuple &tuple) = 0; - virtual void assignArgs(base_tuple &tuple) = 0; - ReturnValueHolder *retVal; -#ifndef HM_NO_EXCEPTIONS - ExceptionHolder *eHolder; -#endif - base_mock *mock; - VirtualDestructable *functor; - VirtualDestructable *matchFunctor; - std::pair funcIndex; - std::list previousCalls; - RegistrationType expectation; - bool satisfied; - int lineno; - const char *funcName; - const char *fileName; -protected: - Call(RegistrationType expectation, base_mock *mock, const std::pair &funcIndex, int X, const char *funcName, const char *fileName) - : retVal(0), -#ifndef HM_NO_EXCEPTIONS - eHolder(0), -#endif - mock(mock), - functor(0), - matchFunctor(0), - funcIndex(funcIndex), - expectation(expectation), - satisfied(false), - lineno(X), - funcName(funcName), - fileName(fileName) - { - } -public: - virtual const base_tuple *getArgs() const = 0; - virtual ~Call() - { -#ifndef HM_NO_EXCEPTIONS - delete eHolder; -#endif - delete functor; - delete matchFunctor; - delete retVal; - } -}; - -std::ostream &operator<<(std::ostream &os, const Call &call); - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m, const CN & n, const CO & o, const CP & p) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m, const CN & n, const CO & o, const CP & p) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m, const CN & n, const CO & o) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m, const CN & n, const CO & o) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m, const CN & n) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m, const CN & n) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l, const CM & m) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k, const CL & l) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,l,NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j, const CK & k) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,k,NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i, const CJ & j) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,j,NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h, const CI & i) { - args = new copy_tuple(a,b,c,d,e,f,g,h,i,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h) { - args = new copy_tuple(a,b,c,d,e,f,g,h,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g, const CH & h) { - args = new copy_tuple(a,b,c,d,e,f,g,h,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g) { - args = new copy_tuple(a,b,c,d,e,f,g,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f, const CG & g) { - args = new copy_tuple(a,b,c,d,e,f,g,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f) { - args = new copy_tuple(a,b,c,d,e,f,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e, const CF & f) { - args = new copy_tuple(a,b,c,d,e,f,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e) { - args = new copy_tuple(a,b,c,d,e,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d, const CE & e) { - args = new copy_tuple(a,b,c,d,e,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d) { - args = new copy_tuple(a,b,c,d,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c, const CD & d) { - args = new copy_tuple(a,b,c,d,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c) { - args = new copy_tuple(a,b,c,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b, const CC & c) { - args = new copy_tuple(a,b,c,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b) { - args = new copy_tuple(a,b,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a, const CB & b) { - args = new copy_tuple(a,b,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA & a) { - args = new copy_tuple(a,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {} - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &tupl) { - return (!args && !matchFunctor) || - (args && (*args == reinterpret_cast &>(tupl))) || - (matchFunctor && (*(TupleInvocable *)(matchFunctor))(tupl)); - } - void assignArgs(base_tuple &tupl) { - if(args) { - args->assign_to(static_cast &>(tupl)); - args->assign_from(static_cast &>(tupl)); - } - } - template - TCall &With(const CA &a) { - args = new copy_tuple(a,NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - return *this; - } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - template - TCall &Match(T &function) { matchFunctor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName) { - args = new copy_tuple - (NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - } - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &) { return true; } - void assignArgs(base_tuple &) {} - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } - Call &Return(Y obj) { retVal = new ReturnValueWrapper(obj); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; -template <> -class TCall : public Call { -private: - ref_comparable_assignable_tuple *args; -public: - const base_tuple *getArgs() const { return args; } - TCall(RegistrationType expectation, base_mock *mock, std::pair funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName) { - args = new copy_tuple - (NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType(),NullType()); - } - ~TCall() { delete args; } - bool matchesArgs(const base_tuple &) { return true; } - void assignArgs(base_tuple &) { } - TCall &After(Call &call) { - previousCalls.push_back(&call); - return *this; - } - template - TCall &Do(T &function) { functor = new DoWrapper(function); return *this; } -#ifndef HM_NO_EXCEPTIONS - template - Call &Throw(Ex exception) { eHolder = new ExceptionWrapper(exception); return *this; } -#endif -}; - -template -class MockRepoInstanceHolder { -public: - static MockRepository *instance; -}; - -template -MockRepository *MockRepoInstanceHolder::instance; - -class MockRepository { -private: - friend inline std::ostream &operator<<(std::ostream &os, const MockRepository &repo); - std::list mocks; - std::map staticFuncMap; -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT - std::list staticReplaces; -#endif - std::list neverCalls; - std::list expectations; - std::list optionals; -#ifndef HM_NO_EXCEPTIONS - ExceptionHolder *latentException; -#endif -public: -#ifndef HM_NO_EXCEPTIONS - void SetLatentException(ExceptionHolder *holder) - { - latentException = holder; - } -#endif - bool autoExpect; -#ifdef _MSC_VER -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT -#define OnCallFunc(func) RegisterExpect_<__COUNTER__, HM_NS Any>(&func, #func, __FILE__, __LINE__) -#define ExpectCallFunc(func) RegisterExpect_<__COUNTER__, HM_NS Once>(&func, #func, __FILE__, __LINE__) -#define NeverCallFunc(func) RegisterExpect_<__COUNTER__, HM_NS Never>(&func, #func, __FILE__, __LINE__) -#define OnCallFuncOverload(func) RegisterExpect_<__COUNTER__, HM_NS Any>(func, #func, __FILE__, __LINE__) -#define ExpectCallFuncOverload(func) RegisterExpect_<__COUNTER__, HM_NS Once>(func, #func, __FILE__, __LINE__) -#define NeverCallFuncOverload(func) RegisterExpect_<__COUNTER__, HM_NS Never>(func, #func, __FILE__, __LINE__) -#endif -#define OnCall(obj, func) RegisterExpect_<__COUNTER__, HM_NS Any>(obj, &func, #func, __FILE__, __LINE__) -#define ExpectCall(obj, func) RegisterExpect_<__COUNTER__, HM_NS Once>(obj, &func, #func, __FILE__, __LINE__) -#define NeverCall(obj, func) RegisterExpect_<__COUNTER__, HM_NS Never>(obj, &func, #func, __FILE__, __LINE__) -#define OnCallOverload(obj, func) RegisterExpect_<__COUNTER__, HM_NS Any>(obj, func, #func, __FILE__, __LINE__) -#define ExpectCallOverload(obj, func) RegisterExpect_<__COUNTER__, HM_NS Once>(obj, func, #func, __FILE__, __LINE__) -#define NeverCallOverload(obj, func) RegisterExpect_<__COUNTER__, HM_NS Never>(obj, func, #func, __FILE__, __LINE__) -#define OnCallDestructor(obj) RegisterExpectDestructor<__COUNTER__, HM_NS Any>(obj, __FILE__, __LINE__) -#define ExpectCallDestructor(obj) RegisterExpectDestructor<__COUNTER__, HM_NS Once>(obj, __FILE__, __LINE__) -#define NeverCallDestructor(obj) RegisterExpectDestructor<__COUNTER__, HM_NS Never>(obj, __FILE__, __LINE__) -#else -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT -#define OnCallFunc(func) RegisterExpect_<__LINE__, HM_NS Any>(&func, #func, __FILE__, __LINE__) -#define ExpectCallFunc(func) RegisterExpect_<__LINE__, HM_NS Once>(&func, #func, __FILE__, __LINE__) -#define NeverCallFunc(func) RegisterExpect_<__LINE__, HM_NS Never>(&func, #func, __FILE__, __LINE__) -#define OnCallFuncOverload(func) RegisterExpect_<__LINE__, HM_NS Any>(func, #func, __FILE__, __LINE__) -#define ExpectCallFuncOverload(func) RegisterExpect_<__LINE__, HM_NS Once>(func, #func, __FILE__, __LINE__) -#define NeverCallFuncOverload(func) RegisterExpect_<__LINE__, HM_NS Never>(func, #func, __FILE__, __LINE__) -#endif -#define OnCall(obj, func) RegisterExpect_<__LINE__, HM_NS Any>(obj, &func, #func, __FILE__, __LINE__) -#define ExpectCall(obj, func) RegisterExpect_<__LINE__, HM_NS Once>(obj, &func, #func, __FILE__, __LINE__) -#define NeverCall(obj, func) RegisterExpect_<__LINE__, HM_NS Never>(obj, &func, #func, __FILE__, __LINE__) -#define OnCallOverload(obj, func) RegisterExpect_<__LINE__, HM_NS Any>(obj, func, #func, __FILE__, __LINE__) -#define ExpectCallOverload(obj, func) RegisterExpect_<__LINE__, HM_NS Once>(obj, func, #func, __FILE__, __LINE__) -#define NeverCallOverload(obj, func) RegisterExpect_<__LINE__, HM_NS Never>(obj, func, #func, __FILE__, __LINE__) -#define OnCallDestructor(obj) RegisterExpectDestructor<__LINE__, HM_NS Any>(obj, __FILE__, __LINE__) -#define ExpectCallDestructor(obj) RegisterExpectDestructor<__LINE__, HM_NS Once>(obj, __FILE__, __LINE__) -#define NeverCallDestructor(obj) RegisterExpectDestructor<__LINE__, HM_NS Never>(obj, __FILE__, __LINE__) -#endif - template - void Member(A *mck, C B::*member) - { - C A::*realMember = (C A::*)member; - C *realRealMember = &(mck->*realMember); - mock *realMock = (mock *)mck; - realMock->members.push_back(new MemberWrap(realRealMember)); - } - template - TCall &RegisterExpectDestructor(Z2 *mck, const char *fileName, unsigned long lineNo); - -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT - template - TCall &RegisterExpect_(Y (*func)(), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo); -#endif - - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo); - - //GCC 3.x doesn't seem to understand overloading on const or non-const member function. Volatile appears to work though. -#if !defined(__GNUC__) || __GNUC__ > 3 - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)() volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); } - - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)() const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); } - - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)() const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); } -#endif - -#ifdef _MSC_VER - // COM only support - you can duplicate this for cdecl and fastcall if you want to, but those are not as common as COM. - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::* func)(), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo); - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo); - - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)() volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)())(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); } - - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)() const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)())(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); } - - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)() const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)())(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); } - template - TCall &RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_(mck, (Y(__stdcall Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); } -#endif - - template - void BasicRegisterExpect(mock *zMock, int baseOffset, int funcIndex, void (base_mock::*func)(), int X); -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT - int BasicStaticRegisterExpect(void (*func)(), void (*fp)(), int X) - { - if (staticFuncMap.find(func) == staticFuncMap.end()) - { - staticFuncMap[func] = X; - staticReplaces.push_back(new Replace(func, fp)); - } - return staticFuncMap[func]; - } -#endif - template - Z DoExpectation(base_mock *mock, std::pair funcno, const base_tuple &tuple); - void DoVoidExpectation(base_mock *mock, std::pair funcno, const base_tuple &tuple, bool makeLatent = false) - { - for (std::list::reverse_iterator i = expectations.rbegin(); i != expectations.rend(); ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno && - call->matchesArgs(tuple) && - !call->satisfied) - { - bool allSatisfy = true; - for (std::list::iterator callsBefore = call->previousCalls.begin(); - callsBefore != call->previousCalls.end(); ++callsBefore) - { - if (!(*callsBefore)->satisfied) - { - allSatisfy = false; - } - } - if (!allSatisfy) continue; - - call->satisfied = true; - - call->assignArgs(const_cast(tuple)); -#ifndef HM_NO_EXCEPTIONS - if (call->eHolder) - call->eHolder->rethrow(); -#endif - if (call->functor != NULL) - (*(TupleInvocable *)(call->functor))(tuple); - - return; - } - } - for (std::list::reverse_iterator i = neverCalls.rbegin(); i != neverCalls.rend(); ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno && - call->matchesArgs(tuple)) - { - bool allSatisfy = true; - for (std::list::iterator callsBefore = call->previousCalls.begin(); - callsBefore != call->previousCalls.end(); ++callsBefore) - { - if (!(*callsBefore)->satisfied) - { - allSatisfy = false; - } - } - if (!allSatisfy) continue; - - call->satisfied = true; - - if (makeLatent) - { -#ifndef HM_NO_EXCEPTIONS - if (latentException) - return; -#endif - RAISELATENTEXCEPTION(ExpectationException(this, call->getArgs(), call->funcName)); - } - else - { - RAISEEXCEPTION(ExpectationException(this, call->getArgs(), call->funcName)); - } - return; - } - } - for (std::list::reverse_iterator i = optionals.rbegin(); i != optionals.rend(); ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno && - call->matchesArgs(tuple)) - { - bool allSatisfy = true; - for (std::list::iterator callsBefore = call->previousCalls.begin(); - callsBefore != call->previousCalls.end(); ++callsBefore) - { - if (!(*callsBefore)->satisfied) - { - allSatisfy = false; - } - } - if (!allSatisfy) continue; - - call->satisfied = true; - - call->assignArgs(const_cast(tuple)); -#ifndef HM_NO_EXCEPTIONS - if (call->eHolder) - call->eHolder->rethrow(); -#endif - if (call->functor != NULL) - (*(TupleInvocable *)(call->functor))(tuple); - - return; - } - } - const char *funcName = NULL; - for (std::list::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno) - funcName = call->funcName; - } - for (std::list::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno) - funcName = call->funcName; - } - for (std::list::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno) - funcName = call->funcName; - } - if (makeLatent) - { -#ifndef HM_NO_EXCEPTIONS - if (latentException) - return; -#endif - RAISELATENTEXCEPTION(ExpectationException(this, &tuple, funcName)); - } - else - { - RAISEEXCEPTION(ExpectationException(this, &tuple, funcName)); - } - } - MockRepository() - : autoExpect(DEFAULT_AUTOEXPECT) -#ifndef HM_NO_EXCEPTIONS - , latentException(0) -#endif - { - MockRepoInstanceHolder<0>::instance = this; - } - ~MockRepository() - { - MockRepoInstanceHolder<0>::instance = 0; -#ifndef HM_NO_EXCEPTIONS - if (!std::uncaught_exception()) - { - try - { -#endif - VerifyAll(); -#ifndef HM_NO_EXCEPTIONS - } - catch(...) - { - delete latentException; - reset(); - for (std::list::iterator i = mocks.begin(); i != mocks.end(); i++) - { - (*i)->destroy(); - } -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT - for (std::list::iterator i = staticReplaces.begin(); i != staticReplaces.end(); i++) - { - delete *i; - } -#endif - throw; - } - } - if (latentException) - { - try - { - latentException->rethrow(); - } - catch(BASE_EXCEPTION e) - { - printf("Latent exception masked!\nException:\n%s\n", e.what()); - } - delete latentException; - } -#endif - reset(); - for (std::list::iterator i = mocks.begin(); i != mocks.end(); i++) - { - (*i)->destroy(); - } -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT - for (std::list::iterator i = staticReplaces.begin(); i != staticReplaces.end(); i++) - { - delete *i; - } -#endif - } - void reset() - { - for (std::list::iterator i = expectations.begin(); i != expectations.end(); i++) - { - delete *i; - } - expectations.clear(); - for (std::list::iterator i = neverCalls.begin(); i != neverCalls.end(); i++) - { - delete *i; - } - neverCalls.clear(); - for (std::list::iterator i = optionals.begin(); i != optionals.end(); i++) - { - delete *i; - } - optionals.clear(); - for (std::list::iterator i = mocks.begin(); i != mocks.end(); i++) - { - (*i)->reset(); - } - } - void VerifyAll() - { -#ifndef HM_NO_EXCEPTIONS - if (latentException) - latentException->rethrow(); -#endif - for (std::list::iterator i = expectations.begin(); i != expectations.end(); i++) - { - if (!(*i)->satisfied) - RAISEEXCEPTION(CallMissingException(this)); - } - } - void VerifyPartial(base_mock *obj) - { -#ifndef HM_NO_EXCEPTIONS - if (latentException) - return; -#endif - for (std::list::iterator i = expectations.begin(); i != expectations.end(); i++) - { - if ((*i)->mock == (base_mock *)obj && - !(*i)->satisfied) - { - RAISELATENTEXCEPTION(CallMissingException(this)); - } - } - } - template - base *Mock(); -}; - -// mock function providers -template -class mockFuncs : public mock { -private: - mockFuncs(); -public: - template - Y expectation0() - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple<>()); - } - template - Y expectation1(A a) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a)); - } - template - Y expectation2(A a, B b) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b)); - } - template - Y expectation3(A a, B b, C c) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c)); - } - template - Y expectation4(A a, B b, C c, D d) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d)); - } - template - Y expectation5(A a, B b, C c, D d, E e) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e)); - } - template - Y expectation6(A a, B b, C c, D d, E e, F f) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f)); - } - template - Y expectation7(A a, B b, C c, D d, E e, F f, G g) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g)); - } - template - Y expectation8(A a, B b, C c, D d, E e, F f, G g, H h) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h)); - } - template - Y expectation9(A a, B b, C c, D d, E e, F f, G g, H h, I i) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i)); - } - template - Y expectation10(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j)); - } - template - Y expectation11(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k)); - } - template - Y expectation12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l)); - } - template - Y expectation13(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m)); - } - template - Y expectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n)); - } - template - Y expectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)); - } - template - Y expectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - return repo->template DoExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)); - } - - template - static Y static_expectation0() - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple<>()); - } - template - static Y static_expectation1(A a) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a)); - } - template - static Y static_expectation2(A a, B b) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b)); - } - template - static Y static_expectation3(A a, B b, C c) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c)); - } - template - static Y static_expectation4(A a, B b, C c, D d) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d)); - } - template - static Y static_expectation5(A a, B b, C c, D d, E e) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e)); - } - template - static Y static_expectation6(A a, B b, C c, D d, E e, F f) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f)); - } - template - static Y static_expectation7(A a, B b, C c, D d, E e, F f, G g) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g)); - } - template - static Y static_expectation8(A a, B b, C c, D d, E e, F f, G g, H h) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h)); - } - template - static Y static_expectation9(A a, B b, C c, D d, E e, F f, G g, H h, I i) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i)); - } - template - static Y static_expectation10(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j)); - } - template - static Y static_expectation11(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k)); - } - template - static Y static_expectation12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l)); - } - template - static Y static_expectation13(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m)); - } - template - static Y static_expectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n)); - } - template - static Y static_expectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)); - } - template - static Y static_expectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) - { - return MockRepoInstanceHolder<0>::instance->template DoExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)); - } - -#ifdef _MSC_VER - template - Y __stdcall stdcallexpectation0() - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple<>()); - } - template - Y __stdcall stdcallexpectation1(A a) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a)); - } - template - Y __stdcall stdcallexpectation2(A a, B b) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b)); - } - template - Y __stdcall stdcallexpectation3(A a, B b, C c) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c)); - } - template - Y __stdcall stdcallexpectation4(A a, B b, C c, D d) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d)); - } - template - Y __stdcall stdcallexpectation5(A a, B b, C c, D d, E e) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e)); - } - template - Y __stdcall stdcallexpectation6(A a, B b, C c, D d, E e, F f) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f)); - } - template - Y __stdcall stdcallexpectation7(A a, B b, C c, D d, E e, F f, G g) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g)); - } - template - Y __stdcall stdcallexpectation8(A a, B b, C c, D d, E e, F f, G g, H h) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h)); - } - template - Y __stdcall stdcallexpectation9(A a, B b, C c, D d, E e, F f, G g, H h, I i) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i)); - } - template - Y __stdcall stdcallexpectation10(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j)); - } - template - Y __stdcall stdcallexpectation11(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k)); - } - template - Y __stdcall stdcallexpectation12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l)); - } - template - Y __stdcall stdcallexpectation13(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m)); - } - template - Y __stdcall stdcallexpectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n)); - } - template - Y __stdcall stdcallexpectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)); - } - template - Y __stdcall stdcallexpectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) - { - MockRepository *repo = mock::repo; - return repo->template DoExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)); - } -#endif -}; - -template -class mockFuncs : public mock { -private: - mockFuncs(); -public: - template - void expectation0() - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple<>()); - } - template - void expectation1(A a) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a)); - } - template - void expectation2(A a, B b) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b)); - } - template - void expectation3(A a, B b, C c) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c)); - } - template - void expectation4(A a, B b, C c, D d) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d)); - } - template - void expectation5(A a, B b, C c, D d, E e) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e)); - } - template - void expectation6(A a, B b, C c, D d, E e, F f) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f)); - } - template - void expectation7(A a, B b, C c, D d, E e, F f, G g) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g)); - } - template - void expectation8(A a, B b, C c, D d, E e, F f, G g, H h) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h)); - } - template - void expectation9(A a, B b, C c, D d, E e, F f, G g, H h, I i) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i)); - } - template - void expectation10(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j)); - } - template - void expectation11(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k)); - } - template - void expectation12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l)); - } - template - void expectation13(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m)); - } - template - void expectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n)); - } - template - void expectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)); - } - template - void expectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) - { - mock *realMock = mock::getRealThis(); - if (realMock->isZombie) - RAISEEXCEPTION(ZombieMockException(realMock->repo)); - MockRepository *repo = realMock->repo; - repo->DoVoidExpectation(realMock, realMock->translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)); - } - template - static void static_expectation0() - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple<>()); - } - template - static void static_expectation1(A a) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a)); - } - template - static void static_expectation2(A a, B b) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b)); - } - template - static void static_expectation3(A a, B b, C c) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c)); - } - template - static void static_expectation4(A a, B b, C c, D d) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d)); - } - template - static void static_expectation5(A a, B b, C c, D d, E e) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e)); - } - template - static void static_expectation6(A a, B b, C c, D d, E e, F f) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f)); - } - template - static void static_expectation7(A a, B b, C c, D d, E e, F f, G g) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g)); - } - template - static void static_expectation8(A a, B b, C c, D d, E e, F f, G g, H h) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h)); - } - template - static void static_expectation9(A a, B b, C c, D d, E e, F f, G g, H h, I i) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i)); - } - template - static void static_expectation10(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j)); - } - template - static void static_expectation11(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k)); - } - template - static void static_expectation12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l)); - } - template - static void static_expectation13(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m)); - } - template - static void static_expectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n)); - } - template - static void static_expectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)); - } - template - static void static_expectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) - { - MockRepoInstanceHolder<0>::instance->DoVoidExpectation(NULL, std::pair(0, X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)); - } - -#ifdef _MSC_VER - template - void __stdcall stdcallexpectation0() - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple<>()); - } - template - void __stdcall stdcallexpectation1(A a) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a)); - } - template - void __stdcall stdcallexpectation2(A a, B b) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b)); - } - template - void __stdcall stdcallexpectation3(A a, B b, C c) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c)); - } - template - void __stdcall stdcallexpectation4(A a, B b, C c, D d) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d)); - } - template - void __stdcall stdcallexpectation5(A a, B b, C c, D d, E e) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e)); - } - template - void __stdcall stdcallexpectation6(A a, B b, C c, D d, E e, F f) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f)); - } - template - void __stdcall stdcallexpectation7(A a, B b, C c, D d, E e, F f, G g) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g)); - } - template - void __stdcall stdcallexpectation8(A a, B b, C c, D d, E e, F f, G g, H h) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h)); - } - template - void __stdcall stdcallexpectation9(A a, B b, C c, D d, E e, F f, G g, H h, I i) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i)); - } - template - void __stdcall stdcallexpectation10(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j)); - } - template - void __stdcall stdcallexpectation11(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k)); - } - template - void __stdcall stdcallexpectation12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l)); - } - template - void __stdcall stdcallexpectation13(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m)); - } - template - void __stdcall stdcallexpectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n)); - } - template - void __stdcall stdcallexpectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)); - } - template - void __stdcall stdcallexpectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) - { - MockRepository *repo = mock::repo; - repo->DoVoidExpectation(this, mock::translateX(X), ref_tuple(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)); - } -#endif -}; - -template -template -void mock::mockedDestructor(int) -{ - repo->DoVoidExpectation(this, translateX(X), ref_tuple<>(), true); - repo->VerifyPartial(this); - isZombie = true; -} - -template -void MockRepository::BasicRegisterExpect(mock *zMock, int baseOffset, int funcIndex, void (base_mock::*func)(), int X) -{ - if (funcIndex > VIRT_FUNC_LIMIT) RAISEEXCEPTION(NotImplementedException(this)); - if ((unsigned int)baseOffset * sizeof(void*) + sizeof(void*)-1 > sizeof(Z)) RAISEEXCEPTION(NotImplementedException(this)); - if (zMock->funcMap.find(std::make_pair(baseOffset, funcIndex)) == zMock->funcMap.end()) - { - if (zMock->funcTables.find(baseOffset) == zMock->funcTables.end()) - { - typedef void (*funcptr)(); - funcptr *funcTable = new funcptr[VIRT_FUNC_LIMIT+1]; - memcpy(funcTable, zMock->notimplementedfuncs, sizeof(funcptr) * VIRT_FUNC_LIMIT); - ((void **)funcTable)[VIRT_FUNC_LIMIT] = zMock; - zMock->funcTables[baseOffset] = funcTable; - ((void **)zMock)[baseOffset] = funcTable; - } - zMock->funcMap[std::make_pair(baseOffset, funcIndex)] = X+1; - zMock->funcTables[baseOffset][funcIndex] = getNonvirtualMemberFunctionAddress(func); - } -} - -template -TCall &MockRepository::RegisterExpectDestructor(Z2 *mck, const char *fileName, unsigned long lineNo) -{ - func_index idx; - ((Z2 *)&idx)->~Z2(); - int funcIndex = idx.lci * FUNCTION_STRIDE + FUNCTION_BASE; - void (mock::*member)(int); - member = &mock::template mockedDestructor; - BasicRegisterExpect(reinterpret_cast *>(mck), - 0, funcIndex, - reinterpret_cast(member), X); -#ifdef EXTRA_DESTRUCTOR - BasicRegisterExpect(reinterpret_cast *>(mck), - 0, funcIndex+1, - reinterpret_cast(member), X); -#endif - TCall *call = new TCall(Once, reinterpret_cast(mck), std::pair(0, funcIndex), lineNo, "destructor", fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} - -#ifdef _MSC_VER -// Support for COM, see declarations -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(); - mfp = &mockFuncs::template stdcallexpectation0; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A); - mfp = &mockFuncs::template stdcallexpectation1; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B); - mfp = &mockFuncs::template stdcallexpectation2; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C); - mfp = &mockFuncs::template stdcallexpectation3; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D); - mfp = &mockFuncs::template stdcallexpectation4; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E); - mfp = &mockFuncs::template stdcallexpectation5; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F); - mfp = &mockFuncs::template stdcallexpectation6; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G); - mfp = &mockFuncs::template stdcallexpectation7; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H); - mfp = &mockFuncs::template stdcallexpectation8; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I); - mfp = &mockFuncs::template stdcallexpectation9; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J); - mfp = &mockFuncs::template stdcallexpectation10; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K); - mfp = &mockFuncs::template stdcallexpectation11; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L); - mfp = &mockFuncs::template stdcallexpectation12; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M); - mfp = &mockFuncs::template stdcallexpectation13; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N); - mfp = &mockFuncs::template stdcallexpectation14; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O); - mfp = &mockFuncs::template stdcallexpectation15; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} - -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (__stdcall Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo) -{ - int funcIndex = getFunctionIndex(func); - Y (__stdcall mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P); - mfp = &mockFuncs::template stdcallexpectation16; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case DontCare: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -#endif - -#ifdef ENABLE_CFUNC_MOCKING_SUPPORT -template -TCall &MockRepository::RegisterExpect_(Y (*func)(), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(); - fp = &mockFuncs::template static_expectation0; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A); - fp = &mockFuncs::template static_expectation1; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B); - fp = &mockFuncs::template static_expectation2; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C); - fp = &mockFuncs::template static_expectation3; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D); - fp = &mockFuncs::template static_expectation4; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E); - fp = &mockFuncs::template static_expectation5; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F); - fp = &mockFuncs::template static_expectation6; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G); - fp = &mockFuncs::template static_expectation7; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H); - fp = &mockFuncs::template static_expectation8; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I); - fp = &mockFuncs::template static_expectation9; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I,J); - fp = &mockFuncs::template static_expectation10; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I,J,K); - fp = &mockFuncs::template static_expectation11; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I,J,K,L); - fp = &mockFuncs::template static_expectation12; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I,J,K,L,M); - fp = &mockFuncs::template static_expectation13; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N); - fp = &mockFuncs::template static_expectation14; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O); - fp = &mockFuncs::template static_expectation15; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} - -template -TCall &MockRepository::RegisterExpect_(Y (*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo) -{ - Y (*fp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P); - fp = &mockFuncs::template static_expectation16; - int index = BasicStaticRegisterExpect(reinterpret_cast(func), reinterpret_cast(fp),X); - TCall *call = new TCall(expect, NULL, std::pair(0, index), lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -#endif - -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y (Z2::*)())func); - Y (mockFuncs::*mfp)(); - mfp = &mockFuncs::template expectation0; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A))func); - Y (mockFuncs::*mfp)(A); - mfp = &mockFuncs::template expectation1; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B))func); - Y (mockFuncs::*mfp)(A,B); - mfp = &mockFuncs::template expectation2; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C))func); - Y (mockFuncs::*mfp)(A,B,C); - mfp = &mockFuncs::template expectation3; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D))func); - Y (mockFuncs::*mfp)(A,B,C,D); - mfp = &mockFuncs::template expectation4; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E))func); - Y (mockFuncs::*mfp)(A,B,C,D,E); - mfp = &mockFuncs::template expectation5; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F); - mfp = &mockFuncs::template expectation6; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G); - mfp = &mockFuncs::template expectation7; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H); - mfp = &mockFuncs::template expectation8; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I); - mfp = &mockFuncs::template expectation9; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I,J))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J); - mfp = &mockFuncs::template expectation10; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I,J,K))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K); - mfp = &mockFuncs::template expectation11; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I,J,K,L))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L); - mfp = &mockFuncs::template expectation12; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M); - mfp = &mockFuncs::template expectation13; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N); - mfp = &mockFuncs::template expectation14; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O); - mfp = &mockFuncs::template expectation15; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} - -template -TCall &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo) -{ - std::pair funcIndex = virtual_index((Y(Z2::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))func); - Y (mockFuncs::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P); - mfp = &mockFuncs::template expectation16; - BasicRegisterExpect(reinterpret_cast *>(mck), - funcIndex.first, funcIndex.second, - reinterpret_cast(mfp),X); - TCall *call = new TCall(expect, reinterpret_cast(mck), funcIndex, lineNo, funcName, fileName); - switch(expect) - { - case Never: neverCalls.push_back(call); break; - case Any: optionals.push_back(call); break; - case Once: - if (autoExpect && expectations.size() > 0) - { - call->previousCalls.push_back(expectations.back()); - } - expectations.push_back(call); - break; - } - return *call; -} - -template -Z MockRepository::DoExpectation(base_mock *mock, std::pair funcno, const base_tuple &tuple) -{ - for (std::list::reverse_iterator i = expectations.rbegin(); i != expectations.rend(); ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno && - call->matchesArgs(tuple) && - !call->satisfied) - { - bool allSatisfy = true; - for (std::list::iterator callsBefore = call->previousCalls.begin(); - callsBefore != call->previousCalls.end(); ++callsBefore) - { - if (!(*callsBefore)->satisfied) - { - allSatisfy = false; - } - } - if (!allSatisfy) continue; - - call->satisfied = true; - - call->assignArgs(const_cast(tuple)); -#ifndef HM_NO_EXCEPTIONS - if (call->eHolder) - call->eHolder->rethrow(); -#endif - if (call->functor != NULL) - { - if(call->retVal == NULL) - { - return (*(TupleInvocable *)(call->functor))(tuple); - } - else - { - (*(TupleInvocable *)(call->functor))(tuple); - } - } - - if (call->retVal) - return ((ReturnValueWrapper *)call->retVal)->rv; - - RAISEEXCEPTION(NoResultSetUpException(this, call->getArgs(), call->funcName)); - } - } - for (std::list::reverse_iterator i = neverCalls.rbegin(); i != neverCalls.rend(); ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno && - call->matchesArgs(tuple)) - { - bool allSatisfy = true; - for (std::list::iterator callsBefore = call->previousCalls.begin(); - callsBefore != call->previousCalls.end(); ++callsBefore) - { - if (!(*callsBefore)->satisfied) - { - allSatisfy = false; - } - } - if (!allSatisfy) continue; - - call->satisfied = true; - - RAISEEXCEPTION(ExpectationException(this, call->getArgs(), call->funcName)); - } - } - for (std::list::reverse_iterator i = optionals.rbegin(); i != optionals.rend(); ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno && - call->matchesArgs(tuple)) - { - bool allSatisfy = true; - for (std::list::iterator callsBefore = call->previousCalls.begin(); - callsBefore != call->previousCalls.end(); ++callsBefore) - { - if (!(*callsBefore)->satisfied) - { - allSatisfy = false; - } - } - if (!allSatisfy) continue; - - call->satisfied = true; - - call->assignArgs(const_cast(tuple)); - -#ifndef HM_NO_EXCEPTIONS - if (call->eHolder) - call->eHolder->rethrow(); -#endif - if (call->functor != NULL) - { - if(call->retVal == NULL) - { - return (*(TupleInvocable *)(call->functor))(tuple); - } - else - { - (*(TupleInvocable *)(call->functor))(tuple); - } - } - - if (call->retVal) - return ((ReturnValueWrapper *)call->retVal)->rv; - - RAISEEXCEPTION(NoResultSetUpException(this, call->getArgs(), call->funcName)); - } - } - const char *funcName = NULL; - for (std::list::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno) - funcName = call->funcName; - } - for (std::list::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno) - funcName = call->funcName; - } - for (std::list::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i) - { - Call *call = *i; - if (call->mock == mock && - call->funcIndex == funcno) - funcName = call->funcName; - } - RAISEEXCEPTION(ExpectationException(this, &tuple, funcName)); -} -template -base *MockRepository::Mock() { - mock *m = new mock(this); - mocks.push_back(m); - return reinterpret_cast(m); -} -inline std::ostream &operator<<(std::ostream &os, const Call &call) -{ - os << call.fileName << "(" << call.lineno << ") "; - if (call.expectation == Once) - os << "Expectation for "; - else - os << "Result set for "; - - os << call.funcName; - - if (call.getArgs()) - call.getArgs()->printTo(os); - else - os << "(...)"; - - os << " on the mock at 0x" << call.mock << " was "; - - if (!call.satisfied) - os << "not "; - - if (call.expectation == Once) - os << "satisfied." << std::endl; - else - os << "used." << std::endl; - - return os; -} - -inline std::ostream &operator<<(std::ostream &os, const MockRepository &repo) -{ - if (repo.expectations.size()) - { - os << "Expections set:" << std::endl; - for (std::list::const_iterator exp = repo.expectations.begin(); exp != repo.expectations.end(); ++exp) - os << **exp; - os << std::endl; - } - - if (repo.neverCalls.size()) - { - os << "Functions explicitly expected to not be called:" << std::endl; - for (std::list::const_iterator exp = repo.neverCalls.begin(); exp != repo.neverCalls.end(); ++exp) - os << **exp; - os << std::endl; - } - - if (repo.optionals.size()) - { - os << "Optional results set up:" << std::endl; - for (std::list::const_iterator exp = repo.optionals.begin(); exp != repo.optionals.end(); ++exp) - os << **exp; - os << std::endl; - } - - return os; -} - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#ifndef NO_HIPPOMOCKS_NAMESPACE -} - -using HippoMocks::MockRepository; -using HippoMocks::DONTCARE_NAME; -using HippoMocks::Call; -using HippoMocks::Out; -using HippoMocks::In; -#endif - -#undef DEBUGBREAK -#undef BASE_EXCEPTION -#undef RAISEEXCEPTION -#undef RAISELATENTEXCEPTION -#undef DONTCARE_NAME -#undef VIRT_FUNC_LIMIT -#undef EXTRA_DESTRUCTOR -#undef FUNCTION_BASE -#undef FUNCTION_STRIDE -#undef ENABLE_CFUNC_MOCKING_SUPPORT - -#endif - diff --git a/src/tests/hippomocks_test/test.cpp b/src/tests/hippomocks_test/test.cpp deleted file mode 100644 index aa87cb6..0000000 --- a/src/tests/hippomocks_test/test.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright Mathieu Champlon 2012 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://turtle.sf.net for documentation. - -#define BOOST_AUTO_TEST_MAIN -#include "hippomocks.h" -#include -#define BOOST_LIB_NAME boost_unit_test_framework -#include - -namespace -{ - struct s - { - virtual void method( int ) {} - virtual s& operator=( int ) { return *this; } - }; - bool check( int ) - { - return true; - } -} - -BOOST_AUTO_TEST_CASE( hmm ) -{ - MockRepository mocks; - s* m = mocks.Mock< s >(); - mocks.ExpectCall( m, s::method ).Match( check ); - mocks.ExpectCallOverload( m, (s&(s::*)(int))&s::operator= ); - m->method( 7 ); -} - -//namespace -//{ -// void free_function() { std::cout << "ok" << std::endl; } -//} -// -//BOOST_AUTO_TEST_CASE( hmm2 ) -//{ -// MockRepository mocks; -// mocks.ExpectCallFunc( free_function ); -// free_function(); -//} diff --git a/src/tests/pch_test/pch_test.cpp b/src/tests/pch_test/pch_test.cpp deleted file mode 100644 index ec0c377..0000000 --- a/src/tests/pch_test/pch_test.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Copyright Mathieu Champlon 2008 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://turtle.sf.net for documentation. - -#include "pch_test.h" - -int main() -{ - return 0; -} diff --git a/src/tests/pch_test/pch_test.h b/src/tests/pch_test/pch_test.h deleted file mode 100644 index f269467..0000000 --- a/src/tests/pch_test/pch_test.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// Copyright Mathieu Champlon 2011 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://turtle.sf.net for documentation. - -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include - -#include -//#include - -// release vc80 -// -// xeumeuleu/xml.h 24 - -// boost/shared_ptr.hpp 5 -// boost/bind.hpp 6 -// boost/type_traits.hpp 19 -// boost/function_types/function_type.hpp 19 -// boost/function.hpp 23 -// boost/function.hpp + boost/bind.hpp 25 -// boost/lambda/lambda.hpp 25 -// boost/lambda/bind.hpp 22 -// boost/function_types/function_type.hpp + boost/type_traits.hpp 36 -// boost/spirit/home/phoenix/core.hpp 46 -// -// boost/test/auto_unit_test.hpp 27 -// turtle/mock.hpp 89 -// boost/test/auto_unit_test.hpp + turtle/mock.hpp 93 -// -// all boost includes from turtle 89 - -// getting rid of : -// boost/bind 3 -// function_type 13 -// boost/phoenix 31

::print(os, p, true); - os << ")"; - } -}; - -template -class ref_comparable_assignable_tuple : public base_tuple -{ -public: - virtual bool operator==(const ref_tuple &bo) = 0; - virtual void assign_from(ref_tuple &from) = 0; - virtual void assign_to(ref_tuple &to) = 0; -}; - -template -struct with_ref -{ - typedef B type; -}; - -template -struct with_ref -{ - typedef B type; -}; - -template -struct with_ref -{ - typedef B type; -}; - -template -struct with_ref -{ - typedef const B & type; -}; - -template -struct with_ref -{ - typedef B type; -}; - -template -struct with_ref &> -{ - typedef OutParam type; -}; - -template -struct with_ref -{ - typedef const B & type; -}; - -template -struct with_ref &> -{ - typedef OutParam type; -}; - -template -struct with_ref -{ - typedef B type; -}; - -template -struct with_ref -{ - typedef B type; -}; - -template -struct with_ref -{ - typedef B type; -}; - -// Fix specifically for char arrays (which aren't assignable, but don't change either) -template -struct with_ref -{ - typedef const char *type; -}; -template -struct with_ref -{ - typedef const char *type; -}; -template -struct with_ref -{ - typedef const char *type; -}; -template -struct with_ref -{ - typedef const char *type; -}; - -template -class copy_tuple : public ref_comparable_assignable_tuple -{ -public: - typename with_ref::type a; - typename with_ref::type b; - typename with_ref::type c; - typename with_ref::type d; - typename with_ref::type e; - typename with_ref::type f; - typename with_ref::type g; - typename with_ref::type h; - typename with_ref::type i; - typename with_ref::type j; - typename with_ref::type k; - typename with_ref::type l; - typename with_ref::type m; - typename with_ref::type n; - typename with_ref::type o; - typename with_ref::type p; - copy_tuple(typename with_ref::type a, typename with_ref::type b, - typename with_ref::type c, typename with_ref::type d, - typename with_ref::type e, typename with_ref::type f, - typename with_ref::type g, typename with_ref::type h, - typename with_ref::type i, typename with_ref::type j, - typename with_ref::type k, typename with_ref::type l, - typename with_ref::type m, typename with_ref::type n, - typename with_ref::type o, typename with_ref::type p) - : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h), i(i), j(j), k(k), l(l), m(m), n(n), o(o), p(p) - {} - bool operator==(const ref_tuple &to) - { - return (comparer::compare(a, to.a) && - comparer::compare(b, to.b) && - comparer::compare(c, to.c) && - comparer::compare(d, to.d) && - comparer::compare(e, to.e) && - comparer::compare(f, to.f) && - comparer::compare(g, to.g) && - comparer::compare(h, to.h) && - comparer::compare(i, to.i) && - comparer::compare(j, to.j) && - comparer::compare(k, to.k) && - comparer::compare(l, to.l) && - comparer::compare(m, to.m) && - comparer::compare(n, to.n) && - comparer::compare(o, to.o) && - comparer