diff --git a/build/boost_test_library.dsw b/build/boost_test_library.dsw index 1468235a..b7fee7ca 100644 --- a/build/boost_test_library.dsw +++ b/build/boost_test_library.dsw @@ -18,6 +18,18 @@ Package=<4> ############################################################################### +Project: "minimal_test"=".\minimal_test.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "online_test"=".\online_test.dsp" - Package Owner=<4> Package=<5> @@ -45,6 +57,21 @@ Package=<4> ############################################################################### +Project: "parameterized_test_test"=".\parameterized_test_test.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name test_exec_monitor + End Project Dependency +}}} + +############################################################################### + Project: "prg_exec_example"=".\prg_exec_example.dsp" - Package Owner=<4> Package=<5> diff --git a/build/minimal_test.dsp b/build/minimal_test.dsp new file mode 100644 index 00000000..7138d614 --- /dev/null +++ b/build/minimal_test.dsp @@ -0,0 +1,106 @@ +# Microsoft Developer Studio Project File - Name="minimal_test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=minimal_test - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "minimal_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "minimal_test.mak" CFG="minimal_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "minimal_test - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "minimal_test - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=xicl6.exe +RSC=rc.exe + +!IF "$(CFG)" == "minimal_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=xilink6.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "minimal_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "c:\temp\boost_test_library\Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\.." /D "_CONSOLE" /D "WIN32" /D "_DEBUG" /D "_MBCS" /YX /FD /GZ /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=xilink6.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Debug" + +!ENDIF + +# Begin Target + +# Name "minimal_test - Win32 Release" +# Name "minimal_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\test\minimal_test.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\..\boost\test\minimal.hpp +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/build/output_test_stream_test.dsp b/build/output_test_stream_test.dsp index 448ec809..bb7b3b27 100644 --- a/build/output_test_stream_test.dsp +++ b/build/output_test_stream_test.dsp @@ -39,9 +39,10 @@ RSC=rc.exe # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -49,7 +50,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "output_test_stream_test - Win32 Debug" diff --git a/build/parameterized_test_test.dsp b/build/parameterized_test_test.dsp new file mode 100644 index 00000000..487010b6 --- /dev/null +++ b/build/parameterized_test_test.dsp @@ -0,0 +1,102 @@ +# Microsoft Developer Studio Project File - Name="parameterized_test_test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=parameterized_test_test - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "parameterized_test_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "parameterized_test_test.mak" CFG="parameterized_test_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "parameterized_test_test - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "parameterized_test_test - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=xicl6.exe +RSC=rc.exe + +!IF "$(CFG)" == "parameterized_test_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=xilink6.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "parameterized_test_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "c:\temp\boost_test_library\Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\.." /D "_CONSOLE" /D "WIN32" /D "_DEBUG" /D "_MBCS" /YX /FD /GZ /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=xilink6.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib test_exec_monitor.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Debug" + +!ENDIF + +# Begin Target + +# Name "parameterized_test_test - Win32 Release" +# Name "parameterized_test_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\test\parameterized_test_test.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/build/unit_test_framework.dsp b/build/unit_test_framework.dsp index 71e627ed..8a475542 100644 --- a/build/unit_test_framework.dsp +++ b/build/unit_test_framework.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe diff --git a/doc/components_testing.htm b/doc/components_testing.htm index eb7b7d3b..963ed5c6 100644 --- a/doc/components_testing.htm +++ b/doc/components_testing.htm @@ -1,4 +1,4 @@ - + @@ -214,7 +214,7 @@ Expected output:
*** No errors detected
Result code: 0

-

11. The Unit Test Framework extension test

@@ -247,14 +247,12 @@ Expected output:
*** Failures in "call_test_main"
Result code: 120

diff --git a/doc/execution_monitor.htm b/doc/execution_monitor.htm index 9a817e07..efcf939f 100644 --- a/doc/execution_monitor.htm +++ b/doc/execution_monitor.htm @@ -1,4 +1,4 @@ - + @@ -9,10 +9,10 @@ -
+
- - + diff --git a/doc/faq.htm b/doc/faq.htm index 96835908..7923a410 100644 --- a/doc/faq.htm +++ b/doc/faq.htm @@ -1,4 +1,4 @@ - + @@ -9,10 +9,10 @@ -
+
Boost logo +
Boost logo

Boost Test Library: Execution Monitor

Introduction
Benefits
@@ -22,43 +22,43 @@ Rationale
Design

Introduction

-

The Boost Test Library's Execution Monitor calls a user-supplied - function in a controlled environment, relieving users from a messy error detection. - To use the Execution Monitor derive a class from the boost::execution_monitor - and overwrite the virtual method int execution_monitor::function(). To start the - monitored function call the execution_monitor::execute( timeout ) member function. - All symbols in the Execution Monitor implementation are located in the namespace - boost.reference to the top +

The Boost Test Library's Execution Monitor calls a user-supplied + function in a controlled environment, relieving users from a messy error detection. + To use the Execution Monitor derive a class from the boost::execution_monitor + and overwrite the virtual method int execution_monitor::function(). To start the + monitored function call the execution_monitor::execute( timeout ) member function. + All symbols in the Execution Monitor implementation are located in the namespace + boost.reference to the top

Benefits

-

Controlled execution of error prone functions with a uniform +

Controlled execution of error prone functions with a uniform error notification.

Specification of boost::execution_monitor

-

boost::execution_monitor uniformly detects and reports - the occurrence of several types of signals and exceptions, reducing various errors - to a uniform boost::execution_exception +

boost::execution_monitor uniformly detects and reports + the occurrence of several types of signals and exceptions, reducing various errors + to a uniform boost::execution_exception which is returned to a caller.

Usage:

  1. Create class inherited from the class execution_monitor.
  2. Overwrite the virtual function int execution_monitor::function().
  3. -
  4. Call the method execution_monitor::execute( timeout - ). The timeout argument specifies seconds that - elapse before a timer_error occurs. May +
  5. Call the method execution_monitor::execute( timeout + ). The timeout argument specifies seconds that + elapse before a timer_error occurs. May be ignored on some platforms.

Effects:

-

Calls the execution_monitor::function() inside a try/catch block - which may also include other unspecified platform dependent error detection code. - Throws boost::execution_exception on an - uncaught C++ exception, a hardware or software signal, trap, or other exception. - execution_monitor::execute() doesn't consider it an error for the execution_monitor::function() +

Calls the execution_monitor::function() inside a try/catch block + which may also include other unspecified platform dependent error detection code. + Throws boost::execution_exception on an + uncaught C++ exception, a hardware or software signal, trap, or other exception. + execution_monitor::execute() doesn't consider it an error for the execution_monitor::function() to return a non-zero value.

Returns: -

-

The integer value returned by the execution_monitor::function(). +

+

The integer value returned by the execution_monitor::function().

- reference to the top + reference to the top

Specification of boost::execution_exception

@@ -76,45 +76,41 @@ char const what() const; }; -

Note 1: Only uncaught C++ exceptions are treated as errors. If the application +

Note 1: Only uncaught C++ exceptions are treated as errors. If the application catches a C++ exception, it will never reach the boost::execution_monitor.

-

Note 2: These errors include Unix signals and Windows structured exceptions. +

Note 2: These errors include Unix signals and Windows structured exceptions. They are often initiated by hardware traps.

-

The implementation decides what is a fatal_system_exception - and what is just a system_exception. Fatal errors are so likely to have corrupted - machine state (like a stack overflow or addressing exception) that it is unreasonable - to continue execution. +

The implementation decides what is a fatal_system_exception + and what is just a system_exception. Fatal errors are so likely to have corrupted + machine state (like a stack overflow or addressing exception) that it is unreasonable + to continue execution. reference to the top

The Execution Monitor compilation

-

To use the Execution Monitor standalone you should include - an execution_monitor.cpp into your project. +

To use the Execution Monitor standalone you should include + an execution_monitor.cpp into your project. It is also supplied as a part of all other Boost Test Library's components.

Examples

-

For examples of usage of Execution Monitor see Program - Execution Monitor or Unit Test Framework. +

For examples of usage of Execution Monitor see Program + Execution Monitor or Unit Test Framework.

Rationale

-

Sometimes we need to call a function and make sure that - no user or system originated exception are being thrown by it. Also uniform exception - reporting would be convenient. While designing we should be aware that we can be +

Sometimes we need to call a function and make sure that + no user or system originated exception are being thrown by it. Also uniform exception + reporting would be convenient. While designing we should be aware that we can be in a situation with no (or almost no) memory available.

Design

-

The Boost Test Library Design - document describes the relationship between the Execution Monitor and several other - components. reference to the top +

The Boost Test Library Design + document describes the relationship between the Execution Monitor and several other + components. reference to the top


-
- - + diff --git a/doc/floating_point_comparison.htm b/doc/floating_point_comparison.htm index 8e5433ad..2288bb22 100644 --- a/doc/floating_point_comparison.htm +++ b/doc/floating_point_comparison.htm @@ -1,4 +1,4 @@ - + @@ -9,10 +9,10 @@ -
+
Boost logo +
Boost logo

Boost Test Library: frequently asked questions

Where is located the latest version of the Boost Test Library?

-

The latest version of Boost Test Library is available +

The latest version of Boost Test Library is available online on www.boost.org.

I found a bug. Where could I report it?

-

Send a bug report to Gennadiy +

Send a bug report to Gennadiy Rozental.

I have a request for a new feature. Where could I ask for it?

-

You can send a request to Gennadiy +

You can send a request to Gennadiy Rozental.

How to create test case?

-

To create a test case use the macro BOOST_TEST_CASE( test_function - ). For more details see Unit test +

To create a test case use the macro BOOST_TEST_CASE( test_function + ). For more details see Unit test framework documentation.

How to create test suite?

-

To create a test suite use the macro BOOST_TEST_SUITE( - suite_name ). For more details see Unit +

To create a test suite use the macro BOOST_TEST_SUITE( + suite_name ). For more details see Unit test framework documentation.

Why did I get a linker error when compiling my test program?

-

Boost Test Library is implemented offline. - To create a test program you should link with the one of the precompiled - library components or use "included" version of the component located - in a boost/test/included directory. For example, to use Test Execution - Monitor you may either include the <boost/test/test_tools.hpp> - and link with libtest_exec_monitor.lib or you could include <boost/test/included/test_exec_monitor.hpp> - in which case you would not need to link with any precompiled component. - Note also that you should strictly follow specification on integration - function in other case some compilers may produce linker error like - this: -

+

Boost Test Library is implemented offline. + To create a test program you should link with the one of the precompiled + library components or use "included" version of the component located + in a boost/test/included directory. For example, to use Test Execution + Monitor you may either include the <boost/test/test_tools.hpp> + and link with libtest_exec_monitor.lib or you could include <boost/test/included/test_exec_monitor.hpp> + in which case you would not need to link with any precompiled component. + Note also that you should strictly follow specification on integration + function in other case some compilers may produce linker error like + this: +

Unresolved external 'init_unit_test_suite(int, char * *).

-

The reasons for this error is that in your implementation you should specify second +

The reasons for this error is that in your implementation you should specify second argument of init_unit_test_suite exactly as in a specification, i.e.: char* [].

How could I redirect testing output?

-

Use unit_test_log::instance()->set_log_output( std::ostream& - ). For more details see Unit test framework +

Use unit_test_log::instance()->set_log_output( std::ostream& + ). For more details see Unit test framework documentation.

I want different default log trace level

-

Use environment variable BOOST_TEST_LOG_LEVEL to define - desired log trace level. You still will be able to reset this value from the command - line. For the list of acceptable values see Unit +

Use environment variable BOOST_TEST_LOG_LEVEL to define + desired log trace level. You still will be able to reset this value from the command + line. For the list of acceptable values see Unit test framework documentation.

-
- - + diff --git a/doc/framework_extensions.htm b/doc/framework_extensions.htm new file mode 100644 index 00000000..4c60ce09 --- /dev/null +++ b/doc/framework_extensions.htm @@ -0,0 +1,29 @@ + + + + +Unit Test Framework Extensions + + + + + + +
+
Boost logo +
Boost logo

Floating-point comparison algorithms

Introduction
How to choose a tolerance
@@ -21,59 +21,59 @@ Acknowledgements
References

Introduction

-

In most cases it is unreasonable to use an operator=(...) - for a floating-point values equality check The simple solution like abs(f1-f2) - <= e does not work for very small or very big values. This floating-point comparison - algorithm is based on the more confident solution presented by Knuth in [1]. For +

In most cases it is unreasonable to use an operator=(...) + for a floating-point values equality check The simple solution like abs(f1-f2) + <= e does not work for very small or very big values. This floating-point comparison + algorithm is based on the more confident solution presented by Knuth in [1]. For a given floating point values u and v and a tolerance e:

- - + - - + - +
-

| u - v | <= e * |u| and | +

+

| u - v | <= e * |u| and | u - v | <= e * |v|
-
defines a "very close with tolerance e" relationship between - u and v + defines a "very close with tolerance e" relationship between + u and v

(1)
-

| u - v | <= e * |u| or   +

+

| u - v | <= e * |u| or   | u - v | <= e * |v|
-
defines a "close enough with tolerance e" relationship between - u and v + defines a "close enough with tolerance e" relationship between + u and v

(2) (2)
-

Both relationships are commutative but are not transitive. - The relationship defined by inequations (1) is stronger that the relationship - defined by inequations (2) (i.e. (1) => (2) ). Because - of the multiplication in the right side of inequations, that could cause an unwanted - underflow condition, the implementation is using modified version of the inequations - (1) and (2) where all underflow, overflow conditions could be guarded +

Both relationships are commutative but are not transitive. + The relationship defined by inequations (1) is stronger that the relationship + defined by inequations (2) (i.e. (1) => (2) ). Because + of the multiplication in the right side of inequations, that could cause an unwanted + underflow condition, the implementation is using modified version of the inequations + (1) and (2) where all underflow, overflow conditions could be guarded safely:

- - +
-

| u - v | / |u| <= e +

+

| u - v | / |u| <= e and | u - v | / |v| <= e
-
| u - v | / |u| <= e or   | u - - v | / |v| <= e + | u - v | / |u| <= e or   | u + - v | / |v| <= e

(1`)
(2`)
- reference to the top + reference to the top

How to choose a tolerance

-

In case of absence of a domain specific requirements the - value of tolerance could be chosen as a sum of the predicted upper limits for "relative - rounding errors" of compared values. The "rounding" is the operation - by which a real value 'x' is represented in a floating-point format with 'p' binary - digits (bits) as the floating-point value 'X'. The "relative rounding error" - is the difference between the real and the floating point values in relation to - real value: |x-X|/|x|. The discrepancy between real and floating point value may +

In case of absence of a domain specific requirements the + value of tolerance could be chosen as a sum of the predicted upper limits for "relative + rounding errors" of compared values. The "rounding" is the operation + by which a real value 'x' is represented in a floating-point format with 'p' binary + digits (bits) as the floating-point value 'X'. The "relative rounding error" + is the difference between the real and the floating point values in relation to + real value: |x-X|/|x|. The discrepancy between real and floating point value may be caused by several reasons:

  • Type promotion
  • @@ -81,43 +81,43 @@
  • Conversion from a decimal presentation to a binary presentation
  • Non-arithmetic operation
-

The first two operations proved to have a relative rounding - error that does not exceed 1/2 * "machine epsilon value" for the appropriate - floating point type (represented by std::numeric_limits<FPT>::epsilon()). - conversion to binary presentation, sadly, does not have such requirement. So we - can't assume that float 1.1 is close to real 1.1 with tolerance 1/2 * "machine - epsilon value" for float (though for 11./10 we can). Non arithmetic operations - either do not have a predicted upper limit relative rounding errors. Note that - both arithmetic and non arithmetic operations might also produce others "non-rounding" +

