CppUnit project page FAQ CppUnit home page

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
include / cppunit / plugin

TestPlugIn.h

Go to the documentation of this file.
00001 #ifndef CPPUNIT_PLUGIN_TESTPLUGIN
00002 #define CPPUNIT_PLUGIN_TESTPLUGIN
00003 
00004 #include <cppunit/Portability.h>
00005 
00006 #if !defined(CPPUNIT_NO_TESTPLUGIN)
00007 
00008 #include <cppunit/plugin/PlugInParameters.h>
00009 
00010 CPPUNIT_NS_BEGIN
00011 
00012 
00013 class Test;
00014 class TestFactoryRegistry;
00015 class TestResult;
00016 class XmlOutputter;
00017 
00018 CPPUNIT_NS_END
00019 
00043 struct CppUnitTestPlugIn
00044 {
00058 virtual void initialize( CPPUNIT_NS::TestFactoryRegistry *registry,
00059 const CPPUNIT_NS::PlugInParameters &parameters ) =0;
00060 
00068 virtual void addListener( CPPUNIT_NS::TestResult *eventManager ) =0;
00069 
00074 virtual void removeListener( CPPUNIT_NS::TestResult *eventManager ) =0;
00075 
00078 virtual void addXmlOutputterHooks( CPPUNIT_NS::XmlOutputter *outputter ) =0;
00079 
00084 virtual void removeXmlOutputterHooks() = 0;
00085 
00094 virtual void uninitialize( CPPUNIT_NS::TestFactoryRegistry *registry ) =0;
00095 };
00096 
00097 
00098 
00107 #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
00108 
00112 typedef CppUnitTestPlugIn *(*TestPlugInSignature)();
00113 
00114 
00118 #define CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( TestPlugInInterfaceType ) \
00119  CPPUNIT_PLUGIN_EXPORT CppUnitTestPlugIn *CPPUNIT_PLUGIN_EXPORTED_NAME(void) \
00120  { \
00121  static TestPlugInInterfaceType plugIn; \
00122  return &plugIn; \
00123  } \
00124  typedef char __CppUnitPlugInExportFunctionDummyTypeDef // dummy typedef so it can end with ';'
00125 
00126 
00127 // Note: This include should remain after definition of CppUnitTestPlugIn
00128 #include <cppunit/plugin/TestPlugInDefaultImpl.h>
00129 
00130 
00139 // Win32
00140 #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER)
00141 #if !defined(APIENTRY)
00142 #define WIN32_LEAN_AND_MEAN 
00143 #define NOGDI
00144 #define NOUSER
00145 #define NOKERNEL
00146 #define NOSOUND
00147 #define NOMINMAX
00148 #define BLENDFUNCTION void // for mingw & gcc
00149 #include <windows.h>
00150 #endif
00151 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
00152  BOOL APIENTRY DllMain( HANDLE hModule, \
00153  DWORD ul_reason_for_call, \
00154  LPVOID lpReserved ) \
00155  { \
00156  return TRUE; \
00157  } \
00158  typedef char __CppUnitPlugInImplementMainDummyTypeDef
00159 
00160 // Unix
00161 #elif defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
00162 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
00163  int main( int argc, char *argv[] ) \
00164  { \
00165  return 0; \
00166  } \
00167  typedef char __CppUnitPlugInImplementMainDummyTypeDef
00168 
00169 
00170 // Other
00171 #else // other platforms don't require anything specifics
00172 #endif
00173 
00174 
00175 
00190 #define CPPUNIT_PLUGIN_IMPLEMENT() \
00191  CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS::TestPlugInDefaultImpl ); \
00192  CPPUNIT_PLUGIN_IMPLEMENT_MAIN()
00193 
00194 
00195 #endif // !defined(CPPUNIT_NO_TESTPLUGIN)
00196 
00197 
00198 #endif // CPPUNIT_PLUGIN_TESTPLUGIN

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers

AltStyle によって変換されたページ (->オリジナル) /