[Cppunit-cvs] cppunit2/src/cpput properties.cpp,1.4,1.5 testrunner.cpp,1.6,1.7
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-20 16:17:48
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31110/src/cpput Modified Files: properties.cpp testrunner.cpp Log Message: * added support for test descriptive data Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** properties.cpp 20 Nov 2004 15:07:00 -0000 1.4 --- properties.cpp 20 Nov 2004 16:17:33 -0000 1.5 *************** *** 657,672 **** const Property & ! PropertiesAccessor::getProperty( const std::string &name ) const { if ( !properties_ ) throw std::invalid_argument( "PropertiesAccessor::getProperty() : null" ); ! return properties_->getProperty( name ); } Value ! PropertiesAccessor::getValue( const std::string &name ) const { ! return properties_ ? properties_->getValue( name ) : Value(); } --- 657,672 ---- const Property & ! PropertiesAccessor::getProperty( const PropertyPath &path ) const { if ( !properties_ ) throw std::invalid_argument( "PropertiesAccessor::getProperty() : null" ); ! return properties_->getProperty( path ); } Value ! PropertiesAccessor::getValue( const PropertyPath &path ) const { ! return properties_ ? properties_->getValue( path ) : Value(); } *************** *** 680,687 **** Value ! PropertiesAccessor::getValue( const std::string &name, ! const Value &defaultValue ) const { ! return properties_ ? properties_->getValue( name, defaultValue ) : defaultValue; } --- 680,687 ---- Value ! PropertiesAccessor::getValue( const PropertyPath &path, ! const Value &defaultValue ) const { ! return properties_ ? properties_->getValue( path, defaultValue ) : defaultValue; } *************** *** 690,694 **** Value PropertiesAccessor::at( unsigned int index, ! const Value &defaultValue ) const { return properties_ ? properties_->at( index, defaultValue ) --- 690,694 ---- Value PropertiesAccessor::at( unsigned int index, ! const Value &defaultValue ) const { return properties_ ? properties_->at( index, defaultValue ) *************** *** 835,851 **** const Property & ! Properties::getProperty( const std::string &name ) const { ! PropertyList::const_iterator it = find( name ); ! if ( it == properties_.end() ) ! throw std::invalid_argument( "Properties::getProperty(" + name + ")" ); ! return *it; } const Value & ! Properties::getValue( const std::string &name ) const { ! return getProperty( name ).value(); } --- 835,848 ---- const Property & ! Properties::getProperty( const PropertyPath &path ) const { ! return *resolvePath( path ); } const Value & ! Properties::getValue( const PropertyPath &path ) const { ! return (*this)[ path ]; } *************** *** 892,912 **** Properties::operator[]( const PropertyPath &path ) const { ! PropertyPath::NamesEnum names = path.names(); ! checkPathNotEmpty( path ); ! const Properties *properties = this; ! while ( true ) ! { ! const std::string &propertyName = names.next(); ! PropertyList::const_iterator it = properties->find( propertyName ); ! if ( it == properties->properties_.end() ) ! { ! throw std::invalid_argument( "OpenTest::Properties: bad property path, '" ! + propertyName + "' is not defined." ); ! } ! const Value &value = it->value(); ! if ( !names.hasNext() ) ! return value; ! properties = &value.asProperties(); ! } } --- 889,893 ---- Properties::operator[]( const PropertyPath &path ) const { ! return resolvePath( path )->value(); } *************** *** 1033,1036 **** --- 1014,1040 ---- + Properties::PropertyList::const_iterator + Properties::resolvePath( const PropertyPath &path ) const + { + PropertyPath::NamesEnum names = path.names(); + checkPathNotEmpty( path ); + const Properties *properties = this; + while ( true ) + { + const std::string &propertyName = names.next(); + PropertyList::const_iterator it = properties->find( propertyName ); + if ( it == properties->properties_.end() ) + { + throw std::invalid_argument( "OpenTest::Properties: bad property path, '" + + propertyName + "' is not defined." ); + } + const Value &value = it->value(); + if ( !names.hasNext() ) + return it; + properties = &value.asProperties(); + } + } + + const Properties * Properties::tryGetProperties( const PropertyPath &path ) const Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testrunner.cpp 20 Nov 2004 15:26:38 -0000 1.6 --- testrunner.cpp 20 Nov 2004 16:17:33 -0000 1.7 *************** *** 29,33 **** { OpenTest::TestId id = declarator_.addTest( test.name(), ! OpenTest::Properties() ); tests_.insert( TestRunner::DeclaredTests::value_type( id, &test ) ); } --- 29,33 ---- { OpenTest::TestId id = declarator_.addTest( test.name(), ! test.info() ); tests_.insert( TestRunner::DeclaredTests::value_type( id, &test ) ); } *************** *** 36,40 **** { OpenTest::TestId id = declarator_.beginSuite( suite.name(), ! OpenTest::Properties() ); tests_.insert( TestRunner::DeclaredTests::value_type( id, &suite ) ); for ( int index = 0; index < suite.testCount(); ++index ) --- 36,40 ---- { OpenTest::TestId id = declarator_.beginSuite( suite.name(), ! suite.info() ); tests_.insert( TestRunner::DeclaredTests::value_type( id, &suite ) ); for ( int index = 0; index < suite.testCount(); ++index ) *************** *** 145,148 **** --- 145,149 ---- tracker.startTest( entry ); TestInfo::startNewTest(); + TestInfo::mergeInResult( configuration ); if ( itTest == tests_.end() ) // protocol error => unknown test { |