My Project
Loading...
Searching...
No Matches
Macros
Mock.h File Reference

Go to the source code of this file.

Macros

#define CXXTEST_MOCK_NAMESPACE   T
 
#define __CXXTEST_MOCK__TRAITS
 
#define CXXTEST_EXTERN_C   extern "C"
 
#define __CXXTEST_MOCK__PROTOTYPE(MOCK, TYPE, NAME, ARGS, REAL, CALL)    namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS; }
 
#define __CXXTEST_MOCK_VOID__PROTOTYPE(MOCK, NAME, ARGS, REAL, CALL)    __CXXTEST_MOCK__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL )
 
#define __CXXTEST_SUPPLY__PROTOTYPE(MOCK, TYPE, NAME, ARGS, REAL, CALL)    TYPE REAL ARGS;
 
#define __CXXTEST_SUPPLY_VOID__PROTOTYPE(MOCK, NAME, ARGS, REAL, CALL)    __CXXTEST_SUPPLY__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL )
 
#define __CXXTEST_MOCK__CLASS_DECLARATION(MOCK, TYPE, NAME, ARGS, REAL, CALL)
 
#define __CXXTEST_MOCK_VOID__CLASS_DECLARATION(MOCK, NAME, ARGS, REAL, CALL)    __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL )
 
#define __CXXTEST_SUPPLY__CLASS_DECLARATION(MOCK, TYPE, NAME, ARGS, REAL, CALL)
 
#define __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION(MOCK, NAME, ARGS, REAL, CALL)    __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL )
 
#define __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION(MOCK, NAME)
 
#define __CXXTEST_MOCK__CLASS_IMPLEMENTATION(MOCK, TYPE, NAME, ARGS, REAL, CALL)
 
#define __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION(MOCK, NAME, ARGS, REAL, CALL)
 
#define __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION(MOCK, TYPE, NAME, ARGS, REAL, CALL)
 
#define __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION(MOCK, NAME, ARGS, REAL, CALL)
 
#define __CXXTEST_MOCK_UNIMPLEMENTED(NAME, ARGS)
 
#define CXXTEST_MOCK_NAMESPACE_STR   __CXXTEST_STR(CXXTEST_MOCK_NAMESPACE) "::"
 
#define __CXXTEST_STR(X)   __CXXTEST_XSTR(X)
 
#define __CXXTEST_XSTR(X)   #X
 
#define CXXTEST_MOCK(MOCK, TYPE, NAME, ARGS, REAL, CALL)    __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL )
 
#define CXXTEST_MOCK_VOID(MOCK, NAME, ARGS, REAL, CALL)    __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL )
 
#define CXXTEST_SUPPLY(MOCK, TYPE, NAME, ARGS, REAL, CALL)    __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL )
 
#define CXXTEST_SUPPLY_VOID(MOCK, NAME, ARGS, REAL, CALL)    __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL )
 
#define CXXTEST_SUPPLY_C(MOCK, TYPE, NAME, ARGS, REAL, CALL)
 
#define CXXTEST_SUPPLY_VOID_C(MOCK, NAME, ARGS, REAL, CALL)
 
#define CXXTEST_MOCK_GLOBAL(TYPE, NAME, ARGS, CALL)    CXXTEST_MOCK( NAME, TYPE, NAME, ARGS, ::NAME, CALL )
 
#define CXXTEST_MOCK_VOID_GLOBAL(NAME, ARGS, CALL)    CXXTEST_MOCK_VOID( NAME, NAME, ARGS, ::NAME, CALL )
 
#define CXXTEST_SUPPLY_GLOBAL(TYPE, NAME, ARGS, CALL)    CXXTEST_SUPPLY( NAME, TYPE, NAME, ARGS, NAME, CALL )
 
#define CXXTEST_SUPPLY_VOID_GLOBAL(NAME, ARGS, CALL)    CXXTEST_SUPPLY_VOID( NAME, NAME, ARGS, NAME, CALL )
 
