src/include/common/base/test.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol, Inc
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 02111-1307  USA
00017  */
00018 
00024 #ifndef INCL_TEST_H
00025 #define INCL_TEST_H
00026 
00028 #ifdef AUTOTOOLS
00029 # include <config.h>
00030 #endif
00031 
00032 // These defines are set in config.h when using the autotools
00033 // mechanism and by the project setup on Windows. They control whether
00034 // tests inside the libraries source code (ENABLE_UNIT_TESTS) or of
00035 // the final library are enabled (ENABLE_INTEGRATION_TESTS).
00036 #if defined(ENABLE_UNIT_TESTS) || defined(ENABLE_INTEGRATION_TESTS)
00037 
00038 // make common macros like CPPUNIT_TEST_ASSERT() available */
00039 # include <cppunit/extensions/TestFactoryRegistry.h>
00040 # include <cppunit/extensions/HelperMacros.h>
00041 # include <string>
00042 
00043 // use this macros instead of the plain CPPUNIT_ one to ensure
00044 // that the autotools Makefile and Visual Studio helper script can find
00045 // all tests and link them into the test binary
00046 #define FUNAMBOL_TEST_SUITE_REGISTRATION( ATestFixtureType ) \
00047     CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ); \
00048     extern "C" { int funambolAutoRegisterRegistry ## ATestFixtureType = 12345; }
00049 
00050 
00051 // until a better solution is found use the helper function from TestMain.cpp
00052 // to get the name of the currently running test; beware, will contain colons
00053 extern const std::string &getCurrentTest();
00054 
00055 // removes special characters like colons and slashes
00056 extern void simplifyFilename(std::string &filename);
00057 
00058 #endif // ENABLE_UNIT_TESTS
00059 
00061 #endif // INCL_TEST_H

Generated on Fri Jun 15 11:38:29 2007 for Funambol C++ Client Library by  doxygen 1.5.2