[Mockpp-commits] mockpp/mockpp SelectUnittestFramework.h,NONE,1.1 CxxTestSupport.h,1.1,1.2
Brought to you by:
ewald-arnold
|
From: Ewald A. <ewa...@us...> - 2005-12-10 15:18:41
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13151/mockpp Modified Files: CxxTestSupport.h Added Files: SelectUnittestFramework.h Log Message: first tests with cxxtest --- NEW FILE: SelectUnittestFramework.h --- /*************************************************************************** SelectUnittestFramework.h - setup for unittest framework in use ------------------- begin : Fri Dec 9 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de $Id: SelectUnittestFramework.h,v 1.1 2005/12/10 15:18:34 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** * * This program 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 of the License, * or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ #ifndef MOCKPP_SELECTUNITTESTFRAMEWORK_H #define MOCKPP_SELECTUNITTESTFRAMEWORK_H #if defined(HAVE_CXXTEST) # define MOCKPP_DERIVE_PUBLIC_UNITFRAMEWORK : public CxxTest::TestSuite #define CXXTEST_HAVE_STD #define CXXTEST_ABORT_TEST_ON_FAIL #ifndef CXXTEST_RUNNING #define CXXTEST_RUNNING #endif #define _CXXTEST_HAVE_STD #define _CXXTEST_HAVE_EH #include <cxxtest/TestListener.h> #include <cxxtest/TestTracker.h> #include <cxxtest/RealDescriptions.h> //#include <cxxtest/TestRunner.h> #include <mockpp/CxxTestSupport.h> #elif defined(HAVE_CPPUNIT) # include <cppunit/extensions/HelperMacros.h> # define MOCKPP_DERIVE_PUBLIC_UNITFRAMEWORK : public CppUnit::TestFixture #else # pragma message ("No unittest framework available at compile time") # define MOCKPP_DERIVE_PUBLIC_UNITFRAMEWORK /**/ #endif // frameworks #endif // MOCKPP_SELECTUNITTESTFRAMEWORK_H Index: CxxTestSupport.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/CxxTestSupport.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CxxTestSupport.h 9 Dec 2005 21:16:49 -0000 1.1 +++ CxxTestSupport.h 10 Dec 2005 15:18:34 -0000 1.2 @@ -30,22 +30,43 @@ #ifndef MOCKPP_CXXTEST_SUPPORT_H #define MOCKPP_CXXTEST_SUPPORT_H -#define MOCKPP_CXXTEST_SUITE(class) \ - static ## class suite_## class; \ +//////////////////////////////////////////////////////////////////////////// +// + +#define MOCKPP_CXXTEST_SUITE_REGISTRATION(classname) \ + static classname suite_ ## classname; \ \ - static CxxTest::List Tests_## class = { 0, 0 }; \ - CxxTest::StaticSuiteDescription suiteDescription_## class( __FILE__, __LINE__, #class, suite_## class, Tests_## class ); \ + static CxxTest::List tests_ ## classname = { 0, 0 }; \ + \ + CxxTest::StaticSuiteDescription suiteDescription_ ## classname( __FILE__, \ + __LINE__, \ + #classname, \ + suite_ ## classname, \ + tests_ ## classname) +//////////////////////////////////////////////////////////////////////////// +// -#define MOCKPP_CXXTEST(class, meth) \ -static class TestDescription_ ## class ## _ ## meth : public CxxTest::RealTestDescription { \ +#define MOCKPP_CXXTEST(classname, meth) \ +static class TestDescription_ ## classname ## _ ## meth \ + : public CxxTest::RealTestDescription { \ public: \ - TestDescription_## class ## meth() : CxxTest::RealTestDescription( Tests_ ## class, suiteDescription_ ##class, __LINE__, #meth ) {} \ - void runTest() { suite_ ## class. ##meth(); } \ -} testDescription_## class ##meth; - + TestDescription_ ## classname ## _ ## meth() \ + : CxxTest::RealTestDescription( tests_ ## classname, \ + suiteDescription_ ##classname, \ + __LINE__, \ + #meth ) \ + {} \ + \ + void runTest() \ + { \ + suite_ ## classname . meth(); \ + } \ +} testDescription_ ## classname ## _ ## meth -#define MOCKPP_CXXTEST_SUITE_END +//////////////////////////////////////////////////////////////////////////// +// +// #define MOCKPP_CXXTEST_SUITE_END #endif // MOCKPP_CXXTEST_SUPPORT_H |