#define CXXTEST_SUPPLY_GLOBAL_C(TYPE, NAME, ARGS, CALL)    CXXTEST_SUPPLY_C( NAME, TYPE, NAME, ARGS, NAME, CALL )
 
#define CXXTEST_SUPPLY_VOID_GLOBAL_C(NAME, ARGS, CALL)    CXXTEST_SUPPLY_VOID_C( NAME, NAME, ARGS, NAME, CALL )
 
#define CXXTEST_MOCK_DEFAULT_VALUE(TYPE, VALUE)
 

Macro Definition Documentation

◆ __CXXTEST_MOCK__CLASS_DECLARATION

#define __CXXTEST_MOCK__CLASS_DECLARATION (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
namespace CXXTEST_MOCK_NAMESPACE { \
class Base_##MOCK : public CxxTest::Link \
{ \
public: \
Base_##MOCK(); \
~Base_##MOCK(); \
bool setUp(); \
bool tearDown(); \
\
static Base_##MOCK &current(); \
\
virtual TYPE NAME ARGS = 0; \
\
private: \
static CxxTest::List _list; \
}; \
\
class Real_##MOCK : public Base_##MOCK \
{ \
public: \
TYPE NAME ARGS; \
}; \
\
class _Unimplemented_##MOCK : public Base_##MOCK \
{ \
public: \
TYPE NAME ARGS; \
}; \
}
#define CXXTEST_MOCK_NAMESPACE
Definition: Mock.h:8

Definition at line 52 of file Mock.h.

◆ __CXXTEST_MOCK__CLASS_IMPLEMENTATION

#define __CXXTEST_MOCK__CLASS_IMPLEMENTATION (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
namespace CXXTEST_MOCK_NAMESPACE { \
TYPE Real_##MOCK::NAME ARGS \
{ \
return REAL CALL; \
} \
\
TYPE _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) \
return NAME CALL; \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
return MockTraits<TYPE>::defaultValue(); \
} \
\
TYPE NAME ARGS \
{ \
return Base_##MOCK::current().NAME CALL; \
} \
}
#define __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION(MOCK, NAME)
Definition: Mock.h:117

Definition at line 135 of file Mock.h.

◆ __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION

#define __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION (   MOCK,
  NAME 
)
Value:
namespace CXXTEST_MOCK_NAMESPACE { \
\
CxxTest::List Base_##MOCK::_list = { 0, 0 }; \
\
Base_##MOCK::Base_##MOCK() { attach( _list ); } \
Base_##MOCK::~Base_##MOCK() { detach( _list ); } \
bool Base_##MOCK::setUp() { return true; } \
bool Base_##MOCK::tearDown() { return true; } \
\
Base_##MOCK &Base_##MOCK::current() \
{ \
if ( _list.empty() ) \
static _Unimplemented_##MOCK unimplemented; \
return *(Base_##MOCK *)_list.tail(); \
} \
}

Definition at line 117 of file Mock.h.

◆ __CXXTEST_MOCK__PROTOTYPE

#define __CXXTEST_MOCK__PROTOTYPE (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)     namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS; }

Definition at line 37 of file Mock.h.

◆ __CXXTEST_MOCK__TRAITS

#define __CXXTEST_MOCK__TRAITS
Value:
{ \
template<class T> \
class MockTraits \
{ \
public: \
static T defaultValue() { return 0; } \
}; \
};
STATIC_VAR jList * T
Definition: janet.cc:30

Definition at line 14 of file Mock.h.

◆ __CXXTEST_MOCK_UNIMPLEMENTED

#define __CXXTEST_MOCK_UNIMPLEMENTED (   NAME,
  ARGS 
)
Value:
TS_FAIL( CXXTEST_MOCK_NAMESPACE_STR #NAME #ARGS " called with no " \
CXXTEST_MOCK_NAMESPACE_STR "Base_" #NAME " object" ); \
#define CXXTEST_MOCK_NAMESPACE_STR
Definition: Mock.h:218
#define TS_FAIL(e)
Definition: TestSuite.h:229

Definition at line 214 of file Mock.h.

◆ __CXXTEST_MOCK_VOID__CLASS_DECLARATION

#define __CXXTEST_MOCK_VOID__CLASS_DECLARATION (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL )

Definition at line 83 of file Mock.h.

◆ __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION

#define __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
namespace CXXTEST_MOCK_NAMESPACE { \
void Real_##MOCK::NAME ARGS \
{ \
REAL CALL; \
} \
\
void _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) \
NAME CALL; \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
} \
\
void NAME ARGS \
{ \
Base_##MOCK::current().NAME CALL; \
} \
}

