cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 34)
Brought to you by:
blep
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(94) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(114) |
Mar
(80) |
Apr
|
May
|
Jun
(36) |
Jul
(67) |
Aug
(37) |
Sep
(33) |
Oct
(28) |
Nov
(91) |
Dec
(16) |
2006 |
Jan
(1) |
Feb
(7) |
Mar
(45) |
Apr
|
May
|
Jun
(36) |
Jul
(7) |
Aug
|
Sep
(32) |
Oct
(3) |
Nov
|
Dec
|
2007 |
Jan
(29) |
Feb
(11) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(35) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(14) |
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(13) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(15) |
From: Baptiste L. <bl...@us...> - 2004-11-16 22:45:37
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24635 Modified Files: README Log Message: * added short notes about documentation generation Index: README =================================================================== RCS file: /cvsroot/cppunit/cppunit2/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 14 Jun 2004 23:23:19 -0000 1.2 --- README 16 Nov 2004 22:45:23 -0000 1.3 *************** *** 3,6 **** --- 3,10 ---- flexibility. + * Building the documentation + + Documentation is written using restructured text. You need docutils to build it (http://docutils.sourceforge.net/). + * Dependencies: |
From: Baptiste L. <bl...@us...> - 2004-11-16 08:47:40
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31427 Modified Files: cppunit2todo.txt features.txt Log Message: * added a bit about functional testing Index: cppunit2todo.txt =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/cppunit2todo.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cppunit2todo.txt 15 Nov 2004 20:41:12 -0000 1.1 --- cppunit2todo.txt 16 Nov 2004 08:47:29 -0000 1.2 *************** *** 123,126 **** --- 123,145 ---- * call a specific function on the DLL passing remaining command-line parameter + Features to enhance + =================== + + Equality check + -------------- + + At the current time it is impossible to overload the + equality check on older compiler without + function template ordering support such as VC++ 6 (you must specialize + the trait template) + + The current implementation should be enhanced to detect if a + specific overload is provided for comparison of AType and BType + is provided, and automatically fallback on the generic == otherwise. + This is similar to the convert to string trick used by stringize(). + + This would solve the overloading issue on older compiler without + function template ordering support. + .. Local Variables: Index: features.txt =================================================================== RCS file: /cvsroot/cppunit/cppunit2/doc/features.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** features.txt 15 Nov 2004 20:41:12 -0000 1.1 --- features.txt 16 Nov 2004 08:47:29 -0000 1.2 *************** *** 10,13 **** --- 10,25 ---- .. contents:: + Support for unit testing and functional testing + =============================================== + + The framework offers the traditional features found in unit testing framework + (assertions, grouping tests in suite...). A significant move has been made to + provide more support for functional test: + + * `rich test description`_ + * `rich test result`_ + * `non aborting assertions`_ + * `test monitoring`_ + Supports for quick develop/test cycle ===================================== *************** *** 24,28 **** * test plug-in to reduce link-time on large project ! In a well-tuned environment that cycle can be as short as a few seconds, as you usually only recompile only two translation units (the test and the tested implementation), and run the test automatically after a --- 36,40 ---- * test plug-in to reduce link-time on large project ! In a well-tuned environment the develop/test cycle can be as short as a few seconds, as you usually only recompile only two translation units (the test and the tested implementation), and run the test automatically after a *************** *** 37,44 **** specific dynamic library or of multiple dynamic libraries at once. ! Test-plug in also help separating the tests from how they are run, thus allowing to centralize the way tests are run and their result reported. Test monitor to detect crash and infinite loop ============================================== --- 49,58 ---- specific dynamic library or of multiple dynamic libraries at once. ! Test-plug in also help separating the tests from the way they are run, thus allowing to centralize the way tests are run and their result reported. + .. _`test monitoring`: + Test monitor to detect crash and infinite loop ============================================== *************** *** 51,62 **** test case. Graphical test driver ===================== ! Graphical test driver are provided to: * navigate test hierarchy * run a specific test or test suite * browse test result Open test runner interface --- 65,86 ---- test case. + Test monitoring is provided by most test drivers of `Open Test`_. + + Text test driver + ===================== + + A text test driver is provided by `Open Test`_ to. It is commonly used in a + post-build step to run unit test with failure location in a compiler like + format for integration with the development environment. + Graphical test driver ===================== ! Graphical test driver are provided by `Open Test`_ to: * navigate test hierarchy * run a specific test or test suite * browse test result + * and more... Open test runner interface *************** *** 65,70 **** The test drivers (the components that run and monitor the tests) can work with any test runner that implements the `Open Test`_ interface. This ! means that the framework graphical test driver can be used to run and ! monitor test implemented using another test framework as long as the `Open Test`_ interface can be implemented for that other framework. --- 89,94 ---- The test drivers (the components that run and monitor the tests) can work with any test runner that implements the `Open Test`_ interface. This ! means that the framework text and graphical test drivers can be used to run and ! monitor tests implemented using another test framework as long as the `Open Test`_ interface can be implemented for that other framework. *************** *** 97,100 **** --- 121,138 ---- parameters, and that default parameters are allowed. + One of the advantages of writing custom assertions is that in addition + to detecting that the assertion failed, a detailed diagnostic can be + provided. For example, when comparing two structured trees, + knowing that they are different let you know that something is wrong, + but not *what*. With custom assertions, the assertion can be tested, and + a detailed diagnostic based on the knowledge of what the structure + represent and what would be useful to diagnostic the failure can + be reported. + + An application of advanced assertions can be found in + `enumeration and string assertions`_. + + (Notes: should move the detail below somewhere else.) + Here is an example of how the assertion ``CPPUT_FAIL( "bad parameters." )`` is expanded. *************** *** 118,132 **** their number can vary. ! One of the advantages of writing custom assertions is that in addition ! to detecting that the assertion failed, a detailed diagnostic can be ! provided. For example, when comparing two structured trees, ! knowing that they are different let you know that something is wrong, ! but not *what*. With custom assertions, the assertion can be tested, and ! a detailed diagnostic based on the knowledge of what the structure ! represent and what would be useful to diagnostic the failure can ! be reported. ! ! An application of advanced assertions can be found in ! `enumeration and string assertions`_. Non aborting assertions support --- 156,160 ---- their number can vary. ! .. _`non aborting assertions`: Non aborting assertions support *************** *** 143,147 **** checking assertions and vice versa. ! Property tree as test result for integration ============================================ --- 171,177 ---- checking assertions and vice versa. ! .. _`rich test result`: ! ! Test result as property tree for integration ============================================ *************** *** 165,170 **** actual values back into the spreadsheet. ! Property tree associated to each test declaration ! ================================================= Each test has a property tree. The property tree can be used to store --- 195,205 ---- actual values back into the spreadsheet. ! Properties can be added to result result during the test case run. This ! makes it easy to provide rich structure output for functional testing. ! ! .. _`rich test description`: ! ! Test description as property tree ! ================================= Each test has a property tree. The property tree can be used to store *************** *** 210,218 **** automatically deferenced. - [Notes: current implementation should be enhanced to detect if a - specific overload is provided for comparison of AType and BType - is provided, and automatically fallback on the generic == otherwise. - This is similar to the convert to string trick used by stringize().] - .. _`enumeration and string assertions`: --- 245,248 ---- *************** *** 228,232 **** ---------------------------- ! The enumeration based assertions works with the concept of enumerator. An enumerator implements a specific interface allowing enumeration of the elements of a collection. The CppTL library provides a complete --- 258,262 ---- ---------------------------- ! The enumeration based assertions work with the concept of enumerator. An enumerator implements a specific interface allowing enumeration of the elements of a collection. The CppTL library provides a complete *************** *** 258,262 **** * ensure a string contains another expected string. ! String assertions works with heterogeneous string type and use the stringize_ mechanism provided by the framework to convert object to string. --- 288,292 ---- * ensure a string contains another expected string. ! String assertions works with heterogeneous string types and use the stringize_ mechanism provided by the framework to convert object to string. |
From: Baptiste L. <bl...@us...> - 2004-11-15 20:41:22
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22756 Added Files: builddoc.bat cppunit2todo.txt default.css features.txt index.txt opentest.txt opentesttodo.txt Log Message: * added some documentations: features, open test, todo for cppunit 2 and open test. docutils is needed to build the doc. --- NEW FILE: opentest.txt --- ====================== Open Test presentation ====================== :Author: Baptiste Lepilleur :Contact: bl...@us... .. contents:: What is Open Test? ================== Open Test provides a mean to easily integrate a testing framework with Open Test `test drivers`__. __ TestDriver_ The open test concept emerged from the complete separation of the way tests of running test from driving and monitoring the test run in CppUnit 2. Those two activities are managed by two components: the TestRunner_ and the TestDriver_. While implementing a TestRunner_ is cheap, implementing TestDriver_ cost a lot, especially if the test driver must provide a graphical user interface. With Open Test, it is possible to reuse the existing TestDriver_ and implement a TestRunner_ for a specific test framework. This makes implementing a specific functional test framework cheap since you only need to implement the testing part. All the monitoring, user interface parts are already implemented and reusable. .. _TestRunner: What is a TestRunner? ===================== A test runner is a lightweight component that provides the following services: * declare all the available tests * run a specific list of tests and track the run of each test. [Notes: need to be enhanced, resource acquisition service...] .. _TestDriver: What is a TestDriver? ===================== A test driver as many responsibility: * monitoring the test run and detecting crash and infinite-loop to resume the test run. * selecting the test(s) to run * providing feedback during the test run (what test is being run, did the test pass...) * generating report of the test run (output result in XML, compiler and human friendly text format...) A test driver can usually be configured from both the command-line and a configuration file for automated testing. Graphical test drivers are provided for interactive browsing of the test hierarchy, and visual feedback... It should be noted that some test drivers could be connected to multiple test runner at the same time. How does the TestDriver communicate with the TestRunner? ======================================================== While it is possible for a TestDriver_ to directly call methods of a TestRunner_, it is not the way it is usually done. Implementing reliable test run monitoring requires running the test in a separate process. Instead of going the easy way and using shared memory to share test data structure, communication between the TestDriver_ and a TestRunner_ rely on a duplex stream communication. While a little more complex to implement, this have the great advantage that a TestDriver_ can be connected to any TestRunner_ that implements the same protocol. A TestDriver_ can communicate with a TestRunner_ that: * is not using the same run-time version of the C library (a common issue on the Windows platform) * is not compiled using the same compiler * is running on a different architecture (is a duplex network connection is used) * is possibly implemented using another language (would require porting the communication layer to the alternate language) .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: --- NEW FILE: opentesttodo.txt --- ============== Open Test todo ============== :Author: Baptiste Lepilleur :Contact: bl...@us... .. contents:: .. _TestDriver: opentest.html .. _TestRunner: opentest.html .. _`Open Test`: opentest.html General status ============== `Open Test`_ is a fairly new concept and hence has a low level of maturity. Everything is to be done. The TestRunner_ interface has been defined and implemented for CppUnit 2. Everything related to test driver need to be defined and implemented. This involves: * defining property tree for suite and test declaration, test runner configuration and test result. * writing a simple text based TestDriver_ * test monitoring and duplex communication through stream * test driver xml output * extend the text based TestDriver_ to accept multiple TestRunner * GUI based TestDriver_ * allow TestDriver selection from command-line Property tree structure ======================= Suite and test declarations --------------------------- TestDeclarator::beginSuite() and TestDeclarator::addTest(). * time-out delay * description, * input/expected values (for functional testing based on input/output) Test runner configuration ------------------------- TestRunner::runTests(). * is logging enabled * number of threads Test configuration ------------------ TestPlanEntry::configuration(). Two categories of data are associated to a test at this stage of the testing: * test specific runner configuration * test descriptive data Test specific runner configuration: * enable logging Test descriptive data: * input/expected values override Test execution result --------------------- TestRunTracker::addTestInfo(). Notes: this method probably needs to be modified since it can be called multiple times (for example, every time a line of log is added). * test status: success ? * test status type: success/failure/fault... * test result message * test result source code location * test result (input/) actual/expected * test result log .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Simple text based TestDriver ============================ Implementing a simple text based TestDriver is required to validate the interface of the TestRunner. It should use direct method call for communication with the TestRunner (which means no monitoring). Features: * text progress (like CppUnit BriefProgressListener) * dynamic log output as the test runner * compiler output (assertion location in a compiler compatible format with failure detail below). * optionally select test to run from the command-line Status: partially implemented in opentest/texttestdriver.h. Test monitoring =============== The test monitoring feature needs to be implemented. It requires that the TestDriver_ spawn a child process that run the TestRunner_ and communicate with it. Communication between the TestDriver_ and the TestRunner_ should be stream based as it allows the usage of various implementation, such as shared memory, pipe, and network... Ideally, all implementations should provide the same interface, only requiring the TestDriver to bother about the implementation type at connection time. A spike solution is being worked on to explore shared memory on Windows (Baptiste: a working implementation is in place but need a lot of clean-up). GUI based TestDriver ==================== * should provide all the functionalities of a text based TestDriver (it simply does not close the result window when the test are done). * should support for multiple TestRunner * allow loading of multiple test plug-in (spawn test plug-in wrapper application for each DLL) QT will likely be the first GUI toolkit to be ported as it is multi-platform and is easier to implement than MFC or wxWidget. TestDriver selection from command-line ====================================== It should be possible to select the TestDriver to use from the command-line. This implies that all test drivers provide a similar interface. The user should be able to choose between text driver and GUI driver from the command-line (use plug-in for TestDriver ?). --- NEW FILE: features.txt --- =============================== CppUnit 2 features presentation =============================== :Author: Baptiste Lepilleur :Contact: bl...@us... .. _`Open Test`: opentest.html .. contents:: Supports for quick develop/test cycle ===================================== The framework help having a quick develop/test cycle with the following features: * test factory registry to reduce build time (only the modified test source file need to be recompiled) * compiler format source location of failed assertion to jump straight to the assertion in the source code * detailed diagnostic on assertion failure, frequently avoiding the need to run the debugger * test plug-in to reduce link-time on large project In a well-tuned environment that cycle can be as short as a few seconds, as you usually only recompile only two translation units (the test and the tested implementation), and run the test automatically after a successful build. This makes test driven design possible in C++. Component based testing with test plug-in ========================================= Tests can be embedded into the dynamic library to test. An application provided with the framework is used to run the test contained in a dynamic library. The application can run the test of a specific dynamic library or of multiple dynamic libraries at once. Test-plug in also help separating the tests from how they are run, thus allowing to centralize the way tests are run and their result reported. Test monitor to detect crash and infinite loop ============================================== The framework provides easy mechanism to monitor the test run. It can automatically spawn a child process that run the test and monitor it for crash or infinite loop. In the case of infinite loop it terminates the child process. If either a crash or an infinite loop occurred, a new child process is spawned and testing resume after the problematic test case. Graphical test driver ===================== Graphical test driver are provided to: * navigate test hierarchy * run a specific test or test suite * browse test result Open test runner interface ========================== The test drivers (the components that run and monitor the tests) can work with any test runner that implements the `Open Test`_ interface. This means that the framework graphical test driver can be used to run and monitor test implemented using another test framework as long as the `Open Test`_ interface can be implemented for that other framework. More detail can be found in the `Open Test`_ document. Flexible output of test result ============================== The result of a test run is thoroughly inspectable. Outputter are provided to output the result in multiple format, such as XML for integration in a tool chain, or a human readable format with compiler like assertion location for integration with IDE. Extensive test driver configuration =================================== Test drivers can be configured either using the command-line or persistent configuration files. The configuration management is designed in such a way that new configuration options can easily be added. Custom assertion support ======================== The assertion design separate the assertion location tracking from the function call used to implement the assertion. This means that assertion functions can have a variable number of parameters, and that default parameters are allowed. Here is an example of how the assertion ``CPPUT_FAIL( "bad parameters." )`` is expanded. The assertion is defined as follow: :: # define CPPUT_FAIL \ CPPUT_BEGIN_ASSERTION_MACRO() \ ::CppUT::fail Which is expanded into: :: ::CppUT::setCheckPointLocation( ::CppUT::Location( __FILE__, __LINE__ ) ), // notes the comma ::CppUT::fail Hence, the code ``CPPUT_FAIL( "bad parameters." )`` first call ``SetCheckPointLocation`` to memorize where the assertion occurred in the source code, and then call the function ``fail`` with the parameter(s) specified by the user. As the parameters are not part of the macro, their number can vary. One of the advantages of writing custom assertions is that in addition to detecting that the assertion failed, a detailed diagnostic can be provided. For example, when comparing two structured trees, knowing that they are different let you know that something is wrong, but not *what*. With custom assertions, the assertion can be tested, and a detailed diagnostic based on the knowledge of what the structure represent and what would be useful to diagnostic the failure can be reported. An application of advanced assertions can be found in `enumeration and string assertions`_. Non aborting assertions support =============================== The framework provides both assertions that abort the current test (throwing an exception), and assertions that do not abort the current test but keep track of the failures. Those assertions are named respectively "aborting assertions " and "checking assertions". The implementation of this feature relies on a mechanism similar to `setCheckPointLocation()` described in `Custom assertion support`_, meaning that all aborting assertions can easily be made available as checking assertions and vice versa. Property tree as test result for integration ============================================ The result of each test case run is always a property tree. All data related to the execution of a test case are stored as property in this tree. For instance, the status of the test (success, failure...) is just a specific property in this tree. Using a property tree provide a lot of flexibility as it allows association of complex data to each test run such as: * duration of the test * log messages * alternative test execution status (succeeded with warning, failure because of missing resources...) * actual and expected value Being able to report actual and expected values in a test result is a very powerful features. For example, if you are generating input values from a spreadsheet application, after running the test, you can put the actual values back into the spreadsheet. Property tree associated to each test declaration ================================================= Each test has a property tree. The property tree can be used to store descriptive data for each test. Property can be marked as "inheritable", meaning all tests of a test suite inherit this property (but they can override it). Here is some example of properties that can be associated with a test: * time-out delay (used by test driver to detect infinite loop and dead-lock) * description .. _stringize: Flexible conversion of object to string for assertion ===================================================== The framework provides a specific service to convert an object into a string. This service is used by assertions to generate diagnostic. Two operations are provided by the service: * conversion of a string into the standard std::string type. * conversion of an object into a string. If the object is a string type it is automatically quoted and escaped. While the default implementation relies on std::ostream for conversion of object to string, an alternative implementation can easily be provided (for platform such eVC++ 4 which do not provide iostream). If the target compiler supports function template partial specialization and the feature is enabled in the configuration, pointer will be automatically deferenced. Flexible test for equality for assertion ======================================== The framework provides a specific service to check if two objects are equal. If the target compiler supports function template partial specialization and the feature is enabled in the configuration, pointer will be automatically deferenced. [Notes: current implementation should be enhanced to detect if a specific overload is provided for comparison of AType and BType is provided, and automatically fallback on the generic == otherwise. This is similar to the convert to string trick used by stringize().] .. _`enumeration and string assertions`: Advanced assertions providing detailed diagnostic ================================================= Two advanced assertions facility are provided: * enumeration based assertions * string based assertions Enumeration based assertions ---------------------------- The enumeration based assertions works with the concept of enumerator. An enumerator implements a specific interface allowing enumeration of the elements of a collection. The CppTL library provides a complete implementation of enumerator that supports STL containers and iterators and can be very easily extended to support other container interfaces. The following assertions are provided for enumeration: * ensure that two enumerations have the same elements in the same order (sequence). On failure, the position of the first different element is reported, as well as the list of identical elements, and the remaining part of the expected and actual lists of elements. * ensure that two enumerations have the same elements regardless of the order (set). On failure, the list of extraneous and missing elements is reported, as well as the list of actual and expected elements. *insert example here* String based assertions ----------------------- The following assertions are provided for string: * ensure two strings are equals. * ensure a string starts with an expected string. * ensure a string ends with an expected string. * ensure a string contains another expected string. String assertions works with heterogeneous string type and use the stringize_ mechanism provided by the framework to convert object to string. String assertions provide detailed diagnostics on failure, escaping the string over multiple lines when it contains \\n or \\r character. *insert example here* Create test cases using generic functor ======================================= Test cases delegate the actual task of setting up the test, running the test and cleaning up after the test (setUp/run/tearDown) to generic functors. A generic functor can be created from a C function, an object instance and a member function or from a functor. When a function with parameters used for testing, its parameters can be bound to specific value, hence creating a generic functor that requires no parameter. *insert example here* Resource Acquisition Is Initialization idiom (RAII) =================================================== The framework uses the fundamental *RAII* C++ idiom (Resource Acquisition Is Initialization idiom) for clarity. Smart-pointer are used to pass dynamically allocated pointer around. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: --- NEW FILE: index.txt --- ========= CppUnit 2 ========= :Author: Baptiste Lepilleur :Contact: bl...@us... .. _`Open Test`: opentest.html .. contents:: Document of interest for users ============================== * `CppUnit 2 features presentation <features.html>`__ * `Open Test presentation <opentest.html>`__ Document of interest for developpers ==================================== * `CppUnit 2 todo <cppunit2todo.html>`__ * `Open Test todo <opentesttodo.html>`__ .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: --- NEW FILE: default.css --- /* cascading style sheet for the HTML output of Docutils. */ .first { margin-top: 0 } .last { margin-bottom: 0 } a.toc-backref { text-decoration: none ; color: black } blockquote.epigraph { margin: 2em 5em ; } dd { margin-bottom: 0.5em } /* Uncomment (& remove this text!) to get bold-faced definition list terms dt { font-weight: bold } */ div.abstract { margin: 2em 5em } div.abstract p.topic-title { font-weight: bold ; text-align: center } div.attention, div.caution, div.danger, div.error, div.hint, div.important, div.note, div.tip, div.warning, div.admonition { margin: 2em ; border: medium outset ; padding: 1em } div.attention p.admonition-title, div.caution p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title, div.warning p.admonition-title { color: red ; font-weight: bold ; font-family: sans-serif } div.hint p.admonition-title, div.important p.admonition-title, div.note p.admonition-title, div.tip p.admonition-title, div.admonition p.admonition-title { font-weight: bold ; font-family: sans-serif } div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic } div.dedication p.topic-title { font-weight: bold ; font-style: normal } div.figure { margin-left: 2em } div.footer, div.header { font-size: smaller } div.sidebar { margin-left: 1em ; border: medium outset ; padding: 0em 1em ; background-color: #ffffee ; width: 40% ; float: right ; clear: right } div.sidebar p.rubric { font-family: sans-serif ; font-size: medium } div.system-messages { margin: 5em } div.system-messages h1 { color: red } div.system-message { border: medium outset ; padding: 1em } div.system-message p.system-message-title { color: red ; font-weight: bold } div.topic { margin: 2em } h1.title { text-align: center } h2.subtitle { text-align: center } hr { width: 75% } ol.simple, ul.simple { margin-bottom: 1em } ol.arabic { list-style: decimal } ol.loweralpha { list-style: lower-alpha } ol.upperalpha { list-style: upper-alpha } ol.lowerroman { list-style: lower-roman } ol.upperroman { list-style: upper-roman } p.attribution { text-align: right ; margin-left: 50% } p.caption { font-style: italic } p.credits { font-style: italic ; font-size: smaller } p.label { white-space: nowrap } p.rubric { font-weight: bold ; font-size: larger ; color: maroon ; text-align: center } p.sidebar-title { font-family: sans-serif ; font-weight: bold ; font-size: larger } p.sidebar-subtitle { font-family: sans-serif ; font-weight: bold } p.topic-title { font-weight: bold } pre.address { margin-bottom: 0 ; margin-top: 0 ; font-family: serif ; font-size: 100% } pre.line-block { font-family: serif ; font-size: 100% } pre.literal-block, pre.doctest-block { margin-left: 2em ; margin-right: 2em ; background-color: #eeeeee } span.classifier { font-family: sans-serif ; font-style: oblique } span.classifier-delimiter { font-family: sans-serif ; font-weight: bold } span.interpreted { font-family: sans-serif } span.option { white-space: nowrap } span.option-argument { font-style: italic } span.pre { white-space: pre } span.problematic { color: red } table { margin-top: 0.5em ; margin-bottom: 0.5em } table.citation { border-left: solid thin gray ; padding-left: 0.5ex } table.docinfo { margin: 2em 4em } table.footnote { border-left: solid thin black ; padding-left: 0.5ex } td, th { padding-left: 0.5em ; padding-right: 0.5em ; vertical-align: top } th.docinfo-name, th.field-name { font-weight: bold ; text-align: left ; white-space: nowrap } h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { font-size: 100% } tt { background-color: #eeeeee } ul.auto-toc { list-style-type: none } --- NEW FILE: builddoc.bat --- rst2html cppunit2todo.txt cppunit2todo.html rst2html index.txt index.html rst2html opentest.txt opentest.html rst2html opentesttodo.txt opentesttodo.html rst2html features.txt features.html --- NEW FILE: cppunit2todo.txt --- ============== CppUnit 2 todo ============== :Author: Baptiste Lepilleur :Contact: bl...@us... .. contents:: .. _TestDriver: opentest.html .. _TestRunner: opentest.html .. _`Open Test`: opentest.html Moving CppUnit 2 to Open Test ============================= Starting point -------------- Currently, the framework has adopted CppUnit approach to driving testing. This means that the framework provides services for both TestDriver_ and TestRunner_ responsibility. Since CppUnit is a testing framework, it should only provide the TestRunner_ for integration with `Open Test`_. What should be removed? ----------------------- * All stuffs concerning test reporting, output result must be removed (will likely be moved to OpenTest but will no longer be based on CppUnit classes). Should at least include the following headers: * progresslistener.h * properties.h (should use OpenTest properties or some proxy) * testcontext.h (some stuff need to be preserved, see `What need to be changed?`_) * testlistener.h * testresult.h (preserved some stuff, integrate some to the TestRunner) * testrunresult.h What need to be changed? ------------------------ * Test should no longer be runnable * TestContext guard chain and protect functions should be moved to the TestRunner. The rest should be taken out => no more TestListener. * TestResult should be integrated to TestRunner. Features to add =============== Test descriptive information ---------------------------- Provides a way to associate descriptive information to a test. **Warning**: it should be designed/documented so that only the framework uses it to declare test. Should also find a way to integrate this with test fixture declaration. Test configuration information ------------------------------ Just before test execution, test descriptive information should be merged with test configuration information (configuration information overriding test descriptive information if they share properties). A mean should be provided to the user to access a read only copy of those data. Test result information ----------------------- The user should be able to set test result information during the test run. This can be used to add a line of log, set specific message, actual values, assertion location... Logging stream -------------- Provides a logging stream that associated logged data to the test. Logged data should be sent to the TestDriver on each '\\n'. This probably requires implementing a streambuffer. This logging stream would be a singleton, like std::cout => CppUT::log. Data written in the stream should be forwarded to the component managing TestInfo (TestRunner ?). This ensures that the correct threading strategy is used (one log per thread, one log for all thread...). Checking assertions vs. aborting assertions ------------------------------------------- Checking assertions (opposed to aborting assertions) need to be added. This should use the same mechanism as `setCheckPointLocation()`: * `setAssertionType( checkingAssertion )` * `setAssertionType( abortingAssertion )` The `fail` function checks the assertion type to determine if an assertion if thrown of is an assertion occurred. It might also be interesting to see if removing Message is worth it. It could be replaced by direct update of the current assertion `Properties`. Test plug-in wrapper application -------------------------------- A TestRunner wrapper application needs to be written for test plug-in support with Open test. The wrapper application: * load the DLL * call a specific function on the DLL passing remaining command-line parameter .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:52:51
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5653/src/cpputtest Modified Files: enumeratortest.cpp Log Message: * started implementing explicit type passing for returned enumerator in generator function. Index: enumeratortest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/enumeratortest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** enumeratortest.cpp 22 Oct 2004 06:20:07 -0000 1.4 --- enumeratortest.cpp 15 Nov 2004 08:52:40 -0000 1.5 *************** *** 297,305 **** --- 297,313 ---- #endif + #if !defined(CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION) checkContent( CppTL::Enum::range( set1_.begin(), set1_.end() ) ); + #endif checkContent( CppTL::Enum::range( list1_.begin(), list1_.end() ) ); checkContent( CppTL::Enum::anyRange( list1_.begin(), list1_.end() ) ); + + // Specifying Type ensure portability across all platforms. + checkContent( CppTL::Enum::range( deque1_.begin(), deque1_.end(), CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::range( vector1_.begin(), vector1_.end(), CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::range( set1_.begin(), set1_.end(), CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::range( list1_.begin(), list1_.end(), CppTL::Type<int>() ) ); } *************** *** 334,345 **** { checkContent( CppTL::Enum::container( deque1_ ) ); - checkContent( CppTL::Enum::container( vector1_ ) ); - checkContent( CppTL::Enum::container( set1_ ) ); - checkContent( CppTL::Enum::container( list1_ ) ); - checkContent( CppTL::Enum::anyContainer( list1_ ) ); } --- 342,354 ---- { checkContent( CppTL::Enum::container( deque1_ ) ); checkContent( CppTL::Enum::container( vector1_ ) ); checkContent( CppTL::Enum::container( set1_ ) ); checkContent( CppTL::Enum::container( list1_ ) ); checkContent( CppTL::Enum::anyContainer( list1_ ) ); + + checkContent( CppTL::Enum::container( deque1_, CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::container( vector1_, CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::container( set1_, CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::container( list1_, CppTL::Type<int>() ) ); } *************** *** 350,355 **** --- 359,368 ---- checkContent( CppTL::Enum::keys( map1_ ) ); + checkContent( CppTL::Enum::keys( map1_, CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::keysRange( map1_.begin(), map1_.end() ) ); + checkContent( CppTL::Enum::keysRange( map1_.begin(), map1_.end(), CppTL::Type<int>() ) ); + checkContent( CppTL::Enum::anyKeys( map1_ ) ); *************** *** 365,368 **** --- 378,387 ---- checkStringContent( CppTL::Enum::valuesRange( map1_.begin(), map1_.end() ) ); + checkStringContent( CppTL::Enum::values( map1_, CppTL::Type<std::string>() ) ); + + checkStringContent( CppTL::Enum::valuesRange( map1_.begin(), + map1_.end(), + CppTL::Type<std::string>() ) ); + checkStringContent( CppTL::Enum::anyValues( map1_ ) ); |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:52:03
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5408/src/cpput Modified Files: cpput.vcproj Log Message: * update with OpenTest stuff Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** cpput.vcproj 22 Oct 2004 06:20:23 -0000 1.15 --- cpput.vcproj 15 Nov 2004 08:51:43 -0000 1.16 *************** *** 129,136 **** Filter=""> <File ! RelativePath=".\SConscript"> </File> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File --- 129,136 ---- Filter=""> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File ! RelativePath=".\SConscript"> </File> <File *************** *** 192,195 **** --- 192,198 ---- Filter=""> <File + RelativePath="..\..\include\cpptl\atomiccounter.h"> + </File> + <File RelativePath="..\..\include\cpptl\config.h"> </File> *************** *** 198,204 **** --- 201,214 ---- </File> <File + RelativePath="..\..\include\cpptl\sharedptr.h"> + </File> + <File RelativePath="..\..\include\cpptl\typetraits.h"> </File> </Filter> + <Filter + Name="opentest" + Filter=""> + </Filter> <File RelativePath=".\assert.cpp"> *************** *** 355,358 **** --- 365,371 ---- </File> <File + RelativePath=".\testrunner.cpp"> + </File> + <File RelativePath="..\..\include\cpput\testrunresult.h"> </File> |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:51:09
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5128/include/cpptl Modified Files: config.h Log Message: * fixed int64_t support on VC++ 7.1 Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config.h 15 Nov 2004 08:19:53 -0000 1.4 --- config.h 15 Nov 2004 08:50:59 -0000 1.5 *************** *** 30,34 **** # if _MSC_VER >= 1310 // VC++ 7.1 # define CPPTL_HAS_INT64 1 ! # define CPPTL_HAS_LONGLONG 1 # pragma warning( disable : 4800 ) // forcing value to bool performance warning # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch --- 30,34 ---- # if _MSC_VER >= 1310 // VC++ 7.1 # define CPPTL_HAS_INT64 1 ! //# define CPPTL_HAS_LONGLONG 1 // support but not by default. # pragma warning( disable : 4800 ) // forcing value to bool performance warning # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:45:38
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3886 Modified Files: properties.h Log Message: * removed conversion loss of data warning Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** properties.h 15 Nov 2004 08:33:30 -0000 1.1 --- properties.h 15 Nov 2004 08:45:24 -0000 1.2 *************** *** 515,519 **** case vtSignedInteger: case vtUnsignedInteger: ! return guts_.intValue_; case vtReal: return int( guts_.realValue_ ); --- 515,519 ---- case vtSignedInteger: case vtUnsignedInteger: ! return int(guts_.intValue_); case vtReal: return int( guts_.realValue_ ); *************** *** 534,540 **** case vtSignedInteger: case vtUnsignedInteger: ! return guts_.uintValue_; case vtReal: ! return int( guts_.realValue_ ); default: throwBadCast(); --- 534,540 ---- case vtSignedInteger: case vtUnsignedInteger: ! return (unsigned int)(guts_.uintValue_); case vtReal: ! return (unsigned int)( guts_.realValue_ ); default: throwBadCast(); *************** *** 593,599 **** return guts_.boolValue_ ? 1.0 : 0.0; case vtSignedInteger: ! return guts_.intValue_; case vtUnsignedInteger: ! return guts_.uintValue_; case vtReal: return guts_.realValue_; --- 593,599 ---- return guts_.boolValue_ ? 1.0 : 0.0; case vtSignedInteger: ! return (long double)(guts_.intValue_); case vtUnsignedInteger: ! return (long double)(guts_.uintValue_); case vtReal: return guts_.realValue_; |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:39:31
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2891/cpputtest Modified Files: main.cpp Log Message: * disabled test failing on VC++ 6 * using OpenTest TextTestDriver instead of CppUnit runner stuff. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** main.cpp 4 Aug 2004 21:21:56 -0000 1.7 --- main.cpp 15 Nov 2004 08:39:20 -0000 1.8 *************** *** 12,15 **** --- 12,18 ---- #include "testfixturetest.h" + #include <cpput/testrunner.h> // cppunit2 testrunner for opentest + #include <opentest/texttestdriver.h> + bool testBasicAssertions(); *************** *** 19,22 **** --- 22,26 ---- bool testTestCase(); bool testFunctors(); + //bool testFunctors2(); *************** *** 25,28 **** --- 29,33 ---- return testBasicAssertions() && testFunctors() && + // testFunctors2() && testTestRunResult() && testTestContext() && *************** *** 76,82 **** allSuite->add( EnumeratorTest::suite() ); allSuite->add( AssertEnumTest::suite() ); ! allSuite->add( CommandLineOptionsTest::suite() ); CppUT::TestContext context; CppUT::TestRunResult result; --- 81,88 ---- allSuite->add( EnumeratorTest::suite() ); allSuite->add( AssertEnumTest::suite() ); ! // allSuite->add( CommandLineOptionsTest::suite() ); + /* // Old stuff using CppUnit 2 CppUT::TestContext context; CppUT::TestRunResult result; *************** *** 88,90 **** --- 94,106 ---- dumpFailures( *allSuite, result ); return result.successful() ? 0 : 1; + */ + + CppUT::TestRunner runner; + CppUT::AbstractTestSuitePtr rootSuite = + CppUT::staticPointerCast<CppUT::AbstractTestSuite>( allSuite ); + runner.setRootSuite( rootSuite ); + + OpenTest::TextTestDriver driver( runner ); + bool sucessful = driver.run(); + return sucessful ? 0 : 1; } |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:37:22
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2484/cpput Added Files: testrunner.cpp Log Message: * basic TestRunner implementation for use with OpenTest TestDriver. --- NEW FILE: testrunner.cpp --- #include <cpput/testrunner.h> #include <cpput/message.h> #include <cpput/testcontext.h> #include <cpput/testlistener.h> #include <cpput/testresult.h> #include <cpput/testsuite.h> #include <cpput/testvisitor.h> #include <opentest/properties.h> #include <opentest/testplan.h> namespace CppUT { // Class TestRunner::TestDeclaratorVisitor // ////////////////////////////////////////////////////////////////// class TestRunner::TestDeclaratorVisitor : public TestVisitor { public: TestDeclaratorVisitor( OpenTest::TestDeclarator &declarator, TestRunner::DeclaredTests &tests ) : declarator_( declarator ) , tests_( tests ) { } public: // overridden from TestVisitor void visitTestCase( Test &test ) { OpenTest::TestId id = declarator_.addTest( test.name(), OpenTest::Properties() ); tests_.insert( TestRunner::DeclaredTests::value_type( id, &test ) ); } void visitTestSuite( AbstractTestSuite &suite ) { OpenTest::TestId id = declarator_.beginSuite( suite.name(), OpenTest::Properties() ); tests_.insert( TestRunner::DeclaredTests::value_type( id, &suite ) ); for ( int index = 0; index < suite.testCount(); ++index ) suite.testAt( index )->accept( *this ); declarator_.endSuite(); } private: OpenTest::TestDeclarator &declarator_; TestRunner::DeclaredTests &tests_; }; class TestRunner::TestTrackerListener : public TestListener { public: TestTrackerListener( OpenTest::TestRunTracker &tracker ) : tracker_( tracker ) , testEntry_( 0 ) { } void setTestPlanEntry( const OpenTest::TestPlanEntry &entry ) { testEntry_ = &entry; } public: // overridden from TestListener void processTestResult( TestResult &result, TestContext &context ) { if ( !testEntry_ ) return; // Notes: at the current time, we don't retrieve the message // in a structured way. => need to change message to use // OpenTest::Properties. OpenTest::Properties openResult; openResult["result"]["status"]["success"] = result.succeeded(); openResult["result"]["status"]["type"] = result.resultType(); openResult["result"]["status"]["message"] = result.message().toString(); if ( result.location().isValid() ) { OpenTest::Value &openLocation = openResult["result"]["status"]["location"]; openLocation["file"] = result.location().fileName(); openLocation["line"] = result.location().lineNumber(); if ( result.location().hasFunctionName() ) openLocation["function"] = result.location().functionName(); } tracker_.addTestInfo( *testEntry_, openResult ); } private: OpenTest::TestRunTracker &tracker_; const OpenTest::TestPlanEntry *testEntry_; }; // Class TestRunner // ////////////////////////////////////////////////////////////////// TestRunner::TestRunner() : suite_( new TestSuite( "All Tests" ) ) { } void TestRunner::setRootSuite( const AbstractTestSuitePtr &suite ) { suite_ = suite; } AbstractTestSuitePtr TestRunner::rootSuite() const { return suite_; } void TestRunner::declareTests( OpenTest::TestDeclarator &declarator ) { TestDeclaratorVisitor visitor( declarator, tests_ ); suite_->accept( visitor ); } void TestRunner::runTests( const OpenTest::TestPlan &testPlan, OpenTest::TestRunTracker &tracker, const OpenTest::Properties &configuration ) { TestTrackerListener listener( tracker ); TestContext testContext; testContext.add( listener ); tracker.startTestRun(); OpenTest::TestPlanEntryPtrEnum enumEntries = testPlan.entries(); while ( enumEntries.hasNext() ) { const OpenTest::TestPlanEntry &entry = *enumEntries.next(); OpenTest::TestId id = entry.test(); DeclaredTests::const_iterator itTest = tests_.find( id ); listener.setTestPlanEntry( entry ); tracker.startTest( entry ); if ( itTest == tests_.end() ) // protocol error => unknown test { OpenTest::Properties openResult; openResult["result"]["status"]["success"] = false; openResult["result"]["status"]["type"] = "skip"; tracker.addTestInfo( entry, openResult ); } else { Test &test = *( itTest->second ); test.run( testContext ); } tracker.endTest( entry ); } tracker.endTestRun(); } } // namespace CppUT |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:36:33
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2296/cpputtest Modified Files: mocktestvisitor.h Log Message: * removed constness of visited tests. Index: mocktestvisitor.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/mocktestvisitor.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mocktestvisitor.h 29 Jan 2004 07:22:44 -0000 1.2 --- mocktestvisitor.h 15 Nov 2004 08:36:24 -0000 1.3 *************** *** 14,23 **** ! void visitTestCase( const CppUT::Test &test ) { ++visitTestCaseCount_; } ! void visitTestSuite( const CppUT::AbstractTestSuite &suite ) { ++visitTestSuiteCount_; --- 14,24 ---- ! public: // overridden from CppUT::TestVisitor ! void visitTestCase( CppUT::Test &test ) { ++visitTestCaseCount_; } ! void visitTestSuite( CppUT::AbstractTestSuite &suite ) { ++visitTestSuiteCount_; |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:34:22
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1882 Added Files: texttestdriver.h Log Message: * rough implementation of a simple TextTestDriver. --- NEW FILE: texttestdriver.h --- #ifndef OPENTEST_TEXTTESTDRIVER_H_INCLUDED # define OPENTEST_TEXTTESTDRIVER_H_INCLUDED # include <opentest/properties.h> # include <opentest/testplan.h> # include <opentest/testrunner.h> # include <deque> # include <map> # include <iostream> // for progress # include <set> # include <stack> namespace OpenTest { class OPENTEST_API TestDriverTestPlan : public TestPlan { public: // overriden from TestPlan TestPlanEntryPtrEnum entries() const; public: void add( const TestPlanEntryPtr &entry ); private: std::deque<TestPlanEntryPtr> entries_; }; class OPENTEST_API TestResult { public: TestResult( TestPlanEntryId id, TestId test ); void addTestResultInfo( const Properties &result ); TestPlanEntryId id() const; TestId test() const; const Properties &result() const; Properties &result(); private: TestPlanEntryId id_; TestId test_; Properties result_; }; class OPENTEST_API TestDriverTestPlanEntry : public TestPlanEntry { public: TestDriverTestPlanEntry( TestPlanEntryId id, TestId test, const Properties &configuration ); public: // overriden from TestPlanEntry TestPlanEntryId id() const; /// Test to run TestId test() const; /// Used to pass configuration data to the test runner or the test itself const Properties &configuration() const; private: TestPlanEntryId id_; TestId test_; Properties configuration_; }; class OPENTEST_API TextTestDriver : private TestRunTracker , private TestDeclarator { public: TextTestDriver( TestRunner &runner ); // void selectTest( const std::string &name ); bool run(); private: // overriden from TestDeclarator TestId beginSuite( const std::string &name, const Properties &data ); TestId addTest( const std::string &name, const Properties &data ); void addSuite( TestId suite ); void endSuite(); private: // overriden from TestRunTracker void startTestRun(); void startTest( const TestPlanEntry &testEntry ); void addTestInfo( const TestPlanEntry &testEntry, const Properties &data ); void endTest( const TestPlanEntry &testEntry ); void endTestRun(); bool shouldStopTestRun(); void aqcuireResources( const ResourceList &resources ) {} void releaseResources( const ResourceList &resources ) {} private: struct TestInfo { TestInfo( TestId id, const std::string &name, const Properties &info ) : id_( id ) , name_( name ) , info_( info ) { } TestId id_; std::string name_; Properties info_; }; typedef std::set<TestId> Tests; typedef std::map<TestId,TestId> Hierarchy; // suite <-> tests typedef std::stack<TestId> DeclarationSuites; typedef std::deque<TestResult> Results; typedef std::vector<unsigned int> TestResultIndexes; typedef std::map<TestId,TestInfo> TestInfos; TestId nextTestId(); void outputFailures(); const TestInfo &getTestInfo( TestId id ) const; TestRunner &runner_; TestInfos testInfos_; Tests tests_; Tests suites_; Hierarchy hierarchy_; DeclarationSuites declarationSuites_; Tests testsToRun_; Results results_; TestResultIndexes failures_; TestResultIndexes successes_; TestId nextTestId_; }; // Inline implementation of TextTestDriver // ////////////////////////////////////////////////////////////////// TestPlanEntryPtrEnum TestDriverTestPlan::entries() const { return CppTL::Enum::anyContainer( entries_ ); } void TestDriverTestPlan::add( const TestPlanEntryPtr &entry ) { entries_.push_back( entry ); } // Inline implementation of TestResult // ////////////////////////////////////////////////////////////////// inline TestResult::TestResult( TestPlanEntryId id, TestId test ) : id_( id ) , test_( test ) { } inline void TestResult::addTestResultInfo( const Properties &result ) { result_.mergeReplacingExisting( result ); } inline TestPlanEntryId TestResult::id() const { return id_; } inline TestId TestResult::test() const { return test_; } inline const Properties & TestResult::result() const { return result_; } inline Properties & TestResult::result() { return result_; } // Inline implementation of TestDriverTestPlanEntry // ////////////////////////////////////////////////////////////////// inline TestDriverTestPlanEntry::TestDriverTestPlanEntry( TestPlanEntryId id, TestId test, const Properties &configuration ) : id_( id ) , test_( test ) , configuration_( configuration ) { } TestPlanEntryId TestDriverTestPlanEntry::id() const { return id_; } /// Test to run TestId TestDriverTestPlanEntry::test() const { return test_; } /// Used to pass configuration data to the test runner or the test itself const Properties & TestDriverTestPlanEntry::configuration() const { return configuration_; } // Inline implementation of TextTestDriver // ////////////////////////////////////////////////////////////////// inline TextTestDriver::TextTestDriver( TestRunner &runner ) : runner_( runner ) , nextTestId_( 0 ) { runner_.declareTests( *this ); std::cout << "Declared suites: " << suites_.size() << "\n" << "Declared tests: " << tests_.size() << std::endl; } inline bool TextTestDriver::run() { if ( testsToRun_.empty() ) testsToRun_ = tests_; TestDriverTestPlan plan; Tests::const_iterator itTest = testsToRun_.begin(); unsigned int entryId = 0; for ( ; itTest != testsToRun_.end(); ++itTest ) plan.add( TestPlanEntryPtr( new TestDriverTestPlanEntry( ++entryId, *itTest, Properties() ) ) ); runner_.runTests( plan, *this, Properties() ); outputFailures(); return failures_.empty(); } inline TestId TextTestDriver::beginSuite( const std::string &name, const Properties &data ) { TestId id = nextTestId(); declarationSuites_.push( id ); suites_.insert( id ); TestInfo info( id, name, data ); testInfos_.insert( TestInfos::value_type( id, info ) ); return id; } inline TestId TextTestDriver::addTest( const std::string &name, const Properties &data ) { TestId id = nextTestId(); hierarchy_.insert( Hierarchy::value_type( declarationSuites_.top(), id ) ); tests_.insert( id ); TestInfo info( id, name, data ); testInfos_.insert( TestInfos::value_type( id, info ) ); return id; } inline void TextTestDriver::addSuite( TestId suite ) { hierarchy_.insert( Hierarchy::value_type( declarationSuites_.top(), suite ) ); } inline void TextTestDriver::endSuite() { declarationSuites_.pop(); } inline TestId TextTestDriver::nextTestId() { return ++nextTestId_; } inline void TextTestDriver::startTestRun() { results_.clear(); successes_.clear(); failures_.clear(); } inline void TextTestDriver::startTest( const TestPlanEntry &testEntry ) { TestResult result( testEntry.id(), testEntry.test() ); // should add descriptive test data first result.addTestResultInfo( testEntry.configuration() ); results_.push_back( result ); std::cout << "Testing '" << getTestInfo( testEntry.test() ).name_ << "' : "; std::cout.flush(); } inline void TextTestDriver::addTestInfo( const TestPlanEntry &testEntry, const Properties &data ) { results_.back().addTestResultInfo( data ); } inline void TextTestDriver::endTest( const TestPlanEntry &testEntry ) { const Properties &result = results_.back().result(); PropertiesAccessor status = result.accessor()["result"]["status"]; bool succeeded = status.getValue( "success", false ).asBool(); std::string statusInfo = succeeded ? "OK" : "FAIL"; if ( succeeded ) successes_.push_back( results_.size() - 1 ); else failures_.push_back( results_.size() - 1 ); std::string resultType = status.getValue( "type", "" ).asString(); if ( !resultType.empty() ) statusInfo += " (" + resultType + ")"; std::cout << statusInfo << std::endl; std::cout.flush(); } inline void TextTestDriver::endTestRun() { } inline bool TextTestDriver::shouldStopTestRun() { return false; } inline const TextTestDriver::TestInfo & TextTestDriver::getTestInfo( TestId test ) const { TestInfos::const_iterator it = testInfos_.find( test ); if ( it == testInfos_.end() ) throw std::invalid_argument( "TextTestDriver::getTestInfo() : bad TestId." ); return it->second; } inline void TextTestDriver::outputFailures() { if ( failures_.empty() ) { std::cout << "All " << testsToRun_.size() << " tests passed..." << std::endl; return; } TestResultIndexes::const_iterator failuresIt = failures_.begin(); for ( ; failuresIt != failures_.end(); ++failuresIt ) { const TestResult &testResult = results_.at( *failuresIt ); PropertiesAccessor info = testResult.result().accessor(); PropertiesAccessor locationInfo = info["result"]["status"]["location"]; if ( locationInfo.isValid() ) { std::cout << locationInfo.getValue("file").asString() << "(" << locationInfo.getValue("line").asInt() << ") : "; } else { std::cout << "Unknown failure location : "; } std::cout << getTestInfo( testResult.test() ).name_ << std::endl; std::string failureType = info["result"]["status"].getValue("type","").asString(); if ( !failureType.empty() ) std::cout << "Failure type : " << failureType << std::endl; std::string message = info["result"]["status"].getValue("message","").asString(); if ( !message.empty() ) std::cout << message << std::endl; std::cout << "Failures: " << failures_.size() << ", "; std::cout << "Tested: " << testsToRun_.size() << std::endl; } } } // namespace OpenTest #endif // OPENTEST_TEXTTESTDRIVER_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:33:39
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1703 Added Files: config.h forwards.h properties.h resourcelist.h testplan.h testrunner.h Log Message: * initial implementation of the TestRunner interface --- NEW FILE: resourcelist.h --- #ifndef OPENTEST_RESOURCELIST_H_INCLUDED # define OPENTEST_RESOURCELIST_H_INCLUDED # include <opentest/config.h> # include <string> namespace OpenTest { class OPENTEST_API ResourceList { public: ResourceList(); ResourceList( const std::string &name ); ResourceList &add( const std::string &name ); unsigned int count() const; std::string at( unsigned int index ) const; private: std::deque<std::string> resources_; }; // inline implementation of ResourceList // ////////////////////////////////////////////////////////////////// inline ResourceList::ResourceList() { } inline ResourceList::ResourceList( const std::string &name ) { add( name ); } inline ResourceList & ResourceList::add( const std::string &name ) { resources_.push_back( name ); return *this; } inline unsigned int ResourceList::count() const { return resources_.size(); } inline std::string ResourceList::at( unsigned int index ) const { return resources_.at( index ); } } // namespace OpenTest #endif // OPENTEST_RESOURCELIST_H_INCLUDED --- NEW FILE: config.h --- #ifndef OPENTEST_CONFIG_H_INCLUDED # define OPENTEST_CONFIG_H_INCLUDED # include <cpptl/config.h> /// @todo add autolink stuff here # define OPENTEST_API #endif // OPENTEST_CONFIG_H_INCLUDED --- NEW FILE: testrunner.h --- #ifndef OPENTEST_TESTRUNNER_H_INCLUDED # define OPENTEST_TESTRUNNER_H_INCLUDED # include <opentest/forwards.h> namespace OpenTest { class OPENTEST_API TestRunner { public: virtual ~TestRunner() { } virtual void declareTests( TestDeclarator &declarator ) = 0; // Notes: test plan must never contains suite [? do we want this constraint?]. // => may be the test runner should indicates if it supports running suite ? // => would make the TestRunTracker interface much more complex though... // => Move 'configuration' in TestPlan ? virtual void runTests( const TestPlan &testPlan, TestRunTracker &tracker, const Properties &configuration ) = 0; }; class OPENTEST_API TestDeclarator { public: virtual ~TestDeclarator() { } virtual TestId beginSuite( const std::string &name, const Properties &data ) = 0; virtual TestId addTest( const std::string &name, const Properties &data ) = 0; virtual void addSuite( TestId suite ) = 0; virtual void endSuite() = 0; }; class OPENTEST_API TestRunTracker { public: virtual ~TestRunTracker() { } virtual void startTestRun() = 0; virtual void startTest( const TestPlanEntry &testEntry ) = 0; virtual void addTestInfo( const TestPlanEntry &testEntry, const Properties &data ) = 0; virtual void endTest( const TestPlanEntry &testEntry ) = 0; virtual void endTestRun() = 0; virtual bool shouldStopTestRun() = 0; virtual void aqcuireResources( const ResourceList &resources ) = 0; virtual void releaseResources( const ResourceList &resources ) = 0; }; } // namespace OpenTest #endif // OPENTEST_TESTRUNNER_H_INCLUDED --- NEW FILE: properties.h --- #ifndef OPENTEST_PROPERTIES_H_INCLUDED # define OPENTEST_PROPERTIES_H_INCLUDED # include <opentest/config.h> # include <cpptl/enumerator.h> # include <exception> # include <deque> # include <vector> # include <string.h> namespace OpenTest { /// @todo For thread-safety, std::string need to be replaced with an implementation /// that guaranty that the copy constructor is thread-safe. class OPENTEST_API ValueBadCast : public std::bad_cast { public: ValueBadCast() [...1141 lines suppressed...] } inline Properties::PropertyList::const_iterator Properties::find( const std::string &name ) const { PropertyList::const_iterator it = properties_.begin(); PropertyList::const_iterator itEnd = properties_.end(); for ( ; it != itEnd; ++it ) if ( it->name() == name ) return it; return itEnd; } } // namespace OpenTest #endif // OPENTEST_PROPERTIES_H_INCLUDED --- NEW FILE: testplan.h --- #ifndef OPENTEST_TESTPLAN_H_INCLUDED # define OPENTEST_TESTPLAN_H_INCLUDED # include <opentest/forwards.h> # include <opentest/properties.h> # include <cpptl/enumerator.h> namespace OpenTest { typedef unsigned int TestPlanEntryId; class OPENTEST_API TestPlan { public: virtual ~TestPlan() { } virtual TestPlanEntryPtrEnum entries() const = 0; }; class OPENTEST_API TestPlanEntry { public: virtual ~TestPlanEntry() { } virtual TestPlanEntryId id() const = 0; /// Test to run virtual TestId test() const = 0; /// Used to pass configuration data to the test runner or the test itself virtual const Properties &configuration() const = 0; }; } // namespace OpenTest #endif // OPENTEST_TESTPLAN_H_INCLUDED --- NEW FILE: forwards.h --- #ifndef OPENTEST_FORWARDS_H_INCLUDED # define OPENTEST_FORWARDS_H_INCLUDED # include <opentest/config.h> # include <cpptl/enumerator.h> # include <cpptl/sharedptr.h> namespace OpenTest { class ConstPropertiesAccessor; class Property; class Properties; class ResourceList; class TestDeclarator; class TestPlan; class TestPlanEntry; class TestRunTracker; class Value; class ValueBadCast; typedef CppTL::SharedPtr<TestPlanEntry> TestPlanEntryPtr; typedef CppTL::AnyEnumerator<TestPlanEntryPtr> TestPlanEntryPtrEnum; typedef unsigned int TestId; } // namespace OpenTest #endif // OPENTEST_FORWARDS_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:32:13
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1425/opentest Log Message: Directory /cvsroot/cppunit/cppunit2/include/opentest added to the repository |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:31:52
|
Update of /cvsroot/cppunit/cppunit2/include/cpputtools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1372/include/cpputtools Modified Files: value.h Log Message: * implementation is broken on VC++ 6 (linker bug with function template) => caused commandlineoptions to crash. Index: value.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpputtools/value.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** value.h 4 Aug 2004 07:55:43 -0000 1.7 --- value.h 15 Nov 2004 08:31:43 -0000 1.8 *************** *** 5,8 **** --- 5,12 ---- # include <stdexcept> + /// @todo Implement broken on VC++ 6 because of linker bug: + /// => all get<xxx>() are resolved as the same function ! + + namespace CppUTTools { |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:30:50
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1226/include/cpput Added Files: testrunner.h Log Message: * basic TestRunner implementation for use with OpenTest TestDriver. --- NEW FILE: testrunner.h --- #ifndef CPPUT_TESTRUNNER_H_INCLUDED # define CPPUT_TESTRUNNER_H_INCLUDED # include <cpput/forwards.h> # include <opentest/testrunner.h> # include <map> namespace CppUT { class CPPUT_API TestRunner : public OpenTest::TestRunner { public: typedef std::map<OpenTest::TestId,Test *> DeclaredTests; TestRunner(); void setRootSuite( const AbstractTestSuitePtr &suite ); AbstractTestSuitePtr rootSuite() const; public: // overridden from OpenTest::TestRunner void declareTests( OpenTest::TestDeclarator &declarator ); void runTests( const OpenTest::TestPlan &testPlan, OpenTest::TestRunTracker &tracker, const OpenTest::Properties &configuration ); private: class TestDeclaratorVisitor; class TestTrackerListener; AbstractTestSuitePtr suite_; DeclaredTests tests_; }; } // namespace CppUT #endif // CPPUT_TESTRUNNER_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:30:15
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/include/cpput Modified Files: testvisitor.h Log Message: * removed constness of visited tests. Index: testvisitor.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testvisitor.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** testvisitor.h 27 Jan 2004 20:34:29 -0000 1.1.1.1 --- testvisitor.h 15 Nov 2004 08:30:05 -0000 1.2 *************** *** 14,20 **** } ! virtual void visitTestCase( const Test &test ) = 0; ! virtual void visitTestSuite( const AbstractTestSuite &suite ) = 0; }; --- 14,20 ---- } ! virtual void visitTestCase( Test &test ) = 0; ! virtual void visitTestSuite( AbstractTestSuite &suite ) = 0; }; |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:29:01
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv870/include/cpput Modified Files: testfixture.h typehelper.h Log Message: * added preprocessor macro to indicate if fixture suite name should be deduced through RTTI or macro expansion: CPPUT_USE_RTTI_TO_NAME_SUITE * fixed typehelper to work on VC++ 6 (linker bug caused all the templated function to resolve into the same function). Index: testfixture.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfixture.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testfixture.h 1 Feb 2004 16:12:51 -0000 1.3 --- testfixture.h 15 Nov 2004 08:28:51 -0000 1.4 *************** *** 152,155 **** --- 152,168 ---- */ + + + + # if CPPUT_USE_RTTI_TO_NAME_SUITE + # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ + ::CppUT::extractType( ::CppTL::Type<FixtureType>(), #FixtureType ) + # else // if CPPUT_USE_RTTI_TO_NAME_SUITE + # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ + std::string( #FixtureType ) + # endif // if CPPUT_USE_RTTI_TO_NAME_SUITE + + + # define CPPUT_TESTSUITE_BEGIN( FixtureType ) \ public: \ *************** *** 158,162 **** static std::string defaultSuiteName() \ { \ ! return ::CppUT::extractType<CppUT_ThisType>( #FixtureType ); \ } \ \ --- 171,175 ---- static std::string defaultSuiteName() \ { \ ! return CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ); \ } \ \ Index: typehelper.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/typehelper.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** typehelper.h 27 Jan 2004 20:34:29 -0000 1.1.1.1 --- typehelper.h 15 Nov 2004 08:28:51 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- # include <typeinfo> + /// @todo Some plateform such as embedded VC++ 4 do not provide std::type_info. namespace CppUT { *************** *** 24,28 **** template<class AType> ! std::string extractType( const char *hint ) { return Impl::extractTypeId( typeid( AType ), hint ); --- 25,30 ---- template<class AType> ! std::string extractType( CppTL::Type<AType>, ! const char *hint ) { return Impl::extractTypeId( typeid( AType ), hint ); |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:25:48
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv452/include/cpput Modified Files: forwards.h Log Message: * added forward declaration for AbstractTestSuitePtr Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/forwards.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** forwards.h 4 Aug 2004 19:41:19 -0000 1.7 --- forwards.h 15 Nov 2004 08:25:39 -0000 1.8 *************** *** 29,32 **** --- 29,33 ---- typedef SmartPtr<Test> TestPtr; typedef SmartPtr<TestExceptionGuard> TestExceptionGuardPtr; + typedef SmartPtr<AbstractTestSuite> AbstractTestSuitePtr; typedef SmartPtr<TestSuite> TestSuitePtr; |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:24:49
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv307/include/cpput Modified Files: config.h Log Message: * added preprocessor macro to indicate if fixture suite name should be deduced through RTTI or macro expansion: CPPUT_USE_RTTI_TO_NAME_SUITE * added missing include of cpptl config. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/config.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** config.h 21 Oct 2004 17:23:22 -0000 1.7 --- config.h 15 Nov 2004 08:24:40 -0000 1.8 *************** *** 2,5 **** --- 2,6 ---- # define CPPUT_CONFIG_H_INCLUDED + # include <cpptl/config.h> # include <boost/config.hpp> *************** *** 16,20 **** //# define CPPUT_USE_BEOS_DLL ! // compiler specific stuffs... --- 17,21 ---- //# define CPPUT_USE_BEOS_DLL ! # define CPPUT_USE_RTTI_TO_NAME_SUITE 1 // compiler specific stuffs... *************** *** 146,152 **** --- 147,157 ---- namespace CppUT { + + // defines YesType and NoType for simple generic programming struct YesType {}; struct NoType { char padding[256]; }; + + /// Base class for non copyable class. class CPPUT_API NonCopyable { |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:23:00
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32355/include/cpptl Added Files: atomiccounter.h sharedptr.h Log Message: * moved shared_ptr & atomiccounter from CppUT to cppTL * simplified implementation of AtomicCounter using forward declaration on windows instead of using pimpl. --- NEW FILE: atomiccounter.h --- #ifndef CPPTL_ATOMICCOUNTER_H_INCLUDED # define CPPTL_ATOMICCOUNTER_H_INCLUDED # include <cpptl/config.h> # ifdef WIN32 // Forwards declaration for WIN32 (avoid including windows.h) extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement(long volatile *); extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement(long volatile *); # endif // ifdef WIN32 namespace CppTL { class CPPTL_API AtomicCounter : public NonCopyable { public: AtomicCounter( long count = 0 ); long increment(); /// Decrements the count and returns the decremented count long decrement(); /// Should returns the current value of the count. /// \warning this method is only defined for debugging and testing /// purpose, you should not rely on it in production code. long count() const; private: volatile long count_; }; // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // AtomicCounter implementation for WIN32 // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// # ifdef WIN32 inline AtomicCounter::AtomicCounter( long count ) : count_( count ) { } inline long AtomicCounter::increment() { return InterlockedIncrement( const_cast< long * >( &count_ ) ); } inline long AtomicCounter::decrement() { return InterlockedDecrement( const_cast< long * >( &count_ ) ); } inline long AtomicCounter::count() const { return count_; } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // NON thread-safe implementation of AtomicCounter // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// #else inline AtomicCounter::AtomicCounter( long count ) : count_( count ) { } inline long AtomicCounter::increment() { return ++count_; } inline long AtomicCounter::decrement() { return --count_; } inline long AtomicCounter::count() const { return count_; } # endif // ifdef WIN32 } // namespace CppTL #endif // CPPTL_ATOMICCOUNTER_H_INCLUDED --- NEW FILE: sharedptr.h --- #ifndef CPPTL_SHAREDPTR_H_INCLUDED # define CPPTL_SHAREDPTR_H_INCLUDED # include <cpptl/config.h> // We use inheritance instead of the typedef in a struct to // simulate the template typedef because the typedef in a struct // trick does not support type deduction in template functions. // If CPPTL_USE_BOOST_SHARED_PTR is defined, then we use boost::shared_ptr // as our smart_pointer, otherwise we use a simple (partial) implementation // of our own. # ifndef CPPTL_USE_BOOST_SHARED_PTR # include <cpptl/atomiccounter.h> namespace CppTL { namespace Impl { struct StaticPointerCastTag {}; /// Smart-pointer base class to avoid template code bloat class SharedPtrBase { public: long use_count() const { if ( count_ ) return count_->count(); return 0; } bool unique() const { return use_count() == 1; } operator bool() const { return p_ != 0; } bool operator !() const { return p_ == 0; } protected: SharedPtrBase() : p_( 0 ) , count_( 0 ) { } explicit SharedPtrBase( void *p ) : p_( p ) , count_( p ? new AtomicCounter( 1 ) : 0 ) { } SharedPtrBase( void *p, AtomicCounter *count, StaticPointerCastTag ) : p_( p ) , count_( count ) { count_->increment(); } SharedPtrBase( const SharedPtrBase &other ) : p_( other.p_ ) , count_( other.count_ ) { if ( p_ ) count_->increment(); } ~SharedPtrBase() { // subclass destructor should call releaseCount(); } bool releaseCount() { if ( count_ && count_->decrement() == 0 ) { delete count_; return true; } return false; } void swap( SharedPtrBase &other ) { void *tmpP = p_; AtomicCounter *tmpCount = count_; p_ = other.p_; count_ = other.count_; other.p_ = tmpP; other.count_ = tmpCount; } void *get() const { return p_; } void *operator ->() const { // assert( p_ != 0 ) return p_; } //private: // Friend template function is not well supported // Private access required by function staticPointerCast<> public: void *p_; AtomicCounter *count_; }; } // namespace Impl template<class PointeeType> class SharedPtr : public Impl::SharedPtrBase { public: typedef SharedPtr<PointeeType> ThisType; typedef Impl::SharedPtrBase SuperClass; SharedPtr() { } explicit SharedPtr( PointeeType *p ) : Impl::SharedPtrBase( p ) { } SharedPtr( PointeeType *p, AtomicCounter *count, Impl::StaticPointerCastTag ) : Impl::SharedPtrBase( p, count, Impl::StaticPointerCastTag() ) { } SharedPtr( const ThisType &other ) : Impl::SharedPtrBase( other ) { } ~SharedPtr() { if ( releaseCount() ) delete p_; } void reset() { SharedPtr tmp; tmp.swap( *this ); } void reset( PointeeType *p ) { SharedPtr tmp( p ); tmp.swap( *this ); } PointeeType *get() const { return static_cast<PointeeType *>( SharedPtrBase::get() ); } void swap( SharedPtr &other ) { SuperClass::swap( other ); } ThisType &operator =( const SharedPtr &other ) { ThisType tmp( other ); swap( tmp ); return *this; } PointeeType &operator *() const { // assert( p_ != 0 ) return *( static_cast<PointeeType *>( p_ ) ); } PointeeType *operator ->() const { return static_cast<PointeeType *>( SuperClass::operator ->() ); } }; template<class TargetType, class SourceType> SharedPtr<TargetType> staticPointerCast( const SharedPtr<SourceType> &p ) { TargetType *target = static_cast<TargetType *>( p.p_ ); return SharedPtr<TargetType>( target, p.count_, Impl::StaticPointerCastTag() ); } } // namespace CppTL # else // ifndef CPPTL_USE_BOOST_SHARED_PTR # include <boost/shared_ptr.hpp> namespace CppTL { template<class PointeeType> class SharedPtr : public ::boost::shared_ptr<PointeeType> { public: typedef SharedPtr<PointeeType> ThisType; SharedPtr() { } explicit SharedPtr( PointeeType *p ) : ::boost::shared_ptr( p ) { } SharedPtr( const ::boost::shared_ptr<PointeeType> &other ) : ::boost::shared_ptr( other ) { } ThisType &operator =( const ::boost::shared_ptr<PointeeType> &other ) { return ::boost::shared_ptr<PointeeType>::operator =( other ); } }; template<class T, class U> SharedPtr<T> staticPointerCast( const ::boost::shared_ptr<U> & r) { return SharedPtr<T>( ::boost::static_pointer_cast<T>( r ) ); } } // namespace CppTL # endif // ifndef CPPTL_USE_BOOST_SHARED_PTR #endif // CPPTL_SHAREDPTR_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:21:15
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31861/include/cpptl Modified Files: enumerator.h Log Message: * added missing template partial specialization guard * fixed return on void function Index: enumerator.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/enumerator.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** enumerator.h 15 Nov 2004 08:18:55 -0000 1.3 --- enumerator.h 15 Nov 2004 08:21:04 -0000 1.4 *************** *** 22,25 **** --- 22,26 ---- }; + # ifndef CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION template<class ValueType> struct STLIteratorTraits<ValueType *> // broken stl vector iterator *************** *** 27,30 **** --- 28,32 ---- typedef ValueType value_type; }; + # endif } // namespace CppTL *************** *** 799,803 **** void advance() { ! return enumerator_->advance(); } --- 801,805 ---- void advance() { ! enumerator_->advance(); } |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:20:02
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31624/include/cpptl Modified Files: config.h Log Message: * added portable int64_t and uint64_t * fixed some macros prefix * fixed VC6 profile Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** config.h 15 Nov 2004 08:12:20 -0000 1.3 --- config.h 15 Nov 2004 08:19:53 -0000 1.4 *************** *** 9,15 **** --- 9,18 ---- # if _MSC_VER <= 1200 // VC++ 6 or before # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info + # pragma warning( disable : 4800 ) // forcing value to bool performance warning + # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch # define CPPTL_NO_VECTOR_STD_ITERATOR # define CPPTL_NO_FUNCTION_TEMPLATE_ORDERING # define CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION + # define CPPTL_HAS_INT64 1 # endif *************** *** 26,29 **** --- 29,34 ---- # if _MSC_VER >= 1310 // VC++ 7.1 + # define CPPTL_HAS_INT64 1 + # define CPPTL_HAS_LONGLONG 1 # pragma warning( disable : 4800 ) // forcing value to bool performance warning # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch *************** *** 44,54 **** # endif ! /// CPPUT_STATIC_CONSTANT is defined to declare a static constant in a class ! /// struct A { CPPUT_STATIC_CONSTANT( x, 1 ) }; // A::x = 1 # if defined(CPPTL_NO_ENUM_STATIC_CONSTANT) ! # define CPPUT_STATIC_CONSTANT( type, assignment ) \ static const int assignment # else ! # define CPPUT_STATIC_CONSTANT( type, assignment ) \ enum { assignment } # endif --- 49,59 ---- # endif ! /// CPPTL_STATIC_CONSTANT is defined to declare a static constant in a class ! /// struct A { CPPTL_STATIC_CONSTANT( x, 1 ) }; // A::x = 1 # if defined(CPPTL_NO_ENUM_STATIC_CONSTANT) ! # define CPPTL_STATIC_CONSTANT( type, assignment ) \ static const int assignment # else ! # define CPPTL_STATIC_CONSTANT( type, assignment ) \ enum { assignment } # endif *************** *** 61,64 **** --- 66,74 ---- # endif + // auto-link specification + /////////////////////////////////////////////////////////////////////////// + + # define CPPTL_API + /////////////////////////////////////////////////////////////////////////// *************** *** 67,73 **** --- 77,99 ---- (void)(0) + # define CPPTL_DEBUG_ASSERT_UNREACHABLE \ + (void)(0) + namespace CppTL { + // defines portable int64_t && uint64_t + # ifndef CPPTL_NO_INT64 + # if CPPTL_HAS_LONGLONG + typedef long long int64_t; + typedef unsigned long long uint64_t; + # elif CPPTL_HAS_INT64 + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + # else + # define CPPTL_NO_INT64 1 + # endif + # endif + template<class T> struct Type *************** *** 76,79 **** --- 102,123 ---- }; + + /// Base class for non copyable class. + class CPPTL_API NonCopyable + { + public: + NonCopyable() + { + } + + ~NonCopyable() + { + } + + private: + NonCopyable( const NonCopyable &other ); + void operator =( const NonCopyable &other ); + }; + } // namespace CppTL |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:19:05
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31447/include/cpptl Modified Files: enumerator.h Log Message: * started implementing explicit type passing for returned enumerator in generator function. Index: enumerator.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/enumerator.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** enumerator.h 22 Oct 2004 06:20:23 -0000 1.2 --- enumerator.h 15 Nov 2004 08:18:55 -0000 1.3 *************** *** 304,308 **** } ! const value_type ¤t() const { CPPTL_ENUMERATOR_CHECK_CURRENT; --- 304,308 ---- } ! value_type current() const { CPPTL_ENUMERATOR_CHECK_CURRENT; *************** *** 500,504 **** } - MapKeysEnumerator &operator =( const Super &other ) { --- 500,503 ---- *************** *** 808,816 **** ! template<class ThinEnumeratorType> class SugarEnumerator { public: ! typedef CPPTL_TYPENAME ThinEnumeratorType::value_type value_type; typedef SugarEnumerator<ThinEnumeratorType> self_type; --- 807,816 ---- ! template<class ThinEnumeratorType ! ,class ValueType = CPPTL_TYPENAME ThinEnumeratorType::value_type > class SugarEnumerator { public: ! typedef ValueType value_type; typedef SugarEnumerator<ThinEnumeratorType> self_type; *************** *** 860,863 **** --- 860,871 ---- return EnumType( begin, end ); } + template<class ForwardItType + ,class ValueType> + ForwardItEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> + range( ForwardItType begin, ForwardItType end, ValueType ) + { + typedef ForwardItEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> EnumType; + return EnumType( begin, end ); + } *************** *** 880,883 **** --- 888,901 ---- } + + template<class ContainerType + ,class ValueType> + ContainerEnumerator<ContainerType,CPPTL_TYPENAME ValueType::type> + container( const ContainerType &enumeratedContainer, ValueType ) + { + typedef ContainerEnumerator<ContainerType,CPPTL_TYPENAME ValueType::type> EnumType; + return EnumType( enumeratedContainer ); + } + template<class ForwardItType> MapKeysEnumerator<ForwardItType> *************** *** 888,891 **** --- 906,918 ---- } + template<class ForwardItType + ,class ValueType> + MapKeysEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> + keysRange( ForwardItType begin, ForwardItType end, ValueType ) + { + typedef MapKeysEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> EnumType; + return EnumType( begin, end ); + } + template<class ContainerType> MapKeysEnumerator< *************** *** 898,901 **** --- 925,937 ---- } + template<class ContainerType + ,class ValueType> + MapKeysEnumerator< CPPTL_TYPENAME ContainerType::const_iterator + , CPPTL_TYPENAME ValueType::type > + keys( const ContainerType &container, ValueType ) + { + return keysRange( container.begin(), container.end(), ValueType() ); + } + template<class ContainerType> MapValuesEnumerator< *************** *** 909,912 **** --- 945,959 ---- } + template<class ContainerType + ,class ValueType> + MapValuesEnumerator< CPPTL_TYPENAME ContainerType::const_iterator + , CPPTL_TYPENAME ValueType::type > + values( const ContainerType &container, ValueType ) + { + typedef MapValuesEnumerator< ContainerType::const_iterator + , CPPTL_TYPENAME ValueType::type > EnumType; + return EnumType( container.begin(), container.end() ); + } + template<class ForwardItType> MapValuesEnumerator<ForwardItType> *************** *** 917,920 **** --- 964,976 ---- } + template<class ForwardItType + ,class ValueType> + MapValuesEnumerator< ForwardItType, CPPTL_TYPENAME ValueType::type > + valuesRange( ForwardItType begin, ForwardItType end, ValueType ) + { + typedef MapValuesEnumerator< ForwardItType, CPPTL_TYPENAME ValueType::type > EnumType; + return EnumType( begin, end ); + } + template<class EnumeratorType> |
From: Baptiste L. <bl...@us...> - 2004-11-15 08:12:30
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30106/include/cpptl Modified Files: config.h Log Message: * added CppUT::Type<> template to pass type around on older compiler. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config.h 22 Oct 2004 06:20:23 -0000 1.2 --- config.h 15 Nov 2004 08:12:20 -0000 1.3 *************** *** 22,25 **** --- 22,26 ---- // VC++ 7.1. Since it is not required to compile, we just pretend it's not available. # define CPPTL_NO_DEDUCED_TYPENAME + # define CPPTL_NO_TEMPLATE_PARTIAL_SPECIALIZATION # endif *************** *** 67,70 **** --- 68,81 ---- + namespace CppTL { + + template<class T> + struct Type + { + typedef T type; + }; + + } // namespace CppTL + #endif // CPPTL_CONFIG_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2004-11-14 23:11:15
|
Update of /cvsroot/cppunit/cppunit2/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26425/doc Log Message: Directory /cvsroot/cppunit/cppunit2/doc added to the repository |