CoCppUnit.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2007 by Peter Dimov.
00004 
00005 This file is part of Calitko (http://www.calitko.org).
00006 
00007 Calitko is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 Calitko is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Calitko; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021 */
00022 
00023 #include "cppunit/extensions/HelperMacros.h"
00024 #include "DataTestSuite.h"
00025 #include "DataTestCaller.h"
00026 
00035 #define CPPUNIT_DATA_TEST( testMethod )                   \
00036     CPPUNIT_TEST_SUITE_ADD_TEST(                          \
00037         ( new CPPUNIT_NS::DataTestSuite<TestFixtureType>( \
00038                   context.getTestNameFor( #testMethod),   \
00039                   &TestFixtureType::testMethod,           \
00040                   &TestFixtureType::testMethod##_data,    \
00041                   context ) ) )
00042 
00048 #define CPPUNIT_DATA_FOR( testMethod )                    \
00049     CppUnitVector <std::pair <std::string, void *> >      \
00050     testMethod##_data()                                   \
00051     { CppUnitVector <std::pair <std::string, void *> > __returnData; \
00052       typedef testMethod##Data __testDataTypedef;
00053 
00059 #define CPPUNIT_DATA_FOR_END()                            \
00060     return __returnData; }
00061 
00070 #define CPPUNIT_DATA_SET( name )                          \
00071     { __testDataTypedef *t = new __testDataTypedef;       \
00072       __returnData.push_back(                             \
00073         std::pair <std::string, void *> ( name, t ) );
00074 
00081 #define CPPUNIT_DATA_SET_END()                            \
00082     }
00083 
00088 #define CPPUNIT_FETCH_DATA( testMethod )                  \
00089     std::auto_ptr <testMethod##Data> t ((testMethod##Data *) __currentTestData);