Definition at line 157 of file Mock.h.

◆ __CXXTEST_MOCK_VOID__PROTOTYPE

#define __CXXTEST_MOCK_VOID__PROTOTYPE (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_MOCK__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL )

Definition at line 40 of file Mock.h.

◆ __CXXTEST_STR

#define __CXXTEST_STR (   X)    __CXXTEST_XSTR(X)

Definition at line 219 of file Mock.h.

◆ __CXXTEST_SUPPLY__CLASS_DECLARATION

#define __CXXTEST_SUPPLY__CLASS_DECLARATION (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
namespace CXXTEST_MOCK_NAMESPACE { \
class Base_##MOCK : public CxxTest::Link \
{ \
public: \
Base_##MOCK(); \
~Base_##MOCK(); \
bool setUp(); \
bool tearDown(); \
\
static Base_##MOCK &current(); \
\
virtual TYPE NAME ARGS = 0; \
\
private: \
static CxxTest::List _list; \
}; \
\
class _Unimplemented_##MOCK : public Base_##MOCK \
{ \
public: \
TYPE NAME ARGS; \
}; \
}

Definition at line 86 of file Mock.h.

◆ __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION

#define __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
namespace CXXTEST_MOCK_NAMESPACE { \
TYPE _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) \
return NAME CALL; \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
return MockTraits<TYPE>::defaultValue(); \
} \
} \
\
TYPE REAL ARGS \
{ \
return CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \
}

Definition at line 178 of file Mock.h.

◆ __CXXTEST_SUPPLY__PROTOTYPE

#define __CXXTEST_SUPPLY__PROTOTYPE (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)     TYPE REAL ARGS;

Definition at line 43 of file Mock.h.

◆ __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION

#define __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL )

Definition at line 111 of file Mock.h.

◆ __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION

#define __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
namespace CXXTEST_MOCK_NAMESPACE { \
void _Unimplemented_##MOCK::NAME ARGS \
{ \
while ( false ) \
NAME CALL; \
__CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \
} \
} \
\
void REAL ARGS \
{ \
CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \
} \

Definition at line 195 of file Mock.h.

◆ __CXXTEST_SUPPLY_VOID__PROTOTYPE

#define __CXXTEST_SUPPLY_VOID__PROTOTYPE (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_SUPPLY__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL )

Definition at line 46 of file Mock.h.

◆ __CXXTEST_XSTR

#define __CXXTEST_XSTR (   X)    #X

Definition at line 220 of file Mock.h.

◆ CXXTEST_EXTERN_C

#define CXXTEST_EXTERN_C   extern "C"

Definition at line 29 of file Mock.h.

◆ CXXTEST_MOCK

#define CXXTEST_MOCK (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL )

Definition at line 289 of file Mock.h.

◆ CXXTEST_MOCK_DEFAULT_VALUE

#define CXXTEST_MOCK_DEFAULT_VALUE (   TYPE,
  VALUE 
)
Value:
{ \
template<> \
class MockTraits<TYPE> \
{ \
public: \
static TYPE defaultValue() { return VALUE; } \
}; \
}
#define VALUE(list, offset)
Definition: omList.c:16

