[Cppunit-cvs] cppunit2/src/cpputtest cpputtest.vcproj,1.12,1.13 main.cpp,1.12,1.13 registrytest.cpp,
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-02-27 15:27:17
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23414/src/cpputtest Modified Files: cpputtest.vcproj main.cpp registrytest.cpp registrytest.h SConscript Log Message: * ported the Registry tests back to the new framework architecture. Index: registrytest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/registrytest.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** registrytest.h 17 Nov 2004 08:59:34 -0000 1.3 --- registrytest.h 27 Feb 2005 15:27:09 -0000 1.4 *************** *** 36,39 **** --- 36,41 ---- void runTest( const std::string &testName ); + void runTestSuite( CppUT::TestSuitePtr suite ); + CppUT::TestFactory makeTestFactory( const std::string &testName ); Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/SConscript,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SConscript 26 Feb 2005 11:40:58 -0000 1.4 --- SConscript 27 Feb 2005 15:27:09 -0000 1.5 *************** *** 8,12 **** assertstringtest.cpp enumeratortest.cpp ! main.cpp testbasicassertion.cpp testfunctor.cpp --- 8,13 ---- assertstringtest.cpp enumeratortest.cpp ! main.cpp ! registrytest.cpp testbasicassertion.cpp testfunctor.cpp Index: registrytest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/registrytest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** registrytest.cpp 17 Nov 2004 21:47:10 -0000 1.2 --- registrytest.cpp 27 Feb 2005 15:27:09 -0000 1.3 *************** *** 1,5 **** #include "registrytest.h" #include <cpput/testcase.h> ! #include <cpput/testcontext.h> --- 1,5 ---- #include "registrytest.h" #include <cpput/testcase.h> ! #include <cpput/testsuite.h> *************** *** 36,41 **** CppUT::TestSuitePtr suite = registry_->createDefaultTests(); ! CppUT::TestContext context; ! suite->run( context ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test1" ) ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test2" ) ); --- 36,41 ---- CppUT::TestSuitePtr suite = registry_->createDefaultTests(); ! runTestSuite( suite ); ! CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test1" ) ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test2" ) ); *************** *** 53,63 **** CppUT::TestSuitePtr suite2 = registry_->createTests( "Name2" ); ! CppUT::TestContext context; ! suite->run( context ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test1" ) ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test2" ) ); CPPUT_ASSERT_EQUAL( 0, testNames_.count( "Test3" ) ); ! suite2->run( context ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test3" ) ); } --- 53,62 ---- CppUT::TestSuitePtr suite2 = registry_->createTests( "Name2" ); ! runTestSuite( suite ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test1" ) ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test2" ) ); CPPUT_ASSERT_EQUAL( 0, testNames_.count( "Test3" ) ); ! runTestSuite( suite2 ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test3" ) ); } *************** *** 75,80 **** CppUT::TestSuitePtr suite = registry_->createTests( "Name" ); ! CppUT::TestContext context; ! suite->run( context ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test1" ) ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test2" ) ); --- 74,78 ---- CppUT::TestSuitePtr suite = registry_->createTests( "Name" ); ! runTestSuite( suite ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test1" ) ); CPPUT_ASSERT_EQUAL( 1, testNames_.count( "Test2" ) ); *************** *** 87,94 **** RegistryTest::makeTest( const std::string &testName ) { ! return CppUT::makeTestCase( CppUT::bind1( ! CppUT::makeMemFn1( this, ! &RegistryTest::runTest), ! testName ), testName ); } --- 85,91 ---- RegistryTest::makeTest( const std::string &testName ) { ! return CppUT::makeTestCase( CppTL::bind_memfn( this, ! &RegistryTest::runTest, ! testName ), testName ); } *************** *** 96,99 **** --- 93,110 ---- void + RegistryTest::runTestSuite( CppUT::TestSuitePtr suite ) + { + for ( int index =0; index < suite->testCount(); ++index ) + { + CppUT::TestPtr test = suite->testAt(index); + if ( test->isTestSuite() ) + runTestSuite( CppTL::staticPointerCast<CppUT::TestSuite>( test ) ); + else + CppTL::staticPointerCast<CppUT::AbstractTestCase>( test )->runTest(); + } + } + + + void RegistryTest::runTest( const std::string &testName ) { *************** *** 105,110 **** RegistryTest::makeTestFactory( const std::string &testName ) { ! return CppUT::bindR1( CppUT::makeMemFnR1<CppUT::TestPtr>( ! this, &RegistryTest::makeTest ), ! testName ); } --- 116,119 ---- RegistryTest::makeTestFactory( const std::string &testName ) { ! return CppTL::bind_memfnr( this, &RegistryTest::makeTest, testName ); } Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** main.cpp 27 Feb 2005 14:38:28 -0000 1.12 --- main.cpp 27 Feb 2005 15:27:09 -0000 1.13 *************** *** 5,9 **** #include "assertstringtest.h" #include "commandlineoptionstest.h" ! //#include "registrytest.h" #include "enumeratortest.h" //#include "testfixturetest.h" --- 5,9 ---- #include "assertstringtest.h" #include "commandlineoptionstest.h" ! #include "registrytest.h" #include "enumeratortest.h" //#include "testfixturetest.h" *************** *** 45,49 **** CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); ! // allSuite->add( RegistryTest::suite() ); // allSuite->add( TestFixtureTest::suite() ); allSuite->add( AssertStringTest::suite() ); --- 45,49 ---- CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); ! allSuite->add( RegistryTest::suite() ); // allSuite->add( TestFixtureTest::suite() ); allSuite->add( AssertStringTest::suite() ); Index: cpputtest.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/cpputtest.vcproj,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** cpputtest.vcproj 27 Feb 2005 14:38:28 -0000 1.12 --- cpputtest.vcproj 27 Feb 2005 15:27:09 -0000 1.13 *************** *** 193,204 **** RelativePath="registrytest.cpp"> <FileConfiguration ! Name="Release|Win32" ! ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> <FileConfiguration ! Name="Debug|Win32" ! ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> --- 193,202 ---- RelativePath="registrytest.cpp"> <FileConfiguration ! Name="Release|Win32"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> <FileConfiguration ! Name="Debug|Win32"> <Tool Name="VCCLCompilerTool"/> |