summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/test/example
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/boost/libs/test/example/Jamfile.v278
-rw-r--r--src/boost/libs/test/example/const_string.hpp179
-rw-r--r--src/boost/libs/test/example/const_string_test.cpp179
-rw-r--r--src/boost/libs/test/example/exec_mon_example.cpp218
-rw-r--r--src/boost/libs/test/example/external_main_example_1.cpp52
-rw-r--r--src/boost/libs/test/example/external_main_example_2.cpp49
-rw-r--r--src/boost/libs/test/example/external_main_example_3.cpp49
-rw-r--r--src/boost/libs/test/example/filtering_example.cpp372
-rw-r--r--src/boost/libs/test/example/named_param_example.cpp120
-rw-r--r--src/boost/libs/test/example/prg_exec_example.cpp20
-rw-r--r--src/boost/libs/test/example/test_case_template_example.cpp35
-rw-r--r--src/boost/libs/test/example/unit_test_example_01.cpp40
-rw-r--r--src/boost/libs/test/example/unit_test_example_02.cpp45
-rw-r--r--src/boost/libs/test/example/unit_test_example_03.cpp57
-rw-r--r--src/boost/libs/test/example/unit_test_example_04.cpp121
-rw-r--r--src/boost/libs/test/example/unit_test_example_05.cpp50
-rw-r--r--src/boost/libs/test/example/unit_test_example_06.cpp44
-rw-r--r--src/boost/libs/test/example/unit_test_example_07.cpp42
-rw-r--r--src/boost/libs/test/example/unit_test_example_08.cpp24
-rw-r--r--src/boost/libs/test/example/unit_test_example_09_1.cpp34
-rw-r--r--src/boost/libs/test/example/unit_test_example_09_2.cpp34
-rw-r--r--src/boost/libs/test/example/unit_test_example_10.cpp172
-rw-r--r--src/boost/libs/test/example/unit_test_example_11.cpp49
-rw-r--r--src/boost/libs/test/example/unit_test_example_12.cpp190
-rw-r--r--src/boost/libs/test/example/unit_test_example_12.input11
-rw-r--r--src/boost/libs/test/example/unit_test_example_13.cpp20
-rw-r--r--src/boost/libs/test/example/unit_test_example_15.cpp32
-rw-r--r--src/boost/libs/test/example/unit_test_example_16.cpp35
28 files changed, 2351 insertions, 0 deletions
diff --git a/src/boost/libs/test/example/Jamfile.v2 b/src/boost/libs/test/example/Jamfile.v2
new file mode 100644
index 000000000..5afb37e0e
--- /dev/null
+++ b/src/boost/libs/test/example/Jamfile.v2
@@ -0,0 +1,78 @@
+# (C) Copyright Gennadiy Rozental 2001-2005.
+# (C) Copyright Juergen Hunold 2006.
+# Use, modification, and distribution are subject to the
+# Boost Software License, Version 1.0. (See accompanying file
+# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#
+# See http://www.boost.org/libs/test for the library home page.
+
+# bring in the rules for testing
+import testing ;
+import os ;
+
+# requirements
+import ../../config/checks/config : requires ;
+
+local HAS_UBSAN = "NO_UBSAN" ; # need to defined something
+if [ os.environ UBSAN ]
+{
+ HAS_UBSAN = "HAS_UBSAN=" [ os.environ UBSAN ] ;
+}
+
+ECHO $(HAS_UBSAN:J) ;
+
+# Project
+project boost/test-examples
+ :
+ : requirements
+ <toolset>clang:<cxxflags>-Wno-c99-extensions <define>$(HAS_UBSAN:J)
+ ;
+
+# Define aliases for the needed libs to get shorter names
+alias prg_exec_monitor
+ : # sources
+ /boost//prg_exec_monitor
+ ;
+
+alias unit_test_framework
+ : # sources
+ /boost//unit_test_framework
+ ;
+
+# make aliases explicit so the libraries will only be built when requested
+explicit unit_test_framework ;
+explicit prg_exec_monitor ;
+
+alias boost_test_examples
+:
+ [ run exec_mon_example.cpp prg_exec_monitor ]
+ [ run-fail prg_exec_example.cpp prg_exec_monitor ]
+
+ [ run-fail test_case_template_example.cpp unit_test_framework/<link>static ]
+
+ [ run-fail unit_test_example_01.cpp unit_test_framework ]
+ [ run-fail unit_test_example_02.cpp unit_test_framework/<link>static ]
+ [ run-fail unit_test_example_03.cpp unit_test_framework/<link>static ]
+ [ run-fail unit_test_example_04.cpp unit_test_framework : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ]
+ [ run-fail unit_test_example_05.cpp unit_test_framework : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ]
+ [ run-fail unit_test_example_06.cpp unit_test_framework ]
+ [ run unit_test_example_07.cpp unit_test_framework : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ]
+ [ run unit_test_example_08.cpp unit_test_framework ]
+ [ run unit_test_example_09_1.cpp
+ unit_test_example_09_2.cpp unit_test_framework ]
+ [ run-fail unit_test_example_10.cpp unit_test_framework/<link>static ]
+ [ run-fail unit_test_example_11.cpp unit_test_framework/<link>static ]
+ [ link unit_test_example_12.cpp unit_test_framework/<link>static ]
+ [ run unit_test_example_13.cpp ]
+ [ run-fail unit_test_example_15.cpp : : : [ requires cxx11_decltype cxx11_hdr_random cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_variadic_macros cxx11_trailing_result_types cxx11_template_aliases ] ]
+ [ run unit_test_example_16.cpp unit_test_framework ]
+
+ [ run named_param_example.cpp ]
+
+ [ run const_string_test.cpp ]
+
+ [ run-fail external_main_example_1.cpp unit_test_framework ]
+ [ run-fail external_main_example_2.cpp unit_test_framework ]
+ [ run-fail external_main_example_3.cpp ]
+ [ run-fail filtering_example.cpp unit_test_framework/<link>static : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ]
+;
diff --git a/src/boost/libs/test/example/const_string.hpp b/src/boost/libs/test/example/const_string.hpp
new file mode 100644
index 000000000..2ff382f8e
--- /dev/null
+++ b/src/boost/libs/test/example/const_string.hpp
@@ -0,0 +1,179 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision$
+//
+// Description : simple string class definition
+// ***************************************************************************
+
+#ifndef CONST_STRING_HPP
+#define CONST_STRING_HPP
+
+// STL
+#include <iterator>
+#include <string>
+#include <cstring>
+using std::string;
+
+namespace common_layer {
+
+// ************************************************************************** //
+// ************** const_string ************** //
+// ************************************************************************** //
+
+class const_string {
+public:
+ // Subtypes
+ typedef char const* iterator;
+ typedef char const* const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef reverse_iterator const_reverse_iterator;
+
+ // Constructor
+ const_string()
+ : m_begin( "" ), m_end( m_begin ) {}
+
+ // Copy constructor is generated by compiler
+
+ const_string( const std::string& s )
+ : m_begin( s.c_str() ),
+ m_end( m_begin + s.length() ) {}
+
+ const_string( char const* s )
+ : m_begin( s ? s : "" )
+ , m_end( s ? m_begin + std::strlen( s ) : m_begin )
+ {}
+
+ const_string( char const* s, size_t length )
+ : m_begin( s ), m_end( m_begin + length ) { if( length == 0 ) erase(); }
+
+ const_string( char const* first, char const* last )
+ : m_begin( first ), m_end( last ) {}
+
+ // data access methods
+ char operator[]( size_t index ) const { return m_begin[index]; }
+ char at( size_t index ) const { return m_begin[index]; }
+
+ char const* data() const { return m_begin; }
+
+ // length operators
+ size_t length() const { return m_end - m_begin; }
+ bool is_empty() const { return m_end == m_begin; }
+
+ void erase() { m_begin = m_end = ""; }
+ void resize( size_t new_len ) { if( m_begin + new_len < m_end ) m_end = m_begin + new_len; }
+ void rshorten( size_t shift = 1 ) { m_end -= shift; if( m_end <= m_begin ) erase(); }
+ void lshorten( size_t shift = 1 ) { m_begin += shift; if( m_end <= m_begin ) erase(); }
+
+ // Assignment operators
+ const_string& operator=( const_string const& s );
+ const_string& operator=( string const& s ) { return *this = const_string( s ); }
+ const_string& operator=( char const* s ) { return *this = const_string( s ); }
+
+ const_string& assign( const_string const& s ) { return *this = s; }
+ const_string& assign( string const& s, size_t len ) { return *this = const_string( s.data(), len ); }
+ const_string& assign( string const& s ) { return *this = const_string( s ); }
+ const_string& assign( char const* s ) { return *this = const_string( s ); }
+ const_string& assign( char const* s, size_t len ) { return *this = const_string( s, len ); }
+ const_string& assign( char const* f, char const* l ) { return *this = const_string( f, l ); }
+
+ void swap( const_string& s ) {
+ // do not want to include alogrithm
+ char const* tmp1 = m_begin;
+ char const* tmp2 = m_end;
+
+ m_begin = s.m_begin;
+ m_end = s.m_end;
+
+ s.m_begin = tmp1;
+ s.m_end = tmp2;
+ }
+
+ // Comparison operators
+ friend bool operator==( const_string const& s1, const_string const& s2 )
+ {
+ return s1.length() == s2.length() && std::strncmp( s1.data(), s2.data(), s1.length() ) == 0;
+ }
+ friend bool operator==( const_string const& s1, char const* s2 ) { return s1 == const_string( s2 ); }
+ friend bool operator==( const_string const& s1, const string& s2 ) { return s1 == const_string( s2 ); }
+
+ friend bool operator!=( const_string const& s1, const_string const& s2 ) { return !(s1 == s2); }
+ friend bool operator!=( const_string const& s1, char const* s2 ) { return !(s1 == s2); }
+ friend bool operator!=( const_string const& s1, const string& s2 ) { return !(s1 == s2); }
+
+ friend bool operator==( char const* s2, const_string const& s1 ) { return s1 == s2; }
+ friend bool operator==( const string& s2, const_string const& s1 ) { return s1 == s2; }
+
+ friend bool operator!=( char const* s2, const_string const& s1 ) { return !(s1 == s2); }
+ friend bool operator!=( const string& s2, const_string const& s1 ) { return !(s1 == s2); }
+
+ // Iterators
+ iterator begin() const { return m_begin; }
+ iterator end() const { return m_end; }
+ reverse_iterator rbegin() const { return reverse_iterator( m_end ); }
+ reverse_iterator rend() const { return reverse_iterator( m_begin ); }
+
+private:
+
+ // Data members
+ char const* m_begin;
+ char const* m_end;
+};
+
+//____________________________________________________________________________//
+
+// first character
+class first_char {
+public:
+ char operator()( const_string source, char default_char = '\0' ) const {
+ return source.is_empty() ? default_char : *source.data();
+ }
+};
+
+//____________________________________________________________________________//
+
+// last character
+class last_char {
+public:
+ char operator()( const_string source, char default_char = '\0' ) const {
+ return source.is_empty() ? default_char : *source.rbegin();
+ }
+};
+
+//____________________________________________________________________________//
+
+inline const_string&
+const_string::operator=( const_string const& s ) {
+ if( &s != this ) {
+ m_begin = s.m_begin;
+ m_end = s.m_end;
+ }
+
+ return *this;
+}
+
+//____________________________________________________________________________//
+
+typedef const_string const literal;
+
+//____________________________________________________________________________//
+
+inline std::ostream&
+operator<<( std::ostream& os, const_string const& str )
+{
+ os << std::string( str.begin(), str.length() );
+
+ return os;
+}
+
+//____________________________________________________________________________//
+
+}; // namespace common_layer
+
+#endif // CONST_STRING_HPP
diff --git a/src/boost/libs/test/example/const_string_test.cpp b/src/boost/libs/test/example/const_string_test.cpp
new file mode 100644
index 000000000..1e9400c99
--- /dev/null
+++ b/src/boost/libs/test/example/const_string_test.cpp
@@ -0,0 +1,179 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile: const_string_test.cpp,v $
+//
+// Version : $Revision$
+//
+// Description : simple string class test
+// ***************************************************************************
+
+#define BOOST_TEST_MODULE const_string test
+#include <boost/test/included/unit_test.hpp>
+
+#include "const_string.hpp"
+using common_layer::const_string;
+
+BOOST_AUTO_TEST_CASE( constructors_test )
+{
+ const_string cs0( "" );
+ BOOST_CHECK_EQUAL( cs0.length(), (size_t)0 );
+ BOOST_CHECK_EQUAL( cs0.begin(), "" );
+ BOOST_CHECK_EQUAL( cs0.end(), "" );
+ BOOST_CHECK( cs0.is_empty() );
+
+ const_string cs01( NULL );
+ BOOST_CHECK_EQUAL( cs01.length(), (size_t)0 );
+ BOOST_CHECK_EQUAL( cs01.begin(), "" );
+ BOOST_CHECK_EQUAL( cs01.end(), "" );
+ BOOST_CHECK( cs01.is_empty() );
+
+ const_string cs1( "test_string" );
+ BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test_string" ), 0 );
+ BOOST_CHECK_EQUAL( cs1.length(), std::strlen("test_string") );
+
+ std::string s( "test_string" );
+ const_string cs2( s );
+ BOOST_CHECK_EQUAL( std::strcmp( cs2.data(), "test_string" ), 0 );
+
+ const_string cs3( cs1 );
+ BOOST_CHECK_EQUAL( std::strcmp( cs3.data(), "test_string" ), 0 );
+
+ const_string cs4( "test_string", 4 );
+ BOOST_CHECK_EQUAL( std::strncmp( cs4.data(), "test", cs4.length() ), 0 );
+
+ const_string cs5( s.data(), s.data() + s.length() );
+ BOOST_CHECK_EQUAL( std::strncmp( cs5.data(), "test_string", cs5.length() ), 0 );
+
+ const_string cs_array[] = { "str1", "str2" };
+
+ BOOST_CHECK_EQUAL( cs_array[0], "str1" );
+ BOOST_CHECK_EQUAL( cs_array[1], "str2" );
+}
+
+BOOST_AUTO_TEST_CASE( data_access_test )
+{
+ const_string cs1( "test_string" );
+ BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test_string" ), 0 );
+
+ BOOST_CHECK_EQUAL( cs1[(size_t)0], 't' );
+ BOOST_CHECK_EQUAL( cs1[(size_t)4], '_' );
+ BOOST_CHECK_EQUAL( cs1[cs1.length()-1], 'g' );
+
+ BOOST_CHECK_EQUAL( cs1[(size_t)0], cs1.at( 0 ) );
+ BOOST_CHECK_EQUAL( cs1[(size_t)2], cs1.at( 5 ) );
+ BOOST_CHECK_EQUAL( cs1.at( cs1.length() - 1 ), 'g' );
+
+ BOOST_CHECK_EQUAL( common_layer::first_char()( cs1 ), 't' );
+ BOOST_CHECK_EQUAL( common_layer::last_char()( cs1 ) , 'g' );
+}
+
+
+BOOST_AUTO_TEST_CASE( length_test )
+{
+ const_string cs1;
+
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)0 );
+ BOOST_CHECK( cs1.is_empty() );
+
+ cs1 = "";
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)0 );
+ BOOST_CHECK( cs1.is_empty() );
+
+ cs1 = "test_string";
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)11 );
+
+ cs1.erase();
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)0 );
+ BOOST_CHECK_EQUAL( cs1.data(), "" );
+
+ cs1 = const_string( "test_string", 4 );
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)4 );
+
+ cs1.resize( 5 );
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)4 );
+
+ cs1.resize( 3 );
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)3 );
+
+ cs1.rshorten();
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)2 );
+ BOOST_CHECK_EQUAL( cs1[(size_t)0], 't' );
+
+ cs1.lshorten();
+ BOOST_CHECK_EQUAL( cs1.length(), (size_t)1 );
+ BOOST_CHECK_EQUAL( cs1[(size_t)0], 'e' );
+
+ cs1.lshorten();
+ BOOST_CHECK( cs1.is_empty() );
+ BOOST_CHECK_EQUAL( cs1.data(), "" );
+
+ cs1 = "test_string";
+ cs1.lshorten( 11 );
+ BOOST_CHECK( cs1.is_empty() );
+ BOOST_CHECK_EQUAL( cs1.data(), "" );
+}
+
+BOOST_AUTO_TEST_CASE( asignment_test )
+{
+ const_string cs1;
+ std::string s( "test_string" );
+
+ cs1 = "test";
+ BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test" ), 0 );
+
+ cs1 = s;
+ BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test_string" ), 0 );
+
+ cs1.assign( "test" );
+ BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test" ), 0 );
+
+ const_string cs2( "test_string" );
+
+ cs1.swap( cs2 );
+ BOOST_CHECK_EQUAL( std::strcmp( cs1.data(), "test_string" ), 0 );
+ BOOST_CHECK_EQUAL( std::strcmp( cs2.data(), "test" ), 0 );
+}
+
+BOOST_AUTO_TEST_CASE( comparison_test )
+{
+ const_string cs1( "test_string" );
+ const_string cs2( "test_string" );
+ std::string s( "test_string" );
+
+ BOOST_CHECK_EQUAL( cs1, "test_string" );
+ BOOST_CHECK_EQUAL( "test_string", cs1 );
+ BOOST_CHECK_EQUAL( cs1, cs2 );
+ BOOST_CHECK_EQUAL( cs1, s );
+ BOOST_CHECK_EQUAL( s , cs1 );
+
+ cs1.resize( 4 );
+
+ BOOST_CHECK( cs1 != "test_string" );
+ BOOST_CHECK( "test_string" != cs1 );
+ BOOST_CHECK( cs1 != cs2 );
+ BOOST_CHECK( cs1 != s );
+ BOOST_CHECK( s != cs1 );
+
+ BOOST_CHECK_EQUAL( cs1, "test" );
+}
+
+BOOST_AUTO_TEST_CASE( iterators_test )
+{
+ const_string cs1( "test_string" );
+ std::string s;
+
+ std::copy( cs1.begin(), cs1.end(), std::back_inserter( s ) );
+ BOOST_CHECK_EQUAL( cs1, s );
+
+ s.erase();
+
+ std::copy( cs1.rbegin(), cs1.rend(), std::back_inserter( s ) );
+ BOOST_CHECK_EQUAL( const_string( s ), "gnirts_tset" );
+}
+
+// EOF
diff --git a/src/boost/libs/test/example/exec_mon_example.cpp b/src/boost/libs/test/example/exec_mon_example.cpp
new file mode 100644
index 000000000..4ef0cd5ba
--- /dev/null
+++ b/src/boost/libs/test/example/exec_mon_example.cpp
@@ -0,0 +1,218 @@
+// (C) Copyright Gennadiy Rozental 2003-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+#include <boost/test/prg_exec_monitor.hpp>
+#include <boost/test/execution_monitor.hpp>
+#include <boost/test/utils/basic_cstring/io.hpp>
+
+#include <iostream>
+
+struct my_exception1
+{
+ explicit my_exception1( int res_code ) : m_res_code( res_code ) {}
+
+ int m_res_code;
+};
+
+struct my_exception2
+{
+ explicit my_exception2( int res_code ) : m_res_code( res_code ) {}
+
+ int m_res_code;
+};
+
+namespace {
+
+class dangerous_call {
+public:
+ dangerous_call( int argc ) : m_argc( argc ) {}
+
+ int operator()()
+ {
+ // here we perform some operation under monitoring that could throw my_exception
+ if( m_argc < 2 )
+ throw my_exception1( 23 );
+ if( m_argc > 3 )
+ throw my_exception2( 45 );
+ else if( m_argc > 2 )
+ throw "too many args";
+
+ return 1;
+ }
+
+private:
+ // Data members
+ int m_argc;
+};
+
+void translate_my_exception1( my_exception1 const& ex )
+{
+ std::cout << "Caught my_exception1(" << ex.m_res_code << ")"<< std::endl;
+}
+
+void translate_my_exception2( my_exception2 const& ex )
+{
+ std::cout << "Caught my_exception2(" << ex.m_res_code << ")"<< std::endl;
+}
+
+int generate_fpe()
+{
+ double d = 0.0;
+
+ d = 1/d;
+
+ return 0;
+}
+
+int generate_fpe2()
+{
+ double d = 1e158;
+
+ d = d*d;
+
+ return 0;
+}
+
+int generate_fpe3()
+{
+ double d = 1.1e-308;
+
+ d = 1/d;
+
+ return 0;
+}
+
+int generate_int_div_0()
+{
+ int i = 0;
+
+ return 1/i;
+}
+
+#if (defined(__clang__) && __clang_major__ >= 6) || (defined(__GNUC__) && __GNUC__ >= 8)
+__attribute__((no_sanitize("null")))
+#endif
+int generate_sigfault()
+{
+ int* p = 0;
+
+ return *p;
+}
+
+
+} // local_namespace
+
+int
+cpp_main( int argc , char *[] )
+{
+ ::boost::execution_monitor ex_mon;
+
+ ///////////////////////////////////////////////////////////////
+
+ ex_mon.register_exception_translator<my_exception1>( &translate_my_exception1, "except1" );
+ ex_mon.register_exception_translator<my_exception2>( &translate_my_exception2, "except2" );
+
+ try {
+ ex_mon.execute( dangerous_call( argc ) );
+ std::cout << "Should reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////
+
+ ex_mon.erase_exception_translator( "except2" );
+
+ try {
+ ex_mon.execute( dangerous_call( 5 ) );
+ std::cout << "Should not reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////
+
+ ex_mon.erase_exception_translator<my_exception1>();
+
+ try {
+ ex_mon.execute( dangerous_call( 1 ) );
+ std::cout << "Should not reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////
+
+// we are currently not able to silence those errors below with UBSAN under clang
+// this seems to come from the way clang handles floating point exceptions + UB.
+#if !(defined(HAS_UBSAN) && (HAS_UBSAN==1) && defined(__clang__))
+
+ ex_mon.p_detect_fp_exceptions.value = boost::fpe::BOOST_FPE_DIVBYZERO;
+ ex_mon.p_catch_system_errors.value = false;
+
+ try {
+ ex_mon.execute( &generate_fpe );
+ std::cout << "Should not reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////
+
+ ex_mon.p_detect_fp_exceptions.value = boost::fpe::BOOST_FPE_ALL;
+
+ try {
+ ex_mon.execute( &generate_fpe2 );
+ std::cout << "Should not reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+
+ try {
+ ex_mon.execute( &generate_fpe3 );
+ std::cout << "Should not reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////
+
+ ex_mon.p_detect_fp_exceptions.value = boost::fpe::BOOST_FPE_OFF;
+ ex_mon.p_catch_system_errors.value = true;
+
+ try {
+ ex_mon.execute( &generate_int_div_0 );
+ std::cout << "Should not reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////
+
+ ex_mon.p_detect_fp_exceptions.value = boost::fpe::BOOST_FPE_OFF;
+ ex_mon.p_catch_system_errors.value = true;
+
+ try {
+ ex_mon.execute( &generate_sigfault );
+ std::cout << "Should not reach this line " << __LINE__ << std::endl;
+ }
+ catch ( boost::execution_exception const& ex ) {
+ std::cout << "Caught exception: " << ex.what() << std::endl;
+ }
+#endif // UBSAN issue
+
+ return 0;
+}
+
+// EOF
diff --git a/src/boost/libs/test/example/external_main_example_1.cpp b/src/boost/libs/test/example/external_main_example_1.cpp
new file mode 100644
index 000000000..78cb1b40b
--- /dev/null
+++ b/src/boost/libs/test/example/external_main_example_1.cpp
@@ -0,0 +1,52 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DYN_LINK
+#define BOOST_TEST_DYN_LINK
+#endif
+#include <boost/test/unit_test.hpp>
+#include <boost/bind.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+void free_test_function( int i, int j )
+{
+ BOOST_TEST( i == j );
+}
+
+//____________________________________________________________________________//
+
+bool
+init_function()
+{
+ framework::master_test_suite().
+ add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 1 ) ) );
+ framework::master_test_suite().
+ add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 2 ) ) );
+ framework::master_test_suite().
+ add( BOOST_TEST_CASE( boost::bind( &free_test_function, 2, 1 ) ) );
+
+ // do your own initialization here
+ // if it successful return true
+
+ // But, you CAN'T use testing tools here
+
+ return true;
+}
+
+//____________________________________________________________________________//
+
+int
+main( int argc, char* argv[] )
+{
+ return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
+}
+
+//____________________________________________________________________________//
diff --git a/src/boost/libs/test/example/external_main_example_2.cpp b/src/boost/libs/test/example/external_main_example_2.cpp
new file mode 100644
index 000000000..4cd453174
--- /dev/null
+++ b/src/boost/libs/test/example/external_main_example_2.cpp
@@ -0,0 +1,49 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DYN_LINK
+#define BOOST_TEST_DYN_LINK
+#endif
+#include <boost/test/unit_test.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( test_suite_1 )
+
+BOOST_AUTO_TEST_CASE( test_case_1 )
+{
+ BOOST_TEST_MESSAGE( "Testing is in progress" );
+
+ BOOST_CHECK( false );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+//____________________________________________________________________________//
+
+bool
+init_function()
+{
+ // do your own initialization here
+ // if it successful return true
+
+ // But, you CAN'T use testing tools here
+ return true;
+}
+
+//____________________________________________________________________________//
+
+int
+main( int argc, char* argv[] )
+{
+ return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
+}
+
+//____________________________________________________________________________//
diff --git a/src/boost/libs/test/example/external_main_example_3.cpp b/src/boost/libs/test/example/external_main_example_3.cpp
new file mode 100644
index 000000000..dc2da95cb
--- /dev/null
+++ b/src/boost/libs/test/example/external_main_example_3.cpp
@@ -0,0 +1,49 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// ***************************************************************************
+
+#define BOOST_TEST_NO_MAIN
+#define BOOST_TEST_ALTERNATIVE_INIT_API
+#include <boost/test/included/unit_test.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( test_suite_1 )
+
+BOOST_AUTO_TEST_CASE( test_case_1 )
+{
+ BOOST_TEST_MESSAGE( "Testing is in progress" );
+
+ BOOST_TEST( false );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+//____________________________________________________________________________//
+
+bool
+init_function()
+{
+ // do your own initialization here
+ // if it successful return true
+
+ // But, you CAN'T use testing tools here
+ return true;
+}
+
+//____________________________________________________________________________//
+
+int
+main( int argc, char* argv[] )
+{
+ return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
+}
+
+//____________________________________________________________________________//
+
diff --git a/src/boost/libs/test/example/filtering_example.cpp b/src/boost/libs/test/example/filtering_example.cpp
new file mode 100644
index 000000000..d8414276b
--- /dev/null
+++ b/src/boost/libs/test/example/filtering_example.cpp
@@ -0,0 +1,372 @@
+// (C) Copyright Gennadiy Rozental 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+#define BOOST_TEST_MODULE filtering test
+#include <boost/test/unit_test.hpp>
+namespace bt=boost::unit_test;
+
+const std::string test1v("test1");
+const std::string test2v("test2");
+const std::string test3v("test3");
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( s1,
+* bt::disabled()
+* bt::description( "initially disabled suite 1")
+* bt::label( "label1" )
+* bt::label( "label2" ))
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::enabled()
+* bt::description("initially enabled case s1/t1"))
+{
+ BOOST_TEST( "s1" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::description( "initially defaulted case s1/t2")
+* bt::expected_failures( 1 ))
+{
+ BOOST_TEST( "s1" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test3,
+* bt::description( "initially defaulted case s1/t3"))
+{
+ BOOST_TEST( "s1" == test3v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s2,
+* bt::disabled()
+* bt::label( "label1" )
+* bt::expected_failures( 3 ))
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::description( "initially defaulted case s2/t1"))
+{
+ BOOST_TEST( "s2" == test1v );
+}
+
+//____________________________________________________________________________//
+
+boost::test_tools::assertion_result
+do_it( bt::test_unit_id )
+{
+ return false;
+}
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::enabled()
+* bt::description( "initially enabled case s2/t2")
+* bt::precondition(do_it))
+{
+ BOOST_TEST( "s2" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test3,
+* bt::description( "initially defaulted case s2/t3"))
+{
+ BOOST_TEST( "s2" == test3v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s3,
+* bt::disabled())
+
+BOOST_AUTO_TEST_CASE( test1 )
+{
+ BOOST_TEST( "s3" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::timeout( 10 ))
+{
+ BOOST_TEST( "s3" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test3,
+* bt::enabled())
+{
+ BOOST_TEST( "s3" == test3v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( s14,
+* bt::depends_on( "s3/s15" )
+* bt::description( "test suite which depends on another test suite"))
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s2" ))
+{
+ BOOST_TEST( "s14" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s15 )
+
+BOOST_AUTO_TEST_CASE( test1 )
+{
+ BOOST_TEST( "s15" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s4 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::disabled()
+* bt::label( "label2" ))
+{
+ BOOST_TEST( "s4" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::depends_on( "s4/test1" )
+* bt::description( "test case which depends on disabled s4/t1"))
+{
+ BOOST_TEST( "s4" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test3,
+* bt::depends_on( "s4/test2" )
+* bt::description( "test case which depends on enabled s4/t2, but indirectly on disabled s4/t1"))
+{
+ BOOST_TEST( "s4" == test3v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+#if 0
+BOOST_AUTO_TEST_SUITE( s5 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s5/test3" ))
+{
+ BOOST_TEST( "s5" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::depends_on( "s5/test1" ))
+{
+ BOOST_TEST( "s5" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test3,
+* bt::depends_on( "s5/test2" ))
+{
+ BOOST_TEST( "s5" == test3v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+#endif
+
+BOOST_AUTO_TEST_SUITE( s6 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s6/test3" )
+* bt::description( "test case which depends on enabled s6/t3"))
+{
+ BOOST_TEST( "s6" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::depends_on( "s6/test1" )
+* bt::description( "test case which depends on enabled s6/t1"))
+{
+ BOOST_TEST( "s6" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test3 )
+{
+ BOOST_TEST( "s6" == test3v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( s9,
+* bt::description( "test suite with all test cases disabled"))
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::disabled()
+* bt::label( "label1" ))
+{
+ BOOST_TEST( "s9" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::disabled())
+{
+ BOOST_TEST( "s9" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE_END()
+
+#if 0
+BOOST_AUTO_TEST_SUITE( s7 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s8/test1" ))
+{
+ BOOST_TEST( "s7" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::depends_on( "s7/test1" ))
+{
+ BOOST_TEST( "s7" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s8 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s8/test2" ))
+{
+ BOOST_TEST( "s8" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::depends_on( "s7/test2" ))
+{
+ BOOST_TEST( "s8" == test2v );
+}
+
+//____________________________________________________________________________//
+`
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s10 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s11" ))
+{
+ BOOST_TEST( "s10" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::depends_on( "s10/test1" ))
+{
+ BOOST_TEST( "s10" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s11 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s11/test2" ))
+{
+ BOOST_TEST( "s11" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::depends_on( "s10" ))
+{
+ BOOST_TEST( "s11" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+#endif
+
+BOOST_AUTO_TEST_SUITE( s12 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s13" )
+* bt::description( "test test case which depends on test suite with all test cases skipped"))
+{
+ BOOST_TEST( "s12" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE( s13 )
+
+BOOST_AUTO_TEST_CASE( test1,
+* bt::depends_on( "s13/test2" ))
+{
+ BOOST_TEST( "s13" == test1v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( test2,
+* bt::disabled())
+{
+ BOOST_TEST( "s13" == test2v );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+// EOF
diff --git a/src/boost/libs/test/example/named_param_example.cpp b/src/boost/libs/test/example/named_param_example.cpp
new file mode 100644
index 000000000..ab8ade47c
--- /dev/null
+++ b/src/boost/libs/test/example/named_param_example.cpp
@@ -0,0 +1,120 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Library Code
+#include <boost/test/utils/named_params.hpp>
+
+using namespace boost::nfp;
+
+////////////////////////////////////////////////////////////////
+// Example:
+
+#include <iostream>
+#include <boost/shared_ptr.hpp>
+
+namespace test {
+ typed_keyword<char const*,struct name_t> name;
+ typed_keyword<int,struct test_index_t> index;
+ keyword<struct value_t,true> value;
+ keyword<struct instance_t,true> instance;
+ keyword<struct ref_t> ref;
+
+ template<typename ValueType>
+ void foo1( char const* n, ValueType v, int i )
+ {
+ std::cout << n << '[' << i << "]=" << v << std::endl;
+ }
+
+ template<class Params>
+ void foo(Params const& params)
+ {
+ int i = params[index];
+ foo1( params[name], params[value], i );
+ }
+
+ template<class Params>
+ void boo(Params const& params)
+ {
+ foo1( params[name], params[value], params.has(index) ? params[index] : 0 );
+ }
+
+ template<class Params>
+ void doo(Params const& params)
+ {
+ char const* nm;
+ if( params.has(name) )
+ nm = params[name];
+ else
+ nm = "abc";
+ foo1( nm, params[value], params.has(index) ? params[index] : 0 );
+ }
+
+ template<typename T>
+ void moo1( T* t )
+ {
+ std::cout << "non shared " << *t << std::endl;
+ }
+
+ template<typename T>
+ void moo1( boost::shared_ptr<T> const& t )
+ {
+ std::cout << "shared " << *t << std::endl;
+ }
+
+ template<class Params>
+ void moo(Params const& params)
+ {
+ moo1( params[instance] );
+ }
+
+ template<class Params>
+ void goo(Params const& params)
+ {
+ params[ref] = 6;
+ }
+}
+
+int main()
+{
+ using test::foo;
+ using test::boo;
+ using test::moo;
+ using test::doo;
+ using test::goo;
+ using test::name;
+ using test::value;
+ using test::index;
+ using test::instance;
+ using test::ref;
+
+ foo(( name = "foo", index = 0, value = 2.5 ));
+ foo(( value = 'a', index = 1, name = "foo" ));
+ foo(( name = "foo", value = "abc", index = 1 ));
+
+ try {
+ foo(( name = "foo", value = "abc" ));
+ }
+ catch( nfp_detail::access_to_invalid_parameter const& ) {
+ std::cout << "Got access_to_invalid_parameter" << std::endl;
+ }
+
+ boo(( name = "boo", value = "abc" ));
+ boo(( name = "boo", index = 1, value = "abc" ));
+ doo(( value = "abc" ));
+ doo(( value = 1.56, name = "ytr" ));
+
+ int i = 5;
+
+ moo( instance = &i );
+ moo( instance = boost::shared_ptr<float>( new float(1.2) ) );
+
+ goo( ref = i );
+
+ return 0;
+}
+
+// EOF
diff --git a/src/boost/libs/test/example/prg_exec_example.cpp b/src/boost/libs/test/example/prg_exec_example.cpp
new file mode 100644
index 000000000..d4f3ac4b4
--- /dev/null
+++ b/src/boost/libs/test/example/prg_exec_example.cpp
@@ -0,0 +1,20 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+#include <boost/test/prg_exec_monitor.hpp>
+
+int add( int i, int j ) { return i+j; }
+
+int cpp_main( int, char *[] ) // note the name!
+{
+ // two ways to detect and report the same error:
+ if ( add(2,2) != 4 ) throw "Oops..."; // #1 throws on error
+
+ return add(2,2) == 4 ? 15 : 1; // #2 returns error directly
+}
+
+// EOF
diff --git a/src/boost/libs/test/example/test_case_template_example.cpp b/src/boost/libs/test/example/test_case_template_example.cpp
new file mode 100644
index 000000000..c55a72b44
--- /dev/null
+++ b/src/boost/libs/test/example/test_case_template_example.cpp
@@ -0,0 +1,35 @@
+// (C) Copyright Gennadiy Rozental 2001-2006.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#ifdef BOOST_MSVC
+# pragma warning(disable: C4345)
+#endif
+
+#include <boost/test/unit_test.hpp>
+using boost::unit_test::test_suite;
+
+// Boost.MPL
+#include <boost/mpl/range_c.hpp>
+
+BOOST_TEST_CASE_TEMPLATE_FUNCTION( free_test_function, Number )
+{
+ BOOST_CHECK_EQUAL( 2, static_cast<int>(Number::value) );
+}
+
+test_suite* init_unit_test_suite( int, char* [] )
+{
+ test_suite* test= BOOST_TEST_SUITE( "Test case template example" );
+
+ typedef boost::mpl::range_c<int,0,10> numbers;
+
+ test->add( BOOST_TEST_CASE_TEMPLATE( free_test_function, numbers ) );
+
+ return test;
+}
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_01.cpp b/src/boost/libs/test/example/unit_test_example_01.cpp
new file mode 100644
index 000000000..4bfcae17d
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_01.cpp
@@ -0,0 +1,40 @@
+// (C) Copyright Gennadiy Rozental 2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+
+// each test module could contain no more then one 'main' file with init function defined
+// alternatively you could define init function yourself
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+namespace bt = boost::unit_test;
+
+//____________________________________________________________________________//
+
+// most frequently you implement test cases as a free functions with automatic registration
+BOOST_AUTO_TEST_CASE( test1 )
+{
+ // reports 'error in "test1": test 2 == 1 failed'
+ BOOST_TEST( 2 == 1 );
+}
+
+//____________________________________________________________________________//
+
+// each test file may contain any number of test cases; each test case has to have unique name
+BOOST_AUTO_TEST_CASE( test2 )
+{
+ int i = 0;
+
+ // reports 'error in "test2": check i == 2 failed [0 != 2]'
+ BOOST_TEST( i == 2 );
+
+ BOOST_TEST( i == 0 );
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_02.cpp b/src/boost/libs/test/example/unit_test_example_02.cpp
new file mode 100644
index 000000000..054dad535
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_02.cpp
@@ -0,0 +1,45 @@
+// (C) Copyright Gennadiy Rozental 2002-2014.
+// (C) Copyright Gennadiy Rozental & Ullrich Koethe 2001.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#include <boost/test/unit_test.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+// you could easily implement test cases as a free functions
+// this test case will need to be explecetely registered in test tree
+void free_test_function()
+{
+ // reports 'error in "free_test_function": test 2 == 1 failed'
+ BOOST_CHECK(2 == 1); // non-critical test => continue after failure
+
+ // reports 'unknown location(0): fatal error in "free_test_function": memory access violation
+ // d:\source code\boost\libs\test\example\unit_test_example_02.cpp(25): last checkpoint'
+ int* p = (int*)0x01;
+ BOOST_CHECK( *p == 0 );
+}
+
+//____________________________________________________________________________//
+
+
+test_suite*
+init_unit_test_suite( int, char* [] ) {
+ framework::master_test_suite().p_name.value = "Unit test example 02";
+
+ // register the test case in test tree and specify number of expected failures so
+ // this example will pass at runtime. We expect 2 errors: one from failed check and
+ // one from memory acces violation
+ framework::master_test_suite().add( BOOST_TEST_CASE( &free_test_function ), 2 );
+
+ return 0;
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_03.cpp b/src/boost/libs/test/example/unit_test_example_03.cpp
new file mode 100644
index 000000000..6c91f3176
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_03.cpp
@@ -0,0 +1,57 @@
+// (C) Copyright Gennadiy Rozental 2002-2014.
+// (C) Copyright Gennadiy Rozental & Ullrich Koethe 2001.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#include <boost/test/unit_test.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+// this test case is automatically registered
+BOOST_AUTO_TEST_CASE( force_division_by_zero )
+{
+ BOOST_CHECK( false );
+
+ // unit test framework can catch operating system signals
+ BOOST_TEST_CHECKPOINT("About to force division by zero!");
+ int i = 1, j = 0;
+
+ // reports 'unknown location(0): fatal error in "force_division_by_zero": integer divide by zero'
+ i = i / j;
+}
+
+//____________________________________________________________________________//
+
+// this test case will have tobe registered manually
+void infinite_loop()
+{
+ // unit test framework can break infinite loops by timeout
+#ifdef __unix // don't have timeout on other platforms
+ BOOST_TEST_CHECKPOINT("About to enter an infinite loop!");
+ while(1);
+#else
+ BOOST_TEST_MESSAGE( "Timeout support is not implemented on your platform" );
+#endif
+}
+
+//____________________________________________________________________________//
+
+test_suite*
+init_unit_test_suite( int , char* [] )
+{
+ framework::master_test_suite().p_name.value = "Unit test example 03";
+
+ // with explicit registration we could specify a test case timeout
+ framework::master_test_suite().add( BOOST_TEST_CASE( &infinite_loop ), 0, /* timeout */ 2 );
+
+ return 0;
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_04.cpp b/src/boost/libs/test/example/unit_test_example_04.cpp
new file mode 100644
index 000000000..02f2ba993
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_04.cpp
@@ -0,0 +1,121 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#define BOOST_TEST_MODULE Unit_test_example_04
+#include <boost/test/unit_test.hpp>
+namespace bt=boost::unit_test;
+
+//____________________________________________________________________________//
+
+struct suite_fixture {
+ suite_fixture() { BOOST_TEST_MESSAGE( "Running some test suite setup" ); }
+ ~suite_fixture() { BOOST_TEST_MESSAGE( "Running some test suite teardown" ); }
+};
+struct suite_fixture2 {
+ suite_fixture2() { BOOST_TEST_MESSAGE( "Running some more test suite setup" ); }
+ ~suite_fixture2() { BOOST_TEST_MESSAGE( "Running some more test suite teardown" ); }
+};
+
+// automatically registered test cases could be organized in test suites
+BOOST_AUTO_TEST_SUITE( my_suite1,
+* bt::fixture<suite_fixture>()
+* bt::fixture<suite_fixture2>() )
+
+BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(my_test1,1)
+
+void some_setup()
+{
+ BOOST_TEST_MESSAGE( "Running some extra setup" );
+}
+
+auto& d =
+* bt::label( "L1" )
+* bt::label( "L2" )
+* bt::description( "test case 1 description" )
+* bt::fixture( &some_setup );
+BOOST_AUTO_TEST_CASE( my_test1 )
+{
+ BOOST_TEST( 2 == 1 );
+}
+
+//____________________________________________________________________________//
+
+// this test case belongs to suite1 test suite
+BOOST_AUTO_TEST_CASE( my_test2, * bt::description( "test case 2 description" ) )
+{
+ int i = 0;
+
+ BOOST_TEST( i == 2 );
+
+ BOOST_TEST( i == 0 );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+//____________________________________________________________________________//
+
+// this test case belongs to master test suite
+BOOST_AUTO_TEST_CASE( my_test3 )
+{
+ int i = 0;
+
+ BOOST_TEST( i == 0 );
+}
+
+//____________________________________________________________________________//
+
+BOOST_TEST_DECORATOR(
+* bt::label( "L3" )
+* bt::description( "suite description" )
+)
+BOOST_AUTO_TEST_SUITE( my_suite2 )
+
+// this test case belongs to suite2 test suite
+BOOST_AUTO_TEST_CASE( my_test4, * bt::depends_on( "my_suite2/internal_suite/my_test5" ) )
+{
+ int i = 0;
+
+ BOOST_CHECK_EQUAL( i, 1 );
+}
+
+BOOST_AUTO_TEST_SUITE( internal_suite )
+
+// this test case belongs to my_suite2:internal_suite test suite
+
+BOOST_TEST_DECORATOR(
+* bt::timeout( 100 )
+)
+BOOST_AUTO_TEST_CASE( my_test5, * bt::expected_failures( 1 ) )
+{
+ int i = 0;
+
+ BOOST_CHECK_EQUAL( i, 1 );
+}
+
+BOOST_AUTO_TEST_CASE( my_test6, *bt::disabled() )
+{
+}
+
+BOOST_AUTO_TEST_CASE( this_should_also_be_disabled,
+* bt::depends_on( "my_suite2/internal_suite/disabled_suite/my_test7" ) )
+{
+}
+
+BOOST_AUTO_TEST_SUITE( disabled_suite, * bt::disabled() )
+
+BOOST_AUTO_TEST_CASE( my_test7 ) {}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE_END()
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_05.cpp b/src/boost/libs/test/example/unit_test_example_05.cpp
new file mode 100644
index 000000000..4cf928e2e
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_05.cpp
@@ -0,0 +1,50 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#define BOOST_TEST_MODULE "Unit test example 05"
+#include <boost/test/unit_test.hpp>
+namespace bt = boost::unit_test;
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( my_suite )
+
+struct F {
+ F() : i( 0 ) { BOOST_TEST_MESSAGE( "setup fixture" ); }
+ ~F() { BOOST_TEST_MESSAGE( "teardown fixture" ); }
+
+ int i;
+};
+
+//____________________________________________________________________________//
+
+// this test case will use struct F as fixture
+auto& d =
+* bt::enabled()
+* bt::expected_failures(1);
+BOOST_FIXTURE_TEST_CASE( my_test1, F )
+{
+ // you have direct access to non-private members of fixture structure
+ BOOST_TEST( i == 1 );
+}
+
+//____________________________________________________________________________//
+
+// you could have any number of test cases with the same fixture
+BOOST_FIXTURE_TEST_CASE( my_test2, F, * bt::depends_on("my_suite/my_test1") )
+{
+ BOOST_TEST( i == 2 );
+
+ BOOST_TEST( i == 0 );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_06.cpp b/src/boost/libs/test/example/unit_test_example_06.cpp
new file mode 100644
index 000000000..f1d56c9db
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_06.cpp
@@ -0,0 +1,44 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#define BOOST_TEST_MODULE Unit test example 06
+#include <boost/test/unit_test.hpp>
+
+//____________________________________________________________________________//
+
+struct F {
+ F() : i( 0 ) { BOOST_TEST_MESSAGE( "setup fixture" ); }
+ ~F() { BOOST_TEST_MESSAGE( "teardown fixture" ); }
+
+ int i;
+};
+
+//____________________________________________________________________________//
+
+// struct F is going to be used as a fixture for all test cases in this test suite
+BOOST_FIXTURE_TEST_SUITE( s, F )
+
+BOOST_AUTO_TEST_CASE( my_test1 )
+{
+ BOOST_CHECK( i == 1 );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( my_test2 )
+{
+ BOOST_CHECK_EQUAL( i, 2 );
+
+ BOOST_CHECK_EQUAL( i, 0 );
+}
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE_END()
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_07.cpp b/src/boost/libs/test/example/unit_test_example_07.cpp
new file mode 100644
index 000000000..22929083f
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_07.cpp
@@ -0,0 +1,42 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#define BOOST_TEST_MODULE Unit_test_example_07
+#include <boost/test/unit_test.hpp>
+#include <boost/mpl/list.hpp>
+
+//____________________________________________________________________________//
+
+struct F {
+ F() : i( 9 ) { BOOST_TEST_MESSAGE( "setup fixture" ); }
+ ~F() { BOOST_TEST_MESSAGE( "teardown fixture" ); }
+
+ int i;
+};
+
+//____________________________________________________________________________//
+
+BOOST_FIXTURE_TEST_SUITE( s, F )
+
+typedef boost::mpl::list<char,int const,float,const double> test_types;
+// this test case template produce a separate test case for each type listed in test_types
+// each produced test case uses struct F as a fixture
+BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
+{
+ T t = static_cast<T>(i);
+
+ // usually it's a bad idea to use BOOST_CHECK_EQUAL for checking equality values of
+ // floating point types. This check may or may not produce an error report
+ BOOST_TEST( (t*t+t)/10 == 9 );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_08.cpp b/src/boost/libs/test/example/unit_test_example_08.cpp
new file mode 100644
index 000000000..700d4f7b0
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_08.cpp
@@ -0,0 +1,24 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#define BOOST_TEST_MODULE Unit_test_example_08
+#include <boost/test/unit_test.hpp>
+
+//____________________________________________________________________________//
+
+// this way we could specify a number of expected failures in automatically registered test case
+BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( my_test1, 1 )
+
+BOOST_AUTO_TEST_CASE( my_test1 )
+{
+ BOOST_TEST( 2 == 1 );
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_09_1.cpp b/src/boost/libs/test/example/unit_test_example_09_1.cpp
new file mode 100644
index 000000000..62357703c
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_09_1.cpp
@@ -0,0 +1,34 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#define BOOST_TEST_MODULE Unit_test_example_09
+#include <boost/test/unit_test.hpp>
+
+// STL
+#include <iostream>
+
+//____________________________________________________________________________//
+
+struct MyConfig {
+ MyConfig() { std::cout << "global setup part1\n"; }
+ ~MyConfig() { std::cout << "global teardown part1\n"; }
+};
+
+// structure MyConfig is used as a global fixture - it's invoked pre and post any testing is performed
+BOOST_TEST_GLOBAL_FIXTURE( MyConfig );
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( my_test1 )
+{
+ BOOST_CHECK( true );
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_09_2.cpp b/src/boost/libs/test/example/unit_test_example_09_2.cpp
new file mode 100644
index 000000000..3a22a5e91
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_09_2.cpp
@@ -0,0 +1,34 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+// only one file should define BOOST_TEST_MAIN/BOOST_TEST_MODULE
+#include <boost/test/unit_test.hpp>
+
+// STL
+#include <iostream>
+
+//____________________________________________________________________________//
+
+struct MyConfig2 {
+ MyConfig2() { std::cout << "global setup part2\n"; }
+ ~MyConfig2() { std::cout << "global teardown part2\n"; }
+};
+
+// structure MyConfig2 is used as a global fixture. You could have any number of global fxtures
+BOOST_TEST_GLOBAL_FIXTURE( MyConfig2 );
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_CASE( my_test2 )
+{
+ BOOST_CHECK( true );
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_10.cpp b/src/boost/libs/test/example/unit_test_example_10.cpp
new file mode 100644
index 000000000..454585ae1
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_10.cpp
@@ -0,0 +1,172 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// (C) Copyright Gennadiy Rozental & Ullrich Koethe 2001.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#include <boost/test/tools/floating_point_comparison.hpp>
+#include <boost/test/unit_test.hpp>
+using namespace boost::unit_test;
+using boost::math::fpc::close_at_tolerance;
+using boost::math::fpc::percent_tolerance;
+
+// BOOST
+#include <boost/lexical_cast.hpp>
+
+// STL
+#include <functional>
+#include <iostream>
+#include <iomanip>
+#include <memory>
+#include <stdexcept>
+
+//____________________________________________________________________________//
+
+struct account {
+ account()
+ : m_amount(0.0)
+ {}
+
+ void deposit(double amount) { m_amount += amount; }
+ void withdraw(double amount)
+ {
+ if(amount > m_amount)
+ {
+ throw std::logic_error("You don't have that much money!");
+ }
+ m_amount -= amount;
+ }
+ double balance() const { return m_amount; }
+
+private:
+ double m_amount;
+};
+
+//____________________________________________________________________________//
+
+struct account_test {
+ account_test( double init_value ) { m_account.deposit( init_value ); }
+
+ account m_account; // a very simple fixture
+
+ void test_init()
+ {
+ // different kinds of non-critical tests
+ // they report the error and continue
+
+ // standard assertion
+ // reports 'error in "account_test::test_init": test m_account.balance() >= 0.0 failed' on error
+ BOOST_CHECK( m_account.balance() >= 0.0 );
+
+ // customized assertion
+ // reports 'error in "account_test::test_init": Initial balance should be more then 1, was actual_value' on error
+ BOOST_CHECK_MESSAGE( m_account.balance() > 1.0,
+ "Initial balance should be more then 1, was " << m_account.balance() );
+
+ // equality assertion (not very wise idea use equality check on floating point values)
+ // reports 'error in "account_test::test_init": test m_account.balance() == 5.0 failed [actual_value != 5]' on error
+ BOOST_CHECK_EQUAL( m_account.balance(), 5.0 );
+
+ // closeness assertion for floating-point numbers (symbol (==) used to mark closeness, (!=) to mark non closeness )
+ // reports 'error in "account_test::test_init": test m_account.balance() (==) 10.0 failed [actual_value (!=) 10 (1e-010)]' on error
+ BOOST_CHECK_CLOSE( m_account.balance(), 10.0, /* tolerance */ 1e-10 );
+ }
+
+ void test_deposit()
+ {
+ // these 2 statements just to show that usage manipulators doesn't hurt Boost.Test output
+ std::cout << "Current balance: " << std::hex << (int)m_account.balance() << std::endl;
+ std::cerr << "Current balance: " << std::hex << (int)m_account.balance() << std::endl;
+
+ float curr_ballance = (float)m_account.balance();
+ float deposit_value;
+
+ std::cout << "Enter deposit value:\n";
+ std::cin >> deposit_value;
+
+ m_account.deposit( deposit_value );
+
+ // correct result validation; could fail due to rounding errors; use BOOST_CHECK_CLOSE instead
+ // reports "test m_account.balance() == curr_ballance + deposit_value failed" on error
+ BOOST_CHECK( m_account.balance() == curr_ballance + deposit_value );
+
+ // different kinds of critical tests
+
+ // reports 'fatal error in "account_test::test_deposit": test m_account.balance() >= 100.0 failed' on error
+ BOOST_REQUIRE( m_account.balance() >= 100.0 );
+
+ // reports 'fatal error in "account_test::test_deposit": Balance should be more than 500.1, was actual_value' on error
+ BOOST_REQUIRE_MESSAGE( m_account.balance() > 500.1,
+ "Balance should be more than 500.1, was " << m_account.balance());
+
+ // reports 'fatal error in "account_test::test_deposit": test std::not_equal_to<double>()(m_account.balance(), 999.9) failed
+ // for (999.9, 999.9)' on error
+ BOOST_REQUIRE_PREDICATE( std::not_equal_to<double>(), (m_account.balance())(999.9) );
+
+ // reports 'fatal error in "account_test::test_deposit": test close_at_tolerance<double>( 1e-9 )( m_account.balance(), 605.5)
+ // failed for (actual_value, 605.5)
+ BOOST_REQUIRE_PREDICATE( close_at_tolerance<double>( percent_tolerance( 1e-9 ) ),
+ (m_account.balance())(605.5) );
+ }
+
+ void test_withdraw()
+ {
+ float curr_ballance = (float)m_account.balance();
+
+ m_account.withdraw(2.5);
+
+ // correct result validation; could fail due to rounding errors; use BOOST_CHECK_CLOSE instead
+ // reports "test m_account.balance() == curr_ballance - 2.5 failed" on error
+ BOOST_CHECK( m_account.balance() == curr_ballance - 2.5 );
+
+ // reports 'error in "account_test::test_withdraw": exception std::runtime_error is expected' on error
+ BOOST_CHECK_THROW( m_account.withdraw( m_account.balance() + 1 ), std::runtime_error );
+
+ }
+};
+
+//____________________________________________________________________________//
+
+struct account_test_suite : public test_suite {
+ account_test_suite( double init_value ) : test_suite("account_test_suite") {
+ // add member function test cases to a test suite
+ boost::shared_ptr<account_test> instance( new account_test( init_value ) );
+
+ test_case* init_test_case = BOOST_CLASS_TEST_CASE( &account_test::test_init, instance );
+ test_case* deposit_test_case = BOOST_CLASS_TEST_CASE( &account_test::test_deposit, instance );
+ test_case* withdraw_test_case = BOOST_CLASS_TEST_CASE( &account_test::test_withdraw, instance );
+
+ deposit_test_case->depends_on( init_test_case );
+ withdraw_test_case->depends_on( deposit_test_case );
+
+ add( init_test_case, 1 );
+ add( deposit_test_case, 1 );
+ add( withdraw_test_case );
+ }
+};
+
+//____________________________________________________________________________//
+
+test_suite*
+init_unit_test_suite( int argc, char * argv[] ) {
+ framework::master_test_suite().p_name.value = "Unit test example 10";
+
+ try {
+ if( argc < 2 )
+ throw std::logic_error( "Initial deposit expected" );
+
+ framework::master_test_suite().add( new account_test_suite( boost::lexical_cast<double>( argv[1] ) ) );
+ }
+ catch( boost::bad_lexical_cast const& ) {
+ throw std::logic_error( "Initial deposit value should match format of double" );
+ }
+
+ return 0;
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_11.cpp b/src/boost/libs/test/example/unit_test_example_11.cpp
new file mode 100644
index 000000000..7808f24ac
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_11.cpp
@@ -0,0 +1,49 @@
+// (C) Copyright Gennadiy Rozental 2002-2014.
+// (C) Copyright Gennadiy Rozental & Ullrich Koethe 2001.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#include <boost/test/unit_test.hpp>
+#include <boost/test/parameterized_test.hpp>
+using namespace boost::unit_test;
+
+// STL
+#include <vector>
+#include <string>
+
+#define LOG_FATAL_ERROR( M ) \
+BOOST_TEST_LOG_ENTRY( ::boost::unit_test::log_fatal_errors ) \
+ << (::boost::unit_test::lazy_ostream::instance() << M)
+//____________________________________________________________________________//
+
+// this free function is invoked with all parameters specified in a list
+void check_string( std::string const& s )
+{
+ // reports 'error in "check_string": test s.substr( 0, 3 ) == "hdr" failed [actual_value != hdr]'
+ BOOST_CHECK_EQUAL( s.substr( 0, 3 ), "hdr" );
+}
+
+//____________________________________________________________________________//
+
+test_suite*
+init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) {
+ framework::master_test_suite().p_name.value = "Unit test example 11";
+
+ LOG_FATAL_ERROR( "something happened" );
+
+ // parameters have no requirements to stay alive beyond the next statement
+ std::string const params[] = { "hdr1 ", "hdr2", "3 " };
+
+ framework::master_test_suite().add(
+ BOOST_PARAM_TEST_CASE( &check_string, (std::string const*)params, params+3 ) );
+
+ return 0;
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_12.cpp b/src/boost/libs/test/example/unit_test_example_12.cpp
new file mode 100644
index 000000000..62767011f
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_12.cpp
@@ -0,0 +1,190 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+
+// Boost.Test
+#include <boost/test/unit_test.hpp>
+#include <boost/test/utils/algorithm.hpp>
+#include <boost/test/tools/floating_point_comparison.hpp>
+#include <boost/test/parameterized_test.hpp>
+using namespace boost::unit_test;
+
+// BOOST
+#include <boost/functional.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/mem_fn.hpp>
+#include <boost/bind.hpp>
+
+// STL
+#include <string>
+#include <stdexcept>
+#include <algorithm>
+#include <functional>
+#include <iostream>
+#include <memory>
+#include <list>
+
+//____________________________________________________________________________//
+
+template<int n>
+struct power_of_10 {
+ BOOST_STATIC_CONSTANT( unsigned long, value = 10*power_of_10<n-1>::value );
+};
+
+template<>
+struct power_of_10<0> {
+ BOOST_STATIC_CONSTANT( unsigned long, value = 1 );
+};
+
+//____________________________________________________________________________//
+
+template<int AlphabetSize>
+class hash_function {
+public:
+ BOOST_STATIC_ASSERT( AlphabetSize <= 5 );
+
+ explicit hash_function( std::string const& alphabet )
+ : m_alphabet( alphabet )
+ {
+ if( m_alphabet.size() != AlphabetSize )
+ throw std::runtime_error( "Wrong alphabet size" );
+
+ std::sort( m_alphabet.begin(), m_alphabet.end() );
+
+ if( std::adjacent_find( m_alphabet.begin(), m_alphabet.end() ) != m_alphabet.end() )
+ throw std::logic_error( "Duplicate characters in alphabet" );
+ }
+
+ unsigned long operator()( std::string const& arg )
+ {
+ m_result = 0;
+
+ if( arg.length() > 8 )
+ throw std::runtime_error( "Wrong argument size" );
+
+ std::string::const_iterator it = std::find_if( arg.begin(), arg.end(),
+ BOOST_TEST_BIND1ST( boost::mem_fun( &hash_function::helper_ ), this ) );
+
+ if( it != arg.end() )
+ throw std::out_of_range( std::string( "Invalid character " ) + *it );
+
+ return m_result;
+ }
+
+private:
+ bool helper_( char c )
+ {
+ std::string::const_iterator it = std::find( m_alphabet.begin(), m_alphabet.end(), c );
+
+ if( it == m_alphabet.end() )
+ return true;
+
+ m_result += power_of_10_( it - m_alphabet.begin() );
+
+ return false;
+ }
+
+ unsigned long power_of_10_( int i ) {
+ switch( i ) {
+ case 0: return power_of_10<0>::value;
+ case 1: return power_of_10<1>::value;
+ case 2: return power_of_10<2>::value;
+ case 3: return power_of_10<3>::value;
+ case 4: return power_of_10<4>::value;
+ default: return 0;
+ }
+ }
+
+ // Data members
+ std::string m_alphabet;
+ unsigned long m_result;
+};
+
+//____________________________________________________________________________//
+
+struct hash_function_test_data {
+ std::string orig_string;
+ unsigned long exp_value;
+
+ friend std::istream& operator>>( std::istream& istr, hash_function_test_data& test_data )
+ {
+ std::istream& tmp = istr >> test_data.orig_string;
+ return !tmp ? tmp : istr >> test_data.exp_value;
+ }
+};
+
+//____________________________________________________________________________//
+
+class hash_function_tester {
+public:
+ explicit hash_function_tester( std::string const& alphabet )
+ : m_function_under_test( alphabet ) {}
+
+ void test( hash_function_test_data const& test_data )
+ {
+ if( test_data.exp_value == (unsigned long)-1 )
+ BOOST_CHECK_THROW( m_function_under_test( test_data.orig_string ), std::runtime_error );
+ else if( test_data.exp_value == (unsigned long)-2 )
+ BOOST_CHECK_THROW( m_function_under_test( test_data.orig_string ), std::out_of_range );
+ else {
+ BOOST_TEST_MESSAGE( "Testing: " << test_data.orig_string );
+ BOOST_CHECK_EQUAL( m_function_under_test( test_data.orig_string ), test_data.exp_value );
+ }
+ }
+
+private:
+ hash_function<4> m_function_under_test;
+};
+
+//____________________________________________________________________________//
+
+struct massive_hash_function_test : test_suite {
+ massive_hash_function_test() : test_suite( "massive_hash_function_test" ) {
+ std::string alphabet;
+ std::cout << "Enter alphabet (4 characters without delimeters)\n";
+ std::cin >> alphabet;
+
+ boost::shared_ptr<hash_function_tester> instance( new hash_function_tester( alphabet ) );
+
+ std::cout << "\nEnter test data in a format [string] [value] to check correct calculation\n";
+ std::cout << "Enter test data in a format [string] -1 to check long string validation\n";
+ std::cout << "Enter test data in a format [string] -2 to check invalid argument string validation\n";
+
+ std::list<hash_function_test_data> test_data_store;
+
+ while( !std::cin.eof() ) {
+ hash_function_test_data test_data;
+
+ if( !(std::cin >> test_data) )
+ break;
+
+ test_data_store.push_back( test_data );
+ }
+
+ add( make_test_case( &hash_function_tester::test,
+ "hash_function_tester",
+ __FILE__,
+ __LINE__,
+ instance,
+ test_data_store.begin(),
+ test_data_store.end() ) );
+ }
+};
+
+//____________________________________________________________________________//
+
+test_suite*
+init_unit_test_suite( int, char* [] ) {
+ framework::master_test_suite().p_name.value = "Unit test example 12";
+
+ framework::master_test_suite().add( new massive_hash_function_test );
+
+ return 0;
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_12.input b/src/boost/libs/test/example/unit_test_example_12.input
new file mode 100644
index 000000000..995120cce
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_12.input
@@ -0,0 +1,11 @@
+asdf
+a 1
+s 1000
+d 10
+f 100
+as 1001
+fadf 211
+ffda 211
+aaaaaaaa 8
+aaaaaaaaa -1
+ab -2
diff --git a/src/boost/libs/test/example/unit_test_example_13.cpp b/src/boost/libs/test/example/unit_test_example_13.cpp
new file mode 100644
index 000000000..a3ac12549
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_13.cpp
@@ -0,0 +1,20 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// ***************************************************************************
+
+#define BOOST_TEST_MODULE system call test example
+#include <boost/test/included/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( broken_test )
+{
+#if defined(WIN32)
+ BOOST_CHECK_EQUAL( ::system("cmd.exe /c dir"), 0 );
+#else
+ BOOST_CHECK_EQUAL( ::system("ls"), 0 );
+#endif
+}
diff --git a/src/boost/libs/test/example/unit_test_example_15.cpp b/src/boost/libs/test/example/unit_test_example_15.cpp
new file mode 100644
index 000000000..69f96ec60
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_15.cpp
@@ -0,0 +1,32 @@
+// (C) Copyright Gennadiy Rozental 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// ***************************************************************************
+
+// Boost.Test
+#define BOOST_TEST_MODULE data driven test example
+#include <boost/test/included/unit_test.hpp>
+
+#include <boost/test/data/test_case.hpp>
+#include <boost/test/data/monomorphic.hpp>
+namespace data=boost::unit_test::data;
+namespace bt=boost::unit_test;
+
+//____________________________________________________________________________//
+
+double x_samples[] = {1.1,2.1,3.1,4.1};
+double y_samples[] = {10.1,9.1,8.1};
+
+auto& D = * bt::tolerance(1e-1);
+BOOST_DATA_TEST_CASE( data_driven_test, data::make(x_samples) * y_samples, x, y )
+{
+ BOOST_TEST( x*y < 32.4 );
+}
+
+//____________________________________________________________________________//
+
+// EOF
diff --git a/src/boost/libs/test/example/unit_test_example_16.cpp b/src/boost/libs/test/example/unit_test_example_16.cpp
new file mode 100644
index 000000000..642f80f62
--- /dev/null
+++ b/src/boost/libs/test/example/unit_test_example_16.cpp
@@ -0,0 +1,35 @@
+// (C) Copyright Raffi Enficiaud 2019.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// ***************************************************************************
+
+// Boost.Test
+#include <boost/test/unit_test.hpp>
+#include <boost/test/unit_test_parameters.hpp>
+
+bool init_unit_test()
+{
+ using namespace boost::unit_test;
+
+// Having some problems on AppleClang 10.10 / Xcode 6/7
+#if !defined(BOOST_TEST_DYN_LINK) || (!defined(BOOST_CLANG) || (BOOST_CLANG != 1) || (__clang_major__ >= 8))
+ log_level logLevel = runtime_config::get<log_level>(runtime_config::btrt_log_level);
+ std::cout << "Current log level: " << static_cast<int>(logLevel) << std::endl;
+#endif
+ return true;
+}
+
+BOOST_AUTO_TEST_CASE( my_test1 )
+{
+ BOOST_CHECK( true );
+}
+
+int main(int argc, char* argv[])
+{
+ int retCode = boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
+ return retCode;
+}