The first two operations proved to have a relative rounding + error that does not exceed 1/2 * "machine epsilon value" for the appropriate + floating point type (represented by std::numeric_limits<FPT>::epsilon()). + conversion to binary presentation, sadly, does not have such requirement. So we + can't assume that float 1.1 is close to real 1.1 with tolerance 1/2 * "machine + epsilon value" for float (though for 11./10 we can). Non arithmetic operations + either do not have a predicted upper limit relative rounding errors. Note that + both arithmetic and non arithmetic operations might also produce others "non-rounding" errors, such as underflow/overflow, division-by-zero or 'operation errors'.

-

All theorems about the upper limit of a rounding error, - including that of 1/2*epsilon, refers only - to the 'rounding' operation, nothing more. This means that the 'operation error', - that is, the error incurred by the operation itself, besides rounding, isn't considered. - In order for numerical software to be able to actually predict error bounds, the - IEEE754 standard requires arithmetic operations to be 'correctly or exactly rounded'. - That is, it is required that the internal computation of a given operation be such - that the floating point result is the exact - result rounded to the number of working bits. In other words, it is required that - the computation used by the operation itself doesn't introduce any additional errors. - The IEEE754 standard does not require same behavior from most non-arithmetic operation. - The underflow/overflow and division-by-zero errors may cause rounding errors with +

All theorems about the upper limit of a rounding error, + including that of 1/2*epsilon, refers only + to the 'rounding' operation, nothing more. This means that the 'operation error', + that is, the error incurred by the operation itself, besides rounding, isn't considered. + In order for numerical software to be able to actually predict error bounds, the + IEEE754 standard requires arithmetic operations to be 'correctly or exactly rounded'. + That is, it is required that the internal computation of a given operation be such + that the floating point result is the exact + result rounded to the number of working bits. In other words, it is required that + the computation used by the operation itself doesn't introduce any additional errors. + The IEEE754 standard does not require same behavior from most non-arithmetic operation. + The underflow/overflow and division-by-zero errors may cause rounding errors with unpredictable upper limits.

-

