cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 27)
Brought to you by:
blep
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(94) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(114) |
Mar
(80) |
Apr
|
May
|
Jun
(36) |
Jul
(67) |
Aug
(37) |
Sep
(33) |
Oct
(28) |
Nov
(91) |
Dec
(16) |
2006 |
Jan
(1) |
Feb
(7) |
Mar
(45) |
Apr
|
May
|
Jun
(36) |
Jul
(7) |
Aug
|
Sep
(32) |
Oct
(3) |
Nov
|
Dec
|
2007 |
Jan
(29) |
Feb
(11) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(35) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(14) |
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(13) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(15) |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:31:46
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6062/src/opentest Modified Files: texttestdriver.cpp Log Message: * fixed propagation of test input. Index: texttestdriver.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/texttestdriver.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** texttestdriver.cpp 28 Feb 2005 22:11:57 -0000 1.1 --- texttestdriver.cpp 28 Feb 2005 22:31:37 -0000 1.2 *************** *** 135,142 **** unsigned int entryId = 0; for ( ; itTest != testsToRun_.end(); ++itTest ) plan.add( TestPlanEntryPtr( new TestDriverTestPlanEntry( ++entryId, *itTest, ! Properties() ) ) ); runner_.runTests( plan, *this, Properties() ); --- 135,145 ---- unsigned int entryId = 0; for ( ; itTest != testsToRun_.end(); ++itTest ) + { + const InternalTestInfo &testInfo = getTestInfo( *itTest ); plan.add( TestPlanEntryPtr( new TestDriverTestPlanEntry( ++entryId, *itTest, ! testInfo.info_ ) ) ); ! } runner_.runTests( plan, *this, Properties() ); |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:31:45
|
Update of /cvsroot/cppunit/cppunit2/examples/input_based_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6062/examples/input_based_test Modified Files: main.cpp Log Message: * fixed propagation of test input. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/examples/input_based_test/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.cpp 28 Feb 2005 20:48:56 -0000 1.1 --- main.cpp 28 Feb 2005 22:31:36 -0000 1.2 *************** *** 29,35 **** CppUT::TestPtr test1 = CppUT::makeTestCase( CppTL::cfn0( testMultiply ), "multiply 7*2" ); ! test1->info()["x"] = 7; ! test1->info()["x"] = 2; ! test1->info()["expected"] = 7*2+1; allSuite->add( test1 ); --- 29,35 ---- CppUT::TestPtr test1 = CppUT::makeTestCase( CppTL::cfn0( testMultiply ), "multiply 7*2" ); ! test1->info()["input"]["x"] = 7; ! test1->info()["input"]["y"] = 2; ! test1->info()["input"]["expected"] = 7*2+1; allSuite->add( test1 ); |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:14:12
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1237/src/cpput Modified Files: assert.cpp exceptionguard.cpp Log Message: * moved cpput/typehelper.h to cpptl/typename.h * renamed helper functions: getObjectTypeName(), getTypeName() and demangleTypeInfoName() * With mingw, typeinfo name is correctly extracted (skip initial digits) * added automatic detection of the presence of RTTI with msvc. Index: exceptionguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/exceptionguard.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** exceptionguard.cpp 27 Feb 2005 17:42:32 -0000 1.4 --- exceptionguard.cpp 28 Feb 2005 22:14:03 -0000 1.5 *************** *** 1,5 **** #include <cpput/exceptionguard.h> #include <cpput/testinfo.h> ! #include <cpput/typehelper.h> #include <cpptl/functor.h> --- 1,5 ---- #include <cpput/exceptionguard.h> #include <cpput/testinfo.h> ! #include <cpptl/typename.h> #include <cpptl/functor.h> *************** *** 57,76 **** // Already injected into result } ! #ifndef CPPTL_NO_RTTI ! catch ( const std::exception &e ) ! { ! addFault( extractObjectType( e, "std::exception" ), e.what() ); ! } ! #else // @todo Need to add catch for all standard derived classes. ! // Warning: => they don't always exist on all platforms. catch ( const std::runtime_error &e ) { ! addFault( extractObjectType( e, "std::runtime_error" ), e.what() ); } catch ( const std::exception &e ) { ! addFault( extractObjectType( e, "std::exception" ), e.what() ); } - #endif catch ( ... ) { --- 57,70 ---- // Already injected into result } ! // @todo Need to add catch for all standard derived classes. ! // Warning: => they don't always exist on all platforms. catch ( const std::runtime_error &e ) { ! addFault( CppTL::getObjectTypeName( e, "std::runtime_error" ), e.what() ); } catch ( const std::exception &e ) { ! addFault( CppTL::getObjectTypeName( e, "std::exception" ), e.what() ); } catch ( ... ) { Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** assert.cpp 27 Feb 2005 10:17:05 -0000 1.8 --- assert.cpp 28 Feb 2005 22:14:03 -0000 1.9 *************** *** 4,8 **** # include <cpput/thread.h> # include <cpput/translate.h> - # include <cpput/typehelper.h> --- 4,7 ---- |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:54
|
Update of /cvsroot/cppunit/cppunit2/examples/input_based_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753/examples/input_based_test Modified Files: SConscript Log Message: * moved texttestdriver.h class implementations into a .cpp Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/examples/input_based_test/SConscript,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SConscript 28 Feb 2005 20:48:56 -0000 1.1 --- SConscript 28 Feb 2005 22:11:54 -0000 1.2 *************** *** 1,6 **** # input_based_test build script ! Import( 'env' ) ! env = env.Copy( LIBPATH = '#libs', LIBS = ['cpput'] ) input_based_test_sources=""" --- 1,5 ---- # input_based_test build script ! Import( 'env_testing' ) input_based_test_sources=""" *************** *** 8,14 **** """.split() ! input_based_test_exe = env.Program( target='input_based_test', ! source=input_based_test_sources ) bin_dir='#bin' ! env.Install( bin_dir, input_based_test_exe ) --- 7,13 ---- """.split() ! input_based_test_exe = env_testing.Program( target='input_based_test', ! source=input_based_test_sources ) bin_dir='#bin' ! env_testing.Install( bin_dir, input_based_test_exe ) |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:54
|
Update of /cvsroot/cppunit/cppunit2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753/src Modified Files: cpput_lib.sln Log Message: * moved texttestdriver.h class implementations into a .cpp Index: cpput_lib.sln =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput_lib.sln,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cpput_lib.sln 17 Nov 2004 09:00:32 -0000 1.4 --- cpput_lib.sln 28 Feb 2005 22:11:55 -0000 1.5 *************** *** 9,12 **** --- 9,17 ---- EndProjectSection EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "input_based_test", "..\examples\input_based_test\input_based_test.vcproj", "{9EB5A164-9071-4E7E-90B3-094D35EA943C}" + ProjectSection(ProjectDependencies) = postProject + {199257EE-17B2-4BC2-A3F7-D379217A86A0} = {199257EE-17B2-4BC2-A3F7-D379217A86A0} + EndProjectSection + EndProject Global GlobalSection(SolutionConfiguration) = preSolution *************** *** 23,26 **** --- 28,35 ---- {F58E403C-FE39-43E5-B7FD-0478FCE3ACE4}.Release.ActiveCfg = Release|Win32 {F58E403C-FE39-43E5-B7FD-0478FCE3ACE4}.Release.Build.0 = Release|Win32 + {9EB5A164-9071-4E7E-90B3-094D35EA943C}.Debug.ActiveCfg = Debug|Win32 + {9EB5A164-9071-4E7E-90B3-094D35EA943C}.Debug.Build.0 = Debug|Win32 + {9EB5A164-9071-4E7E-90B3-094D35EA943C}.Release.ActiveCfg = Release|Win32 + {9EB5A164-9071-4E7E-90B3-094D35EA943C}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:54
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753 Modified Files: sconstruct Log Message: * moved texttestdriver.h class implementations into a .cpp Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sconstruct 26 Feb 2005 11:42:21 -0000 1.4 --- sconstruct 28 Feb 2005 22:11:53 -0000 1.5 *************** *** 34,39 **** tools=['default','mingw'] ) ! Export( 'env' ) SConscript( 'src/cpput/SConscript', build_dir='#buildscons/cpput', duplicate=0 ) SConscript( 'src/cpputtest/SConscript', build_dir='#buildscons/cpputtest', duplicate=0 ) --- 34,45 ---- tools=['default','mingw'] ) ! env_testing = env.Copy( LIBS = ['cpput','opentest'] ) ! ! Export( 'env env_testing' ) SConscript( 'src/cpput/SConscript', build_dir='#buildscons/cpput', duplicate=0 ) + SConscript( 'src/opentest/SConscript', build_dir='#buildscons/opentest', duplicate=0 ) SConscript( 'src/cpputtest/SConscript', build_dir='#buildscons/cpputtest', duplicate=0 ) + SConscript( 'examples/input_based_test/SConscript', build_dir='#buildscons/examples/input_based_test', duplicate=0 ) + SConscript( 'examples/parametrized_test/SConscript', build_dir='#buildscons/examples/parametrized_test', duplicate=0 ) + |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:54
|
Update of /cvsroot/cppunit/cppunit2/examples/parametrized_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753/examples/parametrized_test Modified Files: SConscript Log Message: * moved texttestdriver.h class implementations into a .cpp Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/examples/parametrized_test/SConscript,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SConscript 28 Feb 2005 20:31:30 -0000 1.1 --- SConscript 28 Feb 2005 22:11:54 -0000 1.2 *************** *** 1,6 **** # parametrized_test build script ! Import( 'env' ) ! env = env.Copy( LIBPATH = '#libs', LIBS = ['cpput'] ) parametrized_test_sources=""" --- 1,5 ---- # parametrized_test build script ! Import( 'env_testing' ) parametrized_test_sources=""" *************** *** 8,14 **** """.split() ! parametrized_test_exe = env.Program( target='parametrized_test', ! source=parametrized_test_sources ) bin_dir='#bin' ! env.Install( bin_dir, parametrized_test_exe ) --- 7,13 ---- """.split() ! parametrized_test_exe = env_testing.Program( target='parametrized_test', ! source=parametrized_test_sources ) bin_dir='#bin' ! env_testing.Install( bin_dir, parametrized_test_exe ) |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:54
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753/src/cpputtest Modified Files: SConscript Log Message: * moved texttestdriver.h class implementations into a .cpp Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/SConscript,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SConscript 27 Feb 2005 17:42:32 -0000 1.7 --- SConscript 28 Feb 2005 22:11:56 -0000 1.8 *************** *** 1,6 **** # cpputtest build script ! Import( 'env' ) ! env = env.Copy( LIBPATH = '#libs' ) cpputtest_sources=""" --- 1,5 ---- # cpputtest build script ! Import( 'env_testing' ) cpputtest_sources=""" *************** *** 18,27 **** """.split() - cpputtest_env = env.Copy(LIBS = ['cpput']) #cpputtest_env = env.Copy(LIBS = ['cpput-vc6-rd']) #cpputtest_env.Append( CCFLAGS = ' -DCPPUT_DLL' ) ! cpputtest_exe = cpputtest_env.Program( target='cpputtest', ! source=cpputtest_sources ) #cpputtest_env.Depends( cpputtest_exe, '#libs/cpput-vc6-rd.lib' ) --- 17,25 ---- """.split() #cpputtest_env = env.Copy(LIBS = ['cpput-vc6-rd']) #cpputtest_env.Append( CCFLAGS = ' -DCPPUT_DLL' ) ! cpputtest_exe = env_testing.Program( target='cpputtest', ! source=cpputtest_sources ) #cpputtest_env.Depends( cpputtest_exe, '#libs/cpput-vc6-rd.lib' ) *************** *** 31,33 **** bin_dir='#bin' ! env.Install( bin_dir, cpputtest_exe ) --- 29,31 ---- bin_dir='#bin' ! env_testing.Install( bin_dir, cpputtest_exe ) |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:54
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753/src/cpput Modified Files: cpput.vcproj Log Message: * moved texttestdriver.h class implementations into a .cpp Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** cpput.vcproj 27 Feb 2005 14:38:27 -0000 1.28 --- cpput.vcproj 28 Feb 2005 22:11:55 -0000 1.29 *************** *** 131,138 **** Filter=""> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File ! RelativePath=".\SConscript"> </File> <File --- 131,138 ---- Filter=""> <File ! RelativePath=".\SConscript"> </File> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File *************** *** 218,221 **** --- 218,224 ---- </File> <File + RelativePath="..\..\include\cpptl\typename.h"> + </File> + <File RelativePath="..\..\include\cpptl\typetraits.h"> </File> *************** *** 246,249 **** --- 249,255 ---- </File> <File + RelativePath="..\opentest\texttestdriver.cpp"> + </File> + <File RelativePath="..\..\include\opentest\texttestdriver.h"> </File> *************** *** 431,437 **** RelativePath="..\..\include\cpput\translate.h"> </File> - <File - RelativePath="..\..\include\cpput\typehelper.h"> - </File> </Files> <Globals> --- 437,440 ---- |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:51
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753/include/opentest Modified Files: texttestdriver.h Log Message: * moved texttestdriver.h class implementations into a .cpp Index: texttestdriver.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/texttestdriver.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** texttestdriver.h 28 Feb 2005 20:54:45 -0000 1.9 --- texttestdriver.h 28 Feb 2005 22:11:55 -0000 1.10 *************** *** 8,14 **** # include <deque> # include <map> - # include <iostream> // for progress # include <set> - # include <stack> namespace OpenTest { --- 8,12 ---- *************** *** 260,879 **** - - // Inline implementation of TextTestDriver - // ////////////////////////////////////////////////////////////////// - - TestPlanEntryPtrEnum - TestDriverTestPlan::entries() const - { - return CppTL::Enum::anyContainer( entries_ ); - - } - - - void - TestDriverTestPlan::add( const TestPlanEntryPtr &entry ) - { - entries_.push_back( entry ); - } - - - - // Inline implementation of TestResult - // ////////////////////////////////////////////////////////////////// - - inline - TestResult::TestResult( TestPlanEntryId id, - TestId test ) - : id_( id ) - , test_( test ) - { - } - - - inline TestPlanEntryId - TestResult::id() const - { - return id_; - } - - - inline TestId - TestResult::test() const - { - return test_; - } - - - inline const Properties & - TestResult::result() const - { - return result_; - } - - - inline Properties & - TestResult::result() - { - return result_; - } - - - - // Inline implementation of TestDriverTestPlanEntry - // ////////////////////////////////////////////////////////////////// - - inline - TestDriverTestPlanEntry::TestDriverTestPlanEntry( TestPlanEntryId id, - TestId test, - const Properties &configuration ) - : id_( id ) - , test_( test ) - , configuration_( configuration ) - { - } - - - TestPlanEntryId - TestDriverTestPlanEntry::id() const - { - return id_; - } - - - /// Test to run - TestId - TestDriverTestPlanEntry::test() const - { - return test_; - } - - - /// Used to pass configuration data to the test runner or the test itself - const Properties & - TestDriverTestPlanEntry::configuration() const - { - return configuration_; - } - - - - // Inline implementation of TextTestDriver - // ////////////////////////////////////////////////////////////////// - - inline - TextTestDriver::TextTestDriver( TestRunner &runner ) - : runner_( runner ) - , nextTestId_( 0 ) - { - runner_.declareTests( *this ); - std::cout << "Declared suites: " << suites_.size() << "\n" - << "Declared tests: " << tests_.size() << std::endl; - } - - - inline bool - TextTestDriver::run() - { - if ( testsToRun_.empty() ) - testsToRun_ = tests_; - - TestDriverTestPlan plan; - Tests::const_iterator itTest = testsToRun_.begin(); - unsigned int entryId = 0; - for ( ; itTest != testsToRun_.end(); ++itTest ) - plan.add( TestPlanEntryPtr( new TestDriverTestPlanEntry( - ++entryId, - *itTest, - Properties() ) ) ); - - runner_.runTests( plan, *this, Properties() ); - - outputFailures(); - - return failures_.empty(); - } - - - inline TestId - TextTestDriver::beginSuite( const CppTL::ConstString &name, - const Properties &data ) - { - TestId id = nextTestId(); - declareTestOrSuite( id, name, data ); - declaratorParentSuites_.push_back( id ); - suites_.insert( id ); - return id; - } - - - inline TestId - TextTestDriver::addTest( const CppTL::ConstString &name, - const Properties &data ) - { - TestId id = nextTestId(); - declareTestOrSuite( id, name, data ); - tests_.insert( id ); - return id; - } - - - inline void - TextTestDriver::endSuite() - { - declaratorParentSuites_.pop_back(); - } - - - void - TextTestDriver::declareTestOrSuite( TestId id, - const CppTL::ConstString &name, - const Properties &data ) - { - InternalTestInfo info( id, name, data, declaratorParentSuites_ ); - testInfos_.insert( TestInfos::value_type( id, info ) ); - if ( declaratorParentSuites_.size() > 0 ) - { - TestId parentId = declaratorParentSuites_.back(); - getTestInfo(parentId).children_.push_back( id ); - } - } - - - inline TestId - TextTestDriver::nextTestId() - { - return ++nextTestId_; - } - - - inline void - TextTestDriver::startTestRun() - { - results_.clear(); - successes_.clear(); - failures_.clear(); - } - - - inline void - TextTestDriver::startTest( const TestPlanEntry &testEntry ) - { - TestResult result( testEntry.id(), - testEntry.test() ); - // should add descriptive test data first - result.result().mergeReplacingExisting( testEntry.configuration() ); - results_.push_back( result ); - - const unsigned int maxParent = 1; - std::cout << "Testing '" << getTestPath( testEntry.test(), - maxParent ) << "' : "; - std::cout.flush(); - } - - - inline void - TextTestDriver::mergeInTestResult( const TestPlanEntry &testEntry, - const Properties &result ) - { - results_.back().result()["result"].asProperties().mergeReplacingExisting( result ); - } - - - inline void - TextTestDriver::mergeInTestResult( const TestPlanEntry &testEntry, - const PropertyPath &path, - const Value &value ) - { - results_.back().result()["result"][path] = value; - } - - - inline void - TextTestDriver::appendToTestResult( const TestPlanEntry &testEntry, - const PropertyPath &path, - const Value &value ) - { - results_.back().result()["result"][path].append( value ); - } - - - inline void - TextTestDriver::endTest( const TestPlanEntry &testEntry ) - { - const Properties &result = results_.back().result(); - PropertiesAccessor status = result.accessor()["result"]["status"]; - bool succeeded = status.getValue( "success", false ).asBool(); - CppTL::ConstString statusInfo = succeeded ? "OK" : "FAIL"; - if ( succeeded ) - successes_.push_back( results_.size() - 1 ); - else - failures_.push_back( results_.size() - 1 ); - - CppTL::ConstString resultType = status.getValue( "type", "" ).asString(); - if ( !resultType.empty() ) - statusInfo += " (" + resultType + ")"; - - std::cout << statusInfo << std::endl; - std::cout.flush(); - // std::cout << result.toString() << std::endl; - } - - - inline void - TextTestDriver::endTestRun() - { - } - - - inline bool - TextTestDriver::shouldStopTestRun() - { - return false; - } - - - inline const TextTestDriver::InternalTestInfo & - TextTestDriver::getTestInfo( TestId test ) const - { - TestInfos::const_iterator it = testInfos_.find( test ); - if ( it == testInfos_.end() ) - throw std::invalid_argument( "TextTestDriver::getTestInfo() : bad TestId." ); - return it->second; - } - - - inline TextTestDriver::InternalTestInfo & - TextTestDriver::getTestInfo( TestId test ) - { - TestInfos::iterator it = testInfos_.find( test ); - if ( it == testInfos_.end() ) - throw std::invalid_argument( "TextTestDriver::getTestInfo() : bad TestId." ); - return it->second; - } - - - inline void - TextTestDriver::outputFailures() - { - if ( failures_.empty() ) - { - std::cout << "All " << testsToRun_.size() << " tests passed..." - << std::endl; - return; - } - - TestResultIndexes::const_iterator failuresIt = failures_.begin(); - for ( ; failuresIt != failures_.end(); ++failuresIt ) - { - // @todo update to new result properties structure - const TestResult &testResult = results_.at( *failuresIt ); - PropertiesAccessor info = testResult.result().accessor(); - Properties::ValueEnum enumFaults = info["result/faults"].listValues(); - while ( enumFaults.hasNext() ) - { - // @todo check is properties => schema check ? - Value fault = enumFaults.next(); - reportFailure( testResult, fault.asProperties(), false ); - } - Properties::ValueEnum enumAssertions = info["result/assertions"].listValues(); - while ( enumAssertions.hasNext() ) - { - // @todo check is properties => schema check ? - Value assertion = enumAssertions.next(); - reportFailure( testResult, assertion.asProperties(), true ); - } - /* - PropertiesAccessor locationInfo = info["result"]["status"]["location"]; - if ( locationInfo.isValid() ) - { - std::cout << locationInfo.getValue("file").asString() << "(" - << locationInfo.getValue("line").asInt() << ") : "; - } - else - { - std::cout << "Unknown failure location : "; - } - - std::cout << getTestPath( testResult.test() ) << std::endl; - - CppTL::ConstString failureType = info["result"]["status"].getValue("type","").asString(); - if ( !failureType.empty() ) - std::cout << "Failure type : " << failureType << std::endl; - - CppTL::ConstString message = info["result"]["status"].getValue("message","").asString(); - if ( !message.empty() ) - std::cout << message << std::endl; - */ - - std::cout << "Failures: " << failures_.size() << ", "; - std::cout << "Tested: " << testsToRun_.size() << std::endl; - } - } - - - inline void - TextTestDriver::reportFailure( const TestResult &testResult, - const Properties &failure, - bool isAssertion ) - { - if ( failure.has( "location") ) - { - if ( failure.has("location/file") ) - { - std::cout << failure["location/file"].asString() << "(" - << failure["location/line"].asInt() << ") "; - } - if ( failure.has("location/function") ) - std::cout << "{" << failure["location/function"].asString() << "} "; - std::cout << " : "; - } - - std::cout << getTestPath( testResult.test() ) << std::endl; - - CppTL::ConstString failureType = failure.getValue( "failure_type", - isAssertion ? "assertion" - : "fault" ).asString(); - std::cout << "Failure type : " << failureType << std::endl; - Properties::ValueEnum enumMessages = failure.accessor()["messages"].listValues(); - if ( enumMessages.hasNext() ) - std::cout << "Messages:\n"; - while ( enumMessages.hasNext() ) - { // @todo check type - CppTL::ConstString message = enumMessages.next().asString(); - std::cout << message << std::endl; - } - - Properties::ValueEnum enumLogs = failure.accessor()["logs"].listValues(); - if ( enumLogs.hasNext() ) - std::cout << "Log:\n"; - while ( enumLogs.hasNext() ) - { // @todo check type - CppTL::ConstString log = enumLogs.next().asString(); - std::cout << log << std::endl; - } - - std::cout << "Failure tree:" << failure.toString() << std::endl; - } - - inline CppTL::ConstString - TextTestDriver::getTestPath( TestId test, unsigned int maxParent ) const - { - CppTL::ConstString path; - const InternalTestInfo &info = getTestInfo( test ); - path = "/" + info.name_; - if ( info.parents_.empty() ) - return path; - - bool isPartialPath = maxParent < info.parents_.size(); - - for ( unsigned int index = info.parents_.size()-1; - index != -1 && maxParent-- >0; - --index ) - { - const InternalTestInfo &parentInfo = getTestInfo( info.parents_[index] ); - path = "/" + parentInfo.name_ + path; - } - - if ( isPartialPath ) - path = ".." + path; - return path; - } - - // Implementation of TestInfoExplorer - // ////////////////////////////////////////////////////////////////// - - namespace Impl { - - struct IsTestSuiteOrTestCaseFilter - { - IsTestSuiteOrTestCaseFilter( bool keepSuite ) - : keepSuite_( keepSuite ) - { - } - - bool operator()( const TestInfo &info ) const - { - return info.isTestSuite() == keepSuite_; - } - - bool keepSuite_; - }; - - struct TestId2TestInfoAdapator - { - typedef TestInfo result_type; - TestId2TestInfoAdapator( const TestInfoHolder &holder ) - : holder_( holder ) - { - } - - TestInfo operator()( TestId id ) const - { - return TestInfo( holder_, id ); - } - - const TestInfoHolder &holder_; - }; - - } // namespace Impl - - - inline TestInfoEnumerator - TextTestDriver::getAllTestCases() const - { - return CppTL::Enum::anyTransform( CppTL::Enum::container( tests_, CppTL::Type<TestId>() ), - Impl::TestId2TestInfoAdapator( *this ) ); - } - - - inline TestInfoEnumerator - TextTestDriver::getAllTestSuites() const - { - return CppTL::Enum::anyTransform( CppTL::Enum::container( suites_, CppTL::Type<TestId>() ), - Impl::TestId2TestInfoAdapator( *this ) ); - } - - - inline TestInfo - TextTestDriver::getRootTestSuite() const - { - TestId id; - if ( !tests_.empty() ) - id = *(tests_.begin()); - else if ( !suites_.empty() ) - id = *(suites_.begin()); - else - throw std::logic_error( "TextTestDriver::getRootTestSuite(): no suite defined." ); - - while ( !getTestInfo(id).parents_.empty() ) - id = *(getTestInfo(id).parents_.begin()); - return TestInfo( *this, id ); - } - - - - // Implementation of TestInfoHolder - // ////////////////////////////////////////////////////////////////// - - inline const String & - TextTestDriver::getTestName( TestId id ) const - { - return getTestInfo(id).name_; - } - - - inline PropertiesAccessor - TextTestDriver::getTestDescription( TestId id ) const - { - return getTestInfo(id).info_.accessor()["description"]; - } - - - inline PropertiesAccessor - TextTestDriver::getTestInput( TestId id ) const - { - return getTestInfo(id).info_.accessor()["input"]; - } - - - inline bool - TextTestDriver::isTestSuite( TestId id ) const - { - return suites_.count(id) > 0; - } - - - inline TestInfoEnumerator - TextTestDriver::getTestChildren( TestId id ) const - { - return CppTL::Enum::anyTransform( CppTL::Enum::container( getTestInfo(id).children_ ), - Impl::TestId2TestInfoAdapator( *this ) ); - } - - - inline TestInfoEnumerator - TextTestDriver::getTestParents( TestId id ) const - { - return CppTL::Enum::anyTransform( CppTL::Enum::container( getTestInfo(id).parents_ ), - Impl::TestId2TestInfoAdapator( *this ) ); - } - - - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - // class TestInfo - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - - inline - TestInfo::TestInfo( const TestInfoHolder &holder, - TestId id ) - : id_( id ) - , holder_( holder ) - { - } - - inline const String & - TestInfo::getName() const - { - return holder_.getTestName( id_ ); - } - - inline PropertiesAccessor - TestInfo::getDescription() const - { - return holder_.getTestDescription( id_ ); - } - - inline bool - TestInfo::isTestSuite() const - { - return holder_.isTestSuite( id_ ); - } - - inline bool - TestInfo::isTestCase() const - { - return !isTestSuite(); - } - - - inline TestInfoEnumerator - TestInfo::getParents() const - { - return holder_.getTestParents( id_ ); - } - - - inline PropertiesAccessor - TestInfo::getInput() const - { - return holder_.getTestInput( id_ ); - } - - inline TestInfoEnumerator - TestInfo::getChildren() const - { - return holder_.getTestChildren( id_ ); - } - - inline TestInfoEnumerator - TestInfo::getChildTestSuites() const - { - return CppTL::Enum::anyFilter( getChildren(), - Impl::IsTestSuiteOrTestCaseFilter(true) ); - } - - inline TestInfoEnumerator - TestInfo::getChildTestCases() const - { - return CppTL::Enum::anyFilter( getChildren(), - Impl::IsTestSuiteOrTestCaseFilter(false) ); - } - } // namespace OpenTest - #endif // OPENTEST_TEXTTESTDRIVER_H_INCLUDED --- 258,263 ---- |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:12:14
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32753/src/opentest Added Files: SConscript texttestdriver.cpp Log Message: * moved texttestdriver.h class implementations into a .cpp --- NEW FILE: SConscript --- Import( 'env' ) env = env.Copy( LIBPATH = '#libs' ) opentest_sources=""" texttestdriver.cpp """.split() static_lib = env.StaticLibrary( target='opentest', source=opentest_sources ) #shared_lib = env.SharedLibrary( target='cpput', # source=cpput_sources ) libs_dir='#libs' bin_dir='#bin' env.Install( libs_dir, static_lib ) --- NEW FILE: texttestdriver.cpp --- #include <opentest/texttestdriver.h> #include <iostream> // for progress namespace OpenTest { // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class TestDriverTestPlan // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// TestPlanEntryPtrEnum TestDriverTestPlan::entries() const { return CppTL::Enum::anyContainer( entries_ ); } void TestDriverTestPlan::add( const TestPlanEntryPtr &entry ) { entries_.push_back( entry ); } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class TestResult // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// TestResult::TestResult( TestPlanEntryId id, TestId test ) : id_( id ) , test_( test ) { } TestPlanEntryId TestResult::id() const { return id_; } TestId TestResult::test() const { return test_; } const Properties & TestResult::result() const { return result_; } Properties & TestResult::result() { return result_; } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class TestDriverTestPlanEntry // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// TestDriverTestPlanEntry::TestDriverTestPlanEntry( TestPlanEntryId id, TestId test, const Properties &configuration ) : id_( id ) , test_( test ) , configuration_( configuration ) { } TestPlanEntryId TestDriverTestPlanEntry::id() const { return id_; } /// Test to run TestId TestDriverTestPlanEntry::test() const { return test_; } /// Used to pass configuration data to the test runner or the test itself const Properties & TestDriverTestPlanEntry::configuration() const { return configuration_; } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class TextTestDriver // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// TextTestDriver::TextTestDriver( TestRunner &runner ) : runner_( runner ) , nextTestId_( 0 ) { runner_.declareTests( *this ); std::cout << "Declared suites: " << suites_.size() << "\n" << "Declared tests: " << tests_.size() << std::endl; } bool TextTestDriver::run() { if ( testsToRun_.empty() ) testsToRun_ = tests_; TestDriverTestPlan plan; Tests::const_iterator itTest = testsToRun_.begin(); unsigned int entryId = 0; for ( ; itTest != testsToRun_.end(); ++itTest ) plan.add( TestPlanEntryPtr( new TestDriverTestPlanEntry( ++entryId, *itTest, Properties() ) ) ); runner_.runTests( plan, *this, Properties() ); outputFailures(); return failures_.empty(); } TestId TextTestDriver::beginSuite( const CppTL::ConstString &name, const Properties &data ) { TestId id = nextTestId(); declareTestOrSuite( id, name, data ); declaratorParentSuites_.push_back( id ); suites_.insert( id ); return id; } TestId TextTestDriver::addTest( const CppTL::ConstString &name, const Properties &data ) { TestId id = nextTestId(); declareTestOrSuite( id, name, data ); tests_.insert( id ); return id; } void TextTestDriver::endSuite() { declaratorParentSuites_.pop_back(); } void TextTestDriver::declareTestOrSuite( TestId id, const CppTL::ConstString &name, const Properties &data ) { InternalTestInfo info( id, name, data, declaratorParentSuites_ ); testInfos_.insert( TestInfos::value_type( id, info ) ); if ( declaratorParentSuites_.size() > 0 ) { TestId parentId = declaratorParentSuites_.back(); getTestInfo(parentId).children_.push_back( id ); } } TestId TextTestDriver::nextTestId() { return ++nextTestId_; } void TextTestDriver::startTestRun() { results_.clear(); successes_.clear(); failures_.clear(); } void TextTestDriver::startTest( const TestPlanEntry &testEntry ) { TestResult result( testEntry.id(), testEntry.test() ); // should add descriptive test data first result.result().mergeReplacingExisting( testEntry.configuration() ); results_.push_back( result ); const unsigned int maxParent = 1; std::cout << "Testing '" << getTestPath( testEntry.test(), maxParent ) << "' : "; std::cout.flush(); } void TextTestDriver::mergeInTestResult( const TestPlanEntry &testEntry, const Properties &result ) { results_.back().result()["result"].asProperties().mergeReplacingExisting( result ); } void TextTestDriver::mergeInTestResult( const TestPlanEntry &testEntry, const PropertyPath &path, const Value &value ) { results_.back().result()["result"][path] = value; } void TextTestDriver::appendToTestResult( const TestPlanEntry &testEntry, const PropertyPath &path, const Value &value ) { results_.back().result()["result"][path].append( value ); } void TextTestDriver::endTest( const TestPlanEntry &testEntry ) { const Properties &result = results_.back().result(); PropertiesAccessor status = result.accessor()["result"]["status"]; bool succeeded = status.getValue( "success", false ).asBool(); CppTL::ConstString statusInfo = succeeded ? "OK" : "FAIL"; if ( succeeded ) successes_.push_back( results_.size() - 1 ); else failures_.push_back( results_.size() - 1 ); CppTL::ConstString resultType = status.getValue( "type", "" ).asString(); if ( !resultType.empty() ) statusInfo += " (" + resultType + ")"; std::cout << statusInfo << std::endl; std::cout.flush(); // std::cout << result.toString() << std::endl; } void TextTestDriver::endTestRun() { } bool TextTestDriver::shouldStopTestRun() { return false; } const TextTestDriver::InternalTestInfo & TextTestDriver::getTestInfo( TestId test ) const { TestInfos::const_iterator it = testInfos_.find( test ); if ( it == testInfos_.end() ) throw std::invalid_argument( "TextTestDriver::getTestInfo() : bad TestId." ); return it->second; } TextTestDriver::InternalTestInfo & TextTestDriver::getTestInfo( TestId test ) { TestInfos::iterator it = testInfos_.find( test ); if ( it == testInfos_.end() ) throw std::invalid_argument( "TextTestDriver::getTestInfo() : bad TestId." ); return it->second; } void TextTestDriver::outputFailures() { if ( failures_.empty() ) { std::cout << "All " << testsToRun_.size() << " tests passed..." << std::endl; return; } TestResultIndexes::const_iterator failuresIt = failures_.begin(); for ( ; failuresIt != failures_.end(); ++failuresIt ) { // @todo update to new result properties structure const TestResult &testResult = results_.at( *failuresIt ); PropertiesAccessor info = testResult.result().accessor(); Properties::ValueEnum enumFaults = info["result/faults"].listValues(); while ( enumFaults.hasNext() ) { // @todo check is properties => schema check ? Value fault = enumFaults.next(); reportFailure( testResult, fault.asProperties(), false ); } Properties::ValueEnum enumAssertions = info["result/assertions"].listValues(); while ( enumAssertions.hasNext() ) { // @todo check is properties => schema check ? Value assertion = enumAssertions.next(); reportFailure( testResult, assertion.asProperties(), true ); } /* PropertiesAccessor locationInfo = info["result"]["status"]["location"]; if ( locationInfo.isValid() ) { std::cout << locationInfo.getValue("file").asString() << "(" << locationInfo.getValue("line").asInt() << ") : "; } else { std::cout << "Unknown failure location : "; } std::cout << getTestPath( testResult.test() ) << std::endl; CppTL::ConstString failureType = info["result"]["status"].getValue("type","").asString(); if ( !failureType.empty() ) std::cout << "Failure type : " << failureType << std::endl; CppTL::ConstString message = info["result"]["status"].getValue("message","").asString(); if ( !message.empty() ) std::cout << message << std::endl; */ std::cout << "Failures: " << failures_.size() << ", "; std::cout << "Tested: " << testsToRun_.size() << std::endl; } } void TextTestDriver::reportFailure( const TestResult &testResult, const Properties &failure, bool isAssertion ) { if ( failure.has( "location") ) { if ( failure.has("location/file") ) { std::cout << failure["location/file"].asString() << "(" << failure["location/line"].asInt() << ") "; } if ( failure.has("location/function") ) std::cout << "{" << failure["location/function"].asString() << "} "; std::cout << " : "; } std::cout << getTestPath( testResult.test() ) << std::endl; CppTL::ConstString failureType = failure.getValue( "failure_type", isAssertion ? "assertion" : "fault" ).asString(); std::cout << "Failure type : " << failureType << std::endl; Properties::ValueEnum enumMessages = failure.accessor()["messages"].listValues(); if ( enumMessages.hasNext() ) std::cout << "Messages:\n"; while ( enumMessages.hasNext() ) { // @todo check type CppTL::ConstString message = enumMessages.next().asString(); std::cout << message << std::endl; } Properties::ValueEnum enumLogs = failure.accessor()["logs"].listValues(); if ( enumLogs.hasNext() ) std::cout << "Log:\n"; while ( enumLogs.hasNext() ) { // @todo check type CppTL::ConstString log = enumLogs.next().asString(); std::cout << log << std::endl; } std::cout << "Failure tree:" << failure.toString() << std::endl; } CppTL::ConstString TextTestDriver::getTestPath( TestId test, unsigned int maxParent ) const { CppTL::ConstString path; const InternalTestInfo &info = getTestInfo( test ); path = "/" + info.name_; if ( info.parents_.empty() ) return path; bool isPartialPath = maxParent < info.parents_.size(); for ( unsigned int index = info.parents_.size()-1; index != -1 && maxParent-- >0; --index ) { const InternalTestInfo &parentInfo = getTestInfo( info.parents_[index] ); path = "/" + parentInfo.name_ + path; } if ( isPartialPath ) path = ".." + path; return path; } // Implementation of TestInfoExplorer // ////////////////////////////////////////////////////////////////// namespace Impl { struct IsTestSuiteOrTestCaseFilter { IsTestSuiteOrTestCaseFilter( bool keepSuite ) : keepSuite_( keepSuite ) { } bool operator()( const TestInfo &info ) const { return info.isTestSuite() == keepSuite_; } bool keepSuite_; }; struct TestId2TestInfoAdapator { typedef TestInfo result_type; TestId2TestInfoAdapator( const TestInfoHolder &holder ) : holder_( holder ) { } TestInfo operator()( TestId id ) const { return TestInfo( holder_, id ); } const TestInfoHolder &holder_; }; } // namespace Impl TestInfoEnumerator TextTestDriver::getAllTestCases() const { return CppTL::Enum::anyTransform( CppTL::Enum::container( tests_, CppTL::Type<TestId>() ), Impl::TestId2TestInfoAdapator( *this ) ); } TestInfoEnumerator TextTestDriver::getAllTestSuites() const { return CppTL::Enum::anyTransform( CppTL::Enum::container( suites_, CppTL::Type<TestId>() ), Impl::TestId2TestInfoAdapator( *this ) ); } TestInfo TextTestDriver::getRootTestSuite() const { TestId id; if ( !tests_.empty() ) id = *(tests_.begin()); else if ( !suites_.empty() ) id = *(suites_.begin()); else throw std::logic_error( "TextTestDriver::getRootTestSuite(): no suite defined." ); while ( !getTestInfo(id).parents_.empty() ) id = *(getTestInfo(id).parents_.begin()); return TestInfo( *this, id ); } // Implementation of TestInfoHolder // ////////////////////////////////////////////////////////////////// const String & TextTestDriver::getTestName( TestId id ) const { return getTestInfo(id).name_; } PropertiesAccessor TextTestDriver::getTestDescription( TestId id ) const { return getTestInfo(id).info_.accessor()["description"]; } PropertiesAccessor TextTestDriver::getTestInput( TestId id ) const { return getTestInfo(id).info_.accessor()["input"]; } bool TextTestDriver::isTestSuite( TestId id ) const { return suites_.count(id) > 0; } TestInfoEnumerator TextTestDriver::getTestChildren( TestId id ) const { return CppTL::Enum::anyTransform( CppTL::Enum::container( getTestInfo(id).children_ ), Impl::TestId2TestInfoAdapator( *this ) ); } TestInfoEnumerator TextTestDriver::getTestParents( TestId id ) const { return CppTL::Enum::anyTransform( CppTL::Enum::container( getTestInfo(id).parents_ ), Impl::TestId2TestInfoAdapator( *this ) ); } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class TestInfo // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// TestInfo::TestInfo( const TestInfoHolder &holder, TestId id ) : id_( id ) , holder_( holder ) { } const String & TestInfo::getName() const { return holder_.getTestName( id_ ); } PropertiesAccessor TestInfo::getDescription() const { return holder_.getTestDescription( id_ ); } bool TestInfo::isTestSuite() const { return holder_.isTestSuite( id_ ); } bool TestInfo::isTestCase() const { return !isTestSuite(); } TestInfoEnumerator TestInfo::getParents() const { return holder_.getTestParents( id_ ); } PropertiesAccessor TestInfo::getInput() const { return holder_.getTestInput( id_ ); } TestInfoEnumerator TestInfo::getChildren() const { return holder_.getTestChildren( id_ ); } TestInfoEnumerator TestInfo::getChildTestSuites() const { return CppTL::Enum::anyFilter( getChildren(), Impl::IsTestSuiteOrTestCaseFilter(true) ); } TestInfoEnumerator TestInfo::getChildTestCases() const { return CppTL::Enum::anyFilter( getChildren(), Impl::IsTestSuiteOrTestCaseFilter(false) ); } } // namespace OpenTest |
From: Baptiste L. <bl...@us...> - 2005-02-28 22:10:15
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31325/opentest Log Message: Directory /cvsroot/cppunit/cppunit2/src/opentest added to the repository |
From: Baptiste L. <bl...@us...> - 2005-02-28 21:36:33
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19549/cpptl Modified Files: config.h Added Files: typename.h Log Message: * moved cpput/typehelper.h to cpptl/typename.h * renamed helper functions: getObjectTypeName(), getTypeName() and demangleTypeInfoName() * With mingw, typeinfo name is correctly extracted (skip initial digits) * added automatic detection of the presence of RTTI with msvc. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** config.h 27 Feb 2005 09:56:18 -0000 1.8 --- config.h 28 Feb 2005 21:36:19 -0000 1.9 *************** *** 39,42 **** --- 39,47 ---- # pragma warning( disable : 4180 ) // qualifier applied to function type has no meaning # endif + + # ifndef _CPPRTTI // RTTI is not enabled + # define CPPTL_NO_RTTI + # endif + # endif --- NEW FILE: typename.h --- #ifndef CPPTL_TYPENAME_H_INCLUDED # define CPPTL_TYPENAME_H_INCLUDED # include <cpptl/forwards.h> # include <cpptl/conststring.h> # ifndef CPPTL_NO_RTTI # include <cpptl/stringtools.h> # include <typeinfo> # endif namespace CppTL { # ifndef CPPTL_NO_RTTI inline CppTL::ConstString CPPUT_API demangleTypeInfoName( const std::type_info &type ) { CppTL::ConstString typeName( type.name() ); const int classKeywordLength = 6; size_type startIndex = 0; if ( typeName.substr( 0, classKeywordLength ) == "class " ) startIndex = classKeywordLength; while ( startIndex < typeName.length() && isDigit( typeName[startIndex] ) ) ++startIndex; return typeName.substr(startIndex); } #endif template<class AType> CppTL::ConstString getTypeName( CppTL::Type<AType>, const char *hint ) { # ifndef CPPTL_NO_RTTI return demangleTypeInfoName( typeid( AType ) ); # else return hint; # endif } template<typename Object> CppTL::ConstString getObjectTypeName( const Object &object, const char *hint ) { # ifndef CPPTL_NO_RTTI return demangleTypeInfoName( typeid(object) ); # else return hint; # endif } } // namespace CppUT #endif // CPPTL_TYPENAME_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-02-28 21:36:32
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19549/cpput Modified Files: assert.h testfixture.h Removed Files: typehelper.h Log Message: * moved cpput/typehelper.h to cpptl/typename.h * renamed helper functions: getObjectTypeName(), getTypeName() and demangleTypeInfoName() * With mingw, typeinfo name is correctly extracted (skip initial digits) * added automatic detection of the presence of RTTI with msvc. Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** assert.h 27 Feb 2005 10:15:41 -0000 1.7 --- assert.h 28 Feb 2005 21:36:19 -0000 1.8 *************** *** 7,11 **** # include <cpput/testinfo.h> # include <cpput/translate.h> ! # include <cpput/typehelper.h> namespace CppUT --- 7,11 ---- # include <cpput/testinfo.h> # include <cpput/translate.h> ! # include <cpptl/typename.h> namespace CppUT *************** *** 170,174 **** ::CppUT::Message message( "Unexpected exception caught" ); \ message.add( "Type: " + \ ! ::CppUT::extractObjectType( e, "std::exception" ) ); \ message.add( CppTL::ConstString("What: ") + e.what() ); \ ::CppUT::fail( message ); \ --- 170,174 ---- ::CppUT::Message message( "Unexpected exception caught" ); \ message.add( "Type: " + \ ! ::CppTL::getObjectTypeName( e, "std::exception" ) ); \ message.add( CppTL::ConstString("What: ") + e.what() ); \ ::CppUT::fail( message ); \ *************** *** 177,190 **** } - # define CPPUT_EXPRESSION_WRAPPER( expression, variable ) \ - class Wrapper : public ::CppUT::ExpressionWrapper \ - { \ - public: /* overridden from ExpressionWrapper */ \ - void run() const \ - { \ - expression; \ - } \ - } variable - // Notes: implementing that assertion checking is a bit tricky since all the state // about the current test/assertions is stored in a "static" and --- 177,180 ---- Index: testfixture.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfixture.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testfixture.h 27 Feb 2005 14:38:26 -0000 1.7 --- testfixture.h 28 Feb 2005 21:36:19 -0000 1.8 *************** *** 6,10 **** # include <cpput/testsuite.h> # include <cpput/translate.h> ! # include <cpput/typehelper.h> --- 6,10 ---- # include <cpput/testsuite.h> # include <cpput/translate.h> ! # include <cpptl/typename.h> *************** *** 120,124 **** static CppTL::ConstString defaultSuiteName() { ! return ::CppUT::extractType<CppUT_ThisType>( #FixtureType ); } --- 120,124 ---- static CppTL::ConstString defaultSuiteName() { ! return ::CppTL::getTypeName<CppUT_ThisType>( #FixtureType ); } *************** *** 157,161 **** # if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ ! ::CppUT::extractType( ::CppTL::Type<FixtureType>(), #FixtureType ) # else // if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ --- 157,161 ---- # if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ ! ::CppTL::getTypeName( ::CppTL::Type<FixtureType>(), #FixtureType ) # else // if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ --- typehelper.h DELETED --- |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:54:55
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6393/opentest Modified Files: texttestdriver.h Log Message: * added TestInfoExplorer interface to inspect declared tests. Index: texttestdriver.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/texttestdriver.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** texttestdriver.h 27 Feb 2005 10:15:57 -0000 1.8 --- texttestdriver.h 28 Feb 2005 20:54:45 -0000 1.9 *************** *** 5,8 **** --- 5,9 ---- # include <opentest/testplan.h> # include <opentest/testrunner.h> + # include <cpptl/enumerator.h> # include <deque> # include <map> *************** *** 68,75 **** --- 69,142 ---- }; + class TestInfo; + class TestCaseInfo; + class TestSuiteInfo; + + typedef CppTL::AnyEnumerator<TestInfo> TestInfoEnumerator; + + class TestInfoHolder + { + public: + virtual ~TestInfoHolder() + { + } + + virtual const String &getTestName( TestId id ) const = 0; + virtual PropertiesAccessor getTestDescription( TestId id ) const = 0; + virtual PropertiesAccessor getTestInput( TestId id ) const = 0; + virtual bool isTestSuite( TestId id ) const = 0; + virtual TestInfoEnumerator getTestChildren( TestId id ) const = 0; + virtual TestInfoEnumerator getTestParents( TestId id ) const = 0; + }; + + + class OPENTEST_API TestInfo + { + public: + TestInfo( const TestInfoHolder &holder, + TestId id ); + + virtual ~TestInfo() + { + } + + const String &getName() const; + PropertiesAccessor getDescription() const; + bool isTestSuite() const; + bool isTestCase() const; + TestInfoEnumerator getParents() const; + + // test case specifics + PropertiesAccessor getInput() const; + + // test suite specifics + TestInfoEnumerator getChildren() const; + TestInfoEnumerator getChildTestSuites() const; + TestInfoEnumerator getChildTestCases() const; + + protected: + const TestInfoHolder &holder_; + TestId id_; + }; + + + class OPENTEST_API TestInfoExplorer + { + public: + virtual ~TestInfoExplorer() + { + } + + virtual TestInfoEnumerator getAllTestCases() const = 0; + virtual TestInfoEnumerator getAllTestSuites() const = 0; + virtual TestInfo getRootTestSuite() const = 0; + }; + class OPENTEST_API TextTestDriver : private TestRunTracker , private TestDeclarator + , private TestInfoHolder + , public TestInfoExplorer { public: *************** *** 80,84 **** bool run(); ! private: // overriden from TestDeclarator TestId beginSuite( const CppTL::ConstString &name, const Properties &data ); --- 147,156 ---- bool run(); ! public: // overridden from TestInfoExplorer ! TestInfoEnumerator getAllTestCases() const; ! TestInfoEnumerator getAllTestSuites() const; ! TestInfo getRootTestSuite() const; ! ! private: // overridden from TestDeclarator TestId beginSuite( const CppTL::ConstString &name, const Properties &data ); *************** *** 115,118 **** --- 187,198 ---- void releaseResources( const ResourceList &resources ) {} + private: // overridden from TestInfoHolder + const String &getTestName( TestId id ) const; + PropertiesAccessor getTestDescription( TestId id ) const; + PropertiesAccessor getTestInput( TestId id ) const; + bool isTestSuite( TestId id ) const; + TestInfoEnumerator getTestChildren( TestId id ) const; + TestInfoEnumerator getTestParents( TestId id ) const; + public: typedef std::deque<TestId> ParentSuites; *************** *** 120,126 **** private: ! struct TestInfo { ! TestInfo( TestId id, const CppTL::ConstString &name, const Properties &info, --- 200,206 ---- private: ! struct InternalTestInfo { ! InternalTestInfo( TestId id, const CppTL::ConstString &name, const Properties &info, *************** *** 137,147 **** Properties info_; ParentSuites parents_; }; typedef std::set<TestId> Tests; - typedef std::map<TestId,TestId> Hierarchy; // suite <-> tests typedef std::deque<TestResult> Results; typedef std::vector<unsigned int> TestResultIndexes; ! typedef std::map<TestId,TestInfo> TestInfos; TestId nextTestId(); --- 217,227 ---- Properties info_; ParentSuites parents_; + ParentSuites children_; }; typedef std::set<TestId> Tests; typedef std::deque<TestResult> Results; typedef std::vector<unsigned int> TestResultIndexes; ! typedef std::map<TestId,InternalTestInfo> TestInfos; TestId nextTestId(); *************** *** 149,153 **** void outputFailures(); ! const TestInfo &getTestInfo( TestId id ) const; void declareTestOrSuite( TestId id, --- 229,234 ---- void outputFailures(); ! const InternalTestInfo &getTestInfo( TestId id ) const; ! InternalTestInfo &getTestInfo( TestId id ); void declareTestOrSuite( TestId id, *************** *** 168,173 **** /// TestId of all suites. Tests suites_; - /// Parent/Child association to describe the hierarchy - Hierarchy hierarchy_; /// Stack of parent suite for 'current' declared test. ParentSuites declaratorParentSuites_; --- 249,252 ---- *************** *** 352,359 **** const Properties &data ) { ! TestInfo info( id, name, data, declaratorParentSuites_ ); testInfos_.insert( TestInfos::value_type( id, info ) ); if ( declaratorParentSuites_.size() > 0 ) ! hierarchy_.insert( Hierarchy::value_type( declaratorParentSuites_.back(), id ) ); } --- 431,441 ---- const Properties &data ) { ! InternalTestInfo info( id, name, data, declaratorParentSuites_ ); testInfos_.insert( TestInfos::value_type( id, info ) ); if ( declaratorParentSuites_.size() > 0 ) ! { ! TestId parentId = declaratorParentSuites_.back(); ! getTestInfo(parentId).children_.push_back( id ); ! } } *************** *** 452,456 **** ! inline const TextTestDriver::TestInfo & TextTestDriver::getTestInfo( TestId test ) const { --- 534,538 ---- ! inline const TextTestDriver::InternalTestInfo & TextTestDriver::getTestInfo( TestId test ) const { *************** *** 462,465 **** --- 544,557 ---- + inline TextTestDriver::InternalTestInfo & + TextTestDriver::getTestInfo( TestId test ) + { + TestInfos::iterator it = testInfos_.find( test ); + if ( it == testInfos_.end() ) + throw std::invalid_argument( "TextTestDriver::getTestInfo() : bad TestId." ); + return it->second; + } + + inline void TextTestDriver::outputFailures() *************** *** 569,573 **** { CppTL::ConstString path; ! const TestInfo &info = getTestInfo( test ); path = "/" + info.name_; if ( info.parents_.empty() ) --- 661,665 ---- { CppTL::ConstString path; ! const InternalTestInfo &info = getTestInfo( test ); path = "/" + info.name_; if ( info.parents_.empty() ) *************** *** 580,584 **** --index ) { ! const TestInfo &parentInfo = getTestInfo( info.parents_[index] ); path = "/" + parentInfo.name_ + path; } --- 672,676 ---- --index ) { ! const InternalTestInfo &parentInfo = getTestInfo( info.parents_[index] ); path = "/" + parentInfo.name_ + path; } *************** *** 589,592 **** --- 681,876 ---- } + // Implementation of TestInfoExplorer + // ////////////////////////////////////////////////////////////////// + + namespace Impl { + + struct IsTestSuiteOrTestCaseFilter + { + IsTestSuiteOrTestCaseFilter( bool keepSuite ) + : keepSuite_( keepSuite ) + { + } + + bool operator()( const TestInfo &info ) const + { + return info.isTestSuite() == keepSuite_; + } + + bool keepSuite_; + }; + + struct TestId2TestInfoAdapator + { + typedef TestInfo result_type; + TestId2TestInfoAdapator( const TestInfoHolder &holder ) + : holder_( holder ) + { + } + + TestInfo operator()( TestId id ) const + { + return TestInfo( holder_, id ); + } + + const TestInfoHolder &holder_; + }; + + } // namespace Impl + + + inline TestInfoEnumerator + TextTestDriver::getAllTestCases() const + { + return CppTL::Enum::anyTransform( CppTL::Enum::container( tests_, CppTL::Type<TestId>() ), + Impl::TestId2TestInfoAdapator( *this ) ); + } + + + inline TestInfoEnumerator + TextTestDriver::getAllTestSuites() const + { + return CppTL::Enum::anyTransform( CppTL::Enum::container( suites_, CppTL::Type<TestId>() ), + Impl::TestId2TestInfoAdapator( *this ) ); + } + + + inline TestInfo + TextTestDriver::getRootTestSuite() const + { + TestId id; + if ( !tests_.empty() ) + id = *(tests_.begin()); + else if ( !suites_.empty() ) + id = *(suites_.begin()); + else + throw std::logic_error( "TextTestDriver::getRootTestSuite(): no suite defined." ); + + while ( !getTestInfo(id).parents_.empty() ) + id = *(getTestInfo(id).parents_.begin()); + return TestInfo( *this, id ); + } + + + + // Implementation of TestInfoHolder + // ////////////////////////////////////////////////////////////////// + + inline const String & + TextTestDriver::getTestName( TestId id ) const + { + return getTestInfo(id).name_; + } + + + inline PropertiesAccessor + TextTestDriver::getTestDescription( TestId id ) const + { + return getTestInfo(id).info_.accessor()["description"]; + } + + + inline PropertiesAccessor + TextTestDriver::getTestInput( TestId id ) const + { + return getTestInfo(id).info_.accessor()["input"]; + } + + + inline bool + TextTestDriver::isTestSuite( TestId id ) const + { + return suites_.count(id) > 0; + } + + + inline TestInfoEnumerator + TextTestDriver::getTestChildren( TestId id ) const + { + return CppTL::Enum::anyTransform( CppTL::Enum::container( getTestInfo(id).children_ ), + Impl::TestId2TestInfoAdapator( *this ) ); + } + + + inline TestInfoEnumerator + TextTestDriver::getTestParents( TestId id ) const + { + return CppTL::Enum::anyTransform( CppTL::Enum::container( getTestInfo(id).parents_ ), + Impl::TestId2TestInfoAdapator( *this ) ); + } + + + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + // class TestInfo + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + + inline + TestInfo::TestInfo( const TestInfoHolder &holder, + TestId id ) + : id_( id ) + , holder_( holder ) + { + } + + inline const String & + TestInfo::getName() const + { + return holder_.getTestName( id_ ); + } + + inline PropertiesAccessor + TestInfo::getDescription() const + { + return holder_.getTestDescription( id_ ); + } + + inline bool + TestInfo::isTestSuite() const + { + return holder_.isTestSuite( id_ ); + } + + inline bool + TestInfo::isTestCase() const + { + return !isTestSuite(); + } + + + inline TestInfoEnumerator + TestInfo::getParents() const + { + return holder_.getTestParents( id_ ); + } + + + inline PropertiesAccessor + TestInfo::getInput() const + { + return holder_.getTestInput( id_ ); + } + + inline TestInfoEnumerator + TestInfo::getChildren() const + { + return holder_.getTestChildren( id_ ); + } + + inline TestInfoEnumerator + TestInfo::getChildTestSuites() const + { + return CppTL::Enum::anyFilter( getChildren(), + Impl::IsTestSuiteOrTestCaseFilter(true) ); + } + + inline TestInfoEnumerator + TestInfo::getChildTestCases() const + { + return CppTL::Enum::anyFilter( getChildren(), + Impl::IsTestSuiteOrTestCaseFilter(false) ); + } + } // namespace OpenTest |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:51:40
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5474/opentest Modified Files: forwards.h Log Message: * imported CppTL::ConstString as String for more flexibility. Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/forwards.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** forwards.h 21 Nov 2004 22:27:15 -0000 1.3 --- forwards.h 28 Feb 2005 20:51:25 -0000 1.4 *************** *** 20,23 **** --- 20,25 ---- class ValueBadCast; + typedef CppTL::ConstString String; + typedef CppTL::SharedPtr<TestPlanEntry> TestPlanEntryPtr; typedef CppTL::AnyEnumerator<TestPlanEntryPtr> TestPlanEntryPtrEnum; |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:49:05
|
Update of /cvsroot/cppunit/cppunit2/examples/input_based_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4661 Added Files: .cvsignore SConscript input_based_test.vcproj main.cpp Log Message: * added input based test --- NEW FILE: .cvsignore --- *.plg *.old *.WW *.old --- NEW FILE: main.cpp --- #include <cpput/testcase.h> #include <cpput/testsuite.h> #include <cpput/testrunner.h> // cppunit2 testrunner for opentest #include <cpput/testinfo.h> #include <cpput/assert.h> #include <opentest/texttestdriver.h> #include <opentest/properties.h> static void testMultiply() { // Notes: getValue() returns None value if it doesn't exist. // this makes it difficult to understand what property is missing in // the input => need a getter that throw if the property does not exist. OpenTest::PropertiesAccessor input = CppUT::TestInfo::result()["input"]; int x = input.getValue("x").asInt(); int y = input.getValue("y").asInt(); int expected = input.getValue("expected").asInt(); int result = x * y; CPPUT_ASSERT_EQUAL( expected, result ); } int main( int argc, const char *argv[] ) { CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); CppUT::TestPtr test1 = CppUT::makeTestCase( CppTL::cfn0( testMultiply ), "multiply 7*2" ); test1->info()["x"] = 7; test1->info()["x"] = 2; test1->info()["expected"] = 7*2+1; allSuite->add( test1 ); CppUT::TestRunner runner; CppUT::AbstractTestSuitePtr rootSuite = CppTL::staticPointerCast<CppUT::AbstractTestSuite>( allSuite ); runner.setRootSuite( rootSuite ); OpenTest::TextTestDriver driver( runner ); bool sucessful = driver.run(); return sucessful ? 0 : 1; } --- NEW FILE: input_based_test.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="input_based_test" ProjectGUID="{9EB5A164-9071-4E7E-90B3-094D35EA943C}" RootNamespace="input_based_test" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="../../build/$(ProjectName)/$(ConfigurationName)" IntermediateDirectory="../../build/$(ProjectName)/$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" RuntimeTypeInfo="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="4" DisableSpecificWarnings="4267"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/input_based_test.exe" LinkIncremental="2" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/input_based_test.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="../../build/$(ProjectName)/$(ConfigurationName)" IntermediateDirectory="../../build/$(ProjectName)/$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="0" RuntimeTypeInfo="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3" DisableSpecificWarnings="4267"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/input_based_test.exe" LinkIncremental="1" GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <File RelativePath=".\main.cpp"> </File> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: SConscript --- # input_based_test build script Import( 'env' ) env = env.Copy( LIBPATH = '#libs', LIBS = ['cpput'] ) input_based_test_sources=""" main.cpp """.split() input_based_test_exe = env.Program( target='input_based_test', source=input_based_test_sources ) bin_dir='#bin' env.Install( bin_dir, input_based_test_exe ) |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:48:30
|
Update of /cvsroot/cppunit/cppunit2/examples/input_based_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4484/input_based_test Log Message: Directory /cvsroot/cppunit/cppunit2/examples/input_based_test added to the repository |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:47:39
|
Update of /cvsroot/cppunit/cppunit2/include/cpputtools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4342/include/cpputtools Added Files: .cvsignore Log Message: * ignore function.h --- NEW FILE: .cvsignore --- function.h |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:45:52
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3744/include/cpptl Modified Files: stringtools.h Log Message: * added isDigit() Index: stringtools.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/stringtools.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stringtools.h 27 Feb 2005 10:13:18 -0000 1.5 --- stringtools.h 28 Feb 2005 20:45:41 -0000 1.6 *************** *** 7,10 **** --- 7,15 ---- namespace CppTL { + inline bool isDigit( char c ) + { + return unsigned(c) >= '0' && unsigned(c) <= '9'; + } + inline char digit( unsigned number ) { |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:43:13
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2779/src/cpputtest Modified Files: cpputtest.vcproj Added Files: testexceptionguard.cpp Removed Files: testtestcontext.cpp Log Message: * added testexceptionguard.cpp which replaces testtestcontext.cpp --- NEW FILE: testexceptionguard.cpp --- #include <cpput/assert.h> #include <cpput/exceptionguard.h> #include <cpptl/functor.h> #include <stdio.h> static void increment( int *value ) { ++*value; } static void throwStdException() { throw std::exception(); } namespace { struct CustomException { }; struct AnyException { }; } static void throwAnyException() { throw AnyException(); } static void throwCustomException() { throw CustomException(); } static void testExceptionGuardRunFunctor() { int value = 1; CppUT::ExceptionGuard guard; bool result = guard.protect( CppTL::bind_cfn( &increment, &value ) ); CPPUT_ASSERT_EQUAL( 2, value ); CPPUT_ASSERT_EQUAL( true, result ); } static void testExceptionGuardCatchStandardException() { CppUT::ExceptionGuard guard; bool result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); } static void testExceptionGuardCatchAnyException() { CppUT::ExceptionGuard guard; bool result = guard.protect( CppTL::cfn0( &throwAnyException ) ); CPPUT_ASSERT_EQUAL( false, result ); } static void customExceptionTranslation( const CustomException &e, int *value ) { ++*value; } static void testExceptionGuardAddCustomHandler() { int value = 1; CppUT::ExceptionGuard guard; // check that the exception translator is called CppUT::registerExceptionTranslation( guard, CppTL::bind2( CppTL::cfn2( &customExceptionTranslation ), &value ), CppTL::Type<CustomException>() ); bool result = guard.protect( CppTL::cfn0( &throwCustomException ) ); CPPUT_ASSERT_EQUAL( false, result ); CPPUT_ASSERT_EQUAL( 2, value ); // check that standard and ... catch handler are still active. result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); CPPUT_ASSERT_EQUAL( 2, value ); result = guard.protect( CppTL::cfn0( &throwAnyException ) ); CPPUT_ASSERT_EQUAL( false, result ); guard.removeLast(); // check that standard and ... catch handler are still active, // but not the custom exception handler. result = guard.protect( CppTL::cfn0( &throwCustomException ) ); CPPUT_ASSERT_EQUAL( false, result ); CPPUT_ASSERT_EQUAL( 2, value ); result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); } bool testExceptionGuard() { printf( "Running bootstrap test: testExceptionGuard()...\n" ); try { CppUT::TestInfo::startNewTest(); testExceptionGuardRunFunctor(); testExceptionGuardCatchStandardException(); testExceptionGuardCatchAnyException(); testExceptionGuardAddCustomHandler(); } catch ( const CppUT::AbortingAssertionException &e ) { printf( "testExceptionGuard() failed: %s\n", e.what() ); return false; } catch ( ... ) { printf( "testExceptionGuard() failed (uncaught exception).\n" ); return false; } return true; } Index: cpputtest.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/cpputtest.vcproj,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** cpputtest.vcproj 27 Feb 2005 17:42:32 -0000 1.16 --- cpputtest.vcproj 28 Feb 2005 20:43:02 -0000 1.17 *************** *** 188,194 **** </File> <File - RelativePath=".\mocktestlistener.h"> - </File> - <File RelativePath=".\mocktestvisitor.h"> </File> --- 188,191 ---- --- testtestcontext.cpp DELETED --- |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:38:29
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1437/include/cpptl Modified Files: sharedptr.h Log Message: * includes forwards.h instead of config.h Index: sharedptr.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/sharedptr.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sharedptr.h 23 Feb 2005 22:06:51 -0000 1.3 --- sharedptr.h 28 Feb 2005 20:38:21 -0000 1.4 *************** *** 2,6 **** # define CPPTL_SHAREDPTR_H_INCLUDED ! # include <cpptl/config.h> // We use inheritance instead of the typedef in a struct to --- 2,6 ---- # define CPPTL_SHAREDPTR_H_INCLUDED ! # include <cpptl/forwards.h> // We use inheritance instead of the typedef in a struct to |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:36:44
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv919/include/cpptl Modified Files: typetraits.h Log Message: * includes forwards.h instead of config.h Index: typetraits.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/typetraits.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** typetraits.h 21 Oct 2004 17:23:23 -0000 1.1 --- typetraits.h 28 Feb 2005 20:36:34 -0000 1.2 *************** *** 2,6 **** # define CPPTL_TYPETRAITS_H_INCLUDED ! # include <cpptl/config.h> namespace CppTL --- 2,6 ---- # define CPPTL_TYPETRAITS_H_INCLUDED ! # include <cpptl/forwards.h> namespace CppTL |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:33:58
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32625/include/cpptl Modified Files: functor.h functor.py Log Message: * allow up to 5 arguments. Index: functor.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/functor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functor.h 27 Feb 2005 14:38:25 -0000 1.3 --- functor.h 28 Feb 2005 20:33:34 -0000 1.4 *************** *** 595,598 **** --- 595,1162 ---- + template< class Arg1, class Arg2, class Arg3 > + class FunctorBase3 : public FunctorBase + { + public: + virtual void operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const = 0; + }; + [...1279 lines suppressed...] + } + + template< class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class FA1, class FA2, class FA3, class FA4, class FA5 > + inline Functor0R<Return> + bind_cfnr( Return (*function)( FA1, FA2, FA3, FA4, FA5 ), Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) + { + return fn0r( bind1r( bind2r( bind3r( bind4r( bind5r( cfn5r( function ), a5 ), a4 ), a3 ), a2 ), a1 ) ); + } + + template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class FA1, class FA2, class FA3, class FA4, class FA5 > + inline Functor0R<Return> + bind_memfnr( const Holder &holder, + Return (Object::*member)( FA1, FA2, FA3, FA4, FA5 ), + Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) + { + return fn0r( bind1r( bind2r( bind3r( bind4r( bind5r( memfn5r( holder, member ), a5 ), a4 ), a3 ), a2 ), a1 ) ); + } + Index: functor.py =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/functor.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functor.py 27 Feb 2005 14:38:25 -0000 1.3 --- functor.py 28 Feb 2005 20:33:47 -0000 1.4 *************** *** 1,5 **** # script to generate cpptl/functor.h ! MAX_ARGUMENT_COUNT = 2 header =\ --- 1,5 ---- # script to generate cpptl/functor.h ! MAX_ARGUMENT_COUNT = 5 header =\ |
From: Baptiste L. <bl...@us...> - 2005-02-28 20:33:17
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32472/include/cpput Modified Files: message.h Log Message: * removed some warnings. Index: message.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/message.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** message.h 27 Feb 2005 10:15:41 -0000 1.6 --- message.h 28 Feb 2005 20:32:52 -0000 1.7 *************** *** 73,77 **** void extend( const Message &other ) { ! insertAt( details_.size(), other ); } --- 73,77 ---- void extend( const Message &other ) { ! insertAt( int(details_.size()), other ); } |