cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 6)
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: Steven R. <sm...@us...> - 2007-01-12 05:27:08
|
Update of /cvsroot/cppunit/cppunit/examples/hierarchy In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23758/examples/hierarchy Modified Files: Makefile.am main.cpp Log Message: Fix examples/hierarchy to actually return the result of the tests. It is expected to fail, so mark it using XFAIL_TESTS in Makefile.am. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/hierarchy/main.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** main.cpp 14 Jul 2002 19:48:31 -0000 1.12 --- main.cpp 12 Jan 2007 05:27:05 -0000 1.13 *************** *** 16,23 **** runner.addTest( ChessTest<Chess>::suite() ); ! bool wasSucessful = runner.run(); ! // should be: ! // return wasSuccessful ? 0 : 1; ! return 0; } --- 16,21 ---- runner.addTest( ChessTest<Chess>::suite() ); ! bool wasSuccessful = runner.run(); ! return wasSuccessful ? 0 : 1; } Index: Makefile.am =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/hierarchy/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile.am 7 May 2003 20:07:16 -0000 1.9 --- Makefile.am 12 Jan 2007 05:27:05 -0000 1.10 *************** *** 2,5 **** --- 2,7 ---- TESTS = hierarchy + XFAIL_TESTS = hierarchy + check_PROGRAMS = $(TESTS) |
From: Steven R. <sm...@us...> - 2007-01-12 04:51:35
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12254 Modified Files: ChangeLog Makefile.am Log Message: Do not fail dist-hook if $(distdir)/lib exists. Index: Makefile.am =================================================================== RCS file: /cvsroot/cppunit/cppunit/Makefile.am,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Makefile.am 28 Jul 2006 05:45:21 -0000 1.37 --- Makefile.am 12 Jan 2007 04:51:31 -0000 1.38 *************** *** 49,53 **** cp -dpR $(top_srcdir)/examples/msvc6 $(distdir)/examples cp -dpR $(top_srcdir)/examples/qt $(distdir)/examples ! mkdir $(distdir)/lib find $(distdir) -name CVS | xargs rm -rf perl -pi -e 's/\n/\r\n/g' `find $(distdir) -name '*.ds?'` \ --- 49,53 ---- cp -dpR $(top_srcdir)/examples/msvc6 $(distdir)/examples cp -dpR $(top_srcdir)/examples/qt $(distdir)/examples ! test -d $(distdir)/lib || mkdir $(distdir)/lib find $(distdir) -name CVS | xargs rm -rf perl -pi -e 's/\n/\r\n/g' `find $(distdir) -name '*.ds?'` \ Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.252 retrieving revision 1.253 diff -C2 -d -r1.252 -r1.253 *** ChangeLog 12 Jan 2007 04:26:36 -0000 1.252 --- ChangeLog 12 Jan 2007 04:51:31 -0000 1.253 *************** *** 1,4 **** --- 1,7 ---- 2007-01-11 Steve M. Robbins <sm...@su...> + * Makefile.am (dist-hook): Don't fail if $(distdir)/lib already + exists. + * config/bb_enable_doxygen.m4 (BB_ENABLE_DOXYGEN): Add quotes around function name, BB_ENABLE_DOXYGEN. |
From: Steven R. <sm...@us...> - 2007-01-12 04:37:37
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6958 Modified Files: .cvsignore Log Message: Add cppunit.pc Index: .cvsignore =================================================================== RCS file: /cvsroot/cppunit/cppunit/.cvsignore,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** .cvsignore 15 Jul 2005 19:11:07 -0000 1.7 --- .cvsignore 12 Jan 2007 04:37:33 -0000 1.8 *************** *** 11,12 **** --- 11,13 ---- SunWS_cache ir.out + cppunit.pc |
From: Steven R. <sm...@us...> - 2007-01-12 04:26:40
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2839 Modified Files: ChangeLog Log Message: Add quotes around autoconf macro name, BB_ENABLE_DOXYGEN. Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.251 retrieving revision 1.252 diff -C2 -d -r1.251 -r1.252 *** ChangeLog 26 Oct 2006 07:21:12 -0000 1.251 --- ChangeLog 12 Jan 2007 04:26:36 -0000 1.252 *************** *** 1,2 **** --- 1,7 ---- + 2007-01-11 Steve M. Robbins <sm...@su...> + + * config/bb_enable_doxygen.m4 (BB_ENABLE_DOXYGEN): Add quotes + around function name, BB_ENABLE_DOXYGEN. + 2006-10-26 Baptiste Lepilleur <bl...@us...> * include/cppunit/TestResult.h: |
From: Steven R. <sm...@us...> - 2007-01-12 04:26:39
|
Update of /cvsroot/cppunit/cppunit/config In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2839/config Modified Files: bb_enable_doxygen.m4 Log Message: Add quotes around autoconf macro name, BB_ENABLE_DOXYGEN. Index: bb_enable_doxygen.m4 =================================================================== RCS file: /cvsroot/cppunit/cppunit/config/bb_enable_doxygen.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bb_enable_doxygen.m4 15 Jul 2005 17:56:01 -0000 1.4 --- bb_enable_doxygen.m4 12 Jan 2007 04:26:36 -0000 1.5 *************** *** 1,3 **** ! AC_DEFUN(BB_ENABLE_DOXYGEN, [ AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (auto)]) --- 1,3 ---- ! AC_DEFUN([BB_ENABLE_DOXYGEN], [ AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (auto)]) |
From: Baptiste L. <bl...@us...> - 2006-10-26 07:21:17
|
Update of /cvsroot/cppunit/cppunit/include/cppunit/ui/qt In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13593/include/cppunit/ui/qt Modified Files: Config.h Log Message: - fixed some compilation issues for QtTestRunner. Index: Config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/include/cppunit/ui/qt/Config.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Config.h 10 Apr 2002 15:21:24 -0000 1.1 --- Config.h 26 Oct 2006 07:21:13 -0000 1.2 *************** *** 19,21 **** ! #endif // CPPUNIT_QTUI_CONFIG_H \ No newline at end of file --- 19,21 ---- ! #endif // CPPUNIT_QTUI_CONFIG_H |
From: Baptiste L. <bl...@us...> - 2006-10-26 07:21:17
|
Update of /cvsroot/cppunit/cppunit/include/cppunit In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13593/include/cppunit Modified Files: TestResult.h Log Message: - fixed some compilation issues for QtTestRunner. Index: TestResult.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/include/cppunit/TestResult.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** TestResult.h 29 Aug 2002 22:26:01 -0000 1.22 --- TestResult.h 26 Oct 2006 07:21:12 -0000 1.23 *************** *** 11,14 **** --- 11,15 ---- #include <cppunit/SynchronizedObject.h> #include <cppunit/portability/CppUnitDeque.h> + #include <string> CPPUNIT_NS_BEGIN |
From: Baptiste L. <bl...@us...> - 2006-10-26 07:21:17
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13593 Modified Files: ChangeLog NEWS Log Message: - fixed some compilation issues for QtTestRunner. Index: NEWS =================================================================== RCS file: /cvsroot/cppunit/cppunit/NEWS,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** NEWS 29 Jun 2006 21:11:30 -0000 1.97 --- NEWS 26 Oct 2006 07:21:12 -0000 1.98 *************** *** 1,2 **** --- 1,7 ---- + New in CppUnit 1.12.1: + ---------------------- + + * Portability: fixed some compilation issue for QtTestRunner. + New in CppUnit 1.12.0: ---------------------- Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.250 retrieving revision 1.251 diff -C2 -d -r1.250 -r1.251 *** ChangeLog 28 Jul 2006 05:53:50 -0000 1.250 --- ChangeLog 26 Oct 2006 07:21:12 -0000 1.251 *************** *** 1,2 **** --- 1,6 ---- + 2006-10-26 Baptiste Lepilleur <bl...@us...> + * include/cppunit/TestResult.h: + * include/cppunit/ui/Config.h: fixed compilation issues with QtTestRunner. + 2006-06-29 Baptiste Lepilleur <bl...@us...> * Makefile.am: |
From: Baptiste L. <bl...@us...> - 2006-09-07 22:45:55
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2344/doc Modified Files: cpput.dox doxyfile.in header.html Added Files: coding_guidelines.dox Log Message: - started adding coding guidelines. --- NEW FILE: coding_guidelines.dox --- /** \page coding_guidelines Coding Guidelines <hr> \section cg_naming_convention Naming convention \subsection cg_definition Definition: Capitalized First Letter convention (camel case) This convention is used for most naming, and will be referred to as camel case convention. The name is in mixed case, with the first letter of each word in upper case, and the other in lower case. Acronym (example: DLL = Dynamically Linked Library) are in upper case. Unless stated otherwise, those identifiers should not contain any <tt>'_'</tt>. This convention has two main variants: first letter of the name in lower case, and first letter of the name in upper case. If the first letter is part of an acronym, then the acronym is in the same case as the first letter. Example: <table> <tr><td><b>First letter in upper case</b></td><td><b>First letter in lower case</b></td></tr> <tr><td><tt>TestCase</tt></td><td><tt>testCase</tt></td></tr> <tr><td><tt>DLLLoader</tt></td><td><tt>dllLoader</tt></td></tr> </table> \subsection cg_filename File name File name should be in lower case and File name should not contain any _. File names should be named after the feature they provide. File extensions: <tt>.cpp</tt> for C++ source file <tt>.h/.inl</tt> for C++ headers. Rational: avoid case issues for case sensitive filesystem, corrupting CVS repository when attempting to change file name case on buggy client. Example : \code testcase.c // OK testcase.h // OK testcase.inl // OK resource.c // OK test_case.c // BAD TestCase.c // BAD TestCase.h // BAD TestCase.C // BAD \endcode \subsection cg_cppidentifiers C++ identifiers <DIV class='cg_rule'> <b>Rules:</b> no identifier must contain two underscores <tt>'__'</tt> or starts with a single underscore <tt>'_'</tt>. Identifiers may only contains the following characters: <tt>a..z, A..Z, 0..9</tt>. The usage of <tt>'$'</tt> is forbidden. </DIV> Rationale: such usage of underscore is reserved by the C++ standard. Notes: - C++ compiler usually decorates identifiers using <tt>'__'</tt>, therefore using <tt>'__'</tt> might result in (silent) linking issues. - run-time libraries frequently use macros starting with <tt>'_'</tt> for their implementation. \subsection cg_macro Macro names <DIV class='cg_rule'> <b>Rules:</b> Macro name must be completely in upper case, with words separated by an underscore _. Macro name should also be prefixed with a library or application name. This prefix serves as namespace and help avoiding conflicts. </DIV> The following prefix should be used: <table> <tr><td><b>Library</b></td><td><b>Prefix</b><td></tr> <tr><td>CppUnit 2</td><td>CPPUT_<td></tr> <tr><td>CppTL (CppUnit Tool Library)</td><td>CPPTL_<td></tr> <tr><td>JsonCpp</td><td>JSON_<td></tr> <tr><td>OpenTest</td><td>OPENTEST_<td></tr> </table> Rationale: macro substitution occurs at preprocessing time without regards to namespace. Prefixing macro names help makes them unique and avoid clash between libraries. The naming conventions are such that no C++ identifier should have a name similar to a macro name. This conventions is widely adopted across all C++ naming conventions, meaning that it also help avoid conflicts with third-parties. \subsection cg_class Class names <DIV class='cg_rule'> <b>Rules:</b> Class name must be in camel case, starting with an upper case letter. </DIV> Rationale: defined by java standard naming convention, and a widely spread C++ convention as well. Identifiers starting with an upper case are used to identify Type identifiers (enum, class...) Example: \code Test TestCase ExceptionGuard \endcode \subsection cg_attributes Class attributes <DIV class='cg_rule'> <b>Rules:</b> attribute names must be in camel case starting with a lower case letter and suffixed with an underscore <tt>'_'</tt>. </DIV> Rationale: defined by java standard naming convention, and a widely spread C++ convention as well. Identifiers starting with a lower case are used to identify value identifiers (attribute, variable...) Example: \code int size_; double timeOut_; LightTestRunner runner_; \endcode \subsection cg_memfn Member function names <DIV class='cg_rule'> <b>Rules:</b> member function names must be in camel case, starting with a lower case. The name should contains a verb and be structured in such a way that it can be read naturally. </DIV> Rationale: This is a widely spread convention in the Java and C++ community. Recommendation: when overriding virtual function, specify in which inherited class the virtual function is defined: Example: \code void addChild( const std::string &parentSuiteName, const std::string &childSuiteName ); bool removeChild( const std::string &parentSuiteName, const std::string &childSuiteName ); TestFactoryId add( const std::string &parentSuiteName, const TestFactory &testFactory ); class OPENTEST_API TestRunnerServer : public RemoteMessageServer , private TestRunnerListener { public: TestRunnerServer( TestRunnerInterface &impl ); void attachTransport( const MessageTransportPtr &transport ); public: // overridden from RemoteMessageServer void dispatchPendingMessages( const RemoteMessagePtr &message, MessageTransport &transport ); public: // overridden from TestRunnerListener virtual void testRunStarted( TestRunId testRunId ); virtual void testRunDone( TestRunId testRunId ); virtual void startTesting( TestPlanId testPlanId ); virtual void doneTesting( TestPlanId testPlanId, const ResultStatus &status ); private: // ... }; \endcode \subsection cg_enum Enumeration type <DIV class='cg_rule'> <b>Rules:</b> enumeration type name must be in camel case, starting with an upper case. </DIV> Rationale: avoid potential clash with macro. Example: \code enum ParameterRequirement { noParameter, optionalParameter, requiredParameter, oneOrMoreParameter, zeroOrMoreParameter }; \endcode \subsection cg_localvar Local variables and function parameters <DIV class='cg_rule'> <b>Rules:</b> local variable and function parameters must be in camel case, starting with a lower case. Name should be intention revealing name, that is indicating what is the use of the variable/parameter rather than indicating what the variable/parameter is. </DIV> Rationale: avoid ambiguity in declaration between type and variable name. Example: \code bool parse( const std::string &document, Value &root, bool collectComments = true ); \endcode <hr> \section cg_styleguide Style Guide The following style should be used when writing code: - Indent size: 3 spaces - No tabulations, only spaces (code editor must be configured this way) - Max line length around 95 characters. General code layout: - space inside braces in function call and condition - curly brace should be aligned with keyword initiating the block statement. - only one variable declaration per statements. - one member initialization per line in constructor, comma aligned with colon in case of multiple member initializations. - at least one line (preferably two) to separate free/member function definitions. - return type in function definitions should be \code // An example of constructor TestCase::TestCase( const CppTL::Functor0 &setUp, const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, const std::string &name ) : AbstractTestCase( name ) , setUp_( setUp ) , run_( run ) , tearDown_( tearDown ) { } // An example of member function definition bool Reader::readComment() { Location commentBegin = current_ - 1; Char c = getNextChar(); bool successful = false; if ( c == '*' ) successful = readCStyleComment(); else if ( c == '/' ) successful = readCppStyleComment(); if ( !successful ) return false; if ( collectComments_ ) { CommentPlacement placement = commentBefore; if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) ) { if ( c != '*' || !containsNewLine( commentBegin, current_ ) ) placement = commentAfterOnSameLine; } addComment( commentBegin, current_, placement ); } return true; } \endcode <hr> \section cg_guidelines Guidelines - config.h included in all headers (may be indirectly) - DLL macros - Forwards all classes and typedef in forwards.h - RAII - standard interfaces, but CppTL::ConstString as attribute to ensure thread-safety. - no member function template (use free function instead) - no cast style function template, use CppTL::Type instead (link issue with VC6) - use assertions to check precondition (or intermediate condition in complex algorithm) */ Index: doxyfile.in =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/doxyfile.in,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** doxyfile.in 2 Sep 2006 13:53:41 -0000 1.2 --- doxyfile.in 7 Sep 2006 22:45:50 -0000 1.3 *************** *** 27,31 **** INHERIT_DOCS = YES TAB_SIZE = 3 ! ALIASES = OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO --- 27,35 ---- INHERIT_DOCS = YES TAB_SIZE = 3 ! ALIASES = "testCaseSetup=\link CppUT::AbstractTestCase::setUp() setUp()\endlink" \ ! "testCaseRun=\link CppUT::AbstractTestCase::run() run()\endlink" \ ! "testCaseTearDown=\link CppUT::AbstractTestCase::tearDown() tearDown()\endlink" \ ! "json_ref=<a HREF='http://www.json.org/'>JSON (JavaScript Object Notation)</a>" ! OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO *************** *** 74,78 **** # configuration options related to the input files #--------------------------------------------------------------------------- ! INPUT = ../include/cpptl ../include/cpput ../include/json ../src/cpptl ../src/cpput ./fake_stl . # ../src/opentest ../include/opentest FILE_PATTERNS = *.h *.cpp *.inl *.dox --- 78,82 ---- # configuration options related to the input files #--------------------------------------------------------------------------- ! INPUT = custom.css ../include/cpptl ../include/cpput ../include/json ../src/cpptl ../src/cpput ./fake_stl . # ../src/opentest ../include/opentest FILE_PATTERNS = *.h *.cpp *.inl *.dox *************** *** 107,111 **** HTML_HEADER = header.html HTML_FOOTER = footer.html ! #HTML_STYLESHEET = #HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO --- 111,115 ---- HTML_HEADER = header.html HTML_FOOTER = footer.html ! HTML_STYLESHEET = #HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO Index: cpput.dox =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/cpput.dox,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cpput.dox 2 Sep 2006 22:08:48 -0000 1.5 --- cpput.dox 7 Sep 2006 22:45:50 -0000 1.6 *************** *** 3,6 **** --- 3,7 ---- \ref cpput_todo. + \ref coding_guidelines. \section _warning WARNING Index: header.html =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/header.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** header.html 6 Mar 2006 07:46:58 -0000 1.1 --- header.html 7 Sep 2006 22:45:50 -0000 1.2 *************** *** 4,7 **** --- 4,15 ---- <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> + <style type='text/css'> + .cg_rule { + background-color:grey; + border-style:solid; + border-width:2px; + padding-left: 0.5ex; + } + </style> </head><body> <table width="100%"> |
From: Baptiste L. <bl...@us...> - 2006-09-07 06:43:34
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30932/include/cpptl Modified Files: _stlimpl.h Log Message: - fixed compilation issue on linux. Index: _stlimpl.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/_stlimpl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _stlimpl.h 5 Sep 2006 21:41:29 -0000 1.2 --- _stlimpl.h 7 Sep 2006 06:42:59 -0000 1.3 *************** *** 3,7 **** # include "config.h" ! // add include for malloc/free /* --- 3,7 ---- # include "config.h" ! # include <stdlib.h> /* |
From: Baptiste L. <bl...@us...> - 2006-09-06 19:23:33
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3345 Modified Files: sconstruct Log Message: - made atomic counter copyable - added implementation of CPPTL_ assertions. - fixed wrong assertions in smallmap.h - fixed buggy iterator usage in smallmaptest. - no longer require a library to use cpptl threads. Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** sconstruct 1 Sep 2006 19:51:22 -0000 1.29 --- sconstruct 6 Sep 2006 19:23:26 -0000 1.30 *************** *** 1,2 **** --- 1,12 ---- + # Todo: + # - Check for min Scons versio (0.96.90) + # - doxygen generation does not work on Linux + # - need to detect path and availability of DOT tool when generating doc. + # - revisit doxygen generationg using DynamicSourceGenerator + # http://www.scons.org/wiki/DynamicSourceGenerator + # (see Gary mail on the user ML 19/07/2006 @ 17h25) + + + import os import os.path |
From: Baptiste L. <bl...@us...> - 2006-09-06 19:23:32
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3345/src/cpputtest Modified Files: smallmaptest.cpp Log Message: - made atomic counter copyable - added implementation of CPPTL_ assertions. - fixed wrong assertions in smallmap.h - fixed buggy iterator usage in smallmaptest. - no longer require a library to use cpptl threads. Index: smallmaptest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/smallmaptest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** smallmaptest.cpp 5 Jun 2006 12:09:26 -0000 1.1 --- smallmaptest.cpp 6 Sep 2006 19:23:26 -0000 1.2 *************** *** 28,33 **** for ( int generator = minSeed; generator < maxSeed; ++generator ) sm.insert( IntInt( generator, generator * 101 ) ); ! sm.erase( sm.begin() + beginRange - minSeed, ! sm.begin() + endRange - minSeed); for ( int checker = minSeed; checker < maxSeed; ++checker ) { --- 28,33 ---- for ( int generator = minSeed; generator < maxSeed; ++generator ) sm.insert( IntInt( generator, generator * 101 ) ); ! sm.erase( sm.begin() + (beginRange - minSeed), ! sm.begin() + (endRange - minSeed)); for ( int checker = minSeed; checker < maxSeed; ++checker ) { *************** *** 47,51 **** for ( int generator = minSeed; generator < maxSeed; ++generator ) sm.insert( IntInt( generator, generator * 101 ) ); ! sm.erase( sm.begin() + value - minSeed ); for ( int checker = minSeed; checker < maxSeed; ++checker ) { --- 47,51 ---- for ( int generator = minSeed; generator < maxSeed; ++generator ) sm.insert( IntInt( generator, generator * 101 ) ); ! sm.erase( sm.begin() + (value - minSeed) ); for ( int checker = minSeed; checker < maxSeed; ++checker ) { |
From: Baptiste L. <bl...@us...> - 2006-09-06 19:23:31
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3345/include/cpptl Modified Files: atomiccounter.h config.h intrusiveptr.h smallmap.h stringtools.h Added Files: thread.inl Log Message: - made atomic counter copyable - added implementation of CPPTL_ assertions. - fixed wrong assertions in smallmap.h - fixed buggy iterator usage in smallmaptest. - no longer require a library to use cpptl threads. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** config.h 9 Nov 2005 22:03:56 -0000 1.21 --- config.h 6 Sep 2006 19:23:26 -0000 1.22 *************** *** 208,212 **** /////////////////////////////////////////////////////////////////////////// ! # define CPPTL_ASSERT_MESSAGE( cond, message ) \ (void)(0) --- 208,212 ---- /////////////////////////////////////////////////////////////////////////// ! #ifdef NDEBUG # define CPPTL_ASSERT_MESSAGE( cond, message ) \ (void)(0) *************** *** 214,218 **** --- 214,225 ---- # define CPPTL_DEBUG_ASSERT_UNREACHABLE \ (void)(0) + #else + # include <assert.h> + # define CPPTL_ASSERT_MESSAGE( cond, message ) \ + assert( (cond) && message ) + # define CPPTL_DEBUG_ASSERT_UNREACHABLE \ + assert( false && "unreachable code" ) + #endif namespace CppTL { Index: smallmap.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/smallmap.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** smallmap.h 5 Sep 2006 21:41:30 -0000 1.2 --- smallmap.h 6 Sep 2006 19:23:26 -0000 1.3 *************** *** 120,127 **** void advance( difference_type n ) { ! CPPTL_ASSERT_MESSAGE( map_ && map_->size_ && ! ( current_+n < map_->data_ + map_->size_ && current_+n >= map_->data_), ! "SmallMapIterator::advance: advancing beyond end or beginning" ); ! current_ += n; } --- 120,130 ---- void advance( difference_type n ) { ! if ( n != 0 ) ! { ! CPPTL_ASSERT_MESSAGE( map_ && map_->size_ && ! ( current_+n <= map_->data_ + map_->size_ && current_+n >= map_->data_), ! "SmallMapIterator::advance: advancing beyond end or beginning" ); ! current_ += n; ! } } --- NEW FILE: thread.inl --- #include <cpptl/thread.h> #include <vector> #if CPPTL_HAS_THREAD # ifdef CPPTL_USE_WIN32_THREAD # if !defined(APIENTRY) # undef NOMINMAX # define WIN32_LEAN_AND_MEAN # define NOGDI # define NOUSER # define NOKERNEL # define NOSOUND # define NOMINMAX # define BLENDFUNCTION void // for mingw & gcc # include <windows.h> # endif # elif defined(CPPTL_USE_PTHREAD_THREAD) # include <pthread.h> # endif // # elif defined(CPPTL_USE_PTHREAD_THREAD) #endif // Notes concerning threading implementation: // CppUnit need has very few thread-safety, hence the implementation of the threading // API need not to be highly performant. // // But, the ThreadLocalStorage should not use lock for each get/set (locking when creating // the variable in a new thread is ok though). ThreadLocalStorage is use by assertions // and this would therefore decrease the actually concurrency of the threads using assertions. namespace CppTL { // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // No Thread API // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// #if !(CPPTL_HAS_THREAD) Mutex::Mutex() { } Mutex::~Mutex() { } void Mutex::lock() { } void Mutex::unlock() { } #else // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // Common Thread API implementation // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class ThreadExitHandler // ////////////////////////////////////////////////////////////////////// namespace Impl { class ThreadExitHandler : public NonCopyable { public: static ThreadExitHandler &instance() { // This static is instantiated at static construction time // so it's thread-safe static ThreadExitHandler handler; return handler; } ThreadExitHandler() : magic1_( 0x1a9cd67f ) // magic number are used to protect against , magic2_( 0x3e4a3c9d ) // possible race condition on shutdown. { } ~ThreadExitHandler() { Mutex::ScopedLockGuard guard( lock_ ); while ( !handlers_.empty() ) { handlers_.begin()->first(); handlers_.erase( handlers_.begin() ); } magic1_ = 0xdeadbeef; magic2_ = 0xdeadbeef; } void add( const Functor0 &handler, const void *tag ) { if ( !isValid() ) return; Mutex::ScopedLockGuard guard( lock_ ); Handlers::iterator it = find( tag ); if ( it == handlers_.end() ) handlers_.push_back( HandlerInfo( handler, tag ) ); else *it = HandlerInfo( handler, tag ); } void remove( const void *tag ) { if ( !isValid() ) return; Mutex::ScopedLockGuard guard( lock_ ); Handlers::iterator it = find( tag ); if ( it != handlers_.end() ) { it->first(); handlers_.erase( it ); } } void process() { if ( !isValid() ) return; Mutex::ScopedLockGuard guard( lock_ ); Handlers::iterator it = handlers_.begin(); for ( ; it != handlers_.end(); ++it ) it->first(); } private: typedef std::pair<Functor0,const void *> HandlerInfo; typedef std::vector<HandlerInfo> Handlers; Handlers::iterator find( const void *tag ) { Handlers::iterator it = handlers_.begin(); for ( ; it != handlers_.end(); ++it ) if ( it->second == tag ) return it; return handlers_.end(); } bool isValid() const { return magic1_ == 0x1a9cd67f && magic2_ == 0x3e4a3c9d; } Handlers handlers_; Mutex lock_; unsigned int magic1_; unsigned int magic2_; }; } // namespace Impl class ThreadExitHandlerInitializer { public: ThreadExitHandlerInitializer() { Impl::ThreadExitHandler::instance(); } }; // This force a call to ThreadExitHandler::instance(), // and ensure it is properly initialized. static ThreadExitHandlerInitializer threadExitInitializer; inline void addThreadExitHandler( const Functor0 &handler, const void *tag ) { Impl::ThreadExitHandler::instance().add( handler, tag ); } inline void removeThreadExitHandler( const void *tag ) { Impl::ThreadExitHandler::instance().remove( tag ); } /// This fonction must be called at the end of each thread /// to ensure ThreadLocalStorage are properly cleaned-up. inline void processThreadExitHandlers() { Impl::ThreadExitHandler::instance().process(); } # if CPPTL_USE_WIN32_THREAD // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // Thread API for WIN32 // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class Mutex (win32) // ////////////////////////////////////////////////////////////////////// Mutex::Mutex() : data_( 0 ) { CRITICAL_SECTION *cs = new CRITICAL_SECTION(); ::InitializeCriticalSection( cs ); data_ = cs; } Mutex::~Mutex() { CRITICAL_SECTION *cs = static_cast<CRITICAL_SECTION *>( data_ ); if ( cs ) ::DeleteCriticalSection( cs ); delete cs; } void Mutex::lock() { CRITICAL_SECTION *cs = static_cast<CRITICAL_SECTION *>( data_ ); ::EnterCriticalSection( cs ); } void Mutex::unlock() { CRITICAL_SECTION *cs = static_cast<CRITICAL_SECTION *>( data_ ); ::LeaveCriticalSection( cs ); } // class Impl::RawThreadStorage (win32) // ////////////////////////////////////////////////////////////////////// namespace Impl { class RawThreadStorage { public: RawThreadStorage( const CppTL::Functor1<void *> &deallocator ) : deallocator_( deallocator ) { tlsIndex_ = ::TlsAlloc(); // if ( tlsIndex_ == TLS_OUT_OF_INDEXES ) // failed. // Can't throw exception => during static initialization... addThreadExitHandler( memfn0( this, &RawThreadStorage::onThreadExit ), this ); } ~RawThreadStorage() { removeThreadExitHandler( this ); ::TlsFree( tlsIndex_ ); } void onThreadExit() { deallocator_( getRawThreadStorage( this ) ); setRawThreadStorage( this, 0 ); } CppTL::Functor1<void *> deallocator_; DWORD tlsIndex_; }; RawThreadStorage *createRawThreadStorage( const CppTL::Functor1<void *> &deallocator ) { return new RawThreadStorage( deallocator ); } void freeRawThreadStorage( RawThreadStorage *storage ) { delete storage; } void *getRawThreadStorage( RawThreadStorage *storage ) { // @todo assert if NULL return ::TlsGetValue( storage->tlsIndex_ ); } void setRawThreadStorage( RawThreadStorage *storage, void *value ) { if ( ::TlsSetValue( storage->tlsIndex_, value ) == 0 ) { // @todo handle failure } } } // namespace Impl # elif defined(CPPTL_USE_PTHREAD_THREAD) // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // Thread API for PTHREAD // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class Mutex (pthread) // ////////////////////////////////////////////////////////////////////// Mutex::Mutex() : data_( 0 ) { pthread_mutex_t *mutex = new pthread_mutex_t(); if ( pthread_mutex_init( mutex, 0 ) != 0 ) { // initialization error } data_ = mutex; } Mutex::~Mutex() { pthread_mutex_t *mutex = static_cast<pthread_mutex_t *>( data_ ); if ( mutex ) pthread_mutex_destroy( mutex ); delete mutex; } void Mutex::lock() { pthread_mutex_t *mutex = static_cast<pthread_mutex_t *>( data_ ); if ( pthread_mutex_lock( mutex ) != 0 ) { // @todo error } } void Mutex::unlock() { pthread_mutex_t *mutex = static_cast<pthread_mutex_t *>( data_ ); if ( pthread_mutex_unlock( mutex ) != 0 ) { // @todo error } } // class Impl::ThreadLocalStorageImpl (pthread) // ////////////////////////////////////////////////////////////////////// namespace Impl { class RawThreadStorage { public: RawThreadStorage( const CppTL::Functor1<void *> &deallocator ) : deallocator_( deallocator ) { if ( pthread_key_create( &key_, 0 ) != 0 ) { // error: Can't throw exception => during static initialization } addThreadExitHandler( memfn0( this, &RawThreadStorage::onThreadExit ), this ); } ~RawThreadStorage() { removeThreadExitHandler( this ); if ( pthread_key_delete( key_ ) != 0 ) { // error: can't throw exception, during static uninitialization } } void onThreadExit() { deallocator_( getRawThreadStorage( this ) ); setRawThreadStorage( this, 0 ); } CppTL::Functor1<void *> deallocator_; pthread_key_t key_; }; RawThreadStorage *createRawThreadStorage( const CppTL::Functor1<void *> &deallocator ) { return new RawThreadStorage( deallocator ); } void freeRawThreadStorage( RawThreadStorage *storage ) { delete storage; } void *getRawThreadStorage( RawThreadStorage *storage ) { // @todo assert if NULL return pthread_getspecific( storage->key_ ); } void setRawThreadStorage( RawThreadStorage *storage, void *value ) { if ( pthread_setspecific( storage->key_, value ) != 0 ) { // @todo handle failure } } } // namespace Impl # endif // # elif defined(CPPTL_USE_PTHREAD_THREAD) #endif // #ifdef CPPTL_HAS_THREAD } // namespace CppTL Index: stringtools.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/stringtools.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** stringtools.h 1 Feb 2006 18:26:16 -0000 1.9 --- stringtools.h 6 Sep 2006 19:23:26 -0000 1.10 *************** *** 283,305 **** // need to expose some of those utility functions... ! inline CppTL::ConstString escape( const CppTL::ConstString &text, CppTL::StringBuffer &escaped, const char *newLineEscape = "\\n" ) { ! CppTL::ConstString::const_iterator it = text.begin(); ! while ( it != text.end() ) ! escape( *it++, escaped, newLineEscape ); ! return escaped; } inline CppTL::ConstString ! quoteString( const CppTL::ConstString &text, ! const char *newLineEscape = "\\n" ) { ! CppTL::StringBuffer escaped( size_type(text.length() * 1.2) + 64 ); escaped += CppTL::ConstCharView( "\"", 1 ); ! escape(text, escaped, newLineEscape ); escaped += CppTL::ConstCharView( "\"", 1 ); return escaped; --- 283,313 ---- // need to expose some of those utility functions... ! inline void ! escapeRange( const char *first, ! const char *last, ! CppTL::StringBuffer &escaped, ! const char *newLineEscape = "\\n" ) ! { ! while ( first != last ) ! escape( *first++, escaped, newLineEscape ); ! } ! ! inline void escape( const CppTL::ConstString &text, CppTL::StringBuffer &escaped, const char *newLineEscape = "\\n" ) { ! escapeRange( text.c_str(), text.c_str() + text.length(), escaped ); } inline CppTL::ConstString ! quoteStringRange( const char *first, ! const char *last, ! const char *newLineEscape = "\\n" ) { ! CppTL::StringBuffer escaped( size_type((last-first) * 1.2) + 64 ); escaped += CppTL::ConstCharView( "\"", 1 ); ! escapeRange(first, last, escaped, newLineEscape ); escaped += CppTL::ConstCharView( "\"", 1 ); return escaped; *************** *** 308,311 **** --- 316,335 ---- inline CppTL::ConstString + quoteString( const CppTL::ConstString &text, + const char *newLineEscape = "\\n" ) + { + return quoteStringRange( text.c_str(), text.c_str() + text.length() ); + } + + + inline CppTL::ConstString + quoteMultiLineStringRange( const char *first, + const char *last ) + { + return quoteStringRange( first, last, "\\n\n" ); + } + + + inline CppTL::ConstString quoteMultiLineString( const CppTL::ConstString &str ) { Index: atomiccounter.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/atomiccounter.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** atomiccounter.h 6 Mar 2006 22:50:53 -0000 1.10 --- atomiccounter.h 6 Sep 2006 19:23:26 -0000 1.11 *************** *** 30,34 **** # if CPPTL_USE_WIN32_ATOMIC ! class CPPTL_API AtomicCounter : public NonCopyable { public: --- 30,34 ---- # if CPPTL_USE_WIN32_ATOMIC ! class CPPTL_API AtomicCounter { public: *************** *** 70,74 **** #elif CPPTL_USE_PTHREAD_ATOMIC ! class CPPTL_API AtomicCounter : public NonCopyable { public: --- 70,74 ---- #elif CPPTL_USE_PTHREAD_ATOMIC ! class CPPTL_API AtomicCounter { public: *************** *** 79,82 **** --- 79,87 ---- } + AtomicCounter( const AtomicCounter &other ) + { + pthread_mutex_init( &lock_, 0 ); + } + ~AtomicCounter() { *************** *** 84,87 **** --- 89,97 ---- } + AtomicCounter &operator =( const AtomicCounter &other ) + { + return *this; + } + void increment() { *************** *** 126,130 **** #else ! class CPPTL_API AtomicCounter : public NonCopyable { public: --- 136,140 ---- #else ! class CPPTL_API AtomicCounter { public: Index: intrusiveptr.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/intrusiveptr.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** intrusiveptr.h 11 Dec 2005 17:16:08 -0000 1.4 --- intrusiveptr.h 6 Sep 2006 19:23:26 -0000 1.5 *************** *** 116,120 **** PointeeType &operator *() const { ! // assert( p_ != 0 ) return *p_; } --- 116,120 ---- PointeeType &operator *() const { ! CPPTL_ASSERT_MESSAGE( p_ != 0, "Attempting to dereference a null pointer with operator *." ); return *p_; } *************** *** 122,125 **** --- 122,126 ---- PointeeType *operator ->() const { + CPPTL_ASSERT_MESSAGE( p_ != 0, "Attempting to use a null pointer with operator ->." ); return p_; } |
From: Baptiste L. <bl...@us...> - 2006-09-05 21:41:33
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3768/include/cpptl Modified Files: _stlimpl.h smallmap.h Log Message: - Fixed compilation issues reported by Comeau C++. Index: _stlimpl.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/_stlimpl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _stlimpl.h 5 Jun 2006 12:02:56 -0000 1.1 --- _stlimpl.h 5 Sep 2006 21:41:29 -0000 1.2 *************** *** 111,117 **** copy_with_construct_value( OutputIt firstDestIt, unsigned int count, const ValueType &value ) { ! while ( count-- >= 0 ) { ! new (*firstDestIt)( value ); ++firstDestIt; } --- 111,117 ---- copy_with_construct_value( OutputIt firstDestIt, unsigned int count, const ValueType &value ) { ! while ( count-- > 0 ) { ! construct( *firstDestIt, value ); ++firstDestIt; } Index: smallmap.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/smallmap.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** smallmap.h 5 Jun 2006 12:02:56 -0000 1.1 --- smallmap.h 5 Sep 2006 21:41:30 -0000 1.2 *************** *** 121,125 **** { CPPTL_ASSERT_MESSAGE( map_ && map_->size_ && ! ( current_+n < map_->data_ + map_->size_ && current+n >= map_->data_), "SmallMapIterator::advance: advancing beyond end or beginning" ); current_ += n; --- 121,125 ---- { CPPTL_ASSERT_MESSAGE( map_ && map_->size_ && ! ( current_+n < map_->data_ + map_->size_ && current_+n >= map_->data_), "SmallMapIterator::advance: advancing beyond end or beginning" ); current_ += n; *************** *** 175,184 **** } ! SmallMapIterator( const SmallMapBase<Item> &map, Item *current ) : SuperClass( map, current ) { } ! SmallMapIterator( const SmallMapBase<Item> &map, size_t currentIndex ) : SuperClass( map, map.data_ + currentIndex ) { --- 175,184 ---- } ! SmallMapIterator( const SmallMapBase<T> &map, T *current ) : SuperClass( map, current ) { } ! SmallMapIterator( const SmallMapBase<T> &map, size_t currentIndex ) : SuperClass( map, map.data_ + currentIndex ) { *************** *** 187,191 **** SelfType &operator++() { ! increment(); return *this; } --- 187,191 ---- SelfType &operator++() { ! this->increment(); return *this; } *************** *** 200,204 **** SelfType &operator--() { ! decrement(); return *this; } --- 200,204 ---- SelfType &operator--() { ! this->decrement(); return *this; } *************** *** 213,217 **** SelfType &operator +=( difference_type n ) { ! advance( n ); return *this; } --- 213,217 ---- SelfType &operator +=( difference_type n ) { ! this->advance( n ); return *this; } *************** *** 225,229 **** SelfType &operator -=( difference_type n ) { ! advance( -n ); return *this; } --- 225,229 ---- SelfType &operator -=( difference_type n ) { ! this->advance( -n ); return *this; } *************** *** 242,251 **** reference operator *() const { ! return deref(); } pointer operator->() const { ! return &deref(); } --- 242,251 ---- reference operator *() const { ! return this->deref(); } pointer operator->() const { ! return &(this->deref()); } *************** *** 284,293 **** , allocator_( other.allocator_ ) { ! data_ = allocator_.allocateArray( size_ ); CPPTL_TRY_BEGIN { ! ::CppTL::Impl::copy_with_construct( other.begin(), other.end(), data_ ); } ! CPPTL_TRY_END_CLEANUP( allocator.releaseArray( data_, size_ ) ) } --- 284,293 ---- , allocator_( other.allocator_ ) { ! this->data_ = allocator_.allocateArray( this->size_ ); CPPTL_TRY_BEGIN { ! ::CppTL::Impl::copy_with_construct( other.begin(), other.end(), this->data_ ); } ! CPPTL_TRY_END_CLEANUP( allocator.releaseArray( this->data_, this->size_ ) ) } *************** *** 305,309 **** size_t size() const { ! return size_; } --- 305,309 ---- size_t size() const { ! return this->size_; } *************** *** 370,399 **** iterator begin() { ! return iterator( *this, data_ ); } iterator end() { ! return iterator( *this, size_ ); } const_iterator begin() const { ! return const_iterator( *this, data_ ); } const_iterator end() const { ! return const_iterator( *this, size_ ); } size_t count( const Key &key ) const { ! return lookUp( key) ? 1 : 0; } bool empty() const { ! return size_ == 0; } --- 370,399 ---- iterator begin() { ! return iterator( *this, this->data_ ); } iterator end() { ! return iterator( *this, this->size_ ); } const_iterator begin() const { ! return const_iterator( *this, this->data_ ); } const_iterator end() const { ! return const_iterator( *this, this->size_ ); } size_t count( const Key &key ) const { ! return lookUp( key ) ? 1 : 0; } bool empty() const { ! return this->size_ == 0; } *************** *** 404,408 **** CPPTL_ASSERT_MESSAGE( where >= begin() && where < end(), "SmallMap<T>::erase(): invalid iterator" ); ::CppTL::Impl::copy_and_destroy( where+1, end(), where ); ! --size_; return where; } --- 404,408 ---- CPPTL_ASSERT_MESSAGE( where >= begin() && where < end(), "SmallMap<T>::erase(): invalid iterator" ); ::CppTL::Impl::copy_and_destroy( where+1, end(), where ); ! --(this->size_); return where; } *************** *** 413,417 **** size_t count = last - first; ::CppTL::Impl::copy_and_destroy( last, end(), first ); ! size_ -= count; return iterator( *this, whereIndex ); } --- 413,417 ---- size_t count = last - first; ::CppTL::Impl::copy_and_destroy( last, end(), first ); ! this->size_ -= count; return iterator( *this, whereIndex ); } *************** *** 429,436 **** typedef Pair<iterator,bool> ResultType; size_t whereIndex = insertionIndex( key, 0 ); ! if ( whereIndex < size_ ! && !less_( key, data_[whereIndex].first ) ) { ! return data_[whereIndex].second; } return doInsert( whereIndex, Item( key, Value() ) )->second; --- 429,436 ---- typedef Pair<iterator,bool> ResultType; size_t whereIndex = insertionIndex( key, 0 ); ! if ( whereIndex < this->size_ ! && !less_( key, this->data_[whereIndex].first ) ) { ! return this->data_[whereIndex].second; } return doInsert( whereIndex, Item( key, Value() ) )->second; *************** *** 441,446 **** typedef Pair<iterator,bool> ResultType; size_t whereIndex = insertionIndex( item.first, 0 ); ! if ( whereIndex < size_ ! && !less_( item.first, data_[whereIndex].first ) ) { return ResultType( iterator( *this, whereIndex ), false ); --- 441,446 ---- typedef Pair<iterator,bool> ResultType; size_t whereIndex = insertionIndex( item.first, 0 ); ! if ( whereIndex < this->size_ ! && !less_( item.first, this->data_[whereIndex].first ) ) { return ResultType( iterator( *this, whereIndex ), false ); *************** *** 452,461 **** { size_t whereIndex = insertionIndex( item.first, where.index() ); ! if ( size_ == capacity_ ) { if ( reserve( 1, whereIndex, &item ) ) // element was inserted when increasing capacity. return iterator( *this, whereIndex ); } ! ++size_; iterator itWhere( *this, whereIndex ); ::CppTL::Impl::copy_backwards_and_destroy( itWhere, end()-1, end() ); --- 452,461 ---- { size_t whereIndex = insertionIndex( item.first, where.index() ); ! if ( this->size_ == this->capacity_ ) { if ( reserve( 1, whereIndex, &item ) ) // element was inserted when increasing capacity. return iterator( *this, whereIndex ); } ! ++(this->size_); iterator itWhere( *this, whereIndex ); ::CppTL::Impl::copy_backwards_and_destroy( itWhere, end()-1, end() ); *************** *** 474,480 **** void swap( SelfType &other ) { ! CppTL::swap( data_, other.data_ ); ! CppTL::swap( size_, other.size_ ); ! CppTL::swap( capacity_, other.capacity_ ); allocator_.swap( other.allocator_ ); CppTL::swap( less_, other.less_ ); --- 474,480 ---- void swap( SelfType &other ) { ! CppTL::swap( this->data_, other.data_ ); ! CppTL::swap( this->size_, other.size_ ); ! CppTL::swap( this->capacity_, other.capacity_ ); allocator_.swap( other.allocator_ ); CppTL::swap( less_, other.less_ ); *************** *** 483,492 **** bool operator <( const SelfType &other ) const { ! if ( size_ < other.size_ ) return true; ! if ( size_ > other.size_ || size_ == 0 ) return false; ! Item *i1 = data_, *i2 = other.data_; ! Item *i1end = data_ + size_; for ( ; i1 != i1end; ++i1, ++i2 ) { --- 483,492 ---- bool operator <( const SelfType &other ) const { ! if ( this->size_ < other.size_ ) return true; ! if ( this->size_ > other.size_ || this->size_ == 0 ) return false; ! Item *i1 = this->data_, *i2 = other.data_; ! Item *i1end = this->data_ + this->size_; for ( ; i1 != i1end; ++i1, ++i2 ) { *************** *** 501,508 **** bool operator ==( const SelfType &other ) const { ! if ( size_ != other.size_ ) return false; ! Item *i1 = data_, *i2 = other.data_; ! Item *i1end = data_ + size_; for ( ; i1 != i1end; ++i1, ++i2 ) { --- 501,508 ---- bool operator ==( const SelfType &other ) const { ! if ( this->size_ != other.size_ ) return false; ! Item *i1 = this->data_, *i2 = other.data_; ! Item *i1end = this->data_ + this->size_; for ( ; i1 != i1end; ++i1, ++i2 ) { *************** *** 518,526 **** bool reserve( size_t count, size_t insertIndex = 0, const Item *item = 0) { ! if ( size_ + count <= capacity_ ) return false; const size_t initialCapacity = 8; const size_t minCapacityIncrement = 8; ! size_t newCapacity = size_ + count; newCapacity += CPPTL_MAX( newCapacity / 4, minCapacityIncrement ); newCapacity = CPPTL_MAX( initialCapacity, newCapacity ); --- 518,526 ---- bool reserve( size_t count, size_t insertIndex = 0, const Item *item = 0) { ! if ( this->size_ + count <= this->capacity_ ) return false; const size_t initialCapacity = 8; const size_t minCapacityIncrement = 8; ! size_t newCapacity = this->size_ + count; newCapacity += CPPTL_MAX( newCapacity / 4, minCapacityIncrement ); newCapacity = CPPTL_MAX( initialCapacity, newCapacity ); *************** *** 529,533 **** { if ( !item ) ! insertIndex = size_; ::CppTL::Impl::copy_and_destroy( begin(), begin() + insertIndex, newData ); if ( item ) --- 529,533 ---- { if ( !item ) ! insertIndex = this->size_; ::CppTL::Impl::copy_and_destroy( begin(), begin() + insertIndex, newData ); if ( item ) *************** *** 539,548 **** } CPPTL_TRY_END_CLEANUP( allocator_.release( newData, newCapacity ) ); ! if ( data_ ) ! allocator_.releaseArray( data_, capacity_ ); ! data_ = newData; ! capacity_ = newCapacity; if ( item ) ! ++size_; return true; } --- 539,548 ---- } CPPTL_TRY_END_CLEANUP( allocator_.release( newData, newCapacity ) ); ! if ( this->data_ ) ! allocator_.releaseArray( this->data_, this->capacity_ ); ! this->data_ = newData; ! this->capacity_ = newCapacity; if ( item ) ! ++(this->size_); return true; } *************** *** 550,558 **** size_t insertionIndex( const Key &key, size_t min = 0 ) const { ! size_t max = size_; while ( min != max ) { size_t mid = (max+min) / 2; ! if ( less_( data_[mid].first, key ) ) min = mid + 1; else --- 550,558 ---- size_t insertionIndex( const Key &key, size_t min = 0 ) const { ! size_t max = this->size_; while ( min != max ) { size_t mid = (max+min) / 2; ! if ( less_( this->data_[mid].first, key ) ) min = mid + 1; else *************** *** 565,570 **** { size_t pos = insertionIndex( key, 0 ); ! if ( pos < size_ && !less_( key, data_[pos].first ) ) ! return data_ + pos; return 0; } --- 565,570 ---- { size_t pos = insertionIndex( key, 0 ); ! if ( pos < this->size_ && !less_( key, this->data_[pos].first ) ) ! return this->data_ + pos; return 0; } *************** *** 572,584 **** iterator doInsert( size_t whereIndex, const Item &item ) { ! if ( size_ == capacity_ ) { if ( reserve( 1, whereIndex, &item ) ) // element was inserted when increasing capacity. return begin() + whereIndex; } ! ++size_; iterator itWhere( *this, whereIndex ); iterator itEnd = end(); ! if ( whereIndex != size_ - 1 ) ::CppTL::Impl::copy_backwards_and_destroy( itWhere, itEnd-1, itEnd ); ::CppTL::Impl::construct( *itWhere, item); --- 572,584 ---- iterator doInsert( size_t whereIndex, const Item &item ) { ! if ( this->size_ == this->capacity_ ) { if ( reserve( 1, whereIndex, &item ) ) // element was inserted when increasing capacity. return begin() + whereIndex; } ! ++(this->size_); iterator itWhere( *this, whereIndex ); iterator itEnd = end(); ! if ( whereIndex != this->size_ - 1 ) ::CppTL::Impl::copy_backwards_and_destroy( itWhere, itEnd-1, itEnd ); ::CppTL::Impl::construct( *itWhere, item); |
From: Baptiste L. <bl...@us...> - 2006-09-03 07:59:03
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15622/doc Modified Files: cpput_todo.dox Log Message: - clean-up Index: cpput_todo.dox =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/cpput_todo.dox,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cpput_todo.dox 2 Sep 2006 22:09:18 -0000 1.1 --- cpput_todo.dox 3 Sep 2006 07:58:58 -0000 1.2 *************** *** 227,239 **** - mt-safe/session: can be safely used concurrently by multiple test cases in the same process in a given test session. - - process/session: resource instance can only be used by a single test case in a given test session within a process. - - process: resource instance can only be used by a single test case within a process. - - session: resource instance can only be used by a single test case within the test session. Test session may be distributed over multiple process. - - global: resource instance can only be used by a single test case in the "whole world". --- 227,235 ---- *************** *** 296,300 **** \section todo_mt_testrunner Multi-threaded test runner Needs: provides a way to execute run test cases concurrently as a cheap way to stress ! multi-thread safety. Concurrent test case execution would also allow for short test-run time (though this can be achieve in other way using opentest to parallelize execution in multiple processes). --- 292,296 ---- \section todo_mt_testrunner Multi-threaded test runner Needs: provides a way to execute run test cases concurrently as a cheap way to stress ! multi-thread safety. Concurrent test case execution would also allow for shorter test-run time (though this can be achieve in other way using opentest to parallelize execution in multiple processes). *************** *** 321,333 **** <hr> - \section todo_testdecorator Automatic TestDecorator factory - Provides a generic way to decorate an existing test. Typically involve doing as if its - meta-data are different (name, extended data, input for FIT tests...). - - Decoration should involve a generic algorithm that does not require specific programming. As - input it receives a list of Json::Value and "test name", providing the required elements for - decoration. - - <hr> \section todo_extended_test_data_inheritance CppUT::TestExtendedData Inheritance Needs: frequently, test cases within a test suite have common CppUT::TestExtendedData --- 317,320 ---- *************** *** 339,345 **** --- 326,340 ---- - suite + The following priority when a CppUT::TestExtendedData is multiply defined for a test + case (from highest to lowest): + - test case specific + - group specific (test case specific group first, then suite groups, first group in + sequence get priority) + - suite specific + If there is both CppUT::TestExtendedData associated with the test case (through suite or group), and CppUT::TestExtendedData specificaly defined for the test case, then the later override the other one. + */ \ No newline at end of file |
From: Baptiste L. <bl...@us...> - 2006-09-03 07:15:56
|
Update of /cvsroot/cppunit/cppunit2/makefiles/vs71 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31858/makefiles/vs71 Modified Files: cpput_lib.vcproj Log Message: - added support to declare test case association to a given group in test fixture. Index: cpput_lib.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/makefiles/vs71/cpput_lib.vcproj,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cpput_lib.vcproj 2 Sep 2006 11:24:53 -0000 1.5 --- cpput_lib.vcproj 3 Sep 2006 07:15:49 -0000 1.6 *************** *** 155,158 **** --- 155,161 ---- RelativePath="..\..\doc\cpput.dox"> </File> + <File + RelativePath="..\..\doc\doxyfile.in"> + </File> </Filter> <File |
From: Baptiste L. <bl...@us...> - 2006-09-03 07:15:56
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31858/include/cpput Modified Files: extendeddata.h test.h Log Message: - added support to declare test case association to a given group in test fixture. Index: test.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/test.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test.h 11 Nov 2005 23:23:48 -0000 1.11 --- test.h 3 Sep 2006 07:15:49 -0000 1.12 *************** *** 54,57 **** --- 54,72 ---- } + void addToGroup( const std::string &groupName ) + { + info_["configuration"]["groups"].append( groupName ); + } + + int groupCount() const + { + return info_["configuration"]["groups"].size(); + } + + std::string groupAt( unsigned int index ) const + { + return info_["configuration"]["groups"][index].asString(); + } + /// @warning You must never change the name of the test after /// registering the test or scheduling it for running. Index: extendeddata.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/extendeddata.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** extendeddata.h 11 Nov 2005 23:23:48 -0000 1.2 --- extendeddata.h 3 Sep 2006 07:15:49 -0000 1.3 *************** *** 127,130 **** --- 127,144 ---- /*! \ingroup group_testfixture */ + class CPPUT_API GroupData : public TestExtendedData + { + public: + GroupData( const std::string &groupName ); + + public: // overridden from TestExtendedData + void apply( Test &test ) const; + private: + std::string groupName_; + }; + + + /*! \ingroup group_testfixture + */ class CPPUT_API TestExtendedDataFactory { *************** *** 137,140 **** --- 151,156 ---- static DependenciesData depends( const std::string &dependencies ); + + static GroupData group( const std::string &groupName ); }; |
From: Baptiste L. <bl...@us...> - 2006-09-03 07:15:56
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31858/src/cpputtest Modified Files: testfixturetest.cpp Log Message: - added support to declare test case association to a given group in test fixture. Index: testfixturetest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testfixturetest.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testfixturetest.cpp 8 Nov 2005 23:25:31 -0000 1.8 --- testfixturetest.cpp 3 Sep 2006 07:15:49 -0000 1.9 *************** *** 107,111 **** CPPUT_TEST_WITH_SPECIFICS( testFail, ( describe( "Forced test failure" ), ! timeOut( 30.0 ) ) ); CPPUT_TESTSUITE_END(); --- 107,113 ---- CPPUT_TEST_WITH_SPECIFICS( testFail, ( describe( "Forced test failure" ), ! timeOut( 30.0 ), ! group("testfixture"), ! group("test") ) ); CPPUT_TESTSUITE_END(); *************** *** 219,222 **** --- 221,227 ---- CPPUT_ASSERT_EQUAL( "Forced test failure", test->description() ); CPPUT_ASSERT_EQUAL( 30.0, test->timeOut() ); + CPPUT_ASSERT_EQUAL( 2, test->groupCount() ); + CPPUT_ASSERT_EQUAL( "testfixture", test->groupAt(0) ); + CPPUT_ASSERT_EQUAL( "test", test->groupAt(1) ); MiniTestRunner runner; |
From: Baptiste L. <bl...@us...> - 2006-09-03 07:15:56
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31858/src/cpput Modified Files: extendeddata.cpp Log Message: - added support to declare test case association to a given group in test fixture. Index: extendeddata.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/extendeddata.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** extendeddata.cpp 6 Aug 2005 22:24:53 -0000 1.1 --- extendeddata.cpp 3 Sep 2006 07:15:49 -0000 1.2 *************** *** 4,7 **** --- 4,10 ---- namespace CppUT { + // class TestExtendedDataHelper + // ////////////////////////////////////////////////////////////////// + TestExtendedDataHelper::TestExtendedDataHelper( Test &test ) : test_( test ) *************** *** 23,26 **** --- 26,31 ---- + // class TestExtendedData + // ////////////////////////////////////////////////////////////////// TestExtendedData::~TestExtendedData() { *************** *** 35,38 **** --- 40,46 ---- + // class TestExtendedDataList + // ////////////////////////////////////////////////////////////////// + TestExtendedDataList::TestExtendedDataList( const TestExtendedData &left, const TestExtendedData &right ) *************** *** 50,53 **** --- 58,64 ---- + // class DescriptionData + // ////////////////////////////////////////////////////////////////// + DescriptionData::DescriptionData( const std::string &description ) : description_( description ) *************** *** 63,66 **** --- 74,80 ---- + // class TimeOutData + // ////////////////////////////////////////////////////////////////// + TimeOutData::TimeOutData( double timeOutInSeconds ) : timeOutInSeconds_( timeOutInSeconds ) *************** *** 75,78 **** --- 89,95 ---- + // class DependenciesData + // ////////////////////////////////////////////////////////////////// + DependenciesData::DependenciesData( const std::string &dependencies ) : dependencies_( dependencies ) *************** *** 87,90 **** --- 104,125 ---- + // class GroupData + // ////////////////////////////////////////////////////////////////// + + GroupData::GroupData( const std::string &groupName ) + : groupName_( groupName ) + { + } + + void + GroupData::apply( Test &test ) const + { + test.addToGroup( groupName_ ); + } + + + // class TestExtendedDataFactory + // ////////////////////////////////////////////////////////////////// + TestExtendedDataFactory::~TestExtendedDataFactory() { *************** *** 111,114 **** --- 146,155 ---- } + GroupData + TestExtendedDataFactory::group( const std::string &groupName ) + { + return GroupData( groupName ); + } + } // namespace CppUT |
From: Baptiste L. <bl...@us...> - 2006-09-02 22:09:22
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23990/doc Added Files: cpput_todo.dox Log Message: - added a list of features todo. --- NEW FILE: cpput_todo.dox --- /** \page cpput_todo Features Todo <hr> \section todo_input_driven_testing Input driven testing Needs: provide testers with a way to add test cases without writing code. Existing practice: FIT acceptance testing (http://fitnesse.org/, http://fit.c2.com/) Input data are: - name: name of the fixture to use to interpret the data - data: a Json::Value that represents the input data. The interpretation of it's structure depends on the fixture type. The following fixture types should at least be implemented: - Column: Table based fixture. The first row of the table describe the binding of columns, and the following rows are test case instantiations. If a column name ends with '?' then it is a method call, otherwise it is a data member binding. The framework will automatically compare the actual returned value to the expected value. In case of failure, the actual row is propagated with the test case status. returned with the 'status'. ( returned Example of input data in \json_ref: \verbatim [ ["leftHandSide", "rightHandSide", "operation", "result?"], [1, 2, "add", 3], [1, 2, "substract", -1] ] \endverbatim The code used to implement would be something like this (exact interface for this feature needs to be defined): \code class OperationFixture : public ColumnFixture { public: CPPUT_INPUT_FIXTURE_BEGIN( OperationFixture ) CPPTL_REFLECT_METHOD_WITH_RETURN( operation_, "operation" ) CPPTL_REFLECT_RENAMED_ATTRIBUT( lhs_, "leftHandSide" ) CPPTL_REFLECT_RENAMED_ATTRIBUT( rhs_, "rightHandSide" ) CPPTL_REFLECT_METHOD( result ) CPPUT_INPUT_FIXTURE_END() int result() { if ( operation_ == "add" ) return lhs_ + rhs_; return lhs_ - rhs_; } int lhs_; int rhs_; std::string operation_; }; \endcode - Custom: Only the binding of a fixture name to an implementation is done. Input fixture are registered by name. The framework provides a way to look-up a fixture implementation by name. To study: should input fixture be a suite, a test case factory, and/or rely on the decorator feature (see \ref todo_testdecorator). CppTL::Class, CppTL::Attribut, CppTL::Method can be used for implementation of this feature. <hr> \section todo_mt_testcase Multithreaded test case framework Needs: provides support for test case that create threads doing assertions. Results of assertions made in the threads created by the test case needs to be propagated to the original test case thread. Information about the test made available in the created threads needs to match those available in the original test case thread. The framework is not responsible for starting/joining the threads (the user has full control on this), on the other hand, it should provides the required hook to provide the following features: - associate thread test context to original test case thread test context - unexpected exception handler in thread - failure propagation to original test case thread <hr> \section todo_c_function_testcase Easy creation and registration of test case without fixture Needs: Using TestFixture is overkill when you need to write just a few simple tests. Therefore, the framework should provides a simple to register plain C function and the more generic CppTL::Functor0. Should allow usage of TestExtendedDataFactory (or alternate factory) to provide test specifics data. \code void myTest() { CPPUT_CHECK_TRUE( 1 == 0 ); } CPPUT_REGISTER_TEST_FUNCTION_IN_DEFAULT( myTest ) // and alternative and more compact style: CPPUT_TEST_FUNCTION_IN_DEFAULT( myTest ) { CPPUT_CHECK_TRUE( 1 == 0 ); } // also add registration in named suite... // and support for extended test data: CPPUT_REGISTER_TEST_FUNCTION_IN_DEFAULT_WITH_SPECIFICS( myTest, (timeOut(0.2), describe("Always fails")) ) \endcode <hr> \section todo_light_unit_tests Lightweight unit test declarations Needs: provides an alternative mecanism to implement fixture with less code for people that don't mind having code structure hidden behind macros (class declarations, function declarations...). Existing practice: CppUnitLite (http://c2.com/cgi/wiki?CppUnitLite) Notes that fixture should be instantiated and destroyed on each execution of the test case (constructor/destructor match \testCaseSetup / \testCaseTearDown). \code struct A // The fixture { A() : text_( "hello" ) { } std::string text_; }; CPPUT_TEST_LIGHT_FIXTURE( A, testInit ) // Defines a test case for the fixture. { CPPUT_CHECK_TRUE( text_ == "hello" ); // Directly access fixture members. } CPPUT_TEST_LIGHT_FIXTURE_WITH_SPECIFICS( A, testAdd, timeout(0.2) ) // Defines a test case with specific TestExtendedData. { text_ += "1234"; CPPUT_CHECK_TRUE( text_ == "hello1234" ); } CPPUT_REGISTER_LIGHT_FIXTURE_IN_DEFAULT( A ) // Registers fixture test case in the default suite. CPPUT_REGISTER_LIGHT_FIXTURE_IN( A, "MyTestSuite" ) // Registers fixture test case in the specified suite. \endcode <hr> \section todo_table_based_testcase Table based test case factory Needs: It is frequent to have the needs to validate the result of a given sequence call against a set of input values. Resorting to input test case when the need is simple is overkill. Therefore, the framework should provides a simple way to do this. Existing practice: QTTest table based tests. Input values are stored in a table. For each row of the table a test case is instantiated with the corresponding input values. The user should implements two methods: - storage of input values in table. - a function that execute the test case using a specific API to retreive input values of the current row. Below is an example of what user code could be like. \code class MyTableTest : public TestTableFixture { CPPUT_TESTSUITE_BEGIN( MyTableTest ); CPPUT_TABLE_TEST( testSum ); CPPUT_TESTSUITE_END(); void setupTableTestSum() { table_.addColumn( "value1" ); table_.addColumn( "value2" ); table_.addColumn( "sum" ); table_.newTest("positive") << 1 << 2 << 3; table_.newTest("negative") << -5 << -6 << -11; } void testSum() { CPPUT_TABLE_FIXTURE_FETCH( int, v1 ); CPPUT_TABLE_FIXTURE_FETCH( int, v2 ); CPPUT_TABLE_FIXTURE_FETCH( int, sum ); CPPUT_CHECK_TRUE( v1+v2 == sum ); } }; \endcode Should use CppTL::any to allow storage of data of any types. <hr> \section todo_resources Shared resources between tests Needs: Some test case needs a complex set-up to run, be it a database initialized in a particular way, some file or a graphic user interface. This environment can frequently be reuse by multiple test cases, but since it is costly (in time) to initialize, it is preferable to initialize it only once and reuse it for multiple test cases. To allow this, a particular setup is refered to as a resource. A test case declare its dependencies on resources and can access them through a specific API. A resource is identified by a name, and a registry keep track of all resource factories. Resources are only instantiated when needed. Since test cases can be executed concurrently (either in multiple processes, or multiple threads), there is a need for some resources to ensure that they are used by a single test case at a given time. A exclusion scope is associated to each resource to allow this. Each test cases must declare the list of resources it depends on. Just before the execution of a test case, the framework ensures that it acquires exclusive access according to each resource exclusion specification for all resources the test case depends on. Thoses locks are automatically released when the test case execution is done. During its execution, the test case use a specific API obtain the resource instance. Resource exclusion scope can be as follow: - mt-safe/session: can be safely used concurrently by multiple test cases in the same process in a given test session. - process/session: resource instance can only be used by a single test case in a given test session within a process. - process: resource instance can only be used by a single test case within a process. - session: resource instance can only be used by a single test case within the test session. Test session may be distributed over multiple process. - global: resource instance can only be used by a single test case in the "whole world". The framework will not provide implementation for session or global lock level, but will provide the required abstraction for implementation by the user (those lock levels should be provided by the opentest framework). Idealy, the multi-threaded test runner should split-up the list of test cases to maximize concurrency. Resource factory should be a generic function (CppTL::Functor0R). CppTL::any can be used to store resource instance. Below is an example of what user code could be like: \code CppTL::any makeResourceDatabasePort() // The resource factory function { return CppTL::any( 1234 ); } CPPUT_RESOURCE( "dbport", // resource name makeResourceDatabasePort, // factory function CppTL::multithreadSafeResource ) // lock level // Fixture with a single test case dependending on the resource class MyTests : public CppTL::TestFixture { public: CPPUT_TESTSUITE_BEGIN( MyTests ); CPPUT_TEST_WITH_SPECIFICS( testDatabase, resource("dbport") ); // declare resource dependency for that test case CPPUT_TESTSUITE_END(); void testDatabase() { int dabasePort = CppTL::any_cast( CPPUT_GET_RESOURCE("dbport"), CppTL::Type<int>() ); connectToDatabase( databasePort ); } }; class MyOtherTests : public CppTL::TestFixture { public: CPPUT_TESTSUITE_BEGIN( MyOtherTests ); CPPUT_TESTFIXTURE_RESOURCE( "dbport", databasePort_ ); // indicates that all test cases of the fixture depends on that resource. CPPUT_TEST( testDatabase ); CPPUT_TESTSUITE_END(); void testDatabase() // The resource is automatically bound to databasePort_ before test case execution. { connectToDatabase( databasePort_ ); } int databasePort_; }; \endcode <hr> \section todo_mt_testrunner Multi-threaded test runner Needs: provides a way to execute run test cases concurrently as a cheap way to stress multi-thread safety. Concurrent test case execution would also allow for short test-run time (though this can be achieve in other way using opentest to parallelize execution in multiple processes). Since the goal is to stress concurrent test execution, the framework also need to provide data to help diagnozing failure, such as, for each test case execution, the list of the test case that were running. This list should help figure out which part of the code is not thread-safe. <hr> \section todo_dependencies Test inter-dependencies management in test runner Needs: when a test case fails, it is common that all other test cases that rely on the fonctionnality that was tested to also failed. In that case, it is often difficult to figure out what is the 'real' failure that should be examined. To avoid a test case failure to cascade, the framework should allow to indicate that a given test case depends on other test cases, some test suites, or some test groups. In case of test case failure, all test cases that depends on it are automatically skipped. Use CppUT::TestExtendedData to specify dependencies. When a test is automatically skipped, its status should indicates that it was skipped because of a dependent failure. <hr> \section todo_testdecorator Automatic TestDecorator factory Provides a generic way to decorate an existing test. Typically involve doing as if its meta-data are different (name, extended data, input for FIT tests...). Decoration should involve a generic algorithm that does not require specific programming. As input it receives a list of Json::Value and "test name", providing the required elements for decoration. <hr> \section todo_extended_test_data_inheritance CppUT::TestExtendedData Inheritance Needs: frequently, test cases within a test suite have common CppUT::TestExtendedData (such as module id, timeout...). Therefore, the framework should help associate CppTL::TestExtendedData to multiple test cases at once. There is two way to reference multiple test cases: - group - suite If there is both CppUT::TestExtendedData associated with the test case (through suite or group), and CppUT::TestExtendedData specificaly defined for the test case, then the later override the other one. */ |
From: Baptiste L. <bl...@us...> - 2006-09-02 22:08:52
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23633/doc Modified Files: cpput.dox Log Message: - added a list of features todo. Index: cpput.dox =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/cpput.dox,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cpput.dox 11 Dec 2005 17:16:08 -0000 1.4 --- cpput.dox 2 Sep 2006 22:08:48 -0000 1.5 *************** *** 2,5 **** --- 2,7 ---- \mainpage + \ref cpput_todo. + \section _warning WARNING *************** *** 12,15 **** --- 14,18 ---- - \ref section_features - \ref section_writing_test + - \ref section_instantiating_test - \ref section_assertions - \ref section_ignore_assertion_failure *************** *** 39,42 **** --- 42,67 ---- \section section_writing_test Writing tests + \subsection section_instantiating_test Instantiating tests + A test case is exposed by instantiating a subclass of CppUT::AbstractTestCase. Each + time a test case is executed, the \link CppUT::AbstractTestCase::runTest() runTest()\endlink + method is called. This method calls the virtual methods \testCaseSetup, \testCaseRun + and \testCaseTearDown. + The \testCaseRun and \testCaseTearDown methods are only called if + the \testCaseSetup method was successful (no assertion failure, no exception thrown). + Only the \testCaseRun method is required to be overridden. + It is possible to make assertions in any of those methods. If any exception is thrown + by the \testCaseSetup, \testCaseRun or tearDown() methods, + or if any of those methods makes an assertion that fails, the test case get a 'failed' + status; otherwise it get a 'sucessful' status. The skipped status is never set + automatically (see \ref section_skippingtest for detail). + + There is mainly two ways to create test case: + - Subclassing CppUT::AbstractTestCase and overridding at least \testCaseRun. + - Instantiating CppUT::TestCase, which subclass CppUT::AbstractTestCase, and + passing the function to execute in the constructor. + + A test case is usually created using CppUT::makeTestCase() that instantiate + CppUT::TestCase. + \subsection section_assertions Making assertions When writing unit test, you check that the tested code behave as expected using |
From: Baptiste L. <bl...@us...> - 2006-09-02 13:53:47
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2205/doc Modified Files: doxyfile.in Log Message: removed tree generation Index: doxyfile.in =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/doxyfile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** doxyfile.in 5 Jun 2006 14:03:23 -0000 1.1 --- doxyfile.in 2 Sep 2006 13:53:41 -0000 1.2 *************** *** 117,121 **** DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 ! GENERATE_TREEVIEW = YES TREEVIEW_WIDTH = 250 --- 117,121 ---- DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 ! GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 |
From: Baptiste L. <bl...@us...> - 2006-09-02 11:24:57
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13370/src/cpput Modified Files: SConscript assert.cpp Added Files: message.cpp Log Message: - added LazyMessage, a simple proxy class that avoid building Message until it is really needed (assertion failed). Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/SConscript,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SConscript 7 Nov 2005 22:43:08 -0000 1.10 --- SConscript 2 Sep 2006 11:24:53 -0000 1.11 *************** *** 7,10 **** --- 7,11 ---- extendeddata.cpp lighttestrunner.cpp + message.cpp registry.cpp testcase.cpp --- NEW FILE: message.cpp --- #include <cpput/message.h> #include <string> namespace CppUT { // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class Message // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// Message Message::none; Message::Message() { } Message::Message( const CppTL::StringBuffer &shortDescription ) { add( shortDescription ); } Message::Message( const CppTL::StringConcatenator &shortDescription ) { add( shortDescription ); } Message::Message( const CppTL::ConstString &shortDescription ) { add( shortDescription ); } Message::Message( const std::string &shortDescription ) { add( shortDescription ); } Message::Message( const char *shortDescription ) { add( shortDescription ); } bool Message::empty() const { return details_.empty(); } void Message::insertAt( int index, const char *detail ) { insertAt( index, std::string(detail) ); } void Message::insertAt( int index, const std::string &detail ) { details_.insert( details_.begin() + index, detail ); } void Message::insertAt( int index, const Message &other ) { details_.insert( details_.begin() + index, other.details_.begin(), other.details_.end() ); } void Message::add( const char *detail ) // needed to solve ambiguity due to implicit constructor { add( CppTL::ConstString(detail) ); } void Message::add( const std::string &detail ) { details_.push_back( detail ); } void Message::add( const CppTL::ConstString &detail ) { details_.push_back( detail ); } void Message::extend( const Message &other ) { insertAt( int(details_.size()), other ); } int Message::count() const { return int(details_.size()); } std::string Message::at( int index ) const { return CPPTL_AT( details_, index ).str(); } std::string Message::toString() const { CppTL::StringBuffer message; Details::const_iterator it = details_.begin(); Details::const_iterator itEnd = details_.end(); while ( it != itEnd ) { message += *it++; message += "\n"; if ( it != itEnd ) message += "- "; } return message.c_str(); } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class LazyMessage // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// LazyMessage LazyMessage::none; LazyMessage::LazyMessage() : kind_( defaultConstructor ) { } LazyMessage::LazyMessage( const CppTL::StringBuffer &shortDescription ) : kind_( buffer ) { init_.stringBuffer_ = &shortDescription; } LazyMessage::LazyMessage( const CppTL::StringConcatenator &shortDescription ) : kind_( concatenator ) { init_.concatenor_ = &shortDescription; } LazyMessage::LazyMessage( const CppTL::ConstString &shortDescription ) : kind_( constString ) { init_.constString_ = &shortDescription; } LazyMessage::LazyMessage( const std::string &shortDescription ) : kind_( stdString ) { init_.stdString_ = &shortDescription; } LazyMessage::LazyMessage( const char *shortDescription ) : kind_( constChar ) { init_.cz_ = shortDescription; } LazyMessage::LazyMessage( const Message &aMessage ) : kind_( message ) { init_.message_ = &aMessage; } Message LazyMessage::makeMessage() const { switch ( kind_ ) { default: CPPTL_DEBUG_ASSERT_UNREACHABLE; case defaultConstructor: return Message(); case constChar: return Message(init_.cz_); case stdString: return Message(*(init_.stdString_)); case constString: return Message(*(init_.constString_)); case concatenator: return Message(*(init_.concatenor_)); case buffer: return Message(*(init_.stringBuffer_)); case message: return Message(*(init_.message_)); } } } // namespace CppUT Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** assert.cpp 13 Nov 2005 10:12:01 -0000 1.18 --- assert.cpp 2 Sep 2006 11:24:53 -0000 1.19 *************** *** 10,16 **** void ! fail( const Message &message ) { ! currentAssertion().setMessages( message ); realizeAssertion(); } --- 10,23 ---- void ! fail() { ! fail( translate("Assertion Failed") ); ! } ! ! ! void ! fail( const LazyMessage &message ) ! { ! currentAssertion().setMessages( message.makeMessage() ); realizeAssertion(); } *************** *** 19,28 **** void checkTrue( bool shouldBeTrue, ! const Message &message ) { if ( shouldBeTrue ) return; ! Message newMessage( message ); newMessage.insertAt( 0, translate( "expression did not evaluate to true." ) ); fail( newMessage ); --- 26,35 ---- void checkTrue( bool shouldBeTrue, ! const LazyMessage &message ) { if ( shouldBeTrue ) return; ! Message newMessage( message.makeMessage() ); newMessage.insertAt( 0, translate( "expression did not evaluate to true." ) ); fail( newMessage ); *************** *** 32,41 **** void checkFalse( bool shouldBeFalse, ! const Message &message ) { if ( !shouldBeFalse ) return; ! Message newMessage( message ); newMessage.insertAt( 0, translate( "expression did not evaluate to false." ) ); fail( newMessage ); --- 39,48 ---- void checkFalse( bool shouldBeFalse, ! const LazyMessage &message ) { if ( !shouldBeFalse ) return; ! Message newMessage( message.makeMessage() ); newMessage.insertAt( 0, translate( "expression did not evaluate to false." ) ); fail( newMessage ); *************** *** 45,49 **** void checkAssertionFail( bool assertionFailed, ! const Message &message ) { if ( assertionFailed ) --- 52,56 ---- void checkAssertionFail( bool assertionFailed, ! const LazyMessage &message ) { if ( assertionFailed ) *************** *** 51,55 **** Message newMessage( translate( "Assertion expression did not fail as expected." ) ); ! newMessage.extend( message ); fail( message ); } --- 58,62 ---- Message newMessage( translate( "Assertion expression did not fail as expected." ) ); ! newMessage.extend( message.makeMessage() ); fail( message ); } *************** *** 58,62 **** void checkAssertionPass( bool assertionFailed, ! const Message &message ) { if ( !assertionFailed ) --- 65,69 ---- void checkAssertionPass( bool assertionFailed, ! const LazyMessage &message ) { if ( !assertionFailed ) *************** *** 64,68 **** Message newMessage( translate( "Assertion expression did not pass as expected." ) ); ! newMessage.extend( message ); fail( message ); } --- 71,75 ---- Message newMessage( translate( "Assertion expression did not pass as expected." ) ); ! newMessage.extend( message.makeMessage() ); fail( message ); } *************** *** 72,78 **** buildEqualityFailedMessage( const std::string &expected, const std::string &actual, ! const Message &message ) { ! Message newMessage( message ); newMessage.add( translate( "Equality assertion failed." ) ); newMessage.add( translate( "Expected: " ) + expected ); --- 79,85 ---- buildEqualityFailedMessage( const std::string &expected, const std::string &actual, ! const LazyMessage &message ) { ! Message newMessage( message.makeMessage() ); newMessage.add( translate( "Equality assertion failed." ) ); newMessage.add( translate( "Expected: " ) + expected ); *************** *** 85,91 **** buildUnequalityFailedMessage( const std::string &expected, const std::string &actual, ! const Message &message ) { ! Message newMessage( message ); newMessage.add( translate( "Unequality assertion failed (expected & actual should be different)." ) ); newMessage.add( translate( "Expected: " ) + expected ); --- 92,98 ---- buildUnequalityFailedMessage( const std::string &expected, const std::string &actual, ! const LazyMessage &message ) { ! Message newMessage( message.makeMessage() ); newMessage.add( translate( "Unequality assertion failed (expected & actual should be different)." ) ); newMessage.add( translate( "Expected: " ) + expected ); *************** *** 99,103 **** double actual, double tolerance, ! const Message &message ) { double diff = expected - actual; --- 106,110 ---- double actual, double tolerance, ! const LazyMessage &message ) { double diff = expected - actual; *************** *** 107,111 **** return; ! Message newMessage( message ); newMessage.add( translate( "Double equality assertion failed." ) ); newMessage.add( translate( "Expected: " ) + CppTL::toString( expected ) ); --- 114,118 ---- return; ! Message newMessage( message.makeMessage() ); newMessage.add( translate( "Double equality assertion failed." ) ); newMessage.add( translate( "Expected: " ) + CppTL::toString( expected ) ); |
From: Baptiste L. <bl...@us...> - 2006-09-02 11:24:57
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13370/include/cpput Modified Files: assertcommon.h message.h Log Message: - added LazyMessage, a simple proxy class that avoid building Message until it is really needed (assertion failed). Index: assertcommon.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assertcommon.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** assertcommon.h 13 Nov 2005 23:02:16 -0000 1.2 --- assertcommon.h 2 Sep 2006 11:24:53 -0000 1.3 *************** *** 11,31 **** namespace CppUT { ! void CPPUT_API fail( const Message &message = translate( "Assertion failed." ) ); void CPPUT_API checkTrue( bool shouldBeTrue, ! const Message &message = Message() ); void CPPUT_API checkFalse( bool shouldBeFalse, ! const Message &message = Message() ); void CPPUT_API checkAssertionFail( bool assertionFailed, ! const Message &message = Message() ); void CPPUT_API checkAssertionPass( bool assertionFailed, ! const Message &message = Message() ); Message CPPUT_API buildEqualityFailedMessage( const std::string &expected, const std::string &actual, ! const Message &message = Message() ); template<typename FirstType --- 11,33 ---- namespace CppUT { ! void CPPUT_API fail(); ! ! void CPPUT_API fail( const LazyMessage &message ); void CPPUT_API checkTrue( bool shouldBeTrue, ! const LazyMessage &message = LazyMessage::none ); void CPPUT_API checkFalse( bool shouldBeFalse, ! const LazyMessage &message = LazyMessage::none ); void CPPUT_API checkAssertionFail( bool assertionFailed, ! const LazyMessage &message = LazyMessage::none ); void CPPUT_API checkAssertionPass( bool assertionFailed, ! const LazyMessage &message = LazyMessage::none ); Message CPPUT_API buildEqualityFailedMessage( const std::string &expected, const std::string &actual, ! const LazyMessage &message = LazyMessage::none ); template<typename FirstType *************** *** 33,37 **** Message makeEqualityFailedMessage( const FirstType &expected, const SecondType &actual, ! const Message &message = Message() ) { --- 35,39 ---- Message makeEqualityFailedMessage( const FirstType &expected, const SecondType &actual, ! const LazyMessage &message = LazyMessage::none ) { *************** *** 59,63 **** void checkEquals( const FirstType &expected, const SecondType &actual, ! const Message &message = Message() ) { if ( equalityTest( expected, actual ) ) --- 61,65 ---- void checkEquals( const FirstType &expected, const SecondType &actual, ! const LazyMessage &message = LazyMessage::none ) { if ( equalityTest( expected, actual ) ) *************** *** 69,73 **** Message CPPUT_API buildUnequalityFailedMessage( const std::string &expected, const std::string &actual, ! const Message &message = Message() ); template<typename FirstType --- 71,75 ---- Message CPPUT_API buildUnequalityFailedMessage( const std::string &expected, const std::string &actual, ! const LazyMessage &message = LazyMessage::none ); template<typename FirstType *************** *** 75,79 **** Message makeUnequalityFailedMessage( const FirstType &expected, const SecondType &actual, ! const Message &message = Message() ) { --- 77,81 ---- Message makeUnequalityFailedMessage( const FirstType &expected, const SecondType &actual, ! const LazyMessage &message = LazyMessage::none ) { *************** *** 101,105 **** void checkNotEquals( const FirstType &expected, const SecondType &actual, ! const Message &message = Message() ) { if ( !( equalityTest( expected, actual ) ) ) --- 103,107 ---- void checkNotEquals( const FirstType &expected, const SecondType &actual, ! const LazyMessage &message = LazyMessage::none ) { if ( !( equalityTest( expected, actual ) ) ) *************** *** 112,116 **** double actual, double tolerance, ! const Message &message = Message() ); void CPPUT_API skipCurrentTest(); --- 114,118 ---- double actual, double tolerance, ! const LazyMessage &message = LazyMessage::none ); void CPPUT_API skipCurrentTest(); Index: message.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/message.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** message.h 8 Nov 2005 21:44:54 -0000 1.11 --- message.h 2 Sep 2006 11:24:53 -0000 1.12 *************** *** 2,8 **** # define CPPUT_MESSAGE_H_INCLUDED ! # include <cpput/config.h> # include <cpptl/conststring.h> - //# include <opentest/properties.h> # include <vector> --- 2,7 ---- # define CPPUT_MESSAGE_H_INCLUDED ! # include <cpput/forwards.h> # include <cpptl/conststring.h> # include <vector> *************** *** 10,117 **** namespace CppUT { class CPPUT_API Message { public: ! Message() ! { ! } ! Message( const CppTL::StringBuffer &shortDescription ) ! { ! add( shortDescription ); ! } ! Message( const CppTL::StringConcatenator &shortDescription ) ! { ! add( shortDescription ); ! } ! Message( const CppTL::ConstString &shortDescription ) ! { ! add( shortDescription ); ! } ! Message( const std::string &shortDescription ) ! { ! add( shortDescription ); ! } ! Message( const char *shortDescription ) ! { ! add( shortDescription ); ! } ! bool empty() const ! { ! return details_.empty(); ! } void insertAt( int index, ! const char *detail ) ! { ! insertAt( index, std::string(detail) ); ! } void insertAt( int index, ! const std::string &detail ) ! { ! details_.insert( details_.begin() + index, detail ); ! } void insertAt( int index, ! const Message &other ) ! { ! details_.insert( details_.begin() + index, ! other.details_.begin(), ! other.details_.end() ); ! } ! ! void add( const char *detail ) // needed to solve ambiguity due to implicit constructor ! { ! add( CppTL::ConstString(detail) ); ! } ! ! void add( const std::string &detail ) ! { ! details_.push_back( detail ); ! } ! ! void add( const CppTL::ConstString &detail ) ! { ! details_.push_back( detail ); ! } ! void extend( const Message &other ) ! { ! insertAt( int(details_.size()), other ); ! } ! int count() const ! { ! return int(details_.size()); ! } ! std::string at( int index ) const ! { ! return CPPTL_AT( details_, index ).str(); ! } ! std::string toString() const ! { ! CppTL::StringBuffer message; ! Details::const_iterator it = details_.begin(); ! Details::const_iterator itEnd = details_.end(); ! while ( it != itEnd ) ! { ! message += *it++; ! message += "\n"; ! if ( it != itEnd ) ! message += "- "; ! } ! return message.c_str(); ! } private: --- 9,56 ---- namespace CppUT { + /*! \brief Carry informative message about a failed assertion. + * \ingroup group_assertions + */ class CPPUT_API Message { public: ! static Message none; ! Message(); ! Message( const CppTL::StringBuffer &shortDescription ); ! Message( const CppTL::StringConcatenator &shortDescription ); ! Message( const CppTL::ConstString &shortDescription ); ! Message( const std::string &shortDescription ); ! Message( const char *shortDescription ); ! ! bool empty() const; void insertAt( int index, ! const char *detail ); void insertAt( int index, ! const std::string &detail ); void insertAt( int index, ! const Message &other ); ! void add( const char *detail ); // needed to solve ambiguity due to implicit constructor ! void add( const std::string &detail ); ! void add( const CppTL::ConstString &detail ); ! void extend( const Message &other ); ! int count() const; ! std::string at( int index ) const; ! std::string toString() const; private: *************** *** 121,124 **** --- 60,105 ---- + class CPPUT_API LazyMessage + { + public: + static LazyMessage none; + + LazyMessage(); + + LazyMessage( const CppTL::StringBuffer &shortDescription ); + + LazyMessage( const CppTL::StringConcatenator &shortDescription ); + + LazyMessage( const CppTL::ConstString &shortDescription ); + + LazyMessage( const std::string &shortDescription ); + + LazyMessage( const char *shortDescription ); + + LazyMessage( const Message &message ); + + Message makeMessage() const; + + private: + union { + const char *cz_; + const std::string *stdString_; + const CppTL::ConstString *constString_; + const CppTL::StringConcatenator *concatenor_; + const CppTL::StringBuffer *stringBuffer_; + const Message *message_; + } init_; + enum Kind { + defaultConstructor = 1, + constChar, + stdString, + constString, + concatenator, + buffer, + message + }; + Kind kind_; + }; + } // namespace CppUT |
From: Baptiste L. <bl...@us...> - 2006-09-02 11:24:57
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13370 Modified Files: TODO Log Message: - added LazyMessage, a simple proxy class that avoid building Message until it is really needed (assertion failed). Index: TODO =================================================================== RCS file: /cvsroot/cppunit/cppunit2/TODO,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TODO 23 Jun 2004 18:47:06 -0000 1.2 --- TODO 2 Sep 2006 11:24:53 -0000 1.3 *************** *** 1,5 **** ! * complete works on the CommandLines library ! * move compiler settings (such as CPPUT_DEDUCED_TYPENAME to cpputtools) ! * move other useful header to cpputtools such as: enumerator.h, functor.h (dllproxy.h ? <= platform dependent stuff) ! * works on the TableFixture ! * add 'properties' list to Message, to provides additional structured information about a failure. Find a way to also provide such data for test success (time to run, accessed resource, error level...). \ No newline at end of file --- 1,3 ---- ! * figure out how CHECK/ASSERT can be made more friendly to developper when debugging ! => avoid stepping into cppunit code before processing the assertion. ! * complete works on the CommandLines library => likely moved to opentest. |