For a given number of rounding error (in a simple case - it's just a number of floating point constants and arithmetic involved) it is proposed +

For a given number of rounding error (in a simple case + it's just a number of floating point constants and arithmetic involved) it is proposed to calculate a tolerance as follows:

- + - +
n*std::numeric_limits<T>::epsilon()/2 (3) (3)

where n is number of floating-point rounding errors.

-

For more reading about floating-point comparison see references +

For more reading about floating-point comparison see references at the end.

The close_at_tolerance algorithm

-

The close_at_tolerance - algorithm allows to check the relationship defines by inequations (1) +

The close_at_tolerance + algorithm allows to check the relationship defines by inequations (1) or (2). It is implemented as binary predicate.

template<typename FPT>
 class close_at_tolerance
@@ -129,47 +129,43 @@
 
     bool operator()( FPT left, FPT right ) const;
 };
-

The first constructor allows to specify a tolerance value - to compare against. The first constructor allows to specify a number of rounding - errors, in which case a tolerance is computed using expression (3). - The strong_or_weak switch allows to which relationship is checked. The default - behavior is to check strong relationship defined by inequations (1). - reference to the top +

The first constructor allows to specify a tolerance value + to compare against. The first constructor allows to specify a number of rounding + errors, in which case a tolerance is computed using expression (3). + The strong_or_weak switch allows to which relationship is checked. The default + behavior is to check strong relationship defined by inequations (1). + reference to the top

Compilation

-

The close_at_tolerance algorithm - is implemented in the header file - floating_point_comparison.hpp. It is recommended to use test tools wrappers - located on test_tools.hpp. Note - that you still need to include +

The close_at_tolerance algorithm + is implemented in the header file + floating_point_comparison.hpp. It is recommended to use test tools wrappers + located on test_tools.hpp. Note + that you still need to include floating_point_comparison.hpp yourself since it does not get included automatically.

-

Acknowledgement

-

Fernando Cacciola for very helpful discussion of floating +

Acknowledgements

+

Fernando Cacciola for very helpful discussion of floating point arithmetic in the boost forum.

References

[1] Knuth D.E. The art of computer programming (vol II).
- [2] David Goldberg + [2] David Goldberg What Every Computer Scientist Should Know About Floating-Point Arithmetic
- [3] Kulisch U. + [3] Kulisch U. Rounding near zero.
- [4] Philippe Langlois From + [4] Philippe Langlois From Rounding Error Estimation to Automatic Correction with Automatic Differentiation
- [5] Lots of information on William Kahan home + [5] Lots of information on William Kahan home page
- [4] Alberto Squassabia Comparing - Floats: How To Determine if Floating Quantities Are Close Enough Once a Tolerance + [4] Alberto Squassabia Comparing + Floats: How To Determine if Floating Quantities Are Close Enough Once a Tolerance Has Been Reached C++ Report March 2000.
- [5] Pete Becker The Journeyman's Shop: Trap Handlers, Sticky Bits, and Floating-Point - Comparisons C/C++ Users Journal December 2000. reference to the top + [5] Pete Becker The Journeyman's Shop: Trap Handlers, Sticky Bits, and Floating-Point + Comparisons C/C++ Users Journal December 2000. reference to the top

-
+ + + +
Boost logo +

Unit Test Framework Extensions

+

To be supplied. Sorry.

+ +
+
+ + + diff --git a/doc/getting_started.htm b/doc/getting_started.htm index 9e15f48c..170ab8df 100644 --- a/doc/getting_started.htm +++ b/doc/getting_started.htm @@ -1,4 +1,4 @@ - + @@ -23,16 +23,16 @@

Getting started to use unit test framework

Today is a momentous day. Today I am going to start a new life. I am going to stop -eating a greasy food, start attending a fitness club and ... since today I am going to test programs -I am writing. I can start after the last line of a program is completed or, even -better idea, I can write tests while I am coding. And maybe next time I will +eating a greasy food, start attending a fitness club and ... since today I am going to test programs +I am writing. I can start after the last line of a program is completed or, even +better idea, I can write tests while I am coding. And maybe next time I will write tests before the coding during the design stage. I have read a lot of literature on how to write the tests, I have the unit test framework in hand and an idea of new class. So let's get started.

Let say I want to encapsulate an unchangeable C character buffer with a length into the simple class const_string. Rationale: a string class that does not allocate a memory and provide a convenient read-only access to the preallocated -character buffer. I will probably want const_string to have an interface similar to +character buffer. I will probably want const_string to have an interface similar to the class std::string. What will I do first? In my new life I will start with writing a test module for future class const_string. It will look like this:

@@ -50,7 +50,7 @@ init_unit_test_suite( int argc, // EOF -

Now I can compile it and link with the unit test framework. Done! I have a +

Now I can compile it and link with the unit test framework. Done! I have a working test program. It is empty, so when I run the program it produces following output:

*** No errors detected

@@ -66,7 +66,7 @@ methods. So my class initial version looks like this:

const_string( char const* s ); const_string( char const* s, size_t length ); const_string( char const* begin, char const* end ); - + // Access methods char const* data() const; size_t length() const; @@ -80,32 +80,32 @@ to a test suite. My test program became to look like this:

#include <boost/test/unit_test.hpp>
 using namespace boost::unit_test_framework;
 
-void constructors_test() { 
+void constructors_test() {
      const_string cs0( "" );                                                 // 1 //
      BOOST_CHECK_EQUAL( cs0.length(), (size_t)0 );
      BOOST_CHECK( cs0.is_empty() );
-     
+
      const_string cs01( NULL );                                              // 2 //
      BOOST_CHECK_EQUAL( cs01.length(), (size_t)0 );
      BOOST_CHECK( cs01.is_empty() );
-     
+
      const_string cs1( "test_string" );                                      // 3 //
      BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test_string" ), 0 );
      BOOST_CHECK_EQUAL( cs1.length(), std::strlen("test_string") );
-     
+
      std::string s( "test_string" );                                         // 4 //
      const_string cs2( s );
      BOOST_CHECK_EQUAL( std::strcmp( cs2.data(), "test_string" ), 0 );
-     
+
      const_string cs3( cs1 );                                                // 5 //
      BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test_string" ), 0 );
-     
+
      const_string cs4( "test_string", 4 );                                   // 6 //
      BOOST_CHECK_EQUAL( std::strncmp( cs4.data(), "test", cs4.length() ), 0 );
-     
+
      const_string cs5( s.data(), s.data() + s.length() );                    // 7 //
      BOOST_CHECK_EQUAL( std::strncmp( cs5.data(), "test_string", cs5.length() ), 0 );
-     
+
      const_string cs_array[] = { "str1", "str2" };                           // 8 //
      BOOST_CHECK_EQUAL( cs_array[0], "str1" );
      BOOST_CHECK_EQUAL( cs_array[1], "str2" );
@@ -115,7 +115,7 @@ test_suite*
 init_unit_test_suite( int argc, char* argv[] )
 {
     test_suite* test= BOOST_TEST_SUITE( "const_string test" );
-    
+
     test->add( BOOST_TEST_CASE( &constructors_test ) );
 
     return test;
@@ -130,7 +130,7 @@ contains and a length. The specification of the class const_string does not cont
 expected failures, so, though the constructor can fail if I would pass a pointer to
 an invalid memory,  error check control is not performed (can't require what was not
 promised :-)). But for any valid input it should work. So I am trying to check
-a construction for an empty string (1), a NULL string (2) a regular C string(3), 
+a construction for an empty string (1), a NULL string (2) a regular C string(3),
 an STL string(4), a copy construction(5) and so on . Well, after fixing all the errors in
 the implementation (do you write programs without errors from scratch?) I am able to pass
 this test case and the unit test framework gives me the following report:

@@ -206,13 +206,10 @@ ability to make a changes of any complexity without involving a lengthy regressi testing of your whole product. Your test module and the unit test framework will stay behind your back to help you with any occasional errors.

diff --git a/doc/index.htm b/doc/index.htm index 17a35b07..54872aa3 100644 --- a/doc/index.htm +++ b/doc/index.htm @@ -1,4 +1,4 @@ - + @@ -9,21 +9,22 @@ -
+
- - + diff --git a/doc/minimal.htm b/doc/minimal.htm new file mode 100644 index 00000000..909a7477 --- /dev/null +++ b/doc/minimal.htm @@ -0,0 +1,126 @@ + + + + +Bost Test Library: minimal testing + + + + + + +
+
Boost logo +
Boost logo

Boost Test Library

"Test everything that could possibly break"

XP maxim

Introduction
Components

-

Execution +

Execution monitor
Program Execution Monitor
Test Tools
Test Execution Monitor
- Unit Test Framework

+ Unit Test Framework
+ Minimal Test

FAQ
Design

Migration guide
@@ -31,109 +32,118 @@ Portability
Acknowledgements

Introduction

-

The Boost Test Library provides a matched set - of components for writing test programs, organizing tests in to simple - test cases and test suites, and controlling their runtime execution. - The Program Execution Monitor is +

The Boost Test Library provides a matched set + of components for writing test programs, organizing tests in to simple + test cases and test suites, and controlling their runtime execution. + The Program Execution Monitor is also useful in some production (non-test) environments.

- reference to the top + reference to the top

Components

    -
  • Execution Monitor - a basic - exception and error detection and reporting facility for use in both - production and test programs. The Execution Monitor calls a user-supplied - function and reports all caught runtime exceptions. It is used internally - by other Boost Test Library components. It also could be used in some - production environment to make controlled calls of functions which +
  • Execution Monitor - a basic + exception and error detection and reporting facility for use in both + production and test programs. The Execution Monitor calls a user-supplied + function and reports all caught runtime exceptions. It is used internally + by other Boost Test Library components. It also could be used in some + production environment to make controlled calls of functions which might otherwise crash the program.
    -
  • Program Execution Monitor - a - simple helper facility to be used to monitor a program execution. - The Program Execution Monitor provides the main() function and uses - the Execution Monitor to control a program execution. It should be - used in production environment to produce uniform error reports. To - control programs working in test environment, use the Test +
  • Program Execution Monitor - a + simple helper facility to be used to monitor a program execution. + The Program Execution Monitor provides the main() function and uses + the Execution Monitor to control a program execution. It should be + used in production environment to produce uniform error reports. To + control programs working in test environment, use the Test Execution Monitor instead.
    -
  • Test Execution Monitor - causes - a test program to run in a monitored environment. The Test Execution - Monitor provides the main() function to control a simple test program - execution and allows to use the Test Tools - to implement test logic. It is intended to be used in test environment. - To control production code execution use the Program +
  • Test Execution Monitor - causes + a test program to run in a monitored environment. The Test Execution + Monitor provides the main() function to control a simple test program + execution and allows to use the Test Tools + to implement test logic. It is intended to be used in test environment. + To control production code execution use the Program Execution Monitor.
    -
  • Unit Test Framework - a framework - that simplifies writing and organizing test cases. The framework supports - test cases written as simple free functions or member functions and - organizes them into a tree of test suites. The framework allows to - use the Test Tools to implement a test - cases and provides a facility to manage a log report level and a result - report level.
  • +
  • Unit Test Framework - a framework + that simplifies writing and organizing test cases. The framework supports + test cases written as simple free functions or member functions and + organizes them into a tree of test suites. The framework allows to + use the Test Tools to implement a test + cases and provides a facility to manage a log report level and a result + report level.
  • +
  • Minimal testing - simple facility designed + to provide the functionality provided before by the original version + of Boost.Test.The same as the Test + Execution Monitor it causes the test ptogram to run in a monitored + environment. In addition it defines several simple test tools that + behave similarly to ones defined in Test + Tools. Minimal testinf facility does not require linking with + external components, so could be a component of choice for simple + and quick testing needs.
- reference to the top + reference to the top

FAQ

See Boost Test Library FAQ.

Design

-

See Boost Test +

See Boost Test Library Design.

Boost.Test migration guide

-

This version of Boost.Test library substitute - the original testing library used in a Boost. These are several simple - steps you need to follow to smoothly migrate ot the latest software.

-

If your code were using the original version - of cpp_main facility, to migrate you will need to delete the inclusion - of the <boost/test/cpp_main.cpp>, since this file is not present +

This version of Boost.Test library substitute + the original testing library used in a Boost. These are several simple + steps you need to follow to smoothly migrate to the latest software.

+

If your code were using the original version + of cpp_main facility, to migrate you will need to delete the inclusion + of the <boost/test/cpp_main.cpp>, since this file is not present any more. After that you have following choices:

    -
  • Link with Program Execution Monitor (exact library name depends - on compiler you are using, but most probably it will be libprg_exec_monitor.lib). +
  • Link with Program Execution Monitor (exact library name depends + on compiler you are using, but most probably it will be libprg_exec_monitor.lib).
  • -
  • Include <boost/test/included/prg_exec_monitor.hpp>, in which - case you need not link with precompiled component but it may incur +
  • Include <boost/test/included/prg_exec_monitor.hpp>, in which + case you need not link with precompiled component but it may incur probably some compile time overhead.
-

If your code were using the original version - of test_main and test tools facilitates of Boost.Test library, to migrate +

If your code were using the original version + of test_main and test tools facilitates of Boost.Test library, to migrate to use of latest one you have following choices:

    -
  • Without changing of the code that were using Boost.Test facilities - link with Test Execution Monitor (exact library name depends on compiler +
  • Without changing of the code that were using Boost.Test facilities + link with Test Execution Monitor (exact library name depends on compiler you are using, but most probably it will be libtest_exec_monitor.lib).
  • -
  • Include <boost/test/included/test_exec_monitor.hpp>, in which - case you need not link with precompiled component but it may incur - probably some compile time overhead. Definition of BOOST_INCLUDE_MAIN +
  • Include <boost/test/included/test_exec_monitor.hpp>, in which + case you need not link with precompiled component but it may incur + probably some compile time overhead. Definition of BOOST_INCLUDE_MAIN could be deleted either.
  • -
  • Include <boost/minimal.hpp>, in which case you need not link - with precompiled component and it most probably does not incur a compile - time overhead, but you will be limited ti the set of features defined - in the original test library. Definition of BOOST_INCLUDE_MAIN could - be deleted either. Would you decide in a future to use any of newer - Boost.Test features you will be enforced to snitch to one the two +
  • Include <boost/minimal.hpp>, in which case you need not link + with precompiled component and it most probably does not incur a compile + time overhead, but you will be limited ti the set of features defined + in the original test library. Definition of BOOST_INCLUDE_MAIN could + be deleted either. Would you decide in a future to use any of newer + Boost.Test features you will be enforced to snitch to one the two chaises above.

Open Issues

    -
  • What dependencies will we tolerate in Boost Test Library? Also we +
  • What dependencies will we tolerate in Boost Test Library? Also we need means to overcome this restriction for extensions.
  • Memory usage test tools.
  • Performance test tools.
  • -
  • Facilities to allow testing of template function for the provided +
  • Facilities to allow testing of template function for the provided type list.
  • How to implement compilability checks.
  • -
  • Selective test cases run: ways to define by user and notify the +
  • Selective test cases run: ways to define by user and notify the framework.
  • -
  • Command line argument processing facility: external or internal, +
  • Command line argument processing facility: external or internal, simple or advanced?
  • Integration of the unit test framework into the Boost Build System.
  • Support for the testing of multithreaded programs.
  • @@ -143,37 +153,32 @@
  • Unit Test Framework extension should be documented
  • Should the execution monitor page contain an example?
- reference to the top + reference to the top

Portability

-

Because the Boost Test Library is critical - for porting and testing Boost libraries, it has been written to be extremely - conservative in its use of C++ features, and to keep dependencies to +

Because the Boost Test Library is critical + for porting and testing Boost libraries, it has been written to be extremely + conservative in its use of C++ features, and to keep dependencies to a bare minimum.

-

Tests have been run (and work) under numerous +

Tests have been run (and work) under numerous compilers.

Acknowledgements

Original Test Library:

-

Ed Brey, Kevlin Henney, Ullrich Koethe, and - Thomas Matelich provided very helpful comments during development. Dave - Abrahams, Ed Brey, William Kempf, Jens Maurer, and Wilka suggested numerous - improvements during the Formal Review. Jens Maurer was the review manager. +

Ed Brey, Kevlin Henney, Ullrich Koethe, and + Thomas Matelich provided very helpful comments during development. Dave + Abrahams, Ed Brey, William Kempf, Jens Maurer, and Wilka suggested numerous + improvements during the Formal Review. Jens Maurer was the review manager. Beman Dawes is the developer and maintainer.

Second Release:

-

Beman Dawes and Ullrich Koethe started the - library. Fernando Cacciola, Jeremy Siek, Beman Dawes, Ullrich Koethe, - Dave Abrahams suggested numerous improvements during the Formal Review. - Jeremy Siek was the review manager. Dave reference to the top - Abrahams edited this documentation. Beman Dawes was a great help in - both final testing and merging library with rest of the boost. Gennadiy +

Beman Dawes and Ullrich Koethe started the + library. Fernando Cacciola, Jeremy Siek, Beman Dawes, Ullrich Koethe, + Dave Abrahams suggested numerous improvements during the Formal Review. + Jeremy Siek was the review manager. Dave reference to the top + Abrahams edited this documentation. Beman Dawes was a great help in + both final testing and merging library with rest of the boost. Gennadiy Rozental is the developer and maintainer.

-
+ + + +
Boost logo +

Boost Test Library: minimal testing

+

Introduction
+ Benefits
+ Example
+ Provided Test Tools
+ Integration
+ Test Program
+ Design

+

Introduction

+

Boost.Test minimal testing facility provides + the functionality provided before by the original version of Boost.Test. + The same as the Test Execution Monitor + it causes the test program to run in a monitored environment. In addition + it defines several simple test tools that behave similarly to ones defined + in Test Tools. Minimal testing facility + does not require linking with external components, so could be a component + of choice for simple and quick testing needs. Unlike original Boost.Test + version macro BOOST_INCLUDE_MAIN is not used. main function is included + unconditionally. One consequence is that minimal testing could not be + used for multiunit testing. You will need to use other Boost.Test components + for that purpose.

+

Benefits

+ Simple testing framework that provide + the monitored environment and minimal set of testing tools without need + to link with external components. +

Example

+
#include <boost/test/minimal.hpp>
+
+int add( int i, int j ) { return i+j; }
+
+int test_main( int, char *[] )             // note the name!
+{
+    // six ways to detect and report the same error:
+    BOOST_CHECK( add( 2,2 ) == 4 );        // #1 continues on error
+    BOOST_REQUIRE( add( 2,2 ) == 4 );      // #2 throws on error
+    if( add( 2,2 ) != 4 )
+      BOOST_ERROR( "Ouch..." );            // #3 continues on error
+    if( add( 2,2 ) != 4 )
+      BOOST_FAIL( "Ouch..." );             // #4 throws on error
+    if( add( 2,2 ) != 4 ) throw "Oops..."; // #5 throws on error
+
+    return add( 2, 2 ) == 4 ? 0 : 1;       // #6 returns error code
+}
+

Approach #1 uses the BOOST_CHECK tool, which displays an error + message on std::cout that includes the expression that failed, the source + file name, and the source file line number. It also increments an error + count. At program termination, the error count will be displayed automatically + by the Minimal testing facility.

+

Approach #2 using the BOOST_REQUIRE tool, is similar to #1, + except that after displaying the error, an exception is thrown, to be + caught by the Minimal testing facility. This approach is suitable when + writing a explicit test program, and the error would be so severe as + to make further testing impractical. BOOST_REQUIRE differs from the + C++ Standard Library's assert() macro in that it is always generated, + and channels error detection into the uniform Minimal testing facility + reporting procedure.

+

Approaches #3 and #4 are similar to #1 and #2 respectively, + except that the error detection is coded separately. This is most useful + when the specific condition being tested is not indicative of the reason + for failure.

+

Approach #5 throws an exception, which will be caught and reported + by the Minimal testing facility. This approach is suitable for both + production and test code, in libraries or not. The error message displayed + when the exception is caught will be most meaningful if the exception + is derived from std::exception, or is a char* or std::string.

+

Approach #6 uses a return value to inform the caller of the + error. This approach is particularly suitable for integrating existing + test code with the test tools library. Although it works fine with the + Minimal testing facility libraries, and is very useful for running existing + code under them, most C++ experts prefer using exceptions for error + reporting. reference to the top

+

Provided Test Tools

+

Unlike the Test + Execution Monitor that support complete set of test tools implemented + in a Test Tools component, Minimal testing + facility supply only following four tools:

+

BOOST_CHECK( + predicate )
+ BOOST_REQUIRE( predicate )
+ BOOST_ERROR( message )
+ BOOST_FAIL( message )

+

Their behavior is similar to ones defined in + Test Tools component. Follows the links to see more detailed descriptions. + Old Boost.Test tools names are supported either, but will be deprecated + in a future.

+

Integration

+

The only change (other then include boost/test/minimal.hpp) + you need to make to integrate yout test module with Minimal testing + facility is the signature of your main function. It should look like + this:

+

int test_main( int argc, char* argv[] )

+

After that you will automatically start running + your tests in monitored invironment. Also you can start using test tools + provided by minimal testiing facility and get usiform errors reporting.

+

Test Program

+

minimal_test.cpp

+

Design

+ reference to the top +

The Boost Test Library Design document + describes the relationship between Boost Test Library components.

+ +
+
+ + diff --git a/doc/output_test_stream.htm b/doc/output_test_stream.htm index aadcc7d2..f212c286 100644 --- a/doc/output_test_stream.htm +++ b/doc/output_test_stream.htm @@ -1,4 +1,4 @@ - + @@ -9,25 +9,25 @@ -
+
- - + diff --git a/doc/prg_exec_monitor.htm b/doc/prg_exec_monitor.htm index 605c884d..5cf51e2e 100644 --- a/doc/prg_exec_monitor.htm +++ b/doc/prg_exec_monitor.htm @@ -1,4 +1,4 @@ - + @@ -9,10 +9,10 @@ -
+
Boost logo +
Boost logo

Boost Test Library: output_test_stream tool

Introduction
Benefits
Specification
Examples and Tests

Introduction

-

The class output_test_stream - is a simple tool for testing output operation with standard std::ostream facilities. - The class output_test_stream comply to std::ostream interface so it can be used - in place of any std::ostream argument. In addition it provide several methods to - validate output content. Also it allows to match/save output content versus/into - specified file. Working mode of the output_test_stream could be defined by framework +

The class output_test_stream + is a simple tool for testing output operation with standard std::ostream facilities. + The class output_test_stream comply to std::ostream interface so it can be used + in place of any std::ostream argument. In addition it provide several methods to + validate output content. Also it allows to match/save output content versus/into + specified file. Working mode of the output_test_stream could be defined by framework parameter " Save pattern"

Benefits

-

Simplified mechanism for checking correctness of output +

Simplified mechanism for checking correctness of output operations. reference to the top

Specification

class output_test_stream {
@@ -35,8 +35,8 @@
     explicit  output_test_stream( char const* pattern_file = NULL,
                                   bool match_or_save = true );
 
-              ~output_test_stream();    
-    
+              ~output_test_stream();
+
     bool      is_empty( bool flush_stream = true );
     bool      check_length( std::size_t length, bool flush_stream = true );
     bool      is_equal( char const* arg, bool flush_stream = true );
@@ -49,63 +49,59 @@
     void      flush();
 };
 
-

explicit output_test_stream( +

explicit output_test_stream( char const* pattern_file = NULL, bool match_or_save = true );

-

The class output_test_stream constructor accept pattern - file name and boolean switch match_or_save that are used by match_pattern +

The class output_test_stream constructor accept pattern + file name and boolean switch match_or_save that are used by match_pattern facility. If they are not present you can still use other testing mechanisms.

void flush();

-

The method output_test_stream::flush() is used to clean +

The method output_test_stream::flush() is used to clean the content of the output_test_stream instance.

bool is_empty( bool flush_stream = true );

-

The method output_test_stream::is_empty(...) is used to - check that the content of the output_test_stream instance is empty. The flush_stream - argument manage automatic call of the method output_test_stream::flush() after +

The method output_test_stream::is_empty(...) is used to + check that the content of the output_test_stream instance is empty. The flush_stream + argument manage automatic call of the method output_test_stream::flush() after check is done.

-

bool check_length( std::size_t length, bool flush_stream +

bool check_length( std::size_t length, bool flush_stream = true );

-

The method output_test_stream::check_length(...) is used - to check that the length of the content of the output_test_stream instance is equal - to supplied length value. The flush_stream argument manage automatic call of the +

The method output_test_stream::check_length(...) is used + to check that the length of the content of the output_test_stream instance is equal + to supplied length value. The flush_stream argument manage automatic call of the method output_test_stream::flush() after check is done.

-

bool is_equal( char const* arg, bool flush_stream +

bool is_equal( char const* arg, bool flush_stream = true );
- bool is_equal( std::string const& arg, bool flush_stream + bool is_equal( std::string const& arg, bool flush_stream = true );
- bool is_equal( char const* arg, std::size_t n, bool + bool is_equal( char const* arg, std::size_t n, bool flush_stream = true );

-

The overloaded method output_test_stream::is_equal(...) - is used to check that the content of the output_test_stream instance is equal to - supplied character string. The first version compare with null-terminated string. - The second compare with a reference to std::string object. And finnaly the third - version compare with probably not null-terminated string defined by pointer to - the string begin and the string length. The flush_stream argument manage automatic +

The overloaded method output_test_stream::is_equal(...) + is used to check that the content of the output_test_stream instance is equal to + supplied character string. The first version compare with null-terminated string. + The second compare with a reference to std::string object. And finnaly the third + version compare with probably not null-terminated string defined by pointer to + the string begin and the string length. The flush_stream argument manage automatic call of the method output_test_stream::flush() after check is done.

-

bool match_pattern( +

bool match_pattern( bool flush_stream = true );

-

The method output_test_stream::match_pattern(...) is used - to match the content of the output_test_stream instance versus the pattern file. - The pattern file name is specified in the class output_test_stream constructor. - If second argument of the class output_test_stream constructor - is false, then every call of the method output_test_stream::match_pattern(...) - will cause the output_test_stream instance content to be stored - at the end of the pattern file. The flush_stream argument manage automatic call +

The method output_test_stream::match_pattern(...) is used + to match the content of the output_test_stream instance versus the pattern file. + The pattern file name is specified in the class output_test_stream constructor. + If second argument of the class output_test_stream constructor + is false, then every call of the method output_test_stream::match_pattern(...) + will cause the output_test_stream instance content to be stored + at the end of the pattern file. The flush_stream argument manage automatic call of the method output_test_stream::flush() after check is done.

Examlpes and Tests

output_test_stream_test.cpp
result_report_test.cpp
test_tools_test.cpp
- reference to the top + reference to the top errors_handling_test.cpp


-
- - + diff --git a/doc/style/btl.css b/doc/style/btl.css index d09897fb..a68be51a 100644 --- a/doc/style/btl.css +++ b/doc/style/btl.css @@ -67,7 +67,7 @@ P.test-output font-family: Arial; font-size: 12pt; margin-left: 2em; - white-space: pre + white-space: nowrap } P.page-toc diff --git a/doc/test_exec_monitor.htm b/doc/test_exec_monitor.htm index e7d27c6f..ac0314bb 100644 --- a/doc/test_exec_monitor.htm +++ b/doc/test_exec_monitor.htm @@ -84,14 +84,18 @@

The Test Execution Monitor is supplied as an offline library and should be compiled and linked with a test program. Following files, that are located in the Boost Test Library src directory, compose the component:

-

execution_monitor.cpp
- test_tools.cpp
- unit_test_log.cpp
- unit_test_parameters.cpp
- unit_test_monitor.cpp
- unit_test_result.cpp
- unit_test_suite.cpp
- test_main.cpp

+

execution_monitor.cpp
+ test_tools.cpp
+ unit_test_log.cpp
+ unit_test_parameters.cpp
+ unit_test_monitor.cpp
+ unit_test_result.cpp
+ unit_test_suite.cpp
+ test_main.cpp

+

You also have a choice to include all files + constituting the Test Execution Monitor directly into your test module. + Use <boost/test/included/test_exec_monitor.hpp> + for this porpose.

Example and Test Programs

test_exec_example.cpp
@@ -99,8 +103,8 @@ test_exec_fail2.cpp
test_exec_fail3.cpp
test_exec_fail4.cpp

- -

Rationalereference to the top

+reference to the top +

Rationale

How should a test program report errors? Displaying an error message is an obvious possibility:

@@ -134,13 +138,9 @@ reference to the top


diff --git a/doc/test_lib_design.htm b/doc/test_lib_design.htm index dff0d40a..215101ef 100644 --- a/doc/test_lib_design.htm +++ b/doc/test_lib_design.htm @@ -16,13 +16,9 @@

Boost Test Library: detailed design

To be supplied. Sorry.

diff --git a/doc/test_tools.htm b/doc/test_tools.htm index 897f9b06..3d7f329a 100644 --- a/doc/test_tools.htm +++ b/doc/test_tools.htm @@ -22,8 +22,7 @@ H4

Boost Test Library: Test Tools

Introduction
Benefits
- Specification
-

+ Specification

BOOST_CHECKPOINT
BOOST_WARN
BOOST_CHECK
@@ -74,8 +73,8 @@ H4 }

Output:

Exception in test_main : C string:some_error
- test.cpp(2) : last checkpoint: Going to throw an exception reference to the top -

+ test.cpp(2) : last checkpoint: Going to throw an exception

+ reference to the top

BOOST_WARN( predicate )

This tool is used to perform a weak validation of the the predicate. If predicate is true, the tool produces a conformation message in @@ -205,7 +204,8 @@ H4

Starting test
i=2
still testing...
- struct A. reference to the top

+ struct A.

+ reference to the top

BOOST_WARN_MESSAGE( predicate, message )
BOOST_CHECK_MESSAGE( predicate, message )
BOOST_REQUIRE_MESSAGE( predicate, message )

@@ -295,9 +295,9 @@ H4 return0; }

Output:

-

test.cpp(3) : error in test_main: Nothing to test
- test.cpp(4) : fatal error in test_main: Test is not ready yet reference to the top -

+

test.cpp(3) : error in test_main: Nothing to test

+

test.cpp(4) : fatal error in test_main: Test is not ready yet

+ reference to the top

BOOST_CHECK_THROW( statement, exception )

This tool is used to perform an error detection check. The tool executes the supplied statement and check that it throw the supplied exception. @@ -311,9 +311,8 @@ H4 return 0; }

Output:

-

test.cpp(4) : error in test_main: exception my_exception expected - reference to the top -

+

test.cpp(4) : error in test_main: exception my_exception expected

+ reference to the top

BOOST_CHECK_EQUAL_COLLECTIONS( left_begin, left_end, right_begin )

This tool is used to perform an element comparison of @@ -391,13 +390,9 @@ H4


diff --git a/doc/unit_test_framework.htm b/doc/unit_test_framework.htm index bc5c9fc0..035b4a45 100644 --- a/doc/unit_test_framework.htm +++ b/doc/unit_test_framework.htm @@ -1,4 +1,4 @@ - + @@ -15,10 +15,10 @@ H4 -
+
Boost logo +
Boost logo

Boost Test Library: Program Execution Monitor

Introduction
Benefits
@@ -22,11 +22,11 @@ Rationale
Design

Introduction

-

The Boost Test Library's Program Execution Monitor provides - a replacement main() function which calls a user-supplied cpp_main() - function within a try block. The supplied main() then catches and reports exceptions, +

The Boost Test Library's Program Execution Monitor provides + a replacement main() function which calls a user-supplied cpp_main() + function within a try block. The supplied main() then catches and reports exceptions, relieving users from messy error detection and reporting duties.

-

For use with the Program Execution Monitor, the traditional Hello World program +

For use with the Program Execution Monitor, the traditional Hello World program becomes:

#include <iostream>
 
@@ -37,110 +37,109 @@
     return 0;
 }
 
-

It really is that simple - just change the name of your - initial function from main to cpp_main(). Do make sure the argc and arcv parameters - are specified (although you don't have to name them if you don't use them). Now +

It really is that simple - just change the name of your + initial function from main to cpp_main(). Do make sure the argc and arcv parameters + are specified (although you don't have to name them if you don't use them). Now you can compile it and link with the Program Execution Monitor library.

When the above program executes, the output will be:

Hello, world
no errors detected

-

But what if some lower-level function had thrown a runtime_error - with the message "big trouble"? Then the output would look something +

But what if some lower-level function had thrown a runtime_error + with the message "big trouble"? Then the output would look something like this:

** exception: std::runtime_error: big trouble
**** error return code 5
********** errors detected; see standard output for details ***********

-

And if a lower-level function had bubbled up a return +

And if a lower-level function had bubbled up a return code of 5, the output would look something like this:

**** error return code 5
*********** errors detected; see standard output for details ***********

-

Note that the primary messages appear on standard output - stream, while the final message appears on standard error stream. This increases - the visibility of error notification if standard output and error streams are directed - to different devices or files. - reference to the top +

Note that the primary messages appear on standard output + stream, while the final message appears on standard error stream. This increases + the visibility of error notification if standard output and error streams are directed + to different devices or files. + reference to the top

Benefits

More uniform reporting of errors, particularly exceptions.

In production programs:

-

More uniform error reporting is particularly useful for - programs running unattended under control of scripts or batch files. Some operating - systems pop up message boxes if an uncaught exception occurs, and this requires - operator intervention. By converting such exceptions to non-zero program return +

More uniform error reporting is particularly useful for + programs running unattended under control of scripts or batch files. Some operating + systems pop up message boxes if an uncaught exception occurs, and this requires + operator intervention. By converting such exceptions to non-zero program return codes, the library makes the program a better citizen.

-

More uniform reporting of errors isn't a benefit to some - programs, particularly programs always run by hand by a knowledgeable person. So +

More uniform reporting of errors isn't a benefit to some + programs, particularly programs always run by hand by a knowledgeable person. So cpp_main() wouldn't be worth using in that environment.

In test programs:

-

More uniform error reporting could be useful in test environments - such as the boost regression tests. But in this case it is preferable to use the - Test Execution Monitor or Unit - Test Framework, cause they allows you to use Test Tools and generate more detailed +

More uniform error reporting could be useful in test environments + such as the boost regression tests. But in this case it is preferable to use the + Test Execution Monitor or Unit + Test Framework, cause they allows you to use Test Tools and generate more detailed error information.

Specifications of the supplied main()

-

Uniformly detects and reports the occurrence of several - types of errors, reducing the various errors to a uniform return value which is +

Uniformly detects and reports the occurrence of several + types of errors, reducing the various errors to a uniform return value which is returned to the host environment.

There are two intended uses:

    -
  • In production programs, which require no further action beyond naming the top-level +
  • In production programs, which require no further action beyond naming the top-level function cpp_main() instead of main().
  • -
  • In test frameworks, which supply cpp_main() to detect (or catch) test specific +
  • In test frameworks, which supply cpp_main() to detect (or catch) test specific errors, report them, and then return a presumably non-zero value.

Requires:

-

A user-supplied cpp_main() function with same interface +

A user-supplied cpp_main() function with same interface as main().

- Effects: + Effects:

Call cpp_main( argc, argv ) in a try block.

Treat as errors:

  • Exceptions from cpp_main().
  • Non-zero return from cpp_main().
-

Report errors to both cout (with details) and cerr (summary). - Rationale: Detail error reporting goes to cout so that it is properly interlaced - with other output, thus aiding error analysis. Summary goes to cerr in case cout +

Report errors to both cout (with details) and cerr (summary). + Rationale: Detail error reporting goes to cout so that it is properly interlaced + with other output, thus aiding error analysis. Summary goes to cerr in case cout is redirected.

Returns:

-

non-zero if any error was detected, zero otherwise. +

non-zero if any error was detected, zero otherwise. reference to the top

The Program Execution Monitor compilation

-

The Program Execution Monitor is supplied as an offline - library and should be compiled and linked with a test program. Following files, +

The Program Execution Monitor is supplied as an offline + library and should be compiled and linked with a test program. Following files, that are located in the Boost Test Library src directory, compose the component:

-

execution_monitor.cpp
- cpp_main.cpp

+

execution_monitor.cpp
+ cpp_main.cpp

+

You also have a choice to include all files constituting + the Program Execution Monitor directly into your program. Use <boost/test/included/prg_exec_monitor.hpp> + for this porpose.

Example Program

-

prg_exec_example.cpp +

prg_exec_example.cpp

Rationale

-

The components of a C++ program may report user-detected - errors in several ways, such as via a return value or throwing an exception. System-detected - errors such as dereferencing an invalid pointer are reported in other ways, totally +

The components of a C++ program may report user-detected + errors in several ways, such as via a return value or throwing an exception. System-detected + errors such as dereferencing an invalid pointer are reported in other ways, totally operating system and compiler dependent.

-

Yet many C++ programs, both production and test, must - run in an environment where uniform reporting of errors is necessary. For example, - converting otherwise uncaught exceptions to non-zero program return codes allows - many command line, script, or batch environments to continue processing in a controlled - manner. Even some GUI environments benefit from the unification of errors into +

Yet many C++ programs, both production and test, must + run in an environment where uniform reporting of errors is necessary. For example, + converting otherwise uncaught exceptions to non-zero program return codes allows + many command line, script, or batch environments to continue processing in a controlled + manner. Even some GUI environments benefit from the unification of errors into program return codes.

Design

-

The Boost Test Library Design - document describes the relationship between the Program Execution Monitor and +

The Boost Test Library Design + document describes the relationship between the Program Execution Monitor and Execution Monitor. reference to the top


-
- - + diff --git a/src/cpp_main.cpp b/src/cpp_main.cpp index f04be57f..ab0a2b0b 100644 --- a/src/cpp_main.cpp +++ b/src/cpp_main.cpp @@ -14,7 +14,7 @@ // Description : main function implementation for Program Executon Monitor // *************************************************************************** -// LOCAL +// Boost.Test #include // BOOST @@ -88,15 +88,9 @@ int main( int argc, char* argv[] ) // Revision History : // // $Log$ -// Revision 1.5 2002/08/20 08:24:13 rogeeff -// cvs keywords added +// Revision 1.6 2002/11/02 20:04:41 rogeeff +// release 1.29.0 merged into the main trank // -// 16 Nov 01 Minor message fix (Gennadiy) -// 4 Jun 01 Rewrite to use exception_monitor -// 26 Feb 01 Numerous changes suggested during formal review. -// 25 Jan 01 catch_exceptions.hpp code factored out. -// 22 Jan 01 Remove test_tools dependencies to reduce coupling. -// 5 Nov 00 Initial boost version (Beman Dawes) // *************************************************************************** diff --git a/src/execution_monitor.cpp b/src/execution_monitor.cpp index d5cb3b73..dd0fae18 100644 --- a/src/execution_monitor.cpp +++ b/src/execution_monitor.cpp @@ -22,7 +22,7 @@ // boost libraries. // *************************************************************************** -// LOCAL +// Boost.Test #include // BOOST @@ -462,34 +462,9 @@ static void report_error( execution_exception::error_code ec, char const* msg1, // Revision History : // // $Log$ -// Revision 1.12 2002/09/16 10:37:57 rogeeff -// excessive boost:: removed. Fix for VACPP +// Revision 1.13 2002/11/02 20:04:41 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.11 2002/09/16 08:45:09 rogeeff -// STL includes normalized -// -// Revision 1.10 2002/09/15 11:17:23 johnmaddock -// Added missing includes -// -// Revision 1.9 2002/09/04 07:27:08 rogeeff -// space before colon deleted -// -// Revision 1.8 2002/08/22 11:50:39 johnmaddock -// Added Kylix 3 support -// -// Revision 1.7 2002/08/20 08:24:13 rogeeff -// cvs keywords added -// -// 5 Oct 01 Slightly reworked: (Gennadiy Rozental) -// 5 Jun 01 Made SE code work with several Win32 compilers (Beman) -// 4 Jun 01 New interface to old code (was catch_exceptions.hpp) -// to avoid use of template as requested by users (Beman) -// 4 Apr 01 Added signal handling code. (Ullrich) -// 4 Apr 01 Removed default output at end of exception handling (Ullrich) -// 26 Feb 01 Numerous changes suggested during formal review (Beman) -// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp -// 22 Jan 01 Remove test_tools dependencies to reduce coupling -// 5 Nov 00 Initial boost version (Beman Dawes) // *************************************************************************** diff --git a/src/test_main.cpp b/src/test_main.cpp index 4a52e26d..4d4afcd0 100644 --- a/src/test_main.cpp +++ b/src/test_main.cpp @@ -14,7 +14,7 @@ // Description : implements main function for Test Execution Monitor. // *************************************************************************** -// LOCAL +// Boost.Test #include // for unit test framework #include #include @@ -45,9 +45,9 @@ namespace { // ************** test main ************** // // ************************************************************************** // -using namespace boost::unit_test_framework; - int main( int argc, char* argv[] ) { + using namespace boost::unit_test_framework; + std::string loglevel; bool no_result_code; result_report_level report_level; @@ -90,20 +90,9 @@ int main( int argc, char* argv[] ) { // Revision History : // // $Log$ -// Revision 1.8 2002/09/16 09:29:21 rogeeff -// since boost::smart_ptrs now support incomplete types on borland, no need in grinning_ptr any more +// Revision 1.9 2002/11/02 20:04:41 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.7 2002/09/04 07:27:08 rogeeff -// space before colon deleted -// -// Revision 1.6 2002/08/20 08:24:13 rogeeff -// cvs keywords added -// -// 10 Apr 01 Use new unit_test log features (Ullrich) -// 8 Apr 01 Use boost/test/unit_test.hpp as framework. (Beman) -// 26 Feb 01 Numerous changes suggested during formal review. (Beman) -// 22 Jan 01 Use boost/cpp_main.hpp as framework. (Beman) -// 5 Nov 00 Initial boost version (Beman Dawes) // *************************************************************************** diff --git a/src/test_tools.cpp b/src/test_tools.cpp index 61dfd10f..048a812a 100644 --- a/src/test_tools.cpp +++ b/src/test_tools.cpp @@ -13,7 +13,7 @@ // Description : supplies offline implemtation for the Test Tools // *************************************************************************** -// LOCAL +// Boost.Test #include #include @@ -45,10 +45,10 @@ std::string const& wrapstrstream::str() const { #ifdef BOOST_NO_STRINGSTREAM - m_str.assign( m_buf.str(), m_buf.pcount() ); - m_buf.freeze( false ); + m_str.assign( m_buf->str(), m_buf->pcount() ); + m_buf->freeze( false ); #else - m_str = m_buf.str(); + m_str = m_buf->str(); #endif return m_str; @@ -408,21 +408,9 @@ output_test_stream::sync() // Revision History : // // $Log$ -// Revision 1.9 2002/09/16 08:45:09 rogeeff -// STL includes normalized +// Revision 1.10 2002/11/02 20:04:41 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.8 2002/08/26 08:28:31 rogeeff -// Exclude using namespace for included use -// flush bug for new stringstream fixed -// -// Revision 1.7 2002/08/20 22:10:30 rogeeff -// slightly modified failures report -// -// Revision 1.6 2002/08/20 08:24:13 rogeeff -// cvs keywords added -// -// 5 Oct 01 Reworked version (Gennadiy Rozental) -// ? ??? 01 Initial version (Ullrich Koethe) // *************************************************************************** diff --git a/src/unit_test_log.cpp b/src/unit_test_log.cpp index cbc3782d..fe5b3e87 100644 --- a/src/unit_test_log.cpp +++ b/src/unit_test_log.cpp @@ -14,7 +14,7 @@ // are hidden in this file with use of pimpl idiom. // *************************************************************************** -// LOCAL +// Boost.Test #include #include #include @@ -370,16 +370,9 @@ unit_test_log::start( unit_test_counter test_cases_amount, bool print_build_info // Revision History : // // $Log$ -// Revision 1.8 2002/09/04 07:27:08 rogeeff -// space before colon deleted +// Revision 1.9 2002/11/02 20:04:42 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.7 2002/08/20 22:10:30 rogeeff -// slightly modified failures report -// -// Revision 1.6 2002/08/20 08:24:13 rogeeff -// cvs keywords added -// -// 5 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/src/unit_test_main.cpp b/src/unit_test_main.cpp index 6f121141..ae9e6e97 100644 --- a/src/unit_test_main.cpp +++ b/src/unit_test_main.cpp @@ -25,9 +25,7 @@ #include #include // for cout, cerr -using namespace boost::unit_test_framework; - -extern test_suite* init_unit_test_suite( int argc, char* argv[] ); // prototype for user's test suite init function +extern boost::unit_test_framework::test_suite* init_unit_test_suite( int argc, char* argv[] ); // prototype for user's test suite init function // ************************************************************************** // // ************** unit test main ************** // @@ -36,6 +34,8 @@ extern test_suite* init_unit_test_suite( int argc, char* argv[] ); // prototype int main( int argc, char* argv[] ) { + using namespace boost::unit_test_framework; + std::string loglevel; bool no_result_code; bool print_build_info; @@ -113,10 +113,9 @@ main( int argc, char* argv[] ) // Revision History : // // $Log$ -// Revision 1.6 2002/08/20 08:24:13 rogeeff -// cvs keywords added +// Revision 1.7 2002/11/02 20:04:42 rogeeff +// release 1.29.0 merged into the main trank // -// 5 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/src/unit_test_monitor.cpp b/src/unit_test_monitor.cpp index 25ca0811..ccad0b71 100644 --- a/src/unit_test_monitor.cpp +++ b/src/unit_test_monitor.cpp @@ -15,7 +15,7 @@ // Test Framework to monitor test cases run. // *************************************************************************** -// LOCAL +// Boost.Test #include #include #include @@ -90,10 +90,9 @@ unit_test_monitor::function() // Revision History : // // $Log$ -// Revision 1.4 2002/08/20 08:24:13 rogeeff -// cvs keywords added +// Revision 1.5 2002/11/02 20:04:42 rogeeff +// release 1.29.0 merged into the main trank // -// 5 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/src/unit_test_parameters.cpp b/src/unit_test_parameters.cpp index 084e32de..71376954 100644 --- a/src/unit_test_parameters.cpp +++ b/src/unit_test_parameters.cpp @@ -16,7 +16,7 @@ // facility // *************************************************************************** -// LOCAL +// Boost.Test #include //BOOST @@ -90,13 +90,9 @@ retrieve_framework_parameter( char const* parameter_name, int* argc, char** argv // Revision History : // // $Log$ -// Revision 1.4 2002/09/15 11:17:23 johnmaddock -// Added missing includes +// Revision 1.5 2002/11/02 20:04:42 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.3 2002/08/20 08:24:13 rogeeff -// cvs keywords added -// -// 26 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/src/unit_test_result.cpp b/src/unit_test_result.cpp index 5843ab47..85aced0f 100644 --- a/src/unit_test_result.cpp +++ b/src/unit_test_result.cpp @@ -14,7 +14,7 @@ // implementation is hidden in this file using pimple idiom. // *************************************************************************** -// LOCAL +// Boost.Test #include #include @@ -195,6 +195,37 @@ unit_test_result::test_case_name() //____________________________________________________________________________// +void +unit_test_result::reset_current_result_set() +{ + static unit_test_result* backup = NULL; + static boost::scoped_ptr temporary_substitute; + + assert( Impl::m_curr != NULL ); + + if( backup ) { + Impl::m_curr = backup; + backup = NULL; + temporary_substitute.reset(); + } + else { + backup = Impl::m_curr; + Impl::m_curr = new unit_test_result( NULL, Impl::m_curr->test_case_name(), 0 ); + temporary_substitute.reset( Impl::m_curr ); + } +} + +//____________________________________________________________________________// + +void +unit_test_result::failures_details( unit_test_counter& num_of_failures, bool& exception_caught ) +{ + num_of_failures = m_pimpl->m_assertions_failed; + exception_caught = m_pimpl->m_exception_caught; +} + +//____________________________________________________________________________// + namespace { std::string ps_name( bool p_s, char const* singular_form ) { return p_s ? std::string( singular_form ).append( "s" ) : std::string( singular_form ); } std::string cs_name( bool c_s ) { return c_s ? "case" : "suite"; } @@ -313,19 +344,9 @@ unit_test_result::result_code() // Revision History : // // $Log$ -// Revision 1.10 2002/08/26 08:29:48 rogeeff -// *** empty log message *** +// Revision 1.11 2002/11/02 20:04:42 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.9 2002/08/21 15:15:12 rogeeff -// previos fix finished -// -// Revision 1.8 2002/08/20 22:10:31 rogeeff -// slightly modified failures report -// -// Revision 1.7 2002/08/20 08:24:13 rogeeff -// cvs keywords added -// -// 5 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/src/unit_test_suite.cpp b/src/unit_test_suite.cpp index 93d44b2c..5baaa372 100644 --- a/src/unit_test_suite.cpp +++ b/src/unit_test_suite.cpp @@ -14,7 +14,7 @@ // Extensions could be provided in separate files // *************************************************************************** -// LOCAL +// Boost.Test #include #include #include @@ -195,10 +195,9 @@ test_suite::do_run() // Revision History : // // $Log$ -// Revision 1.4 2002/08/20 08:24:13 rogeeff -// cvs keywords added +// Revision 1.5 2002/11/02 20:04:42 rogeeff +// release 1.29.0 merged into the main trank // -// 5 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/test/Jamfile b/test/Jamfile index 07843b01..74cdc1e3 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -31,6 +31,7 @@ test-suite "unit_test_framework_test" [ test-btl-lib run : minimal_test ] [ test-btl-lib run : output_test_stream_test : unit_test_framework ] [ test-btl-lib run : result_report_test : test_exec_monitor ] + [ test-btl-lib run : parameterized_test_test : test_exec_monitor ] [ test-btl-lib run : test_tools_test : unit_test_framework ] [ test-btl-lib run : unit_test_suite_ex_test : unit_test_framework ] ; diff --git a/test/error_handling_test.pattern b/test/error_handling_test.pattern index ea600eb7..76cde0d0 100644 --- a/test/error_handling_test.pattern +++ b/test/error_handling_test.pattern @@ -60,7 +60,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) -errors_handling_test.cpp(55): error in "bad_function": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function": error_on_demand() BOOST_ERROR Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -73,7 +73,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) -errors_handling_test.cpp(55): error in "bad_test::test": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test": error_on_demand() BOOST_ERROR Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -86,7 +86,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) -errors_handling_test.cpp(55): error in "bad_function_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function_param": error_on_demand() BOOST_ERROR Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -99,7 +99,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) -errors_handling_test.cpp(55): error in "bad_test::test_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test_param": error_on_demand() BOOST_ERROR Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -113,7 +113,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) Exception in "bad_function": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -127,7 +127,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -141,7 +141,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -155,7 +155,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -169,7 +169,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) Exception in "bad_function": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -183,7 +183,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) Exception in "bad_test::test": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -197,7 +197,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) Exception in "bad_function_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -211,7 +211,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) Exception in "bad_test::test_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -224,7 +224,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -237,7 +237,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -250,7 +250,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -263,7 +263,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -277,7 +277,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted Leaving test case "bad_function" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -293,7 +293,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted Leaving test case "bad_test::test" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -309,7 +309,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted Leaving test case "bad_function_param" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -325,7 +325,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted Leaving test case "bad_test::test_param" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -392,7 +392,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) -errors_handling_test.cpp(55): error in "bad_function": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function": error_on_demand() BOOST_ERROR Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -405,7 +405,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) -errors_handling_test.cpp(55): error in "bad_test::test": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test": error_on_demand() BOOST_ERROR Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -418,7 +418,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) -errors_handling_test.cpp(55): error in "bad_function_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function_param": error_on_demand() BOOST_ERROR Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -431,7 +431,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) -errors_handling_test.cpp(55): error in "bad_test::test_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test_param": error_on_demand() BOOST_ERROR Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -445,7 +445,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) Exception in "bad_function": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -459,7 +459,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -473,7 +473,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -487,7 +487,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -501,7 +501,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) Exception in "bad_function": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -515,7 +515,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) Exception in "bad_test::test": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -529,7 +529,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) Exception in "bad_function_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -543,7 +543,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) Exception in "bad_test::test_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -556,7 +556,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_function" Leaving test case "Errors handling test" @@ -569,7 +569,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_test::test" Leaving test case "Errors handling test" @@ -582,7 +582,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_function_param" Leaving test case "Errors handling test" @@ -595,7 +595,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR Leaving test case "bad_test::test_param" Leaving test case "Errors handling test" @@ -609,7 +609,7 @@ Entering test case "Errors handling test" Entering test case "bad_function" (free function) Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted Leaving test case "bad_function" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -625,7 +625,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test" (user test case) Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted Leaving test case "bad_test::test" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -641,7 +641,7 @@ Entering test case "Errors handling test" Entering test case "bad_function_param" (parameterized free function) Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted Leaving test case "bad_function_param" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -657,7 +657,7 @@ Entering test case "Errors handling test" Entering test case "bad_test::test_param" (parameterized user test case) Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted Leaving test case "bad_test::test_param" ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -696,28 +696,28 @@ error_on_demand() BOOST_MESSAGE log level: 2; error type: user error; test case type: free function; Running 1 test case... (free function) -errors_handling_test.cpp(55): error in "bad_function": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function": error_on_demand() BOOST_ERROR =========================== log level: 2; error type: user error; test case type: user test case; Running 1 test case... (user test case) -errors_handling_test.cpp(55): error in "bad_test::test": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test": error_on_demand() BOOST_ERROR =========================== log level: 2; error type: user error; test case type: parameterized free function; Running 1 test case... (parameterized free function) -errors_handling_test.cpp(55): error in "bad_function_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function_param": error_on_demand() BOOST_ERROR =========================== log level: 2; error type: user error; test case type: parameterized user test case; Running 1 test case... (parameterized user test case) -errors_handling_test.cpp(55): error in "bad_test::test_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test_param": error_on_demand() BOOST_ERROR =========================== @@ -725,7 +725,7 @@ log level: 2; error type: cpp exception; test case type: free function; Running 1 test case... (free function) Exception in "bad_function": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== @@ -733,7 +733,7 @@ log level: 2; error type: cpp exception; test case type: user test case; Running 1 test case... (user test case) Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== @@ -741,7 +741,7 @@ log level: 2; error type: cpp exception; test case type: parameterized free func Running 1 test case... (parameterized free function) Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== @@ -749,7 +749,7 @@ log level: 2; error type: cpp exception; test case type: parameterized user test Running 1 test case... (parameterized user test case) Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== @@ -757,7 +757,7 @@ log level: 2; error type: system error; test case type: free function; Running 1 test case... (free function) Exception in "bad_function": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== @@ -765,7 +765,7 @@ log level: 2; error type: system error; test case type: user test case; Running 1 test case... (user test case) Exception in "bad_test::test": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== @@ -773,7 +773,7 @@ log level: 2; error type: system error; test case type: parameterized free func Running 1 test case... (parameterized free function) Exception in "bad_function_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== @@ -781,35 +781,35 @@ log level: 2; error type: system error; test case type: parameterized user test Running 1 test case... (parameterized user test case) Exception in "bad_test::test_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 2; error type: fatal user error; test case type: free function; Running 1 test case... (free function) -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 2; error type: fatal user error; test case type: user test case; Running 1 test case... (user test case) -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 2; error type: fatal user error; test case type: parameterized free function; Running 1 test case... (parameterized free function) -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 2; error type: fatal user error; test case type: parameterized user test case; Running 1 test case... (parameterized user test case) -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== @@ -817,7 +817,7 @@ log level: 2; error type: fatal system error; test case type: free function; Running 1 test case... (free function) Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -827,7 +827,7 @@ log level: 2; error type: fatal system error; test case type: user test case; Running 1 test case... (user test case) Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -837,7 +837,7 @@ log level: 2; error type: fatal system error; test case type: parameterized free Running 1 test case... (parameterized free function) Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -847,7 +847,7 @@ log level: 2; error type: fatal system error; test case type: parameterized user Running 1 test case... (parameterized user test case) Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -875,112 +875,112 @@ Running 1 test case... log level: 3; error type: user error; test case type: free function; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_function": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function": error_on_demand() BOOST_ERROR =========================== log level: 3; error type: user error; test case type: user test case; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_test::test": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test": error_on_demand() BOOST_ERROR =========================== log level: 3; error type: user error; test case type: parameterized free function; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_function_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function_param": error_on_demand() BOOST_ERROR =========================== log level: 3; error type: user error; test case type: parameterized user test case; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_test::test_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test_param": error_on_demand() BOOST_ERROR =========================== log level: 3; error type: cpp exception; test case type: free function; Running 1 test case... Exception in "bad_function": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 3; error type: cpp exception; test case type: user test case; Running 1 test case... Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 3; error type: cpp exception; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 3; error type: cpp exception; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 3; error type: system error; test case type: free function; Running 1 test case... Exception in "bad_function": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 3; error type: system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 3; error type: system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 3; error type: system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 3; error type: fatal user error; test case type: free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 3; error type: fatal user error; test case type: user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 3; error type: fatal user error; test case type: parameterized free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 3; error type: fatal user error; test case type: parameterized user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 3; error type: fatal system error; test case type: free function; Running 1 test case... Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -989,7 +989,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 3; error type: fatal system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -998,7 +998,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 3; error type: fatal system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1007,7 +1007,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 3; error type: fatal system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1035,112 +1035,112 @@ Running 1 test case... log level: 4; error type: user error; test case type: free function; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_function": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function": error_on_demand() BOOST_ERROR =========================== log level: 4; error type: user error; test case type: user test case; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_test::test": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test": error_on_demand() BOOST_ERROR =========================== log level: 4; error type: user error; test case type: parameterized free function; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_function_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_function_param": error_on_demand() BOOST_ERROR =========================== log level: 4; error type: user error; test case type: parameterized user test case; Running 1 test case... -errors_handling_test.cpp(55): error in "bad_test::test_param": error_on_demand() BOOST_ERROR +errors_handling_test.cpp(56): error in "bad_test::test_param": error_on_demand() BOOST_ERROR =========================== log level: 4; error type: cpp exception; test case type: free function; Running 1 test case... Exception in "bad_function": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 4; error type: cpp exception; test case type: user test case; Running 1 test case... Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 4; error type: cpp exception; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 4; error type: cpp exception; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 4; error type: system error; test case type: free function; Running 1 test case... Exception in "bad_function": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 4; error type: system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 4; error type: system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 4; error type: system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 4; error type: fatal user error; test case type: free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 4; error type: fatal user error; test case type: user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 4; error type: fatal user error; test case type: parameterized free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 4; error type: fatal user error; test case type: parameterized user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 4; error type: fatal system error; test case type: free function; Running 1 test case... Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1149,7 +1149,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 4; error type: fatal system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1158,7 +1158,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 4; error type: fatal system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1167,7 +1167,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 4; error type: fatal system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1216,87 +1216,87 @@ Running 1 test case... log level: 5; error type: cpp exception; test case type: free function; Running 1 test case... Exception in "bad_function": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 5; error type: cpp exception; test case type: user test case; Running 1 test case... Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 5; error type: cpp exception; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 5; error type: cpp exception; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -errors_handling_test.cpp(66) : last checkpoint: error_on_demand() throw runtime_error +errors_handling_test.cpp(67) : last checkpoint: error_on_demand() throw runtime_error =========================== log level: 5; error type: system error; test case type: free function; Running 1 test case... Exception in "bad_function": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 5; error type: system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 5; error type: system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 5; error type: system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 5; error type: fatal user error; test case type: free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 5; error type: fatal user error; test case type: user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 5; error type: fatal user error; test case type: parameterized free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 5; error type: fatal user error; test case type: parameterized user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 5; error type: fatal system error; test case type: free function; Running 1 test case... Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1305,7 +1305,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 5; error type: fatal system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1314,7 +1314,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 5; error type: fatal system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1323,7 +1323,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 5; error type: fatal system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1392,59 +1392,59 @@ Running 1 test case... log level: 6; error type: system error; test case type: free function; Running 1 test case... Exception in "bad_function": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 6; error type: system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 6; error type: system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 6; error type: system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": integer divide by zero -errors_handling_test.cpp(71) : last checkpoint: error_on_demand() divide by zero +errors_handling_test.cpp(72) : last checkpoint: error_on_demand() divide by zero =========================== log level: 6; error type: fatal user error; test case type: free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 6; error type: fatal user error; test case type: user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 6; error type: fatal user error; test case type: parameterized free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 6; error type: fatal user error; test case type: parameterized user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 6; error type: fatal system error; test case type: free function; Running 1 test case... Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1453,7 +1453,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 6; error type: fatal system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1462,7 +1462,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 6; error type: fatal system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1471,7 +1471,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 6; error type: fatal system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1559,32 +1559,32 @@ Running 1 test case... log level: 7; error type: fatal user error; test case type: free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 7; error type: fatal user error; test case type: user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 7; error type: fatal user error; test case type: parameterized free function; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_function_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 7; error type: fatal user error; test case type: parameterized user test case; Running 1 test case... -errors_handling_test.cpp(60): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR +errors_handling_test.cpp(61): fatal error in "bad_test::test_param": error_on_demand() BOOST_CRITICAL_ERROR =========================== log level: 7; error type: fatal system error; test case type: free function; Running 1 test case... Exception in "bad_function": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1593,7 +1593,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 7; error type: fatal system error; test case type: user test case; Running 1 test case... Exception in "bad_test::test": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1602,7 +1602,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 7; error type: fatal system error; test case type: parameterized free function; Running 1 test case... Exception in "bad_function_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_function_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1611,7 +1611,7 @@ errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an in log level: 7; error type: fatal system error; test case type: parameterized user test case; Running 1 test case... Exception in "bad_test::test_param": memory access violation -errors_handling_test.cpp(76) : last checkpoint: error_on_demand() write to an invalid address +errors_handling_test.cpp(77) : last checkpoint: error_on_demand() write to an invalid address ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "bad_test::test_param": testing aborted ..\..\..\libs\test\build\../src\unit_test_suite.cpp(95): fatal error in "Errors handling test": testing aborted @@ -1927,9 +1927,6 @@ log level: 9; error type: fatal system error; test case type: parameterized free log level: 9; error type: fatal system error; test case type: parameterized user test case; -Test suite "call_test_main" failed with: -120 test cases out of 240 passed -120 test cases out of 240 failed - 0 assertions out of 80 passed -80 assertions out of 80 failed -while 80 failures expected +Test case "call_test_main" passed with: +240 assertions out of 240 passed + 0 assertions out of 240 failed diff --git a/test/errors_handling_test.cpp b/test/errors_handling_test.cpp index 0e12cd48..03bcb902 100644 --- a/test/errors_handling_test.cpp +++ b/test/errors_handling_test.cpp @@ -11,7 +11,7 @@ // // Version : $Id$ // -// Description : tests an ability of Unit Test Framework to catch all kinds +// Description : tests an ability of Unit Test Framework to catch all kinds // of test errors in a user code and properly report it. // *************************************************************************** @@ -44,7 +44,8 @@ namespace { int divide_by_zero = 0; // will cause an error coresponding to the current error_type; - void error_on_demand() { + void error_on_demand() + { switch( error_type ) { case et_none: BOOST_MESSAGE( "error_on_demand() BOOST_MESSAGE" ); @@ -97,7 +98,7 @@ namespace { tct_end } test_case_type; - char const* test_case_type_name[] = { "free function", + char const* test_case_type_name[] = { "free function", "user test case", "parameterized free function", "parameterized user test case" @@ -109,7 +110,7 @@ namespace { struct bad_test { - void test() + void test() { BOOST_MESSAGE( "(user test case)" ); error_on_demand(); @@ -141,9 +142,9 @@ namespace { //____________________________________________________________________________// -int -test_main( int argc, char * argv[] ) { - int nonmatched = 0; +int +test_main( int argc, char * argv[] ) +{ bool match_or_save = retrieve_framework_parameter( SAVE_TEST_PATTERN, &argc, argv ) != "yes"; output_test_stream output( "error_handling_test.pattern", match_or_save ); @@ -160,8 +161,8 @@ test_main( int argc, char * argv[] ) { unit_test_log::instance().set_log_threshold_level( level ); // for each error type - for( error_type = et_begin; - error_type != et_end; + for( error_type = et_begin; + error_type != et_end; error_type = static_cast(error_type+1) ) { // for each error location @@ -187,14 +188,14 @@ test_main( int argc, char * argv[] ) { break; case tct_param_free_function: // Borland bug workaround -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x560) +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x570) test.add( boost::unit_test_framework::create_test_case( &bad_function_param, std::string( "bad_function_param" ), (int*)params, params+1 ) ); #else test.add( BOOST_PARAM_TEST_CASE( &bad_function_param, (int*)params, params+1 ) ); #endif break; case tct_param_user_test_case: -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x560) +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x570) test.add( boost::unit_test_framework::create_test_case( &bad_test::test_param, std::string( "bad_test::test_param" ), bad_test_instance, (int*)params, params+1 ) ); #else test.add( BOOST_PARAM_CLASS_TEST_CASE( &bad_test::test_param, bad_test_instance, (int*)params, params+1 ) ); @@ -204,17 +205,15 @@ test_main( int argc, char * argv[] ) { continue; } + unit_test_result::reset_current_result_set(); unit_test_log::instance().start( 1 ); test.run(); unit_test_log::instance() << report_progress(); + unit_test_result::reset_current_result_set(); - if( !output.match_pattern() ) { - nonmatched++; - unit_test_log::instance().set_log_stream( std::cout ); - BOOST_ERROR( "Pattern match" ); - unit_test_log::instance().set_log_stream( output ); - } - + unit_test_log::instance().set_log_threshold_level( report_all_errors ); + BOOST_CHECK( output.match_pattern() ); + unit_test_log::instance().set_log_threshold_level( level ); } } } @@ -222,21 +221,20 @@ test_main( int argc, char * argv[] ) { unit_test_result::instance().short_report( output ); output.match_pattern(); - return nonmatched; + return 0; } // main //____________________________________________________________________________// // *************************************************************************** // Revision History : -// -// $Log$ -// Revision 1.7 2002/08/26 09:08:06 rogeeff -// cvs kw added // -// 7 Jul 01 Reworked version (Gennadiy Rozental) -// 16 Jun 01 Initial version (Beman Dawes) +// $Log$ +// Revision 1.8 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank +// // *************************************************************************** // EOF + diff --git a/test/minimal_test.cpp b/test/minimal_test.cpp index 2de29fdd..4fee25f0 100644 --- a/test/minimal_test.cpp +++ b/test/minimal_test.cpp @@ -77,11 +77,8 @@ test_main( int argc, char* argv[] ) // Revision History : // // $Log$ -// Revision 1.2 2002/09/12 08:28:30 rogeeff -// tabs cleaned -// -// Revision 1.1 2002/09/04 07:23:32 rogeeff -// minimal testiing unit test added +// Revision 1.3 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // // *************************************************************************** diff --git a/test/online_test.cpp b/test/online_test.cpp index e8f009f9..81f15af7 100644 --- a/test/online_test.cpp +++ b/test/online_test.cpp @@ -28,10 +28,9 @@ test_main( int argc, char * argv[] ) // Revision History : // // $Log$ -// Revision 1.6 2002/08/26 09:07:41 rogeeff -// switch to use included Test Execution Monitor +// Revision 1.7 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// 5 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/test/output_test_stream_test.cpp b/test/output_test_stream_test.cpp index 6c9f5b15..8b1e8a69 100644 --- a/test/output_test_stream_test.cpp +++ b/test/output_test_stream_test.cpp @@ -211,10 +211,9 @@ init_unit_test_suite( int argc, char* argv[] ) { // Revision History : // // $Log$ -// Revision 1.6 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.7 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// 6 Nov 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/test/parameterized_test_test.cpp b/test/parameterized_test_test.cpp new file mode 100644 index 00000000..14a3dd98 --- /dev/null +++ b/test/parameterized_test_test.cpp @@ -0,0 +1,166 @@ +// (C) Copyright Gennadiy Rozental 2002. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version including documentation. +// +// File : $$ +// +// Version : $Id$ +// +// Description : tests parameterized tests +// *************************************************************************** + +// Boost.Test +#include +#include +#include +#include + +using namespace boost::unit_test_framework; + +#include +#include +#include + +//____________________________________________________________________________// + +void test0( int i ) +{ + BOOST_CHECK( i%2 == 0 ); +} + +//____________________________________________________________________________// + +void test1( int i ) +{ + BOOST_CHECK( i%2 == 0 ); + BOOST_REQUIRE( i%3 != 0 ); +} + +//____________________________________________________________________________// + + +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x560) +#define BOOST_PARAM_TEST_CASE__( arg1, arg2, arg3 ) \ + boost::unit_test_framework::create_test_case( (arg1), std::string( "" ), (arg2), (arg3) ) +#else +#define BOOST_PARAM_TEST_CASE__( arg1, arg2, arg3 ) BOOST_PARAM_TEST_CASE( arg1, arg2, arg3 ) +#endif + +int test_main( int, char* [] ) { + unit_test_counter num_of_failures; + bool exception_caught; + boost::onullstream null_output; + boost::scoped_ptr test; + + unit_test_result::reset_current_result_set(); + unit_test_log::instance().set_log_stream( null_output ); + + { + int test_data[] = { 2, 2, 2 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 0 ); + BOOST_CHECK( !exception_caught ); + } + + { + int test_data[] = { 1, 2, 2 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 1 ); + BOOST_CHECK( !exception_caught ); + } + + { + int test_data[] = { 1, 1, 2 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 3 ); + BOOST_CHECK( !exception_caught ); + } + + { + int test_data[] = { 1, 1, 1 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 6 ); + BOOST_CHECK( !exception_caught ); + } + + unit_test_result::reset_current_result_set(); + unit_test_result::reset_current_result_set(); + + { + int test_data[] = { 6, 6, 6 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 0 ); + BOOST_CHECK( !exception_caught ); + } + + unit_test_result::reset_current_result_set(); + unit_test_result::reset_current_result_set(); + + { + int test_data[] = { 0, 3, 9 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 2 ); + BOOST_CHECK( !exception_caught ); + } + + { + int test_data[] = { 2, 3, 3 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 2 ); + BOOST_CHECK( exception_caught ); + } + + { + int test_data[] = { 3, 2, 6 }; + test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->run(); + + unit_test_result::instance().failures_details( num_of_failures, exception_caught ); + BOOST_CHECK( num_of_failures == 1 ); + BOOST_CHECK( exception_caught ); + } + + unit_test_result::reset_current_result_set(); + unit_test_log::instance().set_log_stream( std::cout ); + + return 0; +} + +//____________________________________________________________________________// + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.2 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank +// + +// *************************************************************************** + +// EOF diff --git a/test/prg_exec_fail1.cpp b/test/prg_exec_fail1.cpp index 0e335fe4..65089f82 100644 --- a/test/prg_exec_fail1.cpp +++ b/test/prg_exec_fail1.cpp @@ -28,8 +28,8 @@ cpp_main( int, char *[] ) // note the name // Revision History : // // $Log$ -// Revision 1.4 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.5 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // // *************************************************************************** diff --git a/test/prg_exec_fail2.cpp b/test/prg_exec_fail2.cpp index 15bfae73..f71eabf0 100644 --- a/test/prg_exec_fail2.cpp +++ b/test/prg_exec_fail2.cpp @@ -27,8 +27,8 @@ int cpp_main( int, char *[] ) // note the name // Revision History : // // $Log$ -// Revision 1.4 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.5 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // // *************************************************************************** diff --git a/test/result_report_test.cpp b/test/result_report_test.cpp index 8946f061..f91c6fa7 100644 --- a/test/result_report_test.cpp +++ b/test/result_report_test.cpp @@ -18,6 +18,7 @@ #include #include #include +#include using boost::test_toolbox::output_test_stream; using namespace boost::unit_test_framework; @@ -34,9 +35,9 @@ using namespace boost::unit_test_framework; void good_foo() {} void bad_foo() { - output_test_stream dev_null; + boost::onullstream null_stream; - unit_test_log::instance().set_log_stream( dev_null ); + unit_test_log::instance().set_log_stream( null_stream ); BOOST_ERROR( "Sure" ); unit_test_log::instance().set_log_stream( std::cout ); } @@ -64,6 +65,7 @@ test_main( int argc, char * argv[] ) output_test_stream output( "result_report_test.pattern", match_or_save ); test_suite* ts_0 = BOOST_TEST_SUITE( "0 test cases inside" ); + test_suite* ts_1 = BOOST_TEST_SUITE( "1 test cases inside" ); ts_1->add( BOOST_TEST_CASE( good_foo ) ); @@ -119,10 +121,9 @@ test_main( int argc, char * argv[] ) // Revision History : // // $Log$ -// Revision 1.5 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.6 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// 6 Nov 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/test/test_exec_fail1.cpp b/test/test_exec_fail1.cpp index f3862096..3d9e446f 100644 --- a/test/test_exec_fail1.cpp +++ b/test/test_exec_fail1.cpp @@ -29,11 +29,9 @@ int test_main( int, char* [] ) // note the name // Revision History : // // $Log$ -// Revision 1.4 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.5 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// 25 Oct 01 Revisited version (Gennadiy Rozental) -// 7 Nov 00 Initial boost version (Beman Dawes) // *************************************************************************** diff --git a/test/test_exec_fail2.cpp b/test/test_exec_fail2.cpp index b47d4160..b329c8fe 100644 --- a/test/test_exec_fail2.cpp +++ b/test/test_exec_fail2.cpp @@ -37,11 +37,9 @@ int test_main( int, char *[] ) // note the name // Revision History : // // $Log$ -// Revision 1.4 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.5 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// 25 Oct 01 Revisited version (Gennadiy Rozental) -// 7 Nov 00 Initial boost version (Beman Dawes) // *************************************************************************** diff --git a/test/test_exec_fail3.cpp b/test/test_exec_fail3.cpp index 2b13f800..be094ec7 100644 --- a/test/test_exec_fail3.cpp +++ b/test/test_exec_fail3.cpp @@ -33,11 +33,9 @@ int test_main( int, char *[] ) // note the name // Revision History : // // $Log$ -// Revision 1.4 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.5 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// 25 Oct 01 Revisited version (Gennadiy Rozental) -// 7 Nov 00 Initial boost version (Beman Dawes) // *************************************************************************** diff --git a/test/test_exec_fail4.cpp b/test/test_exec_fail4.cpp index 63cd55d2..899aa26e 100644 --- a/test/test_exec_fail4.cpp +++ b/test/test_exec_fail4.cpp @@ -33,11 +33,9 @@ int test_main( int, char* [] ) // note the name // Revision History : // // $Log$ -// Revision 1.5 2002/08/26 09:08:06 rogeeff -// cvs kw added +// Revision 1.6 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// 25 Oct 01 Revisited version (Gennadiy Rozental) -// 8 Feb 01 Initial boost version (Beman Dawes) // *************************************************************************** diff --git a/test/test_tools_test.cpp b/test/test_tools_test.cpp index 306bef70..785c0d74 100644 --- a/test/test_tools_test.cpp +++ b/test/test_tools_test.cpp @@ -15,6 +15,7 @@ // Boost.Test #include +#include #include using namespace boost::unit_test_framework; @@ -33,8 +34,10 @@ using namespace boost::unit_test_framework; boost::test_toolbox::output_test_stream output; \ \ unit_test_log::instance().set_log_stream( output ); \ + unit_test_result::reset_current_result_set(); \ tool_usage; \ \ + unit_test_result::reset_current_result_set(); \ unit_test_log::instance().set_log_stream( std::cout ); \ BOOST_CHECK( check ); \ } @@ -46,12 +49,15 @@ using namespace boost::unit_test_framework; boost::test_toolbox::output_test_stream output; \ \ unit_test_log::instance().set_log_stream( output ); \ + unit_test_result::reset_current_result_set(); \ try { \ tool_usage; \ unit_test_log::instance().set_log_stream( std::cout ); \ + unit_test_result::reset_current_result_set(); \ BOOST_CHECK( nothrow_check ); \ } catch( boost::test_toolbox::detail::test_tool_failed const&) { \ unit_test_log::instance().set_log_stream( std::cout ); \ + unit_test_result::reset_current_result_set(); \ BOOST_CHECK( throw_check ); \ } \ } @@ -647,30 +653,30 @@ test_suite* init_unit_test_suite( int argc, char* argv[] ) { test_suite* test = BOOST_TEST_SUITE("Test Tools test"); - test->add( BOOST_TEST_CASE( &test_BOOST_CHECK ), 3 ); - test->add( BOOST_TEST_CASE( &test_BOOST_REQUIRE ), 2 ); + test->add( BOOST_TEST_CASE( &test_BOOST_CHECK ) ); + test->add( BOOST_TEST_CASE( &test_BOOST_REQUIRE ) ); test->add( BOOST_TEST_CASE( &test_BOOST_MESSAGE ) ); test->add( BOOST_TEST_CASE( &test_BOOST_WARN ) ); test->add( BOOST_TEST_CASE( &test_BOOST_CHECKPOINT ) ); test->add( BOOST_TEST_CASE( &test_BOOST_WARN_MESSAGE ) ); - test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_MESSAGE ), 1 ); - test->add( BOOST_TEST_CASE( &test_BOOST_REQUIRE_MESSAGE ), 1 ); - test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_EQUAL ), 3 ); + test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_MESSAGE ) ); + test->add( BOOST_TEST_CASE( &test_BOOST_REQUIRE_MESSAGE ) ); + test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_EQUAL ) ); test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_CLOSE_all ), #if defined(__BORLANDC__) || defined(__GNUC__) - 40 + 6 #elif defined (_MSC_VER) - 34 + 2 #else - 30 + 0 #endif ); - test->add( BOOST_TEST_CASE( &test_BOOST_ERROR ), 2 ); - test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_THROW ), 1 ); - test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_EQUAL_COLLECTIONS ), 2 ); + test->add( BOOST_TEST_CASE( &test_BOOST_ERROR ) ); + test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_THROW ) ); + test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_EQUAL_COLLECTIONS ) ); test->add( BOOST_TEST_CASE( &test_BOOST_IS_DEFINED ) ); - test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_PREDICATE ), 3 ); - test->add( BOOST_TEST_CASE( &test_BOOST_REQUIRE_PREDICATE ), 1 ); + test->add( BOOST_TEST_CASE( &test_BOOST_CHECK_PREDICATE ) ); + test->add( BOOST_TEST_CASE( &test_BOOST_REQUIRE_PREDICATE ) ); return test; } @@ -681,13 +687,9 @@ init_unit_test_suite( int argc, char* argv[] ) { // Revision History : // // $Log$ -// Revision 1.11 2002/09/16 08:40:55 rogeeff -// test fixed to follow latest changes +// Revision 1.12 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.10 2002/08/26 09:08:06 rogeeff -// cvs kw added -// -// 15 Oct 01 Initial version (Gennadiy Rozental) // *************************************************************************** diff --git a/test/unit_test_suite_ex_test.cpp b/test/unit_test_suite_ex_test.cpp index 0dd67d07..cbb50541 100644 --- a/test/unit_test_suite_ex_test.cpp +++ b/test/unit_test_suite_ex_test.cpp @@ -110,13 +110,9 @@ init_unit_test_suite( int argc, char* argv[] ) { // Revision History : // // $Log$ -// Revision 1.7 2002/09/16 08:40:55 rogeeff -// test fixed to follow latest changes +// Revision 1.8 2002/11/02 20:04:43 rogeeff +// release 1.29.0 merged into the main trank // -// Revision 1.6 2002/08/26 09:08:06 rogeeff -// cvs kw added -// -// 6 Nov 01 Initial version (Gennadiy Rozental) // ***************************************************************************
Boost logo +
Boost logo

Boost Test Library: Unit Test Framework

The acceptance test makes the customer satisfied that the
software provides the business value that makes them willing
@@ -36,49 +36,49 @@ H4

The Framework integration
The Framework parameters
The Framework compilation
- The Framework extensions
+ The Framework extensions
Example and Test Programs
Rationale
Design

Also see: Test Tools

Introduction

-

The Boost Test Library's Unit Test Framework provides - facilities to simplify writing test cases using Test Tools - and organizing them into test suites hierarchy. The framework relieves users from - messy a error detection, reporting duties and parameter processing. It provided - main() function that initialize the framework, setups parameters based on command - line arguments and/or environment variables, calls the user-supplied function init_unit_test_suite(argc, - argv) and than runs the provided test suite. The framework keeps track of all passed/failed - Test Tools assertions, provides an ability to check - the testing progress based on the amount of test cases run as part of the total - amount of test cases and generates the result report in several different formats. - The Unit Test Framework intended to be used both for a simple testing needs and - a complex non trivial testing. It is not intended to be used with the production - code, where the Program Execution Monitor could - be used. This was one of the design rationale to make the library implemented offline - vs. an inline implementation to allows us to speed up a compilation at an expense - of a runtime efficiency. The Unit Test Framework should be preferred over Test - Execution Monitor while working on creating new test programs. reference to the top +

The Boost Test Library's Unit Test Framework provides + facilities to simplify writing test cases using Test Tools + and organizing them into test suites hierarchy. The framework relieves users from + messy a error detection, reporting duties and parameter processing. It provided + main() function that initialize the framework, setups parameters based on command + line arguments and/or environment variables, calls the user-supplied function init_unit_test_suite(argc, + argv) and than runs the provided test suite. The framework keeps track of all passed/failed + Test Tools assertions, provides an ability to check + the testing progress based on the amount of test cases run as part of the total + amount of test cases and generates the result report in several different formats. + The Unit Test Framework intended to be used both for a simple testing needs and + a complex non trivial testing. It is not intended to be used with the production + code, where the Program Execution Monitor could + be used. This was one of the design rationale to make the library implemented offline + vs. an inline implementation to allows us to speed up a compilation at an expense + of a runtime efficiency. The Unit Test Framework should be preferred over Test + Execution Monitor while working on creating new test programs. reference to the top

Getting Started

-

See Getting Started to +

See Getting Started to use Unit Test Framework

The Framework components

-

The Unit Test Framework consists of several cooperating - components. All components are located in the namespace boost::unit_test_framework. - The Test Case component encapsulate the notion of a simple - testing unit. The Test Suite component allows to unite - several related testing units into one bundle that could be considered an a compound - testing unit. To manage output generated during testing one could use the - Test Log component. The Test Result component is +

The Unit Test Framework consists of several cooperating + components. All components are located in the namespace boost::unit_test_framework. + The Test Case component encapsulate the notion of a simple + testing unit. The Test Suite component allows to unite + several related testing units into one bundle that could be considered an a compound + testing unit. To manage output generated during testing one could use the + Test Log component. The Test Result component is responsible for testing results presentation.

The Test Case

-

The Unit Test Framework provides an ability for the user - to create the Test Case based on a free function or a user's class method. There - are four types of test cases: function_test_case, - class_test_case, parametrized_function_test_case, - parametrized_class_test_case. All +

The Unit Test Framework provides an ability for the user + to create the Test Case based on a free function or a user's class method. There + are four types of test cases: function_test_case, + class_test_case, parametrized_function_test_case, + parametrized_class_test_case. All of them implements test case interface defined in the abstract base class test_case.

Test case interface

Definition
@@ -94,22 +94,22 @@ H4 };
Description
-

Abstract class test_case define the test case interface. - Use method test_case:set_timeout(...) to set the - timeout value for the test case. See method execution_monitor::execute(...) - for more details about the timeout value. Use method test_case::set_expected_failures(...) - to set the expected amount of Test Tools failures - in the test case. In most cases it's more convenient to set these parameters while - adding this test_case to a test_suite. See the method test_suite::add(...) - for more details. Use method test_case::run() to - start the test case processing. +

Abstract class test_case define the test case interface. + Use method test_case:set_timeout(...) to set the + timeout value for the test case. See method execution_monitor::execute(...) + for more details about the timeout value. Use method test_case::set_expected_failures(...) + to set the expected amount of Test Tools failures + in the test case. In most cases it's more convenient to set these parameters while + adding this test_case to a test_suite. See the method test_suite::add(...) + for more details. Use method test_case::run() to + start the test case processing.

Construction

You will never need to create instances of the class test_case.

- reference to the top + reference to the top

Free function based test cases

Definition
-

defined in - unit_test_suite.hpp +

defined in + unit_test_suite.hpp

Synopsis
class function_test_case : public test_case
 {
@@ -119,20 +119,20 @@ H4
     ... // Implementation
 };
Description
-

Simplest and most widely used form of test cases. Instances - of the class function_test_case are created by the framework for supplied by the - user pointer to free function with the following specification: void (*fct)(). - Note void return type. To report a testing results one should use the Test Tools - instead of returing result code. +

Simplest and most widely used form of test cases. Instances + of the class function_test_case are created by the framework for supplied by the + user pointer to free function with the following specification: void (*fct)(). + Note void return type. To report a testing results one should use the Test Tools + instead of returing result code.

Construction
-

To create a test case based on your test function use +

To create a test case based on your test function use the following macro:

BOOST_TEST_CASE( &free_function ).

-

BOOST_TEST_CASE creates a new instance of the class function_test_case - and returns a pointer to the base class test_case. In most cases you will use it +

BOOST_TEST_CASE creates a new instance of the class function_test_case + and returns a pointer to the base class test_case. In most cases you will use it as an argument to the method test_suite::add(...).

Examples
-
+
void test_feature1()
 {
     ...
@@ -140,7 +140,7 @@ H4
 ...
 
 ts->add( BOOST_TEST_CASE( &test_feature1 ) );
- _____________________ + _____________________
#include <boost/test/unit_test.hpp>
 using boost::unit_test_framework::test_suite;
 
@@ -155,57 +155,57 @@ init_unit_test_suite( int argc, "Example" );
 
     test->add( BOOST_TEST_CASE( &free_test_function )
-  
-    return test; 
+
+    return test;
 }
- reference to the top + reference to the top

Class member function based test cases

Definition
-

defined in unit_test_suite.hpp +

defined in unit_test_suite.hpp

Synopsis
template<class UserTestClass>
 class class_test_case : public test_case
 {
 public:
-    class_test_case( void (UserTestCase::*function_type)(), 
+    class_test_case( void (UserTestCase::*function_type)(),
                      char const* name,
                      boost::shared_ptr<UserTestCase>& user_test_case );
 
     ... // Implementation
 };
Description
-

Instances of the class class_test_case are created by - the framework for the supplied member function and instance of the user's test - class with the following specification: void (UserTestClass::*fct)(). To allow - sharing on the same instance, so that one test case could use results of another, - class_test_case is constructed based on boost::shared_ptr to the user test case - class instance. Note, though, that we could achive similar effect with use of free - function like this: +

Instances of the class class_test_case are created by + the framework for the supplied member function and instance of the user's test + class with the following specification: void (UserTestClass::*fct)(). To allow + sharing on the same instance, so that one test case could use results of another, + class_test_case is constructed based on boost::shared_ptr to the user test case + class instance. Note, though, that we could achive similar effect with use of free + function like this:

void compount_test() {
     UserTestCase instance;
-    
+
     instance.test1();
     instance.test2();
     ...
 };
- The only drawback of this version that you could not separate results of one test - case from another. Another reason to use class member function based tast cases is - to test non default constructible user test case. In other words, if iser test case - need command line arguments or some other parameters to be constructed. As a general - rule it is recommended to use the class_test_case only if you can't implement a test - logic in a free function. Due to usage of templates in an implementation of the class_test_case, - a compilation can be longer would you use the function_test_case. + The only drawback of this version that you could not separate results of one test + case from another. Another reason to use class member function based tast cases is + to test non default constructible user test case. In other words, if iser test case + need command line arguments or some other parameters to be constructed. As a general + rule it is recommended to use the class_test_case only if you can't implement a test + logic in a free function. Due to usage of templates in an implementation of the class_test_case, + a compilation can be longer would you use the function_test_case.
Construction
-

To create an instance of the class class_test_case use +

To create an instance of the class class_test_case use the following macro:

-

BOOST_CLASS_TEST_CASE( function, shared_test_case_instance +

BOOST_CLASS_TEST_CASE( function, shared_test_case_instance ).

-

BOOST_CLASS_TEST_CASE creates a new instance of the class - class_test_case and returns a pointer to the base class test_case. In most cases +

BOOST_CLASS_TEST_CASE creates a new instance of the class + class_test_case and returns a pointer to the base class test_case. In most cases you will use it as an argument to the method test_suite::add(...).

Examples
-
+
class my_complex_test {
 public:
     void test_feature1() {
@@ -215,11 +215,11 @@ init_unit_test_suite( int argc, class class_under_test {
 public:
     // i should be positive; throw an exception otherwise
-    explicit class_under_test( int i ); 
+    explicit class_under_test( int i );
     ...
     // access methods
     int get_value() const;
@@ -229,16 +229,16 @@ ts->add( BOOST_TEST_CASE( &my_complex_test::test_feature1 ) );
public: void test_construction() { BOOST_CHECK_THROW( new class_under_test( -1 ) ); - + v = new class_under_test( 1 ); - + BOOST_CHECK( v is valid ); ... } void test_access_methods() { BOOST_CHECK_EQUAL( v->get_value(), 1 ); - ... + ... } private: class_under_test* v; @@ -249,10 +249,10 @@ boost::shared_ptr<compound_test> instance( new
- reference to the top + reference to the top

Parameterized free function test cases

Definition
-

defined in unit_test_suite.hpp +

defined in unit_test_suite.hpp

Synopsis
template <typename ParamIterator, typename ParameterType>
 class parametrized_function_test_case : public test_case
@@ -260,24 +260,24 @@ ts->add( BOOST_TEST_CASE( &compound_test::test_access_methods, instance )
     ... // Implementation
 };
Description
-

Instances of the class parametrized_function_test_case - are created by the framework for the supplied user's free function with the following - specification: void (*fct)( ParameterType ). +

Instances of the class parametrized_function_test_case + are created by the framework for the supplied user's free function with the following + specification: void (*fct)( ParameterType ).

Construction
-

To create an instance of the class parametrized_function_test_case +

To create an instance of the class parametrized_function_test_case use the following macro:

-

BOOST_PARAM_TEST_CASE( free_function, first_parameter, +

BOOST_PARAM_TEST_CASE( free_function, first_parameter, last_parameter ).

-

Here first_parameter and last_parameter are begin and - end iterators for the list of parameters accordingly. BOOST_PARAM_TEST_CASE creates - a new instance of the class parametrized_function_test_case and returns a pointer - to the abstract class test_case. In most cases you will use it as an argument to - the method test_suite::add(...). Be aware that the parametrized_function_test_case - does not store list of parameters internally. The user should make sure that parameters - list will not be destroyed until the test case is run. That's why it not recommended - to create a parameters list as local variable in init_unit_test_suite. - A simple way to handle a parameters list lifetime is to place it into a user defined - test suite class. +

Here first_parameter and last_parameter are begin and + end iterators for the list of parameters accordingly. BOOST_PARAM_TEST_CASE creates + a new instance of the class parametrized_function_test_case and returns a pointer + to the abstract class test_case. In most cases you will use it as an argument to + the method test_suite::add(...). Be aware that the parametrized_function_test_case + does not store list of parameters internally. The user should make sure that parameters + list will not be destroyed until the test case is run. That's why it not recommended + to create a parameters list as local variable in init_unit_test_suite. + A simple way to handle a parameters list lifetime is to place it into a user defined + test suite class.

Example
void test_file_reader( std::string const& file_name )
 {
@@ -293,7 +293,7 @@ ts->add( BOOST_TEST_CASE( &compound_test::test_access_methods, instance )
 
         files_to_test.push_back( "file N" );
 
-        add( BOOST_TEST_CASE( &test_file_reader, 
+        add( BOOST_TEST_CASE( &test_file_reader,
                               files_to_test.begin(),
                               files_to_test.end() );
     }
@@ -301,11 +301,11 @@ ts->add( BOOST_TEST_CASE( &compound_test::test_access_methods, instance )
 };
 ...
 ts->add( new reader_testing );
- reference to the top -

Parameterized class member function based + reference to the top +

Parameterized class member function based test cases

Definition
-

defined in unit_test_suite.hpp +

defined in unit_test_suite.hpp

Synopsis
template<class UserTestClass, typename ParamIterator, typename ParameterType>
 
@@ -314,24 +314,24 @@ ts->add( new reader_testing );
... // Implementation };
Description
-

Instances of the class parametrized_class_test_case are - created by the framework for the supplied method of the user's test class with - the following specification: void (UserTestClass::*fct)( ParameterType ). The parametrized_class_test_case - is responsible for the creation and the destroying of the user's test class instance. +

Instances of the class parametrized_class_test_case are + created by the framework for the supplied method of the user's test class with + the following specification: void (UserTestClass::*fct)( ParameterType ). The parametrized_class_test_case + is responsible for the creation and the destroying of the user's test class instance.

Construction
-

To create an instance of the class parameterized_class_test_case - use the following macro: -

BOOST_PARAM_TEST_CASE( test_class_method, first_parameter, - last_parameter ). -

Here first_parameter and last_parameter are begin and - end iterators for the list of parameters accordingly. BOOST_TEST_CASE creates a - new instance of the class parametrized_class_test_case and returns a pointer to - the abstract class test_case. In most cases you will use it as an argument to the - method test_suite::add(...). Be aware that the parametrized_class_test_case - does not store list of parameters internally. The user should make sure that parameters - list will not be destroyed until the test case is run. That's why it not recommended - to create a parameters list as local variable in init_unit_test_suite. - For example, you can place parameters list in file scope. +

To create an instance of the class parameterized_class_test_case + use the following macro: +

BOOST_PARAM_TEST_CASE( test_class_method, first_parameter, + last_parameter ). +

Here first_parameter and last_parameter are begin and + end iterators for the list of parameters accordingly. BOOST_TEST_CASE creates a + new instance of the class parametrized_class_test_case and returns a pointer to + the abstract class test_case. In most cases you will use it as an argument to the + method test_suite::add(...). Be aware that the parametrized_class_test_case + does not store list of parameters internally. The user should make sure that parameters + list will not be destroyed until the test case is run. That's why it not recommended + to create a parameters list as local variable in init_unit_test_suite. + For example, you can place parameters list in file scope.

Example:
class my_complex_test
 {
@@ -345,41 +345,41 @@ ts->add( new reader_testing );
ts->add( BOOST_TEST_CASE( &my_complex_test::test_assignment, possible_tolerances.begin(), possible_tolerances.end() ) ); - reference to the top + reference to the top

The Test Suite

Definition
-

defined in unit_test_suite.hpp +

defined in unit_test_suite.hpp

Synopsis
class test_suite : public test_case
 {
 public:
-    void add( test_case* tc, 
+    void add( test_case* tc,
               unit_test_counter expected_failures = 0,
               int timeout = 0 );
     ... // Implementation
 };
Description
-

The Unit Test Framework provides an ability for the user - to combine created test cases into a test suite and create a hierarchy of test - suites of any depth. To add a test_case to the test_suite use the method test_suite::add(...). - The first argument is a pointer to a new test_case, second - expected_failured - defines the amount of Test Tools assertions that - are expected to fail in the test case, and third - timeout defines the timeout - value for the test case. Note that the expected number of failures is calculated - automatically for the test suites, so you do not need to specify them while adding - test suites to a hierarchy. See the method execution_monitor::execute(...) - for more details about the timeout value. Last two arguments are optional and will +

The Unit Test Framework provides an ability for the user + to combine created test cases into a test suite and create a hierarchy of test + suites of any depth. To add a test_case to the test_suite use the method test_suite::add(...). + The first argument is a pointer to a new test_case, second - expected_failured + defines the amount of Test Tools assertions that + are expected to fail in the test case, and third - timeout defines the timeout + value for the test case. Note that the expected number of failures is calculated + automatically for the test suites, so you do not need to specify them while adding + test suites to a hierarchy. See the method execution_monitor::execute(...) + for more details about the timeout value. Last two arguments are optional and will not be set if absent. In this case values defined in the test_case are used. reference to the top

Construction
-

To create instances of the class test_suite you can use +

To create instances of the class test_suite you can use the following macro:

BOOST_TEST_SUITE( test_suite_name ).

-

BOOST_TEST_SUITE creates an instance of the class test_suite - and returns a pointer to it. test_suite is a test_case, that allows to generate +

BOOST_TEST_SUITE creates an instance of the class test_suite + and returns a pointer to it. test_suite is a test_case, that allows to generate a multilevel hierarchy.

The Test result

Definition
-

defined in unit_test_result.hpp +

defined in unit_test_result.hpp

Synopsis
class unit_test_result
 {
@@ -391,92 +391,92 @@ ts->add( BOOST_TEST_CASE( &my_complex_test::test_assignment,
 };
 
Description
-

The Unit Test Framework keeps testing results as the instances - of the class unit_test_result. Class unit_test_result provides three methods for - the result reporting. Use the method unit_test_result::confirmation_report(...) - to report the success/failure confirmation massage only. Use the method unit_test_result::short_report(...) - to report testing results for the current test_case. The report includes an amount - of passed and failed tests and an amount of passed and failed Test - Tools assertions. Use the method unit_test_result::detailed_report(...) - to report testing results for the current test_case and all test cases it consist - of. In most cases you will not need to use this interface directly. The framework +

The Unit Test Framework keeps testing results as the instances + of the class unit_test_result. Class unit_test_result provides three methods for + the result reporting. Use the method unit_test_result::confirmation_report(...) + to report the success/failure confirmation massage only. Use the method unit_test_result::short_report(...) + to report testing results for the current test_case. The report includes an amount + of passed and failed tests and an amount of passed and failed Test + Tools assertions. Use the method unit_test_result::detailed_report(...) + to report testing results for the current test_case and all test cases it consist + of. In most cases you will not need to use this interface directly. The framework provides a report for overall testing results automatically.

Construction
-

To access instance of class unit_test_result holding results - for the current test case use static method unit_test_result::instance(). +

To access instance of class unit_test_result holding results + for the current test case use static method unit_test_result::instance(). reference to the top

The Test log

Definition
-

defined in unit_test_log.hpp +

defined in unit_test_log.hpp

Synopsis
class unit_test_log
-{ 
+{
      static unit_test_log& instance();
      void  set_log_stream( std::ostream& str );
      void  set_log_threshold_level_by_name( char const* lev );
 };
Description
-

To manage the testing output stream the Unit Test Framework - uses a singleton class unit_test_log. To change the test output stream use method - unit_test_log::set_log_stream(...). The default stream is std::cout. To set a log - level use the method unit_test_log::set_log_level_by_name(...). In most cases you - will not need to use this interface directly. The framework provides a simple way - to set the log level from out of the test program. For more details and for the +

To manage the testing output stream the Unit Test Framework + uses a singleton class unit_test_log. To change the test output stream use method + unit_test_log::set_log_stream(...). The default stream is std::cout. To set a log + level use the method unit_test_log::set_log_level_by_name(...). In most cases you + will not need to use this interface directly. The framework provides a simple way + to set the log level from out of the test program. For more details and for the list of acceptable values see Framework parameters.

Construction
-

To access the only instance of the class unit_test_log +

To access the only instance of the class unit_test_log use method unit_test_log::instance(). reference to the top

The Test monitor

-

To monitor a test_case run the Unit Test Framework uses - a class unit_test_monitor. The unit_test_monitor allows run test_case methods under - control of a execution_monitor and extends the - Execution Monitor functionality to translate execution_monitor exceptions into - designated error codes. For more details about the class unit_test_monitor see - the Boost Test Library Design. In most cases - you will not need to utilize unit_test_monitor because the framework already monitor +

To monitor a test_case run the Unit Test Framework uses + a class unit_test_monitor. The unit_test_monitor allows run test_case methods under + control of a execution_monitor and extends the + Execution Monitor functionality to translate execution_monitor exceptions into + designated error codes. For more details about the class unit_test_monitor see + the Boost Test Library Design. In most cases + you will not need to utilize unit_test_monitor because the framework already monitor a test case run.

The Framework integration

Description
-

As mentioned above Unit Test Framework is responsible - for supplying main function that initializing testing environment and taking care - about results reporting. The main function also includes a hook for the function - that should be supplied by the user. So, to integrate test program with the framework +

As mentioned above Unit Test Framework is responsible + for supplying main function that initializing testing environment and taking care + about results reporting. The main function also includes a hook for the function + that should be supplied by the user. So, to integrate test program with the framework you should provide this function with the following specification:

-

boost::unit_test_framework::test_suite* init_unit_test_suite +

boost::unit_test_framework::test_suite* init_unit_test_suite ( int argc, char* argv[] )

-

This function should create and initialize top level instance - of the class test_suite. The NULL pointer returned by the function is treated as - a non-initialized test_suite. In other case the framework runs provided instance - of the class test_suite and then destroy it the end of program, so it should be - allocated dynamically. Command line arguments passed to the function guarantied +

This function should create and initialize top level instance + of the class test_suite. The NULL pointer returned by the function is treated as + a non-initialized test_suite. In other case the framework runs provided instance + of the class test_suite and then destroy it the end of program, so it should be + allocated dynamically. Command line arguments passed to the function guarantied not to have any framework-specific command line arguments.

-

After test cases run the framework reports the results - and returns the result code. Here the list of values returned by the testing programs +

After test cases run the framework reports the results + and returns the result code. Here the list of values returned by the testing programs integrated with the unit test framework:

-
+
- - + + - - + + - - + - + - +
Value Meaning
boost::exit_successreturned if no errors occured during test or success result code was explicetly - requested with return result code framework parameter + returned if no errors occured during test or success result code was explicetly + requested with return result code framework parameter
boost::exit_test_failure returned if non-fatal errors detected and no uncaught exceptions thrown
boost::exit_exception_failure returned if fatal errors detected or uncaught exceptions thrown
Example
@@ -484,199 +484,199 @@ ts->add( BOOST_TEST_CASE( &my_complex_test::test_assignment, init_unit_test_suite( int argc, char* argv[] ) { test_suite* test= BOOST_TEST_SUITE( "Master test suite" ); - + test->add( BOOST_TEST_CASE( &my_test_function ) ); return test; } - reference to the top + reference to the top

The Framework parameters

-

The Unit Test Framework provides two ways to configure - test program run parameters externally: using command line arguments and setting - environment variables. The following tables provides a compiled information about - the framework parameters. Note that default parameter's value (i.e. value of the - parameter if it is not defined either in the environment or among command-line +

The Unit Test Framework provides two ways to configure + test program run parameters externally: using command line arguments and setting + environment variables. The following tables provides a compiled information about + the framework parameters. Note that default parameter's value (i.e. value of the + parameter if it is not defined either in the environment or among command-line arguments) for each parameter is bolded.

- + - + - + - + - - + -
Parameter Name: Log level
Environment variable name: BOOST_TEST_LOG_LEVEL
Command line argument name: --log_level=<value>
Acceptable Values: + - + - + - + - + - + - + - + - + - - + - - + - - +
all - report all log messages including the passed test notification
success - the same as all
test_suite - show test suite messages
messages - show user messages
warnings - report warnings issues by user
all_errors - report all error conditions
cpp_exception - report uncaught c++ exception
system_errors- report system originated non-fatal errors (for example, timeout or floating + - report system originated non-fatal errors (for example, timeout or floating point exception)
fatal_errors- report only user or system originated fatal errors (for example, memory access + - report only user or system originated fatal errors (for example, memory access violation)
progress- report only progress information: number of run test cases vs. overall number + - report only progress information: number of run test cases vs. overall number of test cases
nothing - does not report any information
Description: Set a log level for the testing in a range from a complete log when all successful - tests are confirmed and all test suite messages are included to an empty log when + Set a log level for the testing in a range from a complete log when all successful + tests are confirmed and all test suite messages are included to an empty log when nothing is put into a test output stream.

- + - + - + - + - + -
Parameter Name: [Not] return result code
Environment variable name: BOOST_TEST_RESULT_CODE
Command line argument name: --result_code=<value>
Acceptable Values: yes
no
Description: If set to no enforce framework to return zero result code always. Could be used + If set to no enforce framework to return zero result code always. Could be used for test programs integrated with GUI.

- + - + - + - + - + -
Parameter Name: Result report level
Environment variable name: BOOST_TEST_REPORT_LEVEL
Command line argument name: --report_level=<value>
Acceptable Values: no
confirm
short
detailed
Description:Set the level of result report, that the framework generates at the end of testing. + Set the level of result report, that the framework generates at the end of testing. Use "no" value to eliminate the result report.

- + - + - + - + - + -
Parameter Name: Save pattern
Environment variable name: BOOST_TEST_SAVE_PATTERN
Command line argument name: --save_pattern=yes
Acceptable Values: no
yes
Description:Could be used by a testing program to inquire a saving mode for the + Could be used by a testing program to inquire a saving mode for the output_test_stream tool.

- + - + - + - + - + -
Parameter Name: Print build info
Environment variable name: BOOST_TEST_BUILD_INFO
Command line argument name: --build_info=yes
Acceptable Values: no
yes
Description:If specified in command line make the framework to print build information that + If specified in command line make the framework to print build information that include: platform, compiler, stl in use and boost version.

reference to the top

The Framework compilation

-

The Unit Test Framework is supplied as an offline library - and should be compiled and linked with a test program. Following files, that are +

The Unit Test Framework is supplied as an offline library + and should be compiled and linked with a test program. Following files, that are located in the Boost Test Library src directory, compose the framework:

execution_monitor.cpp
test_tools.cpp
@@ -686,6 +686,9 @@ init_unit_test_suite( int argc, unit_test_monitor.cpp
unit_test_result.cpp
unit_test_suite.cpp

+

You also have a choice to include all files + constituting the framework directly into your test module. Use <boost/test/included/unit_test_framework.hpp> + for this porpose.

Example and Test Programsreference to the top

unit_test_example1.cpp
unit_test_example2.cpp
@@ -696,29 +699,24 @@ init_unit_test_suite( int argc, errors_handling_test.cpp
result_report_test.cpp

Rationale

-

What is the first thing to do when you start working on - new library/class/program? Exactly - we need the unit test module. Writing of the - unit test module should be simple and obvious. On the other hand the framework - should allow us to do a lot of non-trivial things. We want to be able to have a - lot of small test cases. We want to be able to group them in test suites. At the - beginning of the development we want to see as much descriptive error message as - possible, while during regression testing we just want to know is there any errors - at all. For small test programs a run time should prevail over a compilation time - - who want to wait a 1 min to start the test that run a 1 sec?. For a long and +

What is the first thing to do when you start working on + new library/class/program? Exactly - we need the unit test module. Writing of the + unit test module should be simple and obvious. On the other hand the framework + should allow us to do a lot of non-trivial things. We want to be able to have a + lot of small test cases. We want to be able to group them in test suites. At the + beginning of the development we want to see as much descriptive error message as + possible, while during regression testing we just want to know is there any errors + at all. For small test programs a run time should prevail over a compilation time + - who want to wait a 1 min to start the test that run a 1 sec?. For a long and complex test we want to be able to see the test progress.

Design

- reference to the top -

The Boost Test Library Design document describes + reference to the top +

The Boost Test Library Design document describes the relationship between Boost Test Library components.

-