Definition at line 339 of file Mock.h.

◆ CXXTEST_MOCK_GLOBAL

#define CXXTEST_MOCK_GLOBAL (   TYPE,
  NAME,
  ARGS,
  CALL 
)     CXXTEST_MOCK( NAME, TYPE, NAME, ARGS, ::NAME, CALL )

Definition at line 317 of file Mock.h.

◆ CXXTEST_MOCK_NAMESPACE

#define CXXTEST_MOCK_NAMESPACE   T

Definition at line 8 of file Mock.h.

◆ CXXTEST_MOCK_NAMESPACE_STR

#define CXXTEST_MOCK_NAMESPACE_STR   __CXXTEST_STR(CXXTEST_MOCK_NAMESPACE) "::"

Definition at line 218 of file Mock.h.

◆ CXXTEST_MOCK_VOID

#define CXXTEST_MOCK_VOID (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL )

Definition at line 292 of file Mock.h.

◆ CXXTEST_MOCK_VOID_GLOBAL

#define CXXTEST_MOCK_VOID_GLOBAL (   NAME,
  ARGS,
  CALL 
)     CXXTEST_MOCK_VOID( NAME, NAME, ARGS, ::NAME, CALL )

Definition at line 320 of file Mock.h.

◆ CXXTEST_SUPPLY

#define CXXTEST_SUPPLY (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL )

Definition at line 295 of file Mock.h.

◆ CXXTEST_SUPPLY_C

#define CXXTEST_SUPPLY_C (   MOCK,
  TYPE,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
CXXTEST_EXTERN_C __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \
CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL )
#define __CXXTEST_SUPPLY__PROTOTYPE(MOCK, TYPE, NAME, ARGS, REAL, CALL)
Definition: Mock.h:43
#define CXXTEST_EXTERN_C
Definition: Mock.h:29

Definition at line 306 of file Mock.h.

◆ CXXTEST_SUPPLY_GLOBAL

#define CXXTEST_SUPPLY_GLOBAL (   TYPE,
  NAME,
  ARGS,
  CALL 
)     CXXTEST_SUPPLY( NAME, TYPE, NAME, ARGS, NAME, CALL )

Definition at line 323 of file Mock.h.

◆ CXXTEST_SUPPLY_GLOBAL_C

#define CXXTEST_SUPPLY_GLOBAL_C (   TYPE,
  NAME,
  ARGS,
  CALL 
)     CXXTEST_SUPPLY_C( NAME, TYPE, NAME, ARGS, NAME, CALL )

Definition at line 329 of file Mock.h.

◆ CXXTEST_SUPPLY_VOID

#define CXXTEST_SUPPLY_VOID (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)     __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL )

Definition at line 298 of file Mock.h.

◆ CXXTEST_SUPPLY_VOID_C

#define CXXTEST_SUPPLY_VOID_C (   MOCK,
  NAME,
  ARGS,
  REAL,
  CALL 
)
Value:
CXXTEST_EXTERN_C __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \
CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL )
#define __CXXTEST_SUPPLY_VOID__PROTOTYPE(MOCK, NAME, ARGS, REAL, CALL)
Definition: Mock.h:46

Definition at line 310 of file Mock.h.

◆ CXXTEST_SUPPLY_VOID_GLOBAL

#define CXXTEST_SUPPLY_VOID_GLOBAL (   NAME,
  ARGS,
  CALL 
)     CXXTEST_SUPPLY_VOID( NAME, NAME, ARGS, NAME, CALL )

Definition at line 326 of file Mock.h.

◆ CXXTEST_SUPPLY_VOID_GLOBAL_C

#define CXXTEST_SUPPLY_VOID_GLOBAL_C (   NAME,
  ARGS,
  CALL 
)     CXXTEST_SUPPLY_VOID_C( NAME, NAME, ARGS, NAME, CALL )

Definition at line 332 of file Mock.h.