cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 31)
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-23 21:36:33
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27117/include/cpptl Modified Files: sharedptr.h Log Message: * changed implementation to avoid warning (operator -> returning void on solaris) Index: sharedptr.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/sharedptr.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sharedptr.h 15 Nov 2004 08:22:51 -0000 1.1 --- sharedptr.h 23 Feb 2005 21:36:24 -0000 1.2 *************** *** 107,111 **** } ! void *operator ->() const { // assert( p_ != 0 ) --- 107,111 ---- } ! void *deref() const { // assert( p_ != 0 ) *************** *** 193,197 **** PointeeType *operator ->() const { ! return static_cast<PointeeType *>( SuperClass::operator ->() ); } }; --- 193,197 ---- PointeeType *operator ->() const { ! return static_cast<PointeeType *>( SuperClass::deref() ); } }; |
From: Baptiste L. <bl...@us...> - 2005-02-23 21:35:26
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26803/include/cpptl Modified Files: config.h Log Message: * fixed detection of MSVC compiler (other compilers will now correctly skip those specific configurations). Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** config.h 15 Nov 2004 08:50:59 -0000 1.5 --- config.h 23 Feb 2005 21:35:18 -0000 1.6 *************** *** 7,39 **** /////////////////////////////////////////////////////////////////////////// ! # if _MSC_VER <= 1200 // VC++ 6 or before ! # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info ! # pragma warning( disable : 4800 ) // forcing value to bool performance warning ! # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch ! # define CPPTL_NO_VECTOR_STD_ITERATOR ! # define CPPTL_NO_FUNCTION_TEMPLATE_ORDERING ! # define CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION ! # define CPPTL_HAS_INT64 1 ! # endif ! # if _MSC_VER >= 1200 // VC++ 6 and above ! # undef CPPTL_NO_ENUM_STATIC_CONSTANT ! # endif ! # if _MSC_VER <= 1300 // VC++ 7.0 or before // VC++ 7.0 does have deduced typename, but their behavior is not consistent with // VC++ 7.1. Since it is not required to compile, we just pretend it's not available. ! # define CPPTL_NO_DEDUCED_TYPENAME ! # define CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION # endif ! # if _MSC_VER >= 1310 // VC++ 7.1 ! # define CPPTL_HAS_INT64 1 //# define CPPTL_HAS_LONGLONG 1 // support but not by default. ! # pragma warning( disable : 4800 ) // forcing value to bool performance warning ! # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch ! # pragma warning( disable : 4180 ) // qualifier applied to function type has no meaning ! # endif ! --- 7,41 ---- /////////////////////////////////////////////////////////////////////////// ! // Microsoft Visual C++ ! # if defined(_MSC_VER) ! # if _MSC_VER <= 1200 // VC++ 6 or before ! # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info ! # pragma warning( disable : 4800 ) // forcing value to bool performance warning ! # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch ! # define CPPTL_NO_VECTOR_STD_ITERATOR ! # define CPPTL_NO_FUNCTION_TEMPLATE_ORDERING ! # define CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION ! # define CPPTL_HAS_INT64 1 ! # endif ! # if _MSC_VER >= 1200 // VC++ 6 and above ! # undef CPPTL_NO_ENUM_STATIC_CONSTANT ! # endif ! # if _MSC_VER <= 1300 // VC++ 7.0 or before // VC++ 7.0 does have deduced typename, but their behavior is not consistent with // VC++ 7.1. Since it is not required to compile, we just pretend it's not available. ! # define CPPTL_NO_DEDUCED_TYPENAME ! # define CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION # endif ! # if _MSC_VER >= 1310 // VC++ 7.1 ! # define CPPTL_HAS_INT64 1 //# define CPPTL_HAS_LONGLONG 1 // support but not by default. ! # pragma warning( disable : 4800 ) // forcing value to bool performance warning ! # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch ! # pragma warning( disable : 4180 ) // qualifier applied to function type has no meaning ! # endif ! #endif *************** *** 66,69 **** --- 68,87 ---- # endif + /// CPPTL_NO_TYPE_DEFAULT_ARG is defined if the compiler does not support the following construct: + /// template<class ValueType> void doSomething( CppTL::Type<ValueType> type = CppTL::Type<ValueType>() ); + /// With allow for the following usage: + /// doSomething<int>(); + /// Some compiler can not deduce type correctly or may cause silent linker error (all function + /// instantion for different type being recognized as a single one). + /// If this construct is not supported, the portable call syntax should be use: + /// doSomething( CppTL::Type<int>() ); + /// @todo Should this be kept. It is not used at the time... + #if defined(CPPTL_NO_TYPE_DEFAULT_ARG) + # define CPPTL_TYPE_DEFAULT_ARG(aType) + #else + # define CPPTL_TYPE_DEFAULT_ARG(aType) = ::CppTL::Type<aType>() + #endif + + // auto-link specification /////////////////////////////////////////////////////////////////////////// *************** *** 102,106 **** }; - /// Base class for non copyable class. class CPPTL_API NonCopyable --- 120,123 ---- |
From: Baptiste L. <bl...@us...> - 2005-02-23 21:35:06
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/src/cpput Modified Files: functor.py Log Message: * fixed generator: should use CPPTL_TYPENAME instead of CPPUT_DEDUCED_TYPENAME Index: functor.py =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/functor.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functor.py 17 Nov 2004 08:59:34 -0000 1.3 --- functor.py 23 Feb 2005 21:34:53 -0000 1.4 *************** *** 32,36 **** index = 0 for arg in types.types_pack: ! print >> out, '%stypedef CPPUT_DEDUCED_TYPENAME FunctorType::%s %s;' % ( indent, getArgumentTypeName(index), getArgumentTypeName(index) ) --- 32,36 ---- index = 0 for arg in types.types_pack: ! print >> out, '%stypedef CPPTL_TYPENAME FunctorType::%s %s;' % ( indent, getArgumentTypeName(index), getArgumentTypeName(index) ) *************** *** 207,211 **** deduced_typename = '' if len(types.types) > 0 or has_return_type: ! deduced_typename = 'CPPUT_DEDUCED_TYPENAME ' print >> out, """ explicit %s( %s *impl = 0 ) --- 207,211 ---- deduced_typename = '' if len(types.types) > 0 or has_return_type: ! deduced_typename = 'CPPTL_TYPENAME ' print >> out, """ explicit %s( %s *impl = 0 ) *************** *** 251,255 **** template_decl = ', '.join( template_params ) for index in xrange(0,len(types.types)): ! arg_type = 'CPPUT_DEDUCED_TYPENAME FunctorType::%s' % getArgumentTypeName(index) impl_template_params.append( arg_type ) functor_type.append( arg_type ) --- 251,255 ---- template_decl = ', '.join( template_params ) for index in xrange(0,len(types.types)): ! arg_type = 'CPPTL_TYPENAME FunctorType::%s' % getArgumentTypeName(index) impl_template_params.append( arg_type ) functor_type.append( arg_type ) *************** *** 318,329 **** new_suffix = getSuffix( len(types.types) - 1, has_return_type ) template_decl = 'class FunctorType, class ArgType' ! result_type = 'CPPUT_DEDUCED_TYPENAME FunctorType::result_type' impl_template_params = result_type + ', FunctorType, ArgType' makefn_template_params = '' functor_template_params = [] for index in xrange(0,len(types.types) - 1): ! functor_template_params.append( 'CPPUT_DEDUCED_TYPENAME FunctorType::%s' % getArgumentTypeName(index) ) if has_return_type: ! makefn_template_params = '<CPPUT_DEDUCED_TYPENAME FunctorType::result_type>' functor_template_params.insert(0, result_type ) functor_template_params = ',\n '.join( functor_template_params ) --- 318,329 ---- new_suffix = getSuffix( len(types.types) - 1, has_return_type ) template_decl = 'class FunctorType, class ArgType' ! result_type = 'CPPTL_TYPENAME FunctorType::result_type' impl_template_params = result_type + ', FunctorType, ArgType' makefn_template_params = '' functor_template_params = [] for index in xrange(0,len(types.types) - 1): ! functor_template_params.append( 'CPPTL_TYPENAME FunctorType::%s' % getArgumentTypeName(index) ) if has_return_type: ! makefn_template_params = '<CPPTL_TYPENAME FunctorType::result_type>' functor_template_params.insert(0, result_type ) functor_template_params = ',\n '.join( functor_template_params ) |
From: Baptiste L. <bl...@us...> - 2005-02-23 21:34:23
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26402 Modified Files: functor.h Log Message: * fixed generator: should use CPPTL_TYPENAME instead of CPPUT_DEDUCED_TYPENAME Index: functor.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/functor.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** functor.h 17 Nov 2004 08:59:05 -0000 1.5 --- functor.h 23 Feb 2005 21:34:12 -0000 1.6 *************** *** 414,418 **** { public: ! typedef CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type first_argument_type; typedef void result_type; --- 414,418 ---- { public: ! typedef CPPTL_TYPENAME FunctorType::first_argument_type first_argument_type; typedef void result_type; *************** *** 436,440 **** { public: ! typedef CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type first_argument_type; typedef ReturnType result_type; --- 436,440 ---- { public: ! typedef CPPTL_TYPENAME FunctorType::first_argument_type first_argument_type; typedef ReturnType result_type; *************** *** 515,519 **** private: ! CPPUT_DEDUCED_TYPENAME CppTL::SharedPtr< Impl::Functor0Base<ReturnType> > impl_; }; --- 515,519 ---- private: ! CPPTL_TYPENAME CppTL::SharedPtr< Impl::Functor0Base<ReturnType> > impl_; }; *************** *** 548,552 **** private: ! CPPUT_DEDUCED_TYPENAME CppTL::SharedPtr< Impl::Functor1Base<void, Arg1Type> > impl_; }; --- 548,552 ---- private: ! CPPTL_TYPENAME CppTL::SharedPtr< Impl::Functor1Base<void, Arg1Type> > impl_; }; *************** *** 579,583 **** private: ! CPPUT_DEDUCED_TYPENAME CppTL::SharedPtr< Impl::Functor1Base<ReturnType, Arg1Type> > impl_; }; --- 579,583 ---- private: ! CPPTL_TYPENAME CppTL::SharedPtr< Impl::Functor1Base<ReturnType, Arg1Type> > impl_; }; *************** *** 613,617 **** private: ! CPPUT_DEDUCED_TYPENAME CppTL::SharedPtr< Impl::Functor2Base<void, Arg1Type, Arg2Type> > impl_; }; --- 613,617 ---- private: ! CPPTL_TYPENAME CppTL::SharedPtr< Impl::Functor2Base<void, Arg1Type, Arg2Type> > impl_; }; *************** *** 645,649 **** private: ! CPPUT_DEDUCED_TYPENAME CppTL::SharedPtr< Impl::Functor2Base<ReturnType, Arg1Type, Arg2Type> > impl_; }; --- 645,649 ---- private: ! CPPTL_TYPENAME CppTL::SharedPtr< Impl::Functor2Base<ReturnType, Arg1Type, Arg2Type> > impl_; }; *************** *** 717,738 **** template<class FunctorType> ! Functor1<CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type> makeFn1( FunctorType functor ) { ! return Functor1<CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type>( new Impl::Functor1<FunctorType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type>( functor ) ); } template<class ReturnType, class FunctorType> FunctorR1<ReturnType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type> makeFnR1( FunctorType functor ) { return FunctorR1<ReturnType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type>( new Impl::FunctorR1<FunctorType, ReturnType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type>( functor ) ); } --- 717,738 ---- template<class FunctorType> ! Functor1<CPPTL_TYPENAME FunctorType::first_argument_type> makeFn1( FunctorType functor ) { ! return Functor1<CPPTL_TYPENAME FunctorType::first_argument_type>( new Impl::Functor1<FunctorType, ! CPPTL_TYPENAME FunctorType::first_argument_type>( functor ) ); } template<class ReturnType, class FunctorType> FunctorR1<ReturnType, ! CPPTL_TYPENAME FunctorType::first_argument_type> makeFnR1( FunctorType functor ) { return FunctorR1<ReturnType, ! CPPTL_TYPENAME FunctorType::first_argument_type>( new Impl::FunctorR1<FunctorType, ReturnType, ! CPPTL_TYPENAME FunctorType::first_argument_type>( functor ) ); } *************** *** 792,805 **** { return makeFn0( ! Impl::Bind1<CPPUT_DEDUCED_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } template<class FunctorType, class ArgType> ! FunctorR0<CPPUT_DEDUCED_TYPENAME FunctorType::result_type> bindR1( FunctorType functor, ArgType arg ) { ! return makeFnR0<CPPUT_DEDUCED_TYPENAME FunctorType::result_type>( ! Impl::BindR1<CPPUT_DEDUCED_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } --- 792,805 ---- { return makeFn0( ! Impl::Bind1<CPPTL_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } template<class FunctorType, class ArgType> ! FunctorR0<CPPTL_TYPENAME FunctorType::result_type> bindR1( FunctorType functor, ArgType arg ) { ! return makeFnR0<CPPTL_TYPENAME FunctorType::result_type>( ! Impl::BindR1<CPPTL_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } *************** *** 807,834 **** template<class FunctorType> ! Functor2<CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type, ! CPPUT_DEDUCED_TYPENAME FunctorType::second_argument_type> makeFn2( FunctorType functor ) { ! return Functor2<CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type, ! CPPUT_DEDUCED_TYPENAME FunctorType::second_argument_type>( new Impl::Functor2<FunctorType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type, ! CPPUT_DEDUCED_TYPENAME FunctorType::second_argument_type>( functor ) ); } template<class ReturnType, class FunctorType> FunctorR2<ReturnType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type, ! CPPUT_DEDUCED_TYPENAME FunctorType::second_argument_type> makeFnR2( FunctorType functor ) { return FunctorR2<ReturnType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type, ! CPPUT_DEDUCED_TYPENAME FunctorType::second_argument_type>( new Impl::FunctorR2<FunctorType, ReturnType, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type, ! CPPUT_DEDUCED_TYPENAME FunctorType::second_argument_type>( functor ) ); } --- 807,834 ---- template<class FunctorType> ! Functor2<CPPTL_TYPENAME FunctorType::first_argument_type, ! CPPTL_TYPENAME FunctorType::second_argument_type> makeFn2( FunctorType functor ) { ! return Functor2<CPPTL_TYPENAME FunctorType::first_argument_type, ! CPPTL_TYPENAME FunctorType::second_argument_type>( new Impl::Functor2<FunctorType, ! CPPTL_TYPENAME FunctorType::first_argument_type, ! CPPTL_TYPENAME FunctorType::second_argument_type>( functor ) ); } template<class ReturnType, class FunctorType> FunctorR2<ReturnType, ! CPPTL_TYPENAME FunctorType::first_argument_type, ! CPPTL_TYPENAME FunctorType::second_argument_type> makeFnR2( FunctorType functor ) { return FunctorR2<ReturnType, ! CPPTL_TYPENAME FunctorType::first_argument_type, ! CPPTL_TYPENAME FunctorType::second_argument_type>( new Impl::FunctorR2<FunctorType, ReturnType, ! CPPTL_TYPENAME FunctorType::first_argument_type, ! CPPTL_TYPENAME FunctorType::second_argument_type>( functor ) ); } *************** *** 884,902 **** template<class FunctorType, class ArgType> ! Functor1<CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type> bind2( FunctorType functor, ArgType arg ) { return makeFn1( ! Impl::Bind2<CPPUT_DEDUCED_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } template<class FunctorType, class ArgType> ! FunctorR1<CPPUT_DEDUCED_TYPENAME FunctorType::result_type, ! CPPUT_DEDUCED_TYPENAME FunctorType::first_argument_type> bindR2( FunctorType functor, ArgType arg ) { ! return makeFnR1<CPPUT_DEDUCED_TYPENAME FunctorType::result_type>( ! Impl::BindR2<CPPUT_DEDUCED_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } --- 884,902 ---- template<class FunctorType, class ArgType> ! Functor1<CPPTL_TYPENAME FunctorType::first_argument_type> bind2( FunctorType functor, ArgType arg ) { return makeFn1( ! Impl::Bind2<CPPTL_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } template<class FunctorType, class ArgType> ! FunctorR1<CPPTL_TYPENAME FunctorType::result_type, ! CPPTL_TYPENAME FunctorType::first_argument_type> bindR2( FunctorType functor, ArgType arg ) { ! return makeFnR1<CPPTL_TYPENAME FunctorType::result_type>( ! Impl::BindR2<CPPTL_TYPENAME FunctorType::result_type, FunctorType, ArgType>( functor, arg ) ); } |
From: Baptiste L. <bl...@us...> - 2005-02-23 08:54:21
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18007/src/cpputtest Modified Files: enumeratortest.cpp Log Message: * removed include/cpput/enumerator.h which has been replaced by include/cpptl/enumerator.h * added explicit type passing to any*() generator functions. Index: enumeratortest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/enumeratortest.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** enumeratortest.cpp 15 Nov 2004 08:52:40 -0000 1.5 --- enumeratortest.cpp 23 Feb 2005 08:54:05 -0000 1.6 *************** *** 3,7 **** #include <iterator> ! // todo: add test for custom equality predicates #define ENUMERATORTEST_ASSERT_ENUM_EMPTY \ --- 3,8 ---- #include <iterator> ! // @todo: add test for custom equality predicates ! // @todo add test for different enumerated type #define ENUMERATORTEST_ASSERT_ENUM_EMPTY \ *************** *** 298,301 **** --- 299,306 ---- #if !defined(CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + // NOTES: to be portable, the compiler need to be able to remove the optional 'const' + // before the deduced enumerator type. This can only be done using partial + // specialilzation. For portability, it is strongly recommanded to use the portable + // syntax by passing the return type explicitely. checkContent( CppTL::Enum::range( set1_.begin(), set1_.end() ) ); #endif *************** *** 310,313 **** --- 315,319 ---- checkContent( CppTL::Enum::range( set1_.begin(), set1_.end(), CppTL::Type<int>() ) ); checkContent( CppTL::Enum::range( list1_.begin(), list1_.end(), CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::anyRange( list1_.begin(), list1_.end(), CppTL::Type<int>() ) ); } *************** *** 351,354 **** --- 357,361 ---- checkContent( CppTL::Enum::container( set1_, CppTL::Type<int>() ) ); checkContent( CppTL::Enum::container( list1_, CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::anyContainer( list1_, CppTL::Type<int>() ) ); } *************** *** 363,371 **** checkContent( CppTL::Enum::keysRange( map1_.begin(), map1_.end() ) ); - checkContent( CppTL::Enum::keysRange( map1_.begin(), map1_.end(), CppTL::Type<int>() ) ); - checkContent( CppTL::Enum::anyKeys( map1_ ) ); checkContent( CppTL::Enum::anyKeysRange( map1_.begin(), map1_.end() ) ); } --- 370,382 ---- checkContent( CppTL::Enum::keysRange( map1_.begin(), map1_.end() ) ); checkContent( CppTL::Enum::anyKeys( map1_ ) ); checkContent( CppTL::Enum::anyKeysRange( map1_.begin(), map1_.end() ) ); + + checkContent( CppTL::Enum::keysRange( map1_.begin(), map1_.end(), CppTL::Type<int>() ) ); + + checkContent( CppTL::Enum::anyKeys( map1_, CppTL::Type<int>() ) ); + + checkContent( CppTL::Enum::anyKeysRange( map1_.begin(), map1_.end(), CppTL::Type<int>() ) ); } *************** *** 387,390 **** --- 398,406 ---- checkStringContent( CppTL::Enum::anyValuesRange( map1_.begin(), map1_.end() ) ); + + checkStringContent( CppTL::Enum::anyValuesRange( map1_.begin(), map1_.end(), + CppTL::Type<std::string>() ) ); + + checkStringContent( CppTL::Enum::anyValues( map1_, CppTL::Type<std::string>() ) ); } |
From: Baptiste L. <bl...@us...> - 2005-02-23 08:54:20
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18007/include/cpptl Modified Files: enumerator.h Log Message: * removed include/cpput/enumerator.h which has been replaced by include/cpptl/enumerator.h * added explicit type passing to any*() generator functions. Index: enumerator.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/enumerator.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** enumerator.h 19 Nov 2004 19:30:16 -0000 1.5 --- enumerator.h 23 Feb 2005 08:54:04 -0000 1.6 *************** *** 1046,1049 **** --- 1046,1058 ---- template<class ForwardItType + ,class ValueType> + AnyEnumerator<CPPTL_TYPENAME ValueType::type> + anyRange( ForwardItType begin, ForwardItType end, ValueType type ) + { + return any( range( begin, end, type ) ); + } + + + template<class ForwardItType ,class Adaptor > AnyEnumerator<CPPTL_TYPENAME Adaptor::result_type> *************** *** 1060,1063 **** --- 1069,1080 ---- } + template<class ContainerType + ,class ValueType> + AnyEnumerator<CPPTL_TYPENAME ValueType::type> + anyContainer( const ContainerType &enumeratedContainer, ValueType type ) + { + return any( container( enumeratedContainer, type ) ); + } + template<class ForwardItType> AnyEnumerator<CPPTL_TYPENAME RemoveConst< *************** *** 1068,1071 **** --- 1085,1104 ---- } + template<class ForwardItType + ,class ValueType> + AnyEnumerator<CPPTL_TYPENAME ValueType::type> + anyKeysRange( ForwardItType begin, ForwardItType end, ValueType type ) + { + return any( keysRange( begin, end, type ) ); + } + + template<class ContainerType + ,class ValueType> + AnyEnumerator<CPPTL_TYPENAME ValueType::type> + anyKeys( const ContainerType &container, ValueType type ) + { + return any( keys( container, type ) ); + } + template<class ContainerType> AnyEnumerator<CPPTL_TYPENAME RemoveConst< *************** *** 1084,1087 **** --- 1117,1128 ---- } + template<class ForwardItType + ,class ValueType> + AnyEnumerator<CPPTL_TYPENAME ValueType::type> + anyValuesRange( ForwardItType begin, ForwardItType end, ValueType type ) + { + return any( valuesRange( begin, end, type ) ); + } + template<class ContainerType> AnyEnumerator<CPPTL_TYPENAME RemoveConst< *************** *** 1092,1095 **** --- 1133,1144 ---- } + template<class ContainerType + ,class ValueType> + AnyEnumerator<CPPTL_TYPENAME ValueType::type> + anyValues( const ContainerType &container, ValueType type ) + { + return any( values( container, type ) ); + } + template<class EnumeratorType |
From: Baptiste L. <bl...@us...> - 2005-02-23 08:54:20
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18007/include/cpput Modified Files: properties.h Removed Files: enumerator.h Log Message: * removed include/cpput/enumerator.h which has been replaced by include/cpptl/enumerator.h * added explicit type passing to any*() generator functions. --- enumerator.h DELETED --- Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/properties.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** properties.h 4 Aug 2004 07:55:37 -0000 1.3 --- properties.h 23 Feb 2005 08:54:05 -0000 1.4 *************** *** 3,7 **** # include <cpput/config.h> ! # include <cpput/enumerator.h> # include <cpputtools/value.h> # include <map> --- 3,7 ---- # include <cpput/config.h> ! # include <cpptl/enumerator.h> # include <cpputtools/value.h> # include <map> *************** *** 55,61 **** } ! Enumerator<std::string> names() const { ! return enumStlMapKeys( valuesByName_, Type<std::string>() ); } --- 55,61 ---- } ! CppTL::AnyEnumerator<std::string> names() const { ! return CppTL::Enum::anyKeys( valuesByName_, CppTL::Type<std::string>() ); } |
From: Baptiste L. <bl...@us...> - 2005-02-23 07:35:12
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31372 Modified Files: ChangeLog Log Message: * examples/hierarchy/BoardGameTest.h: * examples/hierarchy/ChessTest.h: fixed compilation issue, prefixed access to class member with 'this' (inheriting from template parameter dependent class). Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.224 retrieving revision 1.225 diff -C2 -d -r1.224 -r1.225 *** ChangeLog 19 Nov 2004 20:04:35 -0000 1.224 --- ChangeLog 23 Feb 2005 07:35:03 -0000 1.225 *************** *** 1,2 **** --- 1,9 ---- + 2005-02-23 Baptiste Lepilleur <gai...@fr...> + + * examples/hierarchy/BoardGameTest.h: + * examples/hierarchy/ChessTest.h: fixed compilation issue, prefixed access + to class member with 'this' (inheriting from template parameter + dependent class). + 2004-11-19 Baptiste Lepilleur <gai...@fr...> |
From: Baptiste L. <bl...@us...> - 2005-02-23 07:34:58
|
Update of /cvsroot/cppunit/cppunit/examples/hierarchy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31315/examples/hierarchy Modified Files: BoardGameTest.h ChessTest.h Log Message: * examples/hierarchy/BoardGameTest.h: * examples/hierarchy/ChessTest.h: fixed compilation issue, prefixed access to class member with 'this' (inheriting from template parameter dependent class). Index: BoardGameTest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/hierarchy/BoardGameTest.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** BoardGameTest.h 25 Jun 2004 11:11:45 -0000 1.16 --- BoardGameTest.h 23 Feb 2005 07:34:40 -0000 1.17 *************** *** 27,41 **** void setUp() { ! m_game = new GAMECLASS; } void tearDown() { ! delete m_game; } void testReset() { ! CPPUNIT_ASSERT( m_game->reset() ); } --- 27,41 ---- void setUp() { ! this->m_game = new GAMECLASS; } void tearDown() { ! delete this->m_game; } void testReset() { ! CPPUNIT_ASSERT( this->m_game->reset() ); } *************** *** 43,47 **** { CPPUNIT_NS::stdCOut() << "The following test fails, this is intended:" << "\n"; ! CPPUNIT_ASSERT( !m_game->reset() ); } }; --- 43,47 ---- { CPPUNIT_NS::stdCOut() << "The following test fails, this is intended:" << "\n"; ! CPPUNIT_ASSERT( !this->m_game->reset() ); } }; Index: ChessTest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/hierarchy/ChessTest.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ChessTest.h 10 Jul 2002 18:50:02 -0000 1.9 --- ChessTest.h 23 Feb 2005 07:34:40 -0000 1.10 *************** *** 17,21 **** void testNumberOfPieces() { ! CPPUNIT_ASSERT( m_game->getNumberOfPieces () == 32 ); } }; --- 17,21 ---- void testNumberOfPieces() { ! CPPUNIT_ASSERT( this->m_game->getNumberOfPieces () == 32 ); } }; |
From: Baptiste L. <bl...@us...> - 2005-02-22 21:27:03
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27352/src/cpput Modified Files: testcase.cpp Added Files: exceptionguard.cpp Removed Files: testfailureguard.cpp Log Message: * renamed testfailureguard.h/cpp to exceptionguard.h/cpp --- testfailureguard.cpp DELETED --- Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testcase.cpp 22 Feb 2005 21:14:39 -0000 1.7 --- testcase.cpp 22 Feb 2005 21:26:49 -0000 1.8 *************** *** 3,7 **** #include <cpput/functor.h> #include <cpput/message.h> ! #include <cpput/testfailureguard.h> #include <cpput/testvisitor.h> --- 3,7 ---- #include <cpput/functor.h> #include <cpput/message.h> ! #include <cpput/exceptionguard.h> #include <cpput/testvisitor.h> --- NEW FILE: exceptionguard.cpp --- #include <cpput/exceptionguard.h> #include <cpput/testinfo.h> #include <cpput/typehelper.h> namespace CppUT { // class ExceptionGuardElement // ////////////////////////////////////////////////////////////////// struct ExceptionGuardElement::Context { Context( Functor0 test ) : test_( test ) { } Functor0 test_; }; void ExceptionGuardElement::setNextInChain( const ExceptionGuardElementPtr &deleguate ) { deleguate_ = deleguate; } bool ExceptionGuardElement::callNextInChain( Context &context ) { if ( deleguate_ ) return deleguate_->protect( context ); context.test_(); return true; } namespace Impl { // class StandardTestExceptionGuard // ////////////////////////////////////////////////////////////////// // catch CppUT::AssertionException, std::exception, ... class CPPUT_API StandardTestExceptionGuard : public ExceptionGuardElement { public: // overridden from ExceptionGuardElement bool protect( Context &context ) { try { return callNextInChain( context ); } catch ( const AbortingAssertionException & ) { // 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 ( ... ) { OpenTest::Properties fault; fault["type"] = "unexpected exception"; fault["message"].append( "caught unexpected exception of unknown type." ); TestInfo::appendFaultToResult( fault ); } return false; } private: void addFault( const std::string &exceptionType, const char *what ) { OpenTest::Properties fault; fault["type"] = "unexpected exception"; fault["exception_type"] = exceptionType; fault["message"].append( "caught unexpected exception." ); fault["message"].append( what ); TestInfo::appendFaultToResult( fault ); } }; } // namespace Impl // class ExceptionGuard // ////////////////////////////////////////////////////////////////// ExceptionGuard::ExceptionGuard() { guards_.push_back( ExceptionGuardElementPtr( new Impl::StandardTestExceptionGuard() ) ); } void ExceptionGuard::append( const ExceptionGuardElementPtr &guard ) { guard->setNextInChain( ExceptionGuardElementPtr() ); guards_.back()->setNextInChain( guard ); guards_.insert( guards_.end()-1, guard ); } void ExceptionGuard::removeLast() { if ( guards_.size() == 1 ) // should we throw an exception ? return; guards_.erase( guards_.end() - 1 ); guards_.back()->setNextInChain( ExceptionGuardElementPtr() ); } bool ExceptionGuard::protect( Functor0 test ) const { ExceptionGuardElement::Context context( test ); return guards_.front()->protect( context ); } } // namespace CppUT |
From: Baptiste L. <bl...@us...> - 2005-02-22 21:27:01
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27352/include/cpput Added Files: exceptionguard.h Removed Files: testfailureguard.h Log Message: * renamed testfailureguard.h/cpp to exceptionguard.h/cpp --- testfailureguard.h DELETED --- --- NEW FILE: exceptionguard.h --- #ifndef CPPUT_TESTFAILUREGUARD_H_INCLUDED # define CPPUT_TESTFAILUREGUARD_H_INCLUDED # include <cpput/forwards.h> # include <cpput/functor.h> # include <deque> /* Tests setUp(), tearDown(), run() call are protected by a ExceptionGuard. * * This guard chain ensures that any exceptions thrown by the call is caught and properly handled. * The default guard chain handles AssertionException (thrown when an assertion fails), * std::exception, and any other exception. * * A ExceptionGuardElement can be added to the guard chain to handle exception type unknown * to the test framework which are not derived from std::exception (MFC CException * for example). */ namespace CppUT { class CPPUT_API ExceptionGuardElement { public: struct Context; virtual ~ExceptionGuardElement() { } void setNextInChain( const ExceptionGuardElementPtr &deleguate ); /// Returns \c false if a failure or a fault occurred, \c true otherwise. virtual bool protect( Context &context ) = 0; protected: bool callNextInChain( Context &context ); private: ExceptionGuardElementPtr deleguate_; }; /** Helpers to provide simple exception translation. */ template<class ExceptionType ,class Translator> class ExceptionTranslatorGuard : public ExceptionGuardElement { public: ExceptionTranslatorGuard( Translator translator ) : translator_( translator ) { } // overridden from ExceptionGuardElement bool protect( Context &context ) { try { return callNextInChain( context ); } catch ( const ExceptionType &e ) { translator_( e ); return false; } } private: Translator translator_; }; /** * @see registerExceptionTranslation() to easily register custom exception translator. */ class CPPUT_API ExceptionGuard { public: ExceptionGuard(); void append( const ExceptionGuardElementPtr &guard ); void removeLast(); bool protect( Functor0 test ) const; private: typedef std::deque<ExceptionGuardElementPtr> Guards; Guards guards_; }; /** Register an exception translator. * @todo provides some helper to generate faul result... * \code * static void translateMFCException( CException *e ) { * TCHAR szCause[255]; * ex.GetErrorMessage(szCause, 255); * CString str( szCause ); * * OpenTest::Properties fault; * fault["type"] = "unexpected exception"; * fault["exception_type"] = "CException"; * fault["message"].append( (const char *)str ); * TestInfo::appendFaultToResult( fault ); * } * \endcode */ template<class Translator ,class ExceptionType> void registerExceptionTranslation( ExceptionGuard &guard, Translator translator, CppTL::Type<ExceptionType> ) { typedef ExceptionTranslatorGuard<ExceptionType,Translator> GuardType; guard.append( ExceptionGuardElementPtr( new GuardType( translator ) ) ); } } // namespace CppUT #endif // CPPUT_TESTFAILUREGUARD_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-02-22 21:15:27
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23938/src/cpput Modified Files: testcase.cpp testfailureguard.cpp Log Message: * simplified TestExceptionGuard implementation * renamed TestExceptionGuardChain to ExceptionGuard * added facility to easily register an exception translator. Index: testfailureguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testfailureguard.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** testfailureguard.cpp 20 Nov 2004 15:26:38 -0000 1.12 --- testfailureguard.cpp 22 Feb 2005 21:14:40 -0000 1.13 *************** *** 5,12 **** namespace CppUT { ! // class TestExceptionGuard // ////////////////////////////////////////////////////////////////// void ! TestExceptionGuard::setNextInChain( const TestExceptionGuardPtr &deleguate ) { deleguate_ = deleguate; --- 5,25 ---- namespace CppUT { ! // class ExceptionGuardElement // ////////////////////////////////////////////////////////////////// + + struct ExceptionGuardElement::Context + { + Context( Functor0 test ) + : test_( test ) + { + } + + Functor0 test_; + }; + + + void ! ExceptionGuardElement::setNextInChain( const ExceptionGuardElementPtr &deleguate ) { deleguate_ = deleguate; *************** *** 15,21 **** bool ! TestExceptionGuard::callNextInChain( Context &context ) { ! return deleguate_->protect( context ); } --- 28,37 ---- bool ! ExceptionGuardElement::callNextInChain( Context &context ) { ! if ( deleguate_ ) ! return deleguate_->protect( context ); ! context.test_(); ! return true; } *************** *** 27,33 **** // catch CppUT::AssertionException, std::exception, ... ! class CPPUT_API StandardTestExceptionGuard : public TestExceptionGuard { ! public: // overridden from TestExceptionGuard bool protect( Context &context ) { --- 43,49 ---- // catch CppUT::AssertionException, std::exception, ... ! class CPPUT_API StandardTestExceptionGuard : public ExceptionGuardElement { ! public: // overridden from ExceptionGuardElement bool protect( Context &context ) { *************** *** 80,155 **** }; - - // class Impl::ExecutorTestExceptionGuard - // ////////////////////////////////////////////////////////////////// - - class ExecutorTestExceptionGuard : public TestExceptionGuard - { - public: // overridden from TestExceptionGuard - bool protect( Context &context ) - { - context.test_(); - return true; - } - }; - } // namespace Impl ! // class TestExceptionGuardChain // ////////////////////////////////////////////////////////////////// ! // Order of the guard in the chain: ! // standard <= always the first to be called ! // user 1 ! // user 2 ! // executor ! ! TestExceptionGuardChain::TestExceptionGuardChain() { ! guards_.push_back( TestExceptionGuardPtr( new Impl::StandardTestExceptionGuard() ) ); ! guards_.push_back( TestExceptionGuardPtr( new Impl::ExecutorTestExceptionGuard() ) ); ! connectChain(); } void ! TestExceptionGuardChain::appendGuard( const TestExceptionGuardPtr &guard ) { guards_.insert( guards_.end()-1, guard ); - connectChain(); } void ! TestExceptionGuardChain::removeLastGuard() { ! if ( guards_.size() <= 2 ) // should we throw an exception ? return; ! guards_.erase( guards_.end() - 2 ); ! connectChain(); } bool ! TestExceptionGuardChain::protect( Functor0 test ) const { ! TestExceptionGuard::Context context( test ); return guards_.front()->protect( context ); } - - void - TestExceptionGuardChain::connectChain() - { - unsigned int length = guards_.size(); - if ( length >= 2 ) - guards_[ length-2 ]->setNextInChain( guards_[ length-1 ] ); - if ( length >= 3 ) - guards_[ length-3 ]->setNextInChain( guards_[ length-2 ] ); - } - - } // namespace CppUT --- 96,138 ---- }; } // namespace Impl ! // class ExceptionGuard // ////////////////////////////////////////////////////////////////// ! ExceptionGuard::ExceptionGuard() { ! guards_.push_back( ExceptionGuardElementPtr( new Impl::StandardTestExceptionGuard() ) ); } void ! ExceptionGuard::append( const ExceptionGuardElementPtr &guard ) { + guard->setNextInChain( ExceptionGuardElementPtr() ); + guards_.back()->setNextInChain( guard ); guards_.insert( guards_.end()-1, guard ); } void ! ExceptionGuard::removeLast() { ! if ( guards_.size() == 1 ) // should we throw an exception ? return; ! guards_.erase( guards_.end() - 1 ); ! guards_.back()->setNextInChain( ExceptionGuardElementPtr() ); } bool ! ExceptionGuard::protect( Functor0 test ) const { ! ExceptionGuardElement::Context context( test ); return guards_.front()->protect( context ); } } // namespace CppUT Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testcase.cpp 20 Nov 2004 15:26:38 -0000 1.6 --- testcase.cpp 22 Feb 2005 21:14:39 -0000 1.7 *************** *** 38,47 **** AbstractTestCase::runTest() { ! TestExceptionGuardChain guardsChain; return runTest( guardsChain ); } bool ! AbstractTestCase::runTest( const TestExceptionGuardChain &guardsChain ) { bool initialized = guardsChain.protect( makeMemFn0( this, --- 38,47 ---- AbstractTestCase::runTest() { ! ExceptionGuard guardsChain; return runTest( guardsChain ); } bool ! AbstractTestCase::runTest( const ExceptionGuard &guardsChain ) { bool initialized = guardsChain.protect( makeMemFn0( this, |
From: Baptiste L. <bl...@us...> - 2005-02-22 21:15:27
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23938/include/cpput Modified Files: forwards.h testcase.h testfailureguard.h Log Message: * simplified TestExceptionGuard implementation * renamed TestExceptionGuardChain to ExceptionGuard * added facility to easily register an exception translator. Index: testcase.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testcase.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testcase.h 20 Nov 2004 15:26:37 -0000 1.6 --- testcase.h 22 Feb 2005 21:14:38 -0000 1.7 *************** *** 21,25 **** /// @warning: TestInfo::startNewTest() must be called before each test ! bool runTest( const TestExceptionGuardChain &guardsChain ); public: // overridden from Test --- 21,25 ---- /// @warning: TestInfo::startNewTest() must be called before each test ! bool runTest( const ExceptionGuard &guardsChain ); public: // overridden from Test Index: testfailureguard.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfailureguard.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** testfailureguard.h 20 Nov 2004 15:26:37 -0000 1.12 --- testfailureguard.h 22 Feb 2005 21:14:39 -0000 1.13 *************** *** 6,10 **** # include <deque> ! /* Tests setUp(), tearDown(), run() call are protected by a TestExceptionGuardChain. * * This guard chain ensures that any exceptions thrown by the call is caught and properly handled. --- 6,10 ---- # include <deque> ! /* Tests setUp(), tearDown(), run() call are protected by a ExceptionGuard. * * This guard chain ensures that any exceptions thrown by the call is caught and properly handled. *************** *** 12,16 **** * std::exception, and any other exception. * ! * A TestExceptionGuard can be added to the guard chain to handle exception type unknown * to the test framework which are not derived from std::exception (MFC CException * for example). */ --- 12,16 ---- * std::exception, and any other exception. * ! * A ExceptionGuardElement can be added to the guard chain to handle exception type unknown * to the test framework which are not derived from std::exception (MFC CException * for example). */ *************** *** 18,39 **** namespace CppUT { ! class CPPUT_API TestExceptionGuard { public: ! virtual ~TestExceptionGuard() ! { ! } ! ! void setNextInChain( const TestExceptionGuardPtr &deleguate ); ! struct Context { ! Context( Functor0 test ) ! : test_( test ) ! { ! } ! Functor0 test_; ! }; /// Returns \c false if a failure or a fault occurred, \c true otherwise. --- 18,31 ---- namespace CppUT { ! class CPPUT_API ExceptionGuardElement { public: ! struct Context; ! virtual ~ExceptionGuardElement() { ! } ! void setNextInChain( const ExceptionGuardElementPtr &deleguate ); /// Returns \c false if a failure or a fault occurred, \c true otherwise. *************** *** 44,71 **** private: ! TestExceptionGuardPtr deleguate_; }; ! class CPPUT_API TestExceptionGuardChain { public: ! TestExceptionGuardChain(); ! void appendGuard( const TestExceptionGuardPtr &guard ); - void removeLastGuard(); ! bool protect( Functor0 test ) const; ! private: ! void connectChain(); private: ! typedef std::deque<TestExceptionGuardPtr> Guards; Guards guards_; }; } // namespace CppUT --- 36,121 ---- private: ! ExceptionGuardElementPtr deleguate_; }; ! /** Helpers to provide simple exception translation. ! */ ! template<class ExceptionType ! ,class Translator> ! class ExceptionTranslatorGuard : public ExceptionGuardElement { public: ! ExceptionTranslatorGuard( Translator translator ) ! : translator_( translator ) ! { ! } ! // overridden from ExceptionGuardElement ! bool protect( Context &context ) ! { ! try ! { ! return callNextInChain( context ); ! } ! catch ( const ExceptionType &e ) ! { ! translator_( e ); ! return false; ! } ! } ! private: ! Translator translator_; ! }; ! /** ! * @see registerExceptionTranslation() to easily register custom exception translator. ! */ ! class CPPUT_API ExceptionGuard ! { ! public: ! ExceptionGuard(); ! void append( const ExceptionGuardElementPtr &guard ); ! ! void removeLast(); ! ! bool protect( Functor0 test ) const; private: ! typedef std::deque<ExceptionGuardElementPtr> Guards; Guards guards_; }; + + /** Register an exception translator. + * @todo provides some helper to generate faul result... + * \code + * static void translateMFCException( CException *e ) { + * TCHAR szCause[255]; + * ex.GetErrorMessage(szCause, 255); + * CString str( szCause ); + * + * OpenTest::Properties fault; + * fault["type"] = "unexpected exception"; + * fault["exception_type"] = "CException"; + * fault["message"].append( (const char *)str ); + * TestInfo::appendFaultToResult( fault ); + * } + * \endcode + */ + template<class Translator + ,class ExceptionType> + void registerExceptionTranslation( ExceptionGuard &guard, + Translator translator, + CppTL::Type<ExceptionType> ) + { + typedef ExceptionTranslatorGuard<ExceptionType,Translator> GuardType; + guard.append( ExceptionGuardElementPtr( new GuardType( translator ) ) ); + } + + } // namespace CppUT Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/forwards.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** forwards.h 18 Nov 2004 09:20:34 -0000 1.11 --- forwards.h 22 Feb 2005 21:14:37 -0000 1.12 *************** *** 24,29 **** class TestResult; class TestExceptionHandler; ! class TestExceptionGuard; ! class TestExceptionGuardChain; class TestInfoData; class TestListener; --- 24,29 ---- class TestResult; class TestExceptionHandler; ! class ExceptionGuardElement; ! class ExceptionGuard; class TestInfoData; class TestListener; *************** *** 33,37 **** typedef CppTL::SharedPtr<Test> TestPtr; ! typedef CppTL::SharedPtr<TestExceptionGuard> TestExceptionGuardPtr; typedef CppTL::SharedPtr<TestInfoData> TestInfoDataPtr; typedef CppTL::SharedPtr<AbstractTestSuite> AbstractTestSuitePtr; --- 33,37 ---- typedef CppTL::SharedPtr<Test> TestPtr; ! typedef CppTL::SharedPtr<ExceptionGuardElement> ExceptionGuardElementPtr; typedef CppTL::SharedPtr<TestInfoData> TestInfoDataPtr; typedef CppTL::SharedPtr<AbstractTestSuite> AbstractTestSuitePtr; |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:30:22
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27805/src/cpput Modified Files: assert.cpp Log Message: * renamed 'message' to 'messages' Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** assert.cpp 20 Nov 2004 15:07:00 -0000 1.6 --- assert.cpp 21 Nov 2004 22:28:54 -0000 1.7 *************** *** 15,19 **** { for ( int index =0; index < message.count(); ++index ) ! TestInfo::currentAssertion()["message"].append( message.at(index) ); TestInfo::realizeAssertion(); } --- 15,19 ---- { for ( int index =0; index < message.count(); ++index ) ! TestInfo::currentAssertion()["messages"].append( message.at(index) ); TestInfo::realizeAssertion(); } |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:30:06
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27744/src/cpputtest Modified Files: testtestcase.cpp Log Message: * fixed failing unit tests Index: testtestcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestcase.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testtestcase.cpp 20 Nov 2004 15:26:38 -0000 1.9 --- testtestcase.cpp 21 Nov 2004 22:28:24 -0000 1.10 *************** *** 150,154 **** CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 0, testRunCall ); --- 150,154 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR_FALSE( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 0, testRunCall ); *************** *** 168,172 **** CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); --- 168,172 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR_FALSE( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); *************** *** 186,190 **** CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); --- 186,190 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR_FALSE( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:28:46
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27566/include/opentest Modified Files: forwards.h texttestdriver.h Log Message: * added reporting of error and fault Index: texttestdriver.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/texttestdriver.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** texttestdriver.h 20 Nov 2004 15:07:00 -0000 1.4 --- texttestdriver.h 21 Nov 2004 22:27:15 -0000 1.5 *************** *** 155,158 **** --- 155,162 ---- std::string getTestPath( TestId test, unsigned int maxParent = -1 ) const; + void reportFailure( const TestResult &testResult, + const Properties &failure, + bool isAssertion ); + TestRunner &runner_; /// Information associated to each test/suite at declaration time *************** *** 472,475 **** --- 476,494 ---- 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() ) *************** *** 492,495 **** --- 511,515 ---- if ( !message.empty() ) std::cout << message << std::endl; + */ std::cout << "Failures: " << failures_.size() << ", "; *************** *** 499,502 **** --- 519,566 ---- + 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; + + std::string 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 + std::string 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 + std::string log = enumLogs.next().asString(); + std::cout << log << std::endl; + } + + std::cout << "Failure tree:" << failure.toString() << std::endl; + } + inline std::string TextTestDriver::getTestPath( TestId test, unsigned int maxParent ) const Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/forwards.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** forwards.h 19 Nov 2004 19:31:38 -0000 1.2 --- forwards.h 21 Nov 2004 22:27:15 -0000 1.3 *************** *** 8,15 **** namespace OpenTest { - class ConstPropertiesAccessor; class Property; class PropertyPath; class Properties; class ResourceList; class TestDeclarator; --- 8,15 ---- namespace OpenTest { class Property; class PropertyPath; class Properties; + class PropertiesAccessor; class ResourceList; class TestDeclarator; |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:28:44
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27414/src/cpput Modified Files: properties.cpp Log Message: * fixed bug in Properties::hasList() * added PropertiesAccessor::listValues() Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** properties.cpp 20 Nov 2004 16:17:33 -0000 1.5 --- properties.cpp 21 Nov 2004 22:26:32 -0000 1.6 *************** *** 697,700 **** --- 697,707 ---- + Properties::ValueEnum + PropertiesAccessor::listValues() const + { + return properties_ ? properties_->listValues() : Properties::ValueEnum(); + } + + unsigned int PropertiesAccessor::listSize() const *************** *** 957,961 **** Properties::hasList() const { ! return listSize() == 0; } --- 964,968 ---- Properties::hasList() const { ! return listSize() > 0; } |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:28:01
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27414/include/opentest Modified Files: properties.h Log Message: * fixed bug in Properties::hasList() * added PropertiesAccessor::listValues() Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** properties.h 20 Nov 2004 16:17:33 -0000 1.8 --- properties.h 21 Nov 2004 22:26:32 -0000 1.9 *************** *** 218,268 **** - /// Helper to navigate the property tree in read-only mode and - /// avoid testing if every single node exist. - class OPENTEST_API PropertiesAccessor - { - public: - PropertiesAccessor( const Properties *properties = 0 ); - - PropertiesAccessor operator[]( unsigned int index ) const; - - PropertiesAccessor operator[]( const PropertyPath &path ) const; - - const Properties &properties() const; - - bool isValid() const; - - bool has( const PropertyPath &path ) const; - - const Property &getProperty( const PropertyPath &path ) const; - - /// If the current node is valid then returns the value of the property - /// named 'name', otherwise returns an empty value. - Value getValue( const PropertyPath &path ) const; - - Value at( unsigned int index ) const; - - /// If current node is valid and has a property named 'name' returns its - /// values, otherwise returns the 'defaultValue'. - Value getValue( const PropertyPath &path, - const Value &defaultValue ) const; - - /// If current node is valid and has a indexed value at the specified - //// index returns its values, otherwise returns the 'defaultValue'. - Value at( unsigned int index, - const Value &defaultValue ) const; - - unsigned int listSize() const; - - bool hasList() const; - - private: - const Properties *properties_; - }; - - /* Properties properties; properties["result"]["status"]["general"] = "pass"; // pass, fail, skip properties["result"]["status"]["detail"] = "success"; properties["result"]["duration"] = 163.5; --- 218,225 ---- /* Properties properties; properties["result"]["status"]["general"] = "pass"; // pass, fail, skip + properties["result/status/general"] = "pass"; // pass, fail, skip properties["result"]["status"]["detail"] = "success"; properties["result"]["duration"] = 163.5; *************** *** 384,387 **** --- 341,391 ---- }; + + + /// Helper to navigate the property tree in read-only mode and + /// avoid testing if every single node exist. + class OPENTEST_API PropertiesAccessor + { + public: + PropertiesAccessor( const Properties *properties = 0 ); + + PropertiesAccessor operator[]( unsigned int index ) const; + + PropertiesAccessor operator[]( const PropertyPath &path ) const; + + const Properties &properties() const; + + bool isValid() const; + + bool has( const PropertyPath &path ) const; + + const Property &getProperty( const PropertyPath &path ) const; + + /// If the current node is valid then returns the value of the property + /// named 'name', otherwise returns an empty value. + Value getValue( const PropertyPath &path ) const; + + Value at( unsigned int index ) const; + + /// If current node is valid and has a property named 'name' returns its + /// values, otherwise returns the 'defaultValue'. + Value getValue( const PropertyPath &path, + const Value &defaultValue ) const; + + /// If current node is valid and has a indexed value at the specified + //// index returns its values, otherwise returns the 'defaultValue'. + Value at( unsigned int index, + const Value &defaultValue ) const; + + Properties::ValueEnum listValues() const; + + unsigned int listSize() const; + + bool hasList() const; + + private: + const Properties *properties_; + }; + } // namespace OpenTest |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:26:22
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27026/include/cpput Modified Files: testrunner.h Log Message: * test result are propagated to the test runner during test Index: testrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testrunner.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testrunner.h 20 Nov 2004 15:06:59 -0000 1.2 --- testrunner.h 21 Nov 2004 22:24:45 -0000 1.3 *************** *** 29,32 **** --- 29,34 ---- private: class TestDeclaratorVisitor; + class TestResultUpdaterImpl; + typedef CppTL::SharedPtr<TestResultUpdaterImpl> TestResultUpdaterImplPtr; void sendTestStatus( const OpenTest::TestPlanEntry &entry, |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:26:06
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27026/src/cpput Modified Files: testrunner.cpp Log Message: * test result are propagated to the test runner during test Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testrunner.cpp 20 Nov 2004 16:17:33 -0000 1.7 --- testrunner.cpp 21 Nov 2004 22:24:46 -0000 1.8 *************** *** 49,57 **** ! /* ! class TestRunner::TestTrackerListener : public TestListener { public: ! TestTrackerListener( OpenTest::TestRunTracker &tracker ) : tracker_( tracker ) , testEntry_( 0 ) --- 49,56 ---- ! class TestRunner::TestResultUpdaterImpl : public TestResultUpdater { public: ! TestResultUpdaterImpl( OpenTest::TestRunTracker &tracker ) : tracker_( tracker ) , testEntry_( 0 ) *************** *** 64,92 **** } ! public: // overridden from TestListener ! void processTestResult( TestResult &result, ! TestContext &context ) { ! if ( !testEntry_ ) ! return; ! ! // Notes: at the current time, we don't retrieve the message ! // in a structured way. => need to change message to use ! // OpenTest::Properties. ! OpenTest::Properties openResult; ! openResult["result"]["status"]["success"] = result.succeeded(); ! openResult["result"]["status"]["type"] = result.resultType(); ! openResult["result"]["status"]["message"] = result.message().toString(); ! if ( result.location().isValid() ) ! { ! OpenTest::Value &openLocation = openResult["result"]["status"]["location"]; ! openLocation["file"] = result.location().fileName(); ! openLocation["line"] = result.location().lineNumber(); ! if ( result.location().hasFunctionName() ) ! openLocation["function"] = result.location().functionName(); ! } ! tracker_.mergeInTestResult( *testEntry_, openResult ); } --- 63,82 ---- } ! // overridden from TestResultUpdater ! void mergeInResult( const OpenTest::Properties &result ) { ! tracker_.mergeInTestResult( *testEntry_, result ); ! } ! void mergeInResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) ! { ! tracker_.mergeInTestResult( *testEntry_, path, value ); ! } ! void appendToResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) ! { ! tracker_.appendToTestResult( *testEntry_, path, value ); } *************** *** 95,99 **** const OpenTest::TestPlanEntry *testEntry_; }; - */ --- 85,88 ---- *************** *** 136,139 **** --- 125,131 ---- { tracker.startTestRun(); + TestResultUpdaterImplPtr resultUpdater( new TestResultUpdaterImpl( tracker ) ); + TestInfo::setTestResultUpdater( CppTL::staticPointerCast<TestResultUpdater>( + resultUpdater ) ); OpenTest::TestPlanEntryPtrEnum enumEntries = testPlan.entries(); *************** *** 141,144 **** --- 133,137 ---- { const OpenTest::TestPlanEntry &entry = *enumEntries.next(); + resultUpdater->setTestPlanEntry( entry ); OpenTest::TestId id = entry.test(); DeclaredTests::const_iterator itTest = tests_.find( id ); |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:24:04
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26626/include/cpput Modified Files: testinfo.h Log Message: * added api for logging Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testinfo.h 20 Nov 2004 15:47:15 -0000 1.6 --- testinfo.h 21 Nov 2004 22:22:24 -0000 1.7 *************** *** 99,102 **** --- 99,104 ---- bool CPPUT_API testHasFailed(); + void CPPUT_API log( const std::string &text ); + void CPPUT_API appendFaultToResult( const OpenTest::Properties &fault ); |
From: Baptiste L. <bl...@us...> - 2004-11-21 22:23:56
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26626/src/cpput Modified Files: testinfo.cpp Log Message: * added api for logging Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testinfo.cpp 20 Nov 2004 15:47:15 -0000 1.6 --- testinfo.cpp 21 Nov 2004 22:22:24 -0000 1.7 *************** *** 82,86 **** assertion["location"]["function"] = assertionLocation_.function_; TestInfo::appendToResult( "assertions", assertion ); // @todo Move appendToResult here ! if ( assertionType_ == abortingAssertion ) { --- 82,87 ---- assertion["location"]["function"] = assertionLocation_.function_; TestInfo::appendToResult( "assertions", assertion ); // @todo Move appendToResult here ! if ( !assertion.has( "failure_type" ) ) ! assertion["failure_type"] = "assertion"; if ( assertionType_ == abortingAssertion ) { *************** *** 220,226 **** } void appendFaultToResult( const OpenTest::Properties &fault ) { ! appendToResult( "faults", fault ); } --- 221,235 ---- } + void log( const std::string &text ) + { + appendToResult( "logs", text ); + } + void appendFaultToResult( const OpenTest::Properties &fault ) { ! OpenTest::Properties actualFault = fault; ! if ( !actualFault.has( "failure_type" ) ) ! actualFault["failure_type"] = "fault"; ! appendToResult( "faults", actualFault ); } |
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 { |
From: Baptiste L. <bl...@us...> - 2004-11-20 16:17:48
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31110/include/cpput Modified Files: test.h Log Message: * added support for test descriptive data Index: test.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/test.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test.h 17 Nov 2004 21:47:09 -0000 1.3 --- test.h 20 Nov 2004 16:17:32 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- # include <cpput/forwards.h> + # include <opentest/properties.h> # include <string> *************** *** 23,27 **** std::string name() const { ! return name_; } --- 24,28 ---- std::string name() const { ! return info().getValue( "configuration/name", "" ).asString(); } *************** *** 30,34 **** void setName( const std::string &name ) { ! name_ = name; } --- 31,47 ---- void setName( const std::string &name ) { ! info()["configuration/name"] = name; ! } ! ! OpenTest::PropertiesAccessor info() const ! { ! return info_.accessor(); ! } ! ! /// @warning You must never change the name of the test after ! /// registering the test or scheduling it for running. ! OpenTest::Properties &info() ! { ! return info_; } *************** *** 47,59 **** Test() { } Test( const std::string &name ) - : name_( name ) { } private: ! std::string name_; }; --- 60,73 ---- Test() { + setName( "<undefined>" ); } Test( const std::string &name ) { + setName( name ); } private: ! OpenTest::Properties info_; }; |
From: Baptiste L. <bl...@us...> - 2004-11-20 16:17:48
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31110/include/opentest Modified Files: properties.h Log Message: * added support for test descriptive data Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** properties.h 20 Nov 2004 15:06:59 -0000 1.7 --- properties.h 20 Nov 2004 16:17:33 -0000 1.8 *************** *** 235,243 **** bool has( const PropertyPath &path ) const; ! const Property &getProperty( const std::string &name ) const; /// If the current node is valid then returns the value of the property /// named 'name', otherwise returns an empty value. ! Value getValue( const std::string &name ) const; Value at( unsigned int index ) const; --- 235,243 ---- bool has( const PropertyPath &path ) const; ! const Property &getProperty( const PropertyPath &path ) const; /// If the current node is valid then returns the value of the property /// named 'name', otherwise returns an empty value. ! Value getValue( const PropertyPath &path ) const; Value at( unsigned int index ) const; *************** *** 245,249 **** /// If current node is valid and has a property named 'name' returns its /// values, otherwise returns the 'defaultValue'. ! Value getValue( const std::string &name, const Value &defaultValue ) const; --- 245,249 ---- /// If current node is valid and has a property named 'name' returns its /// values, otherwise returns the 'defaultValue'. ! Value getValue( const PropertyPath &path, const Value &defaultValue ) const; *************** *** 306,312 **** bool has( const PropertyPath &path ) const; ! const Property &getProperty( const std::string &name ) const; ! const Value &getValue( const std::string &name ) const; const Value &at( unsigned int index ) const; --- 306,312 ---- bool has( const PropertyPath &path ) const; ! const Property &getProperty( const PropertyPath &path ) const; ! const Value &getValue( const PropertyPath &path ) const; const Value &at( unsigned int index ) const; *************** *** 368,371 **** --- 368,373 ---- PropertyList::const_iterator find( const std::string &name ) const; + PropertyList::const_iterator resolvePath( const PropertyPath &path ) const; + Properties *tryGetProperties( const PropertyPath &path ); |