diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/test | |
parent | Initial commit. (diff) | |
download | ceph-upstream/16.2.11+ds.tar.xz ceph-upstream/16.2.11+ds.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
169 files changed, 27586 insertions, 0 deletions
diff --git a/src/boost/libs/test/CONTRIBUTE.md b/src/boost/libs/test/CONTRIBUTE.md new file mode 100644 index 000000000..c67b112d5 --- /dev/null +++ b/src/boost/libs/test/CONTRIBUTE.md @@ -0,0 +1,26 @@ +# How to contribute to Boost.Test + +## Ticket +We like having a ticket stating the bug you are experiencing or the feature you want to implement. +We use the [GitHub issues](https://github.com/boostorg/test/issues) for raising bugs and feature requests, +while older tickets may be found in our former bug tracking system at https://svn.boost.org/ +(`test` component). + +## Pull requests +We welcome any contribution in the form of a pull request. Each PR is never integrated exactly as submitted, +we first run our internal unit tests on several platforms, and work the PR if needed. + +To ease the work of the maintainer and make the integration of your changes faster, please + +- base all your PR on the latest develop, rebase if develop changed since you forked the library +- ensure that your changes are not creating any regression in the current test bed (see below on how to run + the unit tests) +- provide a test case that reproduces the problem you encountered +- integrate your unit test into the `Jamfile.v2` of the test folder + +# Running the unit tests +Please make sure that the current set of tests pass for the changes that you submit. +To run the tests, see [this document](test/README.md). + +# Compile the documentation +The instructions for compiling the documentation are provided in [this document](doc/README.md). diff --git a/src/boost/libs/test/Jamfile.v2 b/src/boost/libs/test/Jamfile.v2 new file mode 100644 index 000000000..cc332e119 --- /dev/null +++ b/src/boost/libs/test/Jamfile.v2 @@ -0,0 +1,9 @@ +# (C) Copyright Juergen Hunold 2006-2010. +# 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. + +build-project example ; +build-project test ; diff --git a/src/boost/libs/test/LICENSE b/src/boost/libs/test/LICENSE new file mode 100644 index 000000000..36b7cd93c --- /dev/null +++ b/src/boost/libs/test/LICENSE @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/src/boost/libs/test/README.md b/src/boost/libs/test/README.md new file mode 100644 index 000000000..72b0e7b8c --- /dev/null +++ b/src/boost/libs/test/README.md @@ -0,0 +1,55 @@ +![boosttest logo](doc/html/images/boost.test.logo.png) + +# What is Boost.Test? +Boost.Test is a C++03/11/14/17 unit testing library, available on a wide range of platforms and compilers. + +The library is part of [Boost](www.boost.org). The latest release +of the library is available from the boost web site. + +Full instructions for use of this library can be accessed from +http://www.boost.org/doc/libs/release/libs/test/ + +# Key features + +* Easy to get started with: + 1. download and deflate the latest boost archive + 1. create a test module with this (header version): + ``` + #define BOOST_TEST_MODULE your_test_module + #include <boost/test/included/unit_test.hpp> + ``` + 1. Write your first test case: + ``` + BOOST_AUTO_TEST_CASE( your_test_case ) { + std::vector<int> a{1, 2}; + std::vector<int> b{1, 2}; + BOOST_TEST( a == b ); + } + ``` + 1. build and run + 1. done +* powerful and unique test assertion macro [`BOOST_TEST`](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/testing_tools/boost_test_universal_macro.html), that understands floating points, collections, strings... and uses appropriate comparison paradigm +* self-registering test cases, organize cases in test suites, apply fixtures on test cases, suites or globally +* provide assertion [context](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/test_output/test_tools_support_for_logging/contexts.html) for advanced diagnostic on failure +* powerful and extensible [dataset](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/test_cases/test_case_generation.html) tests +* add [decoration](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/decorators.html) to test cases and suites for [advanced description](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/semantic.html), [group/label](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/tests_grouping.html), and [dependencies](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/tests_dependencies.html) +* powerful command line options and test case filters +* extensible logging, XML and JUNIT outputs for third-party tools (eg. cont. integration) +* various usage (shared/static library/header only) for faster integration and/or compilation/build cycles, smaller binaries + +# Copyright and license +Copyright 2001-2014, Gennadiy Rozental.<br/> +Copyright 2013-2020, Boost.Test team. + +Distributed under the Boost Software License, Version 1.0.<br/> +(Get a copy at www.boost.org/LICENSE_1_0.txt) + +# Contribute +Please read [this document](CONTRIBUTE.md) to get started. + +# Build Status + +Branch | Travis | Appveyor | codecov.io | Deps | Docs | Tests | +:-------------: | ------ | -------- | ---------- | ---- | ---- | ----- | +[`master`](https://github.com/boostorg/test/tree/master) | [![Build Status](https://travis-ci.org/boostorg/test.svg?branch=master)](https://travis-ci.org/boostorg/test) | [![Build status](https://ci.appveyor.com/api/projects/status/n6ajg604w9gdbn8f/branch/master?svg=true)](https://ci.appveyor.com/project/raffienficiaud/test/branch/master) | [![codecov](https://codecov.io/gh/boostorg/test/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/test/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/test.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/test.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/test.html) +[`develop`](https://github.com/boostorg/test/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/test.svg?branch=develop)](https://travis-ci.org/boostorg/test) | [![Build status](https://ci.appveyor.com/api/projects/status/n6ajg604w9gdbn8f/branch/develop?svg=true)](https://ci.appveyor.com/project/raffienficiaud/test/branch/develop) | [![codecov](https://codecov.io/gh/boostorg/test/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/test/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/test.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/test.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/test.html) diff --git a/src/boost/libs/test/build/CMakeLists.txt b/src/boost/libs/test/build/CMakeLists.txt new file mode 100644 index 000000000..4b441836e --- /dev/null +++ b/src/boost/libs/test/build/CMakeLists.txt @@ -0,0 +1,131 @@ +# Copyright 2014, Raffi Enficiaud + +# 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. + +cmake_minimum_required(VERSION 2.8.11) +project(BoostTest) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +set(CMAKE_MACOSX_RPATH ON) + +add_definitions(-DBOOST_TEST_NO_LIB) + +# build type, by default to release (with optimisations) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +if(NOT WITHOUT_TESTS) + # ctest sets BUILD_TESTING automatically, but does not seem to serve its purpose. + include(CTest) + enable_testing() +endif() + + +include(CheckCXXCompilerFlag) +include(CheckIncludeFileCXX) + +if(NOT MSVC) + # c++11 options + check_cxx_compiler_flag(-std=c++11 HAS_CXX11_FLAG) + check_cxx_compiler_flag(-std=c++0x HAS_CXX0X_FLAG) + if(HAS_CXX11_FLAG) + message(STATUS "Compiling with C++11 support") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + elseif(HAS_CXX0X_FLAG) + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + endif() +endif() + +if(MSVC) + add_definitions(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) + set(MSVC_Additional_flags "/fp:fast /GF /Oy /GT /Ox /Ob2 /Oi /Os") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MSVC_Additional_flags}") +endif() + + +# global path +set(BOOST_TEST_ROOT_DIR ${BoostTest_SOURCE_DIR}/..) +set(BOOST_ROOT_DIR ${BOOST_TEST_ROOT_DIR}/../..) +get_filename_component(BOOST_TEST_ROOT_DIR_ABS ${BoostTest_SOURCE_DIR}/.. ABSOLUTE) +get_filename_component(BOOST_ROOT_DIR_ABS ${BOOST_ROOT_DIR} ABSOLUTE) + +# include globs +file(GLOB_RECURSE + BOOST_UTF_HEADERS + ${BOOST_TEST_ROOT_DIR}/include/*.hpp + ${BOOST_TEST_ROOT_DIR}/include/*.ipp) + +# organize files +foreach(_h IN LISTS BOOST_UTF_HEADERS) + get_filename_component(_hh ${_h} ABSOLUTE) + file(RELATIVE_PATH _v ${BOOST_TEST_ROOT_DIR_ABS}/include/boost/test ${_hh}) + get_filename_component(_v "${_v}" DIRECTORY) + string(REPLACE "/" "\\" _v "${_v}") + source_group(${_v} FILES ${_h}) +endforeach() + +set(BOOST_UTF_SRC + ${BOOST_TEST_ROOT_DIR}/src/compiler_log_formatter.cpp + + ${BOOST_TEST_ROOT_DIR}/src/debug.cpp + ${BOOST_TEST_ROOT_DIR}/src/decorator.cpp + ${BOOST_TEST_ROOT_DIR}/src/execution_monitor.cpp + ${BOOST_TEST_ROOT_DIR}/src/framework.cpp + ${BOOST_TEST_ROOT_DIR}/src/junit_log_formatter.cpp + ${BOOST_TEST_ROOT_DIR}/src/plain_report_formatter.cpp + ${BOOST_TEST_ROOT_DIR}/src/progress_monitor.cpp + ${BOOST_TEST_ROOT_DIR}/src/results_collector.cpp + ${BOOST_TEST_ROOT_DIR}/src/results_reporter.cpp + ${BOOST_TEST_ROOT_DIR}/src/test_framework_init_observer.cpp + ${BOOST_TEST_ROOT_DIR}/src/test_tools.cpp + ${BOOST_TEST_ROOT_DIR}/src/test_tree.cpp + ${BOOST_TEST_ROOT_DIR}/src/unit_test_log.cpp + ${BOOST_TEST_ROOT_DIR}/src/unit_test_main.cpp + ${BOOST_TEST_ROOT_DIR}/src/unit_test_monitor.cpp + ${BOOST_TEST_ROOT_DIR}/src/unit_test_parameters.cpp + ${BOOST_TEST_ROOT_DIR}/src/xml_log_formatter.cpp + ${BOOST_TEST_ROOT_DIR}/src/xml_report_formatter.cpp +) + +add_library(boost_test_framework + STATIC + ${BOOST_UTF_HEADERS} + ${BOOST_UTF_SRC}) +#target_compile_definitions(boost_test_framework PUBLIC "-DBOOST_TEST_DYN_LINK=0") +target_include_directories(boost_test_framework + PUBLIC + ${BOOST_TEST_ROOT_DIR}/include/ + ${BOOST_ROOT_DIR_ABS}/) +set_target_properties(boost_test_framework PROPERTIES FOLDER "UTF") + +add_library(boost_test_framework_shared + SHARED + ${BOOST_UTF_HEADERS} + ${BOOST_UTF_SRC}) +target_compile_definitions(boost_test_framework_shared PUBLIC "-DBOOST_TEST_DYN_LINK=1") +target_include_directories(boost_test_framework_shared + PUBLIC + ${BOOST_TEST_ROOT_DIR}/include/ + ${BOOST_ROOT_DIR_ABS}/) +set_target_properties(boost_test_framework_shared PROPERTIES FOLDER "UTF") + +#### +# Documentation files (files only, no target) +file(GLOB_RECURSE + BOOST_UTF_DOC_FILES + ${BOOST_TEST_ROOT_DIR}/doc/*.qbk) +add_custom_target( + quickbook + SOURCES ${BOOST_UTF_DOC_FILES}) +set_property(TARGET quickbook PROPERTY FOLDER "Documentation/") + +# Unit tests +add_subdirectory(${BOOST_TEST_ROOT_DIR}/test tmp_folders_tests) diff --git a/src/boost/libs/test/build/Jamfile.v2 b/src/boost/libs/test/build/Jamfile.v2 new file mode 100644 index 000000000..c4fa6e0c6 --- /dev/null +++ b/src/boost/libs/test/build/Jamfile.v2 @@ -0,0 +1,119 @@ +# (C) Copyright boost 2004-2014. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/test for the library home page. + +import os ; + +import ../../predef/check/predef + : check + : predef-check ; + +project boost/test + : source-location ../src + : requirements <link>shared:<define>BOOST_TEST_DYN_LINK=1 + <toolset>borland:<cxxflags>-w-8080 + <target-os>cygwin:<define>_POSIX_C_SOURCE=200112L + # Disable Warning about boost::noncopyable not being exported + <link>shared,<toolset>msvc:<cxxflags>-wd4275 + <toolset>msvc:<cxxflags>-wd4671 + <toolset>msvc:<cxxflags>-wd4673 + [ predef-check "BOOST_COMP_GNUC >= 4.3.0" : : <cxxflags>-Wno-variadic-macros ] + <toolset>clang:<cxxflags>-Wno-c99-extensions + <toolset>clang:<cxxflags>-Wno-variadic-macros + <warnings>all + # <warnings-as-errors>on + + : usage-requirements + <define>BOOST_TEST_NO_AUTO_LINK=1 + # Disable Warning about boost::noncopyable not being exported + <link>shared,<toolset>msvc:<cxxflags>-wd4275 + ; + +PRG_EXEC_MON_SOURCES = + execution_monitor + debug + cpp_main + ; + +TEST_EXEC_MON_SOURCES = + compiler_log_formatter + debug + decorator + execution_monitor + framework + plain_report_formatter + progress_monitor + results_collector + results_reporter + test_framework_init_observer + test_main + test_tools + test_tree + unit_test_log + unit_test_main + unit_test_monitor + unit_test_parameters + junit_log_formatter + xml_log_formatter + xml_report_formatter + ; + +UTF_SOURCES = + compiler_log_formatter + debug + decorator + execution_monitor + framework + plain_report_formatter + progress_monitor + results_collector + results_reporter + test_framework_init_observer + test_tools + test_tree + unit_test_log + unit_test_main + unit_test_monitor + unit_test_parameters + junit_log_formatter + xml_log_formatter + xml_report_formatter + ; + +lib boost_prg_exec_monitor + : # sources + $(PRG_EXEC_MON_SOURCES).cpp + : # requirements + : # default build + : # usage-requirements + <link>shared:<define>BOOST_TEST_DYN_LINK=1 + ; + +lib boost_test_exec_monitor + : # sources + $(TEST_EXEC_MON_SOURCES).cpp + : # requirements + <link>static + : # default build + : # usage-requirements + <link>shared:<define>BOOST_TEST_DYN_LINK=1 + ; + +lib boost_unit_test_framework + : # sources + $(UTF_SOURCES).cpp + : # requirements + : # default build + : # usage-requirements + <link>shared:<define>BOOST_TEST_DYN_LINK=1 + ; + +alias minimal ; + +alias included ; + +boost-install boost_prg_exec_monitor + boost_test_exec_monitor + boost_unit_test_framework ; 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; +} diff --git a/src/boost/libs/test/index.html b/src/boost/libs/test/index.html new file mode 100644 index 000000000..2e588616d --- /dev/null +++ b/src/boost/libs/test/index.html @@ -0,0 +1,12 @@ +<HTML> +<HEAD> +<META http-equiv="refresh" content="0; URL=doc/html/index.html"> +</HEAD> +<BODY> +Automatic redirection failed, please go to +<A href="doc/html/index.html">doc/index.html</A>. +</BODY> +</HTML> +<!-- Copyright Gennadiy Rozental 2001-2014. +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt) --> diff --git a/src/boost/libs/test/meta/libraries.json b/src/boost/libs/test/meta/libraries.json new file mode 100644 index 000000000..3c0e086e8 --- /dev/null +++ b/src/boost/libs/test/meta/libraries.json @@ -0,0 +1,16 @@ +{ + "key": "test", + "name": "Test", + "authors": [ + "Gennadiy Rozental", + "Raffi Enficiaud" + ], + "description": "Support for simple program testing, full unit testing, and for program execution monitoring.", + "category": [ + "Correctness" + ], + "maintainers": [ + "Gennadiy Rozental <rogeeff -at- gmail.com>", + "Raffi Enficiaud <raffi.enficiaud -at- free.fr>" + ] +} diff --git a/src/boost/libs/test/src/compiler_log_formatter.cpp b/src/boost/libs/test/src/compiler_log_formatter.cpp new file mode 100644 index 000000000..e1508c2f1 --- /dev/null +++ b/src/boost/libs/test/src/compiler_log_formatter.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/compiler_log_formatter.ipp> + +// EOF diff --git a/src/boost/libs/test/src/cpp_main.cpp b/src/boost/libs/test/src/cpp_main.cpp new file mode 100644 index 000000000..ab92ba5e7 --- /dev/null +++ b/src/boost/libs/test/src/cpp_main.cpp @@ -0,0 +1,19 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/cpp_main.ipp> + +// EOF + diff --git a/src/boost/libs/test/src/debug.cpp b/src/boost/libs/test/src/debug.cpp new file mode 100644 index 000000000..04c6e0a10 --- /dev/null +++ b/src/boost/libs/test/src/debug.cpp @@ -0,0 +1,24 @@ +// (C) Copyright Gennadiy Rozental 2006-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/debug.ipp> + +// *************************************************************************** +// Revision History : +// +// $Log$ +// *************************************************************************** + +// EOF diff --git a/src/boost/libs/test/src/decorator.cpp b/src/boost/libs/test/src/decorator.cpp new file mode 100644 index 000000000..3972407d6 --- /dev/null +++ b/src/boost/libs/test/src/decorator.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2011. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/decorator.ipp> + +// EOF diff --git a/src/boost/libs/test/src/execution_monitor.cpp b/src/boost/libs/test/src/execution_monitor.cpp new file mode 100644 index 000000000..e7fdfb913 --- /dev/null +++ b/src/boost/libs/test/src/execution_monitor.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/execution_monitor.ipp> + +// EOF diff --git a/src/boost/libs/test/src/framework.cpp b/src/boost/libs/test/src/framework.cpp new file mode 100644 index 000000000..52e761483 --- /dev/null +++ b/src/boost/libs/test/src/framework.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/framework.ipp> + +// EOF diff --git a/src/boost/libs/test/src/junit_log_formatter.cpp b/src/boost/libs/test/src/junit_log_formatter.cpp new file mode 100644 index 000000000..0cac80465 --- /dev/null +++ b/src/boost/libs/test/src/junit_log_formatter.cpp @@ -0,0 +1,13 @@ +// (C) Copyright 2016 Raffi Enficiaud. +// 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. +// +// forward to impl + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/junit_log_formatter.ipp> + +// EOF diff --git a/src/boost/libs/test/src/plain_report_formatter.cpp b/src/boost/libs/test/src/plain_report_formatter.cpp new file mode 100644 index 000000000..95cf64fd6 --- /dev/null +++ b/src/boost/libs/test/src/plain_report_formatter.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/plain_report_formatter.ipp> + +// EOF diff --git a/src/boost/libs/test/src/progress_monitor.cpp b/src/boost/libs/test/src/progress_monitor.cpp new file mode 100644 index 000000000..1d4afc7a5 --- /dev/null +++ b/src/boost/libs/test/src/progress_monitor.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/progress_monitor.ipp> + +// EOF diff --git a/src/boost/libs/test/src/results_collector.cpp b/src/boost/libs/test/src/results_collector.cpp new file mode 100644 index 000000000..5d8e0b7dd --- /dev/null +++ b/src/boost/libs/test/src/results_collector.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/results_collector.ipp> + +// EOF diff --git a/src/boost/libs/test/src/results_reporter.cpp b/src/boost/libs/test/src/results_reporter.cpp new file mode 100644 index 000000000..205cba5f8 --- /dev/null +++ b/src/boost/libs/test/src/results_reporter.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/results_reporter.ipp> + +// EOF diff --git a/src/boost/libs/test/src/test_framework_init_observer.cpp b/src/boost/libs/test/src/test_framework_init_observer.cpp new file mode 100644 index 000000000..140329ddf --- /dev/null +++ b/src/boost/libs/test/src/test_framework_init_observer.cpp @@ -0,0 +1,15 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 +//! Forwarding source +// ************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/test_framework_init_observer.ipp> + +// EOF diff --git a/src/boost/libs/test/src/test_main.cpp b/src/boost/libs/test/src/test_main.cpp new file mode 100644 index 000000000..f7ae352d2 --- /dev/null +++ b/src/boost/libs/test/src/test_main.cpp @@ -0,0 +1,15 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 +/// @brief forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/test_main.ipp> + +// EOF diff --git a/src/boost/libs/test/src/test_tools.cpp b/src/boost/libs/test/src/test_tools.cpp new file mode 100644 index 000000000..d9d296037 --- /dev/null +++ b/src/boost/libs/test/src/test_tools.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/test_tools.ipp> + +// EOF diff --git a/src/boost/libs/test/src/test_tree.cpp b/src/boost/libs/test/src/test_tree.cpp new file mode 100644 index 000000000..bc273ed96 --- /dev/null +++ b/src/boost/libs/test/src/test_tree.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/test_tree.ipp> + +// EOF diff --git a/src/boost/libs/test/src/unit_test_log.cpp b/src/boost/libs/test/src/unit_test_log.cpp new file mode 100644 index 000000000..c09437cbd --- /dev/null +++ b/src/boost/libs/test/src/unit_test_log.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/unit_test_log.ipp> + +// EOF diff --git a/src/boost/libs/test/src/unit_test_main.cpp b/src/boost/libs/test/src/unit_test_main.cpp new file mode 100644 index 000000000..74b0b84c6 --- /dev/null +++ b/src/boost/libs/test/src/unit_test_main.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/unit_test_main.ipp> + +// EOF diff --git a/src/boost/libs/test/src/unit_test_monitor.cpp b/src/boost/libs/test/src/unit_test_monitor.cpp new file mode 100644 index 000000000..ffc646195 --- /dev/null +++ b/src/boost/libs/test/src/unit_test_monitor.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/unit_test_monitor.ipp> + +// EOF diff --git a/src/boost/libs/test/src/unit_test_parameters.cpp b/src/boost/libs/test/src/unit_test_parameters.cpp new file mode 100644 index 000000000..e82694e34 --- /dev/null +++ b/src/boost/libs/test/src/unit_test_parameters.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/unit_test_parameters.ipp> + +// EOF diff --git a/src/boost/libs/test/src/xml_log_formatter.cpp b/src/boost/libs/test/src/xml_log_formatter.cpp new file mode 100644 index 000000000..ca497a9f3 --- /dev/null +++ b/src/boost/libs/test/src/xml_log_formatter.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/xml_log_formatter.ipp> + +// EOF diff --git a/src/boost/libs/test/src/xml_report_formatter.cpp b/src/boost/libs/test/src/xml_report_formatter.cpp new file mode 100644 index 000000000..18ff1d865 --- /dev/null +++ b/src/boost/libs/test/src/xml_report_formatter.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2005-2010. +// 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 : forwarding source +// *************************************************************************** + +#define BOOST_TEST_SOURCE +#include <boost/test/impl/xml_report_formatter.ipp> + +// EOF diff --git a/src/boost/libs/test/test/CMakeLists.txt b/src/boost/libs/test/test/CMakeLists.txt new file mode 100644 index 000000000..7133a93b9 --- /dev/null +++ b/src/boost/libs/test/test/CMakeLists.txt @@ -0,0 +1,187 @@ +#### +# Unit tests for the Unit Test Framework library + +if(NOT DEFINED BOOST_TEST_ROOT_DIR) + message(FATAL_ERROR "Please use this file from the main CMakeLists.txt from the build/ folder") +endif() + +if(NOT TARGET boost_test_framework OR NOT TARGET boost_test_framework_shared) + message(FATAL_ERROR "Please use this file from the main CMakeLists.txt from the build/ folder") +endif() + +# unit tests folder +set(BOOST_TEST_UNITTESTS_FOLDER ${BOOST_TEST_ROOT_DIR}/test) +set(BOOST_TEST_EXAMPLES_FOLDER ${BOOST_TEST_ROOT_DIR}/example) + + +# documentation tests +file(GLOB_RECURSE + BOOST_UTF_DOC_EXAMPLES + CONFIGURE_DEPENDS + ${BOOST_TEST_ROOT_DIR}/doc/examples/*.cpp) + +foreach(_h IN LISTS BOOST_UTF_DOC_EXAMPLES) + get_filename_component(_hh ${_h} NAME_WE) + add_executable(doc-${_hh} + ${_h} + ${BOOST_TEST_ROOT_DIR}/doc/examples/${_hh}.output) + set_target_properties(doc-${_hh} + PROPERTIES + FOLDER "Doc examples" + VS_DEBUGGER_WORKING_DIRECTORY ${BOOST_TEST_UNITTESTS_FOLDER}) + target_include_directories(doc-${_hh} + PUBLIC + ${BOOST_TEST_ROOT_DIR}/include/ + ${BOOST_ROOT_DIR_ABS}/) + + add_test(NAME doc-${_hh}-test + COMMAND doc-${_hh}) + get_filename_component(_ext ${_h} EXT) + string(FIND ${_ext} "fail" _index_fail) + if(${_index_fail} GREATER -1) + set_tests_properties(doc-${_hh}-test + PROPERTIES + WILL_FAIL TRUE) + endif() +endforeach() + + +# datasets +file(GLOB + BOOST_TEST_UNITTESTS_DATASET + CONFIGURE_DEPENDS + ${BOOST_TEST_UNITTESTS_FOLDER}/test-organization-ts/datasets-test/*.cpp + ${BOOST_TEST_UNITTESTS_FOLDER}/test-organization-ts/datasets-test/*.hpp) +add_executable(boost_test_datasets ${BOOST_TEST_UNITTESTS_DATASET}) +set_target_properties(boost_test_datasets + PROPERTIES + FOLDER "Unit tests" + VS_DEBUGGER_WORKING_DIRECTORY ${BOOST_TEST_UNITTESTS_FOLDER}) +target_include_directories(boost_test_datasets + PUBLIC + ${BOOST_TEST_ROOT_DIR}/include/ + ${BOOST_ROOT_DIR_ABS}/) +target_link_libraries(boost_test_datasets boost_test_framework) +add_test(NAME bt-unittest-dataset + COMMAND boost_test_datasets) + + +#### +# TS writing-test-ts + +set(BOOST_UTF_TESTS_FIND_FILES + writing-test-ts + execution_monitor-ts + framework-ts + usage-variants-ts + utils-ts + test-organization-ts + smoke-ts + ) + + +foreach(_ts IN LISTS BOOST_UTF_TESTS_FIND_FILES) + + file(GLOB + _boost_utf_current_tsuite + ${BOOST_TEST_UNITTESTS_FOLDER}/${_ts}/*.cpp) + + foreach(_h IN LISTS _boost_utf_current_tsuite) + get_filename_component(_hh ${_h} ABSOLUTE) + get_filename_component(_name ${_h} NAME_WE) + file(RELATIVE_PATH _v ${BOOST_TEST_UNITTESTS_FOLDER} ${_hh}) + + add_executable(${_name} ${_hh}) + set_target_properties(${_name} + PROPERTIES + FOLDER "Unit tests/${_ts}" + VS_DEBUGGER_WORKING_DIRECTORY ${BOOST_TEST_UNITTESTS_FOLDER}) + target_link_libraries(${_name} + PRIVATE + boost_test_framework) # inaccurate + + add_test(NAME bt-unittest-${_name} + COMMAND ${_name}) + endforeach() + + unset(_boost_utf_current_tsuite) + +endforeach() # test suite + + +# +# Example code +# + +set(LIST_EXAMPLES + unit_test_example_01.cpp,shared,fail + unit_test_example_02.cpp,static,fail + unit_test_example_03.cpp,static,fail + unit_test_example_04.cpp,shared,fail + unit_test_example_05.cpp,shared,fail + unit_test_example_06.cpp,shared,fail + unit_test_example_07.cpp,shared,run + unit_test_example_08.cpp,shared,run + unit_test_example_09_1.cpp,unit_test_example_09_2.cpp,shared,run + + unit_test_example_10.cpp,static,fail + unit_test_example_11.cpp,static,fail + unit_test_example_12.cpp,static,link + unit_test_example_13.cpp,shared,run + unit_test_example_15.cpp,shared,fail + unit_test_example_16.cpp,shared,run + + const_string_test.cpp,none,run + named_param_example.cpp,none,run + + external_main_example_1.cpp,shared,fail + external_main_example_2.cpp,shared,fail + external_main_example_3.cpp,none,fail + filtering_example.cpp,static,fail +) + +foreach(_var IN LISTS LIST_EXAMPLES) + string(REPLACE "," ";" _var_to_list "${_var}") + list(REVERSE _var_to_list) + list(GET _var_to_list 0 action) + list(GET _var_to_list 1 boost_test_type) + list(REMOVE_AT _var_to_list 0) + list(REMOVE_AT _var_to_list 0) + + list(GET _var_to_list 0 first_file) + get_filename_component(_name_example "${first_file}" NAME_WE) + + set(_list_files) + foreach(_file IN LISTS _var_to_list) + set(_list_files ${_list_files} ${BOOST_TEST_EXAMPLES_FOLDER}/${_file}) + endforeach() + + add_executable(${_name_example} ${_list_files}) + set_target_properties(${_name_example} + PROPERTIES + FOLDER "Examples" + VS_DEBUGGER_WORKING_DIRECTORY ${BOOST_TEST_UNITTESTS_FOLDER}) + + if("${boost_test_type}" STREQUAL "shared") + target_link_libraries(${_name_example} + PRIVATE + boost_test_framework_shared) + elseif("${boost_test_type}" STREQUAL "static") + target_link_libraries(${_name_example} + PRIVATE + boost_test_framework) + elseif(NOT "${boost_test_type}" STREQUAL "none") + message(FATAL_ERROR "Wrong action for example target '${_name_example}'") + endif() + + if("${action}" STREQUAL "run" OR "${action}" STREQUAL "run-fail") + add_test(NAME bt-exampletest-${_name_example} + COMMAND ${_name_example}) + + if("${action}" STREQUAL "run-fail") + set_tests_properties(bt-exampletest-${_name_example} + PROPERTIES + WILL_FAIL TRUE) + endif() + endif() +endforeach() diff --git a/src/boost/libs/test/test/Jamfile.v2 b/src/boost/libs/test/test/Jamfile.v2 new file mode 100644 index 000000000..513b74146 --- /dev/null +++ b/src/boost/libs/test/test/Jamfile.v2 @@ -0,0 +1,507 @@ +# (C) Copyright Gennadiy Rozental 2001-2015. +# 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. + +import path ; +import project ; +import property ; +import property-set ; +import regex ; +import "class" : new ; + +import ../../config/checks/config : requires ; + +project boost/test-tests + : requirements + ; + +import ../../predef/check/predef + : check require + : predef-check predef-require ; + +local check_msg = "Boost.Test feature check: " ; + +# documentation requirements: we use new style examples in the doc and compile on compilers supporting that +requirements_documentation = [ requires cxx11_decltype cxx11_hdr_random cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_variadic_macros cxx11_template_aliases ] ; + +# requirements for BOOST_TEST feature, full extension +requirements_boost_test_full_support = [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ; +# requirements_boost_test_full_support += [ check-target-builds ../tools/check_boost_test_support.cpp "Boost.Test feature check: BOOST_TEST full support" : : <build>no ] ; + +# requirements for dataset feature +requirements_datasets = [ requires cxx11_decltype cxx11_hdr_random cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_variadic_macros cxx11_trailing_result_types cxx11_template_aliases ] ; + +# avoiding some broken compilers (seen on Travis) +local l_gcc_c11_rvalue_full_support = [ predef-require "!BOOST_COMP_GNUC" or "BOOST_COMP_GNUC >= 5.0" ] ; + +#_________________________________________________________________________________________________# + +# lib gcov : : <name>gcov : ; + +rule boost.test-self-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? : extra-options ? : requirements * ) +{ + source_files ?= $(test-suite)/$(test-name).cpp ; + usage-variant ?= boost_unit_test_framework/<link>static ; + + return [ $(test-rule) $(source_files) ../build//$(usage-variant) $(extra-libs) +# gcov + : -- "" #args + : $(pattern_file) + : # Activating -pedantic finds more gotchas + # Unfortunately, this warns about the use of "long long" in gcc's own stdlib + # So deactivate those warnings again + <toolset>gcc:<cxxflags>-pedantic + <toolset>gcc:<cxxflags>-Wno-long-long + [ predef-check "BOOST_COMP_GNUC >= 4.3.0" : : <cxxflags>-Wno-variadic-macros ] + <toolset>clang:<cxxflags>-Wno-c99-extensions + <toolset>clang:<cxxflags>-Wno-variadic-macros + <toolset>clang:<cxxflags>-Werror=address-of-temporary + #<toolset>clang:<cxxflags>-Werror=bind-to-temporary-copy + <toolset>clang:<cxxflags>-Werror=return-stack-address + # <toolset>clang:<cxxflags>-Werror=dangling +# <toolset>gcc:<cxxflags>--coverage + <warnings>all + $(extra-options) + $(requirements) + : $(test-name) + ] ; +} + +#_________________________________________________________________________________________________# + +rule boost.test-mt-test ( test-rule : test-suite : test-name : usage-variant ? : pattern_file * : source_files * : extra-libs ? ) +{ + return [ boost.test-self-test $(test-rule) + : $(test-suite) + : $(test-name) + : $(usage-variant) + : $(pattern_file) + : $(source_files) + : $(extra-libs) + : <threading>multi + ] ; +} + +#_________________________________________________________________________________________________# + +rule docs-example-as-test ( test-file ) +{ + test-file-name = [ path.basename $(test-file) ] ; + test-name-rule = [ MATCH (.+)\\.(.+)\\.cpp : $(test-file-name) ] ; + + + return [ boost.test-self-test $(test-name-rule[2]) + : ../doc/examples + : doc-$(test-name-rule[1]) + : included + : + : $(test-file) + : + : + : $(requirements_documentation) # requirements + ] ; +} + +#_________________________________________________________________________________________________# + +test-suite "utils-ts" +: + [ boost.test-self-test run : utils-ts : algorithm-test ] + [ boost.test-self-test run : utils-ts : basic_cstring-test ] + [ boost.test-self-test run : utils-ts : class_properties-test ] + [ boost.test-self-test run : utils-ts : foreach-test ] + [ boost.test-self-test run : utils-ts : named_params-test ] + [ boost.test-self-test run : utils-ts : runtime-param-test : : : : : : [ requires cxx11_auto_declarations cxx11_function_template_default_args cxx11_lambdas cxx11_hdr_initializer_list cxx11_template_aliases ] ] + [ boost.test-self-test run : utils-ts : string_cast-test ] + [ boost.test-self-test run : utils-ts : token_iterator-test ] +; + +#_________________________________________________________________________________________________# + +test-suite "usage-variants-ts" +: + [ boost.test-self-test run : usage-variants-ts : single-header-test : included ] + [ boost.test-self-test run : usage-variants-ts : single-header-custom-init-test : included ] + [ boost.test-self-test run : usage-variants-ts : single-header-custom-main-test : included ] + + [ boost.test-self-test run : usage-variants-ts : static-library-test ] + [ boost.test-self-test run : usage-variants-ts : static-library-custom-init-test ] + + [ boost.test-self-test run : usage-variants-ts : shared-library-test : boost_unit_test_framework/<link>shared ] + [ boost.test-self-test run : usage-variants-ts : shared-library-custom-init-test : boost_unit_test_framework/<link>shared ] + [ boost.test-self-test run : usage-variants-ts : shared-library-custom-main-test : boost_unit_test_framework/<link>shared ] + + [ boost.test-self-test run : test-organization-ts : header-only-over-multiple-files : included : : usage-variants-ts/single-header-multiunit-1-test.cpp usage-variants-ts/single-header-multiunit-2-test.cpp ] +; + +#_________________________________________________________________________________________________# + +test-suite "framework-ts" +: + [ boost.test-self-test run : framework-ts : result-report-test : : baseline-outputs/result-report-test.pattern baseline-outputs/result_report_test.pattern.default_behaviour ] + [ boost.test-self-test run : framework-ts : log-formatter-test : : baseline-outputs/log-formatter-context-test.pattern baseline-outputs/log-formatter-test.pattern baseline-outputs/log-formatter-test.pattern.junit ] # should be ordered alphabetically + [ boost.test-self-test run : framework-ts : run-by-name-or-label-test ] + [ boost.test-self-test run : framework-ts : version-uses-module-name : included ] + [ boost.test-self-test run : framework-ts : test-macro-global-fixture : : baseline-outputs/global-fixtures-test.pattern ] + [ boost.test-self-test run : framework-ts : message-in-datatestcase-test : : baseline-outputs/messages-in-datasets-test.pattern : : : : $(requirements_datasets) ] + [ boost.test-self-test run : framework-ts : decorators-datatestcase-test : : : : : : $(requirements_datasets) ] + [ compile-fail framework-ts/master-test-suite-non-copyable-test.cpp ../build//included ] + [ boost.test-self-test run : framework-ts : log-count-skipped-test : included : baseline-outputs/log-count-skipped-tests.pattern ] + + # ticket 13371: "Use-after-free with --log_sink=file" + # this single check is not enough as we should check for various command line options: we make extensive + # checks in the smoke-tests (see below) + # [ boost.test-self-test run : framework-ts : check-streams-on-exit : included ] +; + +#_________________________________________________________________________________________________# + +test-suite "writing-test-ts" +: + [ boost.test-self-test run : writing-test-ts : assertion-construction-test : : : : : : $(requirements_boost_test_full_support) [ requires cxx11_trailing_result_types cxx11_nullptr ] ] + [ boost.test-self-test run : writing-test-ts : boost_check_equal-str-test ] + [ boost.test-self-test run : writing-test-ts : collection-comparison-test : : : : : : $(requirements_boost_test_full_support) [ requires cxx11_unified_initialization_syntax ] ] # required by the test content + [ boost.test-self-test run : writing-test-ts : dont_print_log_value-test : : : : : : $(requirements_datasets) ] + [ boost.test-self-test run : writing-test-ts : fp-comparisons-test : : : : : : $(requirements_boost_test_full_support) ] + [ boost.test-self-test run : writing-test-ts : fp-multiprecision-comparison-test : : : : : : $(requirements_boost_test_full_support) ] + [ boost.test-self-test run : writing-test-ts : fp-no-comparison-for-incomplete-types-test ] + [ boost.test-self-test run : writing-test-ts : fp-relational-operator ] + [ boost.test-self-test run : writing-test-ts : output_test_stream-test ] + [ boost.test-self-test run : writing-test-ts : test_tools-test : : baseline-outputs/test_tools-test.pattern : : : : $(requirements_boost_test_full_support) ] + [ boost.test-self-test run : writing-test-ts : windows-headers-test ] + [ boost.test-self-test run : writing-test-ts : tools-under-debugger-test ] + [ boost.test-self-test run : writing-test-ts : tools-debuggable-test : : : : : : $(requirements_boost_test_full_support) ] + [ boost.test-self-test run : writing-test-ts : test-dataset-over-tuples : : : : : : $(requirements_datasets) ] + [ boost.test-self-test run : writing-test-ts : nullptr-support-test : : : : : : [ requires cxx11_nullptr ] ] + [ boost.test-self-test run : writing-test-ts : user-defined-types-logging-customization-points ] + [ boost.test-self-test run : writing-test-ts : test-fixture-detect-setup-teardown ] + [ boost.test-self-test run : writing-test-ts : test-fixture-detect-setup-teardown-cpp11 : : : : : : [ requires cxx11_decltype cxx11_trailing_result_types ] ] + [ boost.test-self-test run : writing-test-ts : test-with-precondition : : : : : : [ requires cxx11_auto_declarations cxx11_lambdas ] ] + [ boost.test-self-test run : writing-test-ts : test-timeout : : : : : : [ requires cxx11_hdr_thread cxx11_hdr_chrono ] ] + [ boost.test-self-test run-fail : writing-test-ts : test-timeout-fail : : : : : : [ requires cxx11_hdr_thread cxx11_hdr_chrono ] ] + [ boost.test-self-test run : writing-test-ts : test-timeout-suite : : : : : : $(requirements_datasets) [ requires cxx11_hdr_thread cxx11_hdr_chrono ] ] + [ boost.test-self-test run-fail : writing-test-ts : test-timeout-suite-fail : : : : : : $(requirements_datasets) [ requires cxx11_hdr_thread cxx11_hdr_chrono ] ] +; + +#_________________________________________________________________________________________________# + +test-suite "test-organization-ts" +: + [ boost.test-self-test run : test-organization-ts : parameterized_test-test ] + [ boost.test-self-test run : test-organization-ts : test_case_template-test ] + [ boost.test-self-test run : test-organization-ts : test_case_template-with-tuples-test : : : : : : [ requires cxx11_hdr_tuple cxx11_auto_declarations cxx11_variadic_templates ] ] + [ boost.test-self-test run : test-organization-ts : test_case_template-with-variadic-typelist : : : : : : [ requires cxx11_hdr_tuple cxx11_auto_declarations cxx11_variadic_templates ] ] + [ boost.test-self-test run : test-organization-ts : datasets-test : : : [ glob test-organization-ts/datasets-test/*.cpp ] : : : $(requirements_datasets) ] + [ boost.test-self-test run : test-organization-ts : dataset-variadic_and_move_semantic-test : : : : : : $(requirements_datasets) ] + [ boost.test-self-test run : test-organization-ts : test_unit-order-test ] + [ boost.test-self-test run : test-organization-ts : test_unit-order-shuffled-test : : : : : : $(requirements_boost_test_full_support) ] + [ boost.test-self-test run : test-organization-ts : test_unit-nested-suite-dependency ] + [ boost.test-self-test run : test-organization-ts : test_unit-sanitize-names ] + [ boost.test-self-test run : test-organization-ts : test-tree-management-test ] + [ boost.test-self-test run : test-organization-ts : test-tree-several-suite-decl ] + [ boost.test-self-test run : test-organization-ts : test_unit-report-clashing-names ] + [ boost.test-self-test run : test-organization-ts : test_unit-several-ts-same-name ] + # cannot pass parameters from the command line, another test developed below + # [ boost.test-self-test run : test-organization-ts : dataset-master-test-suite-accessible-test : : --param1=1 --param2=2 : : : : $(requirements_datasets) ] +; + +#_________________________________________________________________________________________________# + +test-suite "multithreading-ts" +: + [ boost.test-mt-test run : multithreading-ts : sync-access-test : : : : /boost/thread//boost_thread/<link>static ] +; + +#_________________________________________________________________________________________________# + +test-suite "prg_exec_monitor-ts" +: + [ boost.test-self-test run-fail : prg_exec_monitor-ts : result-code-test : boost_prg_exec_monitor/<link>static ] + [ boost.test-self-test run-fail : prg_exec_monitor-ts : system-exception-test : boost_prg_exec_monitor/<link>static ] + [ boost.test-self-test run-fail : prg_exec_monitor-ts : uncatched-exception-test : included ] + [ boost.test-self-test run-fail : prg_exec_monitor-ts : user-fatal-exception-test : boost_prg_exec_monitor/<link>static ] +; + +#_________________________________________________________________________________________________# + +test-suite "execution_monitor-ts" +: + [ boost.test-self-test run : execution_monitor-ts : errors-handling-test : : baseline-outputs/errors-handling-test.pattern + baseline-outputs/errors-handling-test.pattern2 ] + [ boost.test-self-test run : execution_monitor-ts : custom-exception-test ] + [ boost.test-self-test run : execution_monitor-ts : boost_exception-test ] +; + +#_________________________________________________________________________________________________# + +import sequence ; + +test-suite "doc-examples-ts" +: + [ sequence.transform docs-example-as-test : [ glob ../doc/examples/*.cpp ] ] +; + +#_________________________________________________________________________________________________# + +class bt-conditional-sink +{ + import property-set ; + import targets ; + import property ; + + rule __init__ ( logger : log_or_report : sink_is_file : log_new_style ) + { + self.logger = $(logger) ; + sink_is_file ?= "no" ; + self.sink_is_file = $(sink_is_file) ; + self.log_or_report = $(log_or_report) ; + self.log_new_style = $(log_new_style) ; + } + + rule check ( properties * ) + { + local ps = [ property-set.create $(properties) ] ; + local path,relative-to-build-dir = [ $(ps).target-path ] ; + local path = $(path,relative-to-build-dir[1]) ; + + local ret ; + if $(self.log_new_style) = "yes" && $(self.log_or_report) = "log" + { + ret += "<testing.arg>--logger=$(self.logger)" ; + + if $(self.sink_is_file) = "yes" + { + ret += ",,smoke-ts-sink-new-style.$(self.logger):" ; + } + + ret = $(ret:J) ; + } + else + { + ret += <testing.arg>--$(self.log_or_report)_format=$(self.logger) ; + + if $(self.sink_is_file) = "yes" + { + ret += <testing.arg>--$(self.log_or_report)_sink=smoke-ts-sink.$(self.logger) ; + } + } + #ECHO ret is $(ret) ; + #ECHO ret2 is $(ret:J) ; + return $(ret) ; + } +} + +rule boost.test-smoke-ts-logger ( test-name-prefix : logger ? : log_or_report ? : requirements ? : log_new_style ? ) +{ + logger ?= HRF ; + log_or_report ?= log ; + log_new_style ?= no ; + + local detailed_name = all ; + if $(log_or_report) = report + { + detailed_name = detailed ; + } + + requirements ?= $(requirements_datasets) ; + + local bt-format-instance = [ new bt-conditional-sink $(logger) : $(log_or_report) : "no" : $(log_new_style) ] ; + local bt-format-sink-instance = [ new bt-conditional-sink $(logger) : $(log_or_report) : "yes" : $(log_new_style) ] ; + + local conditions-format = <conditional>@$(bt-format-instance).check ; + local conditions-format-sink = <conditional>@$(bt-format-sink-instance).check ; + + to-return = + [ run smoke-ts-included : + : : $(requirements) $(conditions-format) : $(test-name-prefix)-0-$(log_or_report)-format-$(log_new_style) ] + [ run smoke-ts-included : --$(log_or_report)_level=$(detailed_name) + : : $(requirements) $(conditions-format) : $(test-name-prefix)-1-$(log_or_report)-format-$(log_new_style)-all ] + [ run smoke-ts-included : + : : $(requirements) $(conditions-format-sink) : $(test-name-prefix)-2-$(log_or_report)-format-to-file-$(log_new_style) ] + [ run smoke-ts-included : --$(log_or_report)_level=$(detailed_name) + : : $(requirements) $(conditions-format-sink) : $(test-name-prefix)-3-$(log_or_report)-format-to-file-$(log_new_style)-all ] + [ run smoke-ts-included : --run_test=test1/_2 + : : $(requirements) $(conditions-format) : $(test-name-prefix)-4-$(log_or_report)-format-$(log_new_style)-filter ] + + [ run check-streams-on-exit : + : : $(requirements) $(conditions-format) : $(test-name-prefix)-5--$(log_or_report)-format--newstyle-$(log_new_style) ] + [ run check-streams-on-exit : + : : $(requirements) $(conditions-format-sink) : $(test-name-prefix)-6--$(log_or_report)-format--newstyle-$(log_new_style)--with-sink ] + + ; + + return $(to-return) ; +} + +exe smoke-ts-included : smoke-ts/basic-smoke-test.cpp + : $(requirements_datasets) ; + +exe smoke-ts-included-2 : smoke-ts/basic-smoke-test2.cpp ; + +exe smoke-ts-included-3 : smoke-ts/basic-smoke-test3.cpp ; + +# for template test case filtering from the command line +exe smoke-ts-included-4 : smoke-ts/basic-smoke-test4.cpp ; + +exe check-streams-on-exit : framework-ts/check-streams-on-exit.cpp ; + +exe dataset-master-test-suite-accessible-test : test-organization-ts/dataset-master-test-suite-accessible-test.cpp + : $(requirements_datasets) ; + +alias "smoke-ts" +: +[ boost.test-smoke-ts-logger bt-st-txml : XML : log ] +[ boost.test-smoke-ts-logger bt-st-txml : XML : log : : yes ] +[ boost.test-smoke-ts-logger bt-st-txml : XML : report ] +[ boost.test-smoke-ts-logger bt-st-thrf : HRF : log ] +[ boost.test-smoke-ts-logger bt-st-thrf : HRF : log : : yes ] +[ boost.test-smoke-ts-logger bt-st-thrf : HRF : report ] +[ boost.test-smoke-ts-logger bt-st-tjunit : JUNIT : log ] +[ boost.test-smoke-ts-logger bt-st-tjunit : JUNIT : log : : yes ] +[ run smoke-ts-included-2 : <testing.arg>\"--run_test=test<*\" : : : bt-st-runtest-with-colons ] +[ run check-streams-on-exit : --list_content --report_sink=stdout : : $(requirements_datasets) : cla-check-list-content-with-report-sink ] +[ run check-streams-on-exit : --list_content --report_sink=test.txt : : $(requirements_datasets) : cla-check-list-content-with-report-sink-2 ] + +# check being able to pass arguments command line arguments to the dataset generator +[ run dataset-master-test-suite-accessible-test : -- --param1=1 --param2=2 : : $(requirements_datasets) : dataset-lazy-generator ] + +# several command line parameter checks +[ run smoke-ts-included : --version : : $(requirements_datasets) : cla-check-print-version ] +[ run smoke-ts-included : -c true : : $(requirements_datasets) : cla-result-code-short ] +[ run smoke-ts-included : -c false : : $(requirements_datasets) : cla-result-code-short-false ] +[ run smoke-ts-included : --result_code=true : : $(requirements_datasets) : cla-result-code-long ] +[ run smoke-ts-included : --result_code=false : : $(requirements_datasets) : cla-result-code-long-false ] +[ run smoke-ts-included : --no_result_code : : $(requirements_datasets) : cla-result-code-long-false-short ] +[ run smoke-ts-included : -x no -c --list_content=HRF : : $(requirements_datasets) : cla-mixed-long-short1 ] +[ run smoke-ts-included : -x -c no --list_content=HRF : : $(requirements_datasets) : cla-mixed-long-short2 ] +[ run smoke-ts-included : -x -c no --list_content=HRF -- --some-ignored : : $(requirements_datasets) : cla-mixed-long-short3 ] + +# those checks are mainly for consistency: we run a very simple thing, pass command line and +# check behaviour wrt. to the command line arguments + +[ run-fail smoke-ts-included-3 : : : : cla-no-args-checking-fail ] # sanity check + +# short vs. long arguments with optional value +[ run-fail smoke-ts-included-3 : --result_code : : : cla-ignore-result-code-long-fail-optional ] +[ run smoke-ts-included-3 : --result_code=0 : : : cla-ignore-result-code-long-no-fail ] +[ run-fail smoke-ts-included-3 : --no_result_code=0 : : : cla-ignore-result-code-long-fail-negated-wrong ] +[ run smoke-ts-included-3 : --no_result_code : : : cla-ignore-result-code-long-no-fail-negated ] +[ run-fail smoke-ts-included-3 : --result_code=1 : : : cla-ignore-result-code-long-fail ] +[ run-fail smoke-ts-included-3 : -c : : : cla-ignore-result-code-short-fail-optional ] +[ run smoke-ts-included-3 : -c no : : : cla-ignore-result-code-short-no-fail ] +[ run-fail smoke-ts-included-3 : -c yes : : : cla-ignore-result-code-short-fail ] + +# short vs. long arguments without optional arguments +[ run-fail smoke-ts-included-3 : --run_test : : : cla-runtest-long-fail-no-optional ] +[ run smoke-ts-included-3 : --run_test=case2 : : : cla-runtest-long-no-fail ] +[ run smoke-ts-included-3 : --run_test=case2 : : : cla-runtest-long-fail1 ] +[ run-fail smoke-ts-included-3 : --run_test=case2 --run_test=some_suite : : : cla-runtest-repeated-long-fail ] +[ run-fail smoke-ts-included-3 : --run_test=some_suite/case1 : : : cla-runtest-long-fail2 ] +[ run-fail smoke-ts-included-3 : -t : : : cla-runtest-short-fail-no-optional ] +[ run-fail smoke-ts-included-3 : -t some_suite : : : cla-runtest-short-fail1 ] +[ run-fail smoke-ts-included-3 : -t some_suite/case1 : : : cla-runtest-short-fail2 ] +[ run smoke-ts-included-3 : -t case2 : : : cla-runtest-short-no-fail ] + +# mixed short/long +[ run-fail smoke-ts-included-3 : --run_test=case2 -t some_suite : : : cla-runtest-repeated-mixed-long-fail1 ] +[ run-fail smoke-ts-included-3 : -t some_suite --run_test=case2 : : : cla-runtest-repeated-mixed-long-fail2 ] +[ run smoke-ts-included-3 : --run_test=case2 -t some_suite -c no : : : cla-runtest-repeated-mixed-long-no-fail1 ] +[ run smoke-ts-included-3 : -t some_suite -c no --run_test=case2 : : : cla-runtest-repeated-mixed-long-no-fail2 ] +[ run smoke-ts-included-3 : -c no --run_test=case2 -t some_suite : : : cla-runtest-repeated-mixed-long-no-fail3 ] +[ run-fail smoke-ts-included-3 : --result_code=1 --run_test=case2 -t some_suite : : : cla-runtest-repeated-mixed-long-fail3 ] +[ run smoke-ts-included-3 : --result_code=0 --run_test=case2 -t some_suite : : : cla-runtest-repeated-mixed-long-fail4 ] + +# template test case filtering command line +[ run-fail smoke-ts-included-4 : : : : cla-template-test-case-sanity-1 ] +[ run-fail smoke-ts-included-4 : \"--run_test=test<my_struct<int_ float>>\" : : : cla-template-test-case-sanity-2 ] +[ run smoke-ts-included-4 : \"--run_test=test<my_struct<int_ int>>\" : : : cla-template-test-case-sanity-3 ] +[ run smoke-ts-included-4 : \"--run_test=test<my_struct<int_ int>>,test<my_struct<float_ float>>\" : : : cla-template-test-case-sanity-4 ] +[ run-fail smoke-ts-included-4 : \"--run_test=test<my_struct<int_ int>>,test<my_struct<char_ float>>\" : : : cla-template-test-case-sanity-5 ] +[ run-fail smoke-ts-included-4 : \"--run_test=some_suite/*\" : : : cla-template-test-case-sanity-6 ] +[ run-fail smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<float_ int>>\" : : : cla-template-test-case-sanity-7 ] +[ run-fail smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<int_ float>>\" : : : cla-template-test-case-sanity-8 ] +[ run-fail smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<int_ float>>,test<my_struct<float_ int>>\" : : : cla-template-test-case-sanity-9 ] +[ run smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<float_ float>>\" : : : cla-template-test-case-sanity-10 ] +# test<my_struct<double_ double>> does not exist: error because test tree empty +[ run-fail smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<double_ double>>\" : : : cla-template-test-case-sanity-11 ] +# test<my_struct<double_ double>> does not exist, but this is not reported as error since there is at least one test case running +[ run smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<float_ float>>,test<my_struct<double_ double>>\" : : : cla-template-test-case-sanity-12 ] +[ run smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<float_ float>>,test<my_struct<char_ char>>\" : : : cla-template-test-case-sanity-13 ] +[ run smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<float_ float>>\" \"--run_test=test<my_struct<int_ int>>\" : : : cla-template-test-case-sanity-14 ] +[ run smoke-ts-included-4 : \"--run_test=some_suite/test<my_struct<float_ float>>,test<my_struct<char_ char>>\" \"--run_test=test<my_struct<int_ int>>\" : : : cla-template-test-case-sanity-15 ] +; + +exe custom-command-line-binary-1 : ../doc/examples/runtime-configuration_1.run-fail.cpp ; +exe custom-command-line-binary-2 : ../doc/examples/runtime-configuration_2.run-fail.cpp + : $(requirements_boost_test_full_support) ; +exe custom-command-line-binary-3 : ../doc/examples/runtime-configuration_3.run-fail.cpp + : $(requirements_boost_test_full_support) ; +exe custom-command-line-binary-4 : ../doc/examples/runtime-configuration_4.run-fail.cpp + : $(requirements_datasets) [ requires cxx11_trailing_result_types cxx11_auto_declarations ] $(l_gcc_c11_rvalue_full_support) ; + +alias "custom-command-line-ts" +: +# custom command line interface tests +[ run custom-command-line-binary-1 : -- --specific-param \"'additional value with quotes'\" : : : cla-specific-api1-test-1-1 ] +[ run custom-command-line-binary-1 : --log_level=all --no_color -- --specific-param \"'additional value with quotes'\" : : : cla-specific-api1-test-1-2 ] + +[ run-fail custom-command-line-binary-2 : -- --random-string \"mock_device\" : : $(requirements_boost_test_full_support) : cla-specific-api1-test-2-0 ] +[ run custom-command-line-binary-2 : -- --device-name \"mock_device\" : : $(requirements_boost_test_full_support) : cla-specific-api1-test-2-1 ] +[ run custom-command-line-binary-2 : --log_level=all --no_color -- --device-name \"mock_device\" : : $(requirements_boost_test_full_support) : cla-specific-api1-test-2-2 ] + +[ run-fail custom-command-line-binary-3 : -- : : $(requirements_boost_test_full_support) : cla-specific-api1-test-3-0 ] +[ run-fail custom-command-line-binary-3 : -- --create-parametrized : : $(requirements_boost_test_full_support) : cla-specific-api1-test-3-1 ] +[ run-fail custom-command-line-binary-3 : -- --create-parametrized 3 : : $(requirements_boost_test_full_support) : cla-specific-api1-test-3-2 ] +[ run custom-command-line-binary-3 : -- --create-parametrized 3 2 : : $(requirements_boost_test_full_support) : cla-specific-api1-test-3-3 ] + +[ run-fail custom-command-line-binary-4 : -- : : $(requirements_datasets) [ requires cxx11_trailing_result_types cxx11_auto_declarations ] $(l_gcc_c11_rvalue_full_support) : cla-specific-api1-test-4-0 ] +[ run-fail custom-command-line-binary-4 : -- --test-file : : $(requirements_datasets) [ requires cxx11_trailing_result_types cxx11_auto_declarations ] $(l_gcc_c11_rvalue_full_support) : cla-specific-api1-test-4-1 ] +[ run-fail custom-command-line-binary-4 : -- --test-file : ../doc/examples/runtime-configuration_4-test-fail.txt : $(requirements_datasets) [ requires cxx11_trailing_result_types cxx11_auto_declarations ] $(l_gcc_c11_rvalue_full_support) : cla-specific-api1-test-4-2 ] +[ run-fail custom-command-line-binary-4 : --log_level=all --no_color -- --test-file : ../doc/examples/runtime-configuration_4-test-fail.txt : $(requirements_datasets) [ requires cxx11_trailing_result_types cxx11_auto_declarations ] $(l_gcc_c11_rvalue_full_support) : cla-specific-api1-test-4-3 ] +[ run custom-command-line-binary-4 : -- --test-file : ../doc/examples/runtime-configuration_4-test.txt : $(requirements_datasets) [ requires cxx11_trailing_result_types cxx11_auto_declarations ] $(l_gcc_c11_rvalue_full_support) : cla-specific-api1-test-4-4 ] +[ run custom-command-line-binary-4 : --log_level=all --no_color -- --test-file : ../doc/examples/runtime-configuration_4-test.txt : $(requirements_datasets) [ requires cxx11_trailing_result_types cxx11_auto_declarations ] $(l_gcc_c11_rvalue_full_support) : cla-specific-api1-test-4-5 ] + +; + +#_________________________________________________________________________________________________# + +# A target that runs all the tests +alias test +: + smoke-ts + utils-ts + usage-variants-ts + framework-ts + writing-test-ts + test-organization-ts + multithreading-ts + prg_exec_monitor-ts + execution_monitor-ts + doc-examples-ts + custom-command-line-ts +; + +#_________________________________________________________________________________________________# + +rule test-selfcontained ( path ) +{ + for local file in [ path.glob-tree $(path) : *.hpp ] + { + result += [ compile selfcontained.cpp : $(requirements_datasets) <define>BOOST_HEADER_TEST_NAME=$(file) : [ regex.replace [ path.relative-to $(path) $(file) ] "/" "_" ] ] ; + } + + return $(result) ; +} + +# Test for self-contained headers +alias test_selfcontained_headers : [ test-selfcontained ../include ] ; + + +#_________________________________________________________________________________________________# +# Tests of the examples + +build-project ../example ; +# EOF diff --git a/src/boost/libs/test/test/README.md b/src/boost/libs/test/test/README.md new file mode 100644 index 000000000..a00c62977 --- /dev/null +++ b/src/boost/libs/test/test/README.md @@ -0,0 +1,38 @@ +# How to run the unit tests + +This folder contains the unit tests for Boost.Test. + +In order to run the unit tests, you first need to create `b2`. Check the documentation of boost +on how to generate `b2`. + +## OSX + +Please run the tests in C++11 mode, with the following commands + + cd <boost-root-folder> + ./bootstrap.sh + ./b2 headers + cd libs/test/test + ../../../b2 -j8 toolset=clang cxxflags="-stdlib=libc++ -std=c++11" linkflags="-stdlib=libc++" + +## Linux + +As for OSX, please run the tests in C++11 mode, using the following commands + + cd <boost-root-folder> + ./bootstrap.sh + ./b2 headers + cd libs/test/test + ../../../b2 cxxflags=-std=c++11 + +## Windows + + +### Visual Studio 2017 C++17 mode +To run the tests for Visual Studio 2017 / C++17 mode, use the following commands: + + cd <boost-root-folder> + call bootstrap.bat + b2 headers + cd libs\test\test + ..\..\..\b2 --abbreviate-paths toolset=msvc-14.1 cxxflags="/std:c++latest"
\ No newline at end of file diff --git a/src/boost/libs/test/test/baseline-outputs/errors-handling-test.pattern b/src/boost/libs/test/test/baseline-outputs/errors-handling-test.pattern new file mode 100644 index 000000000..fc05a2a85 --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/errors-handling-test.pattern @@ -0,0 +1,392 @@ + +=========================== +log level: log_successful_tests; error type: no error; + +164: Entering test case "error_on_demand" +99: info: check 'no error' has passed +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: user message; + +164: Entering test case "error_on_demand" +message +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: user warning; + +164: Entering test case "error_on_demand" +107: warning: in "error_on_demand": warning +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: user non-fatal error; + +164: Entering test case "error_on_demand" +111: error: in "error_on_demand": non-fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: cpp exception; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": class std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: system error; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": integer divide by zero +126: last checkpoint: error_on_demand() divide by zero +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: user fatal error; + +164: Entering test case "error_on_demand" +115: fatal error: in "error_on_demand": fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: system fatal error; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address +Test is aborted +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: no error; + +164: Entering test case "error_on_demand" +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: user message; + +164: Entering test case "error_on_demand" +message +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: user warning; + +164: Entering test case "error_on_demand" +107: warning: in "error_on_demand": warning +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: user non-fatal error; + +164: Entering test case "error_on_demand" +111: error: in "error_on_demand": non-fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: cpp exception; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": class std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: system error; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": integer divide by zero +126: last checkpoint: error_on_demand() divide by zero +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: user fatal error; + +164: Entering test case "error_on_demand" +115: fatal error: in "error_on_demand": fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: system fatal error; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address +Test is aborted +Leaving test case "error_on_demand" + +=========================== +log level: log_messages; error type: no error; + + +=========================== +log level: log_messages; error type: user message; + +message +Test case error_on_demand did not check any assertions + +=========================== +log level: log_messages; error type: user warning; + +107: warning: in "error_on_demand": warning +Test case error_on_demand did not check any assertions + +=========================== +log level: log_messages; error type: user non-fatal error; + +111: error: in "error_on_demand": non-fatal error + +=========================== +log level: log_messages; error type: cpp exception; + +0: fatal error: in "error_on_demand": class std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_messages; error type: system error; + +0: fatal error: in "error_on_demand": integer divide by zero +126: last checkpoint: error_on_demand() divide by zero + +=========================== +log level: log_messages; error type: user fatal error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_messages; error type: system fatal error; + +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address +Test is aborted + +=========================== +log level: log_warnings; error type: no error; + + +=========================== +log level: log_warnings; error type: user message; + + +=========================== +log level: log_warnings; error type: user warning; + +107: warning: in "error_on_demand": warning + +=========================== +log level: log_warnings; error type: user non-fatal error; + +111: error: in "error_on_demand": non-fatal error + +=========================== +log level: log_warnings; error type: cpp exception; + +0: fatal error: in "error_on_demand": class std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_warnings; error type: system error; + +0: fatal error: in "error_on_demand": integer divide by zero +126: last checkpoint: error_on_demand() divide by zero + +=========================== +log level: log_warnings; error type: user fatal error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_warnings; error type: system fatal error; + +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address + +=========================== +log level: log_all_errors; error type: no error; + + +=========================== +log level: log_all_errors; error type: user message; + + +=========================== +log level: log_all_errors; error type: user warning; + + +=========================== +log level: log_all_errors; error type: user non-fatal error; + +111: error: in "error_on_demand": non-fatal error + +=========================== +log level: log_all_errors; error type: cpp exception; + +0: fatal error: in "error_on_demand": class std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_all_errors; error type: system error; + +0: fatal error: in "error_on_demand": integer divide by zero +126: last checkpoint: error_on_demand() divide by zero + +=========================== +log level: log_all_errors; error type: user fatal error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_all_errors; error type: system fatal error; + +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address + +=========================== +log level: log_cpp_exception_errors; error type: no error; + + +=========================== +log level: log_cpp_exception_errors; error type: user message; + + +=========================== +log level: log_cpp_exception_errors; error type: user warning; + + +=========================== +log level: log_cpp_exception_errors; error type: user non-fatal error; + + +=========================== +log level: log_cpp_exception_errors; error type: cpp exception; + +0: fatal error: in "error_on_demand": class std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_cpp_exception_errors; error type: system error; + +0: fatal error: in "error_on_demand": integer divide by zero +126: last checkpoint: error_on_demand() divide by zero + +=========================== +log level: log_cpp_exception_errors; error type: user fatal error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_cpp_exception_errors; error type: system fatal error; + +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address + +=========================== +log level: log_system_errors; error type: no error; + + +=========================== +log level: log_system_errors; error type: user message; + + +=========================== +log level: log_system_errors; error type: user warning; + + +=========================== +log level: log_system_errors; error type: user non-fatal error; + + +=========================== +log level: log_system_errors; error type: cpp exception; + + +=========================== +log level: log_system_errors; error type: system error; + +0: fatal error: in "error_on_demand": integer divide by zero +126: last checkpoint: error_on_demand() divide by zero + +=========================== +log level: log_system_errors; error type: user fatal error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_system_errors; error type: system fatal error; + +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address + +=========================== +log level: log_fatal_errors; error type: no error; + + +=========================== +log level: log_fatal_errors; error type: user message; + + +=========================== +log level: log_fatal_errors; error type: user warning; + + +=========================== +log level: log_fatal_errors; error type: user non-fatal error; + + +=========================== +log level: log_fatal_errors; error type: cpp exception; + + +=========================== +log level: log_fatal_errors; error type: system error; + + +=========================== +log level: log_fatal_errors; error type: user fatal error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_fatal_errors; error type: system fatal error; + +0: fatal error: in "error_on_demand": memory access violation +131: last checkpoint: write to an invalid address + +=========================== +log level: log_nothing; error type: no error; + + +=========================== +log level: log_nothing; error type: user message; + + +=========================== +log level: log_nothing; error type: user warning; + + +=========================== +log level: log_nothing; error type: user non-fatal error; + + +=========================== +log level: log_nothing; error type: cpp exception; + + +=========================== +log level: log_nothing; error type: system error; + + +=========================== +log level: log_nothing; error type: user fatal error; + + +=========================== +log level: log_nothing; error type: system fatal error; + diff --git a/src/boost/libs/test/test/baseline-outputs/errors-handling-test.pattern2 b/src/boost/libs/test/test/baseline-outputs/errors-handling-test.pattern2 new file mode 100644 index 000000000..4d04baa1d --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/errors-handling-test.pattern2 @@ -0,0 +1,279 @@ + +=========================== +log level: log_successful_tests; error type: no error; + +164: Entering test case "error_on_demand" +99: info: check 'no error' has passed +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: user message; + +164: Entering test case "error_on_demand" +message +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: user warning; + +164: Entering test case "error_on_demand" +107: warning: in "error_on_demand": warning +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: user non-fatal error; + +164: Entering test case "error_on_demand" +111: error: in "error_on_demand": non-fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: cpp exception; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error +Leaving test case "error_on_demand" + +=========================== +log level: log_successful_tests; error type: system error; + +164: Entering test case "error_on_demand" +115: fatal error: in "error_on_demand": fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: no error; + +164: Entering test case "error_on_demand" +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: user message; + +164: Entering test case "error_on_demand" +message +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: user warning; + +164: Entering test case "error_on_demand" +107: warning: in "error_on_demand": warning +Test case error_on_demand did not check any assertions +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: user non-fatal error; + +164: Entering test case "error_on_demand" +111: error: in "error_on_demand": non-fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: cpp exception; + +164: Entering test case "error_on_demand" +0: fatal error: in "error_on_demand": std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error +Leaving test case "error_on_demand" + +=========================== +log level: log_test_suites; error type: system error; + +164: Entering test case "error_on_demand" +115: fatal error: in "error_on_demand": fatal error +Leaving test case "error_on_demand" + +=========================== +log level: log_messages; error type: no error; + + +=========================== +log level: log_messages; error type: user message; + +message +Test case error_on_demand did not check any assertions + +=========================== +log level: log_messages; error type: user warning; + +107: warning: in "error_on_demand": warning +Test case error_on_demand did not check any assertions + +=========================== +log level: log_messages; error type: user non-fatal error; + +111: error: in "error_on_demand": non-fatal error + +=========================== +log level: log_messages; error type: cpp exception; + +0: fatal error: in "error_on_demand": std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_messages; error type: system error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_warnings; error type: no error; + + +=========================== +log level: log_warnings; error type: user message; + + +=========================== +log level: log_warnings; error type: user warning; + +107: warning: in "error_on_demand": warning + +=========================== +log level: log_warnings; error type: user non-fatal error; + +111: error: in "error_on_demand": non-fatal error + +=========================== +log level: log_warnings; error type: cpp exception; + +0: fatal error: in "error_on_demand": std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_warnings; error type: system error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_all_errors; error type: no error; + + +=========================== +log level: log_all_errors; error type: user message; + + +=========================== +log level: log_all_errors; error type: user warning; + + +=========================== +log level: log_all_errors; error type: user non-fatal error; + +111: error: in "error_on_demand": non-fatal error + +=========================== +log level: log_all_errors; error type: cpp exception; + +0: fatal error: in "error_on_demand": std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_all_errors; error type: system error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_cpp_exception_errors; error type: no error; + + +=========================== +log level: log_cpp_exception_errors; error type: user message; + + +=========================== +log level: log_cpp_exception_errors; error type: user warning; + + +=========================== +log level: log_cpp_exception_errors; error type: user non-fatal error; + + +=========================== +log level: log_cpp_exception_errors; error type: cpp exception; + +0: fatal error: in "error_on_demand": std::runtime_error: test std::runtime error what() message +121: last checkpoint: error_on_demand() throw runtime_error + +=========================== +log level: log_cpp_exception_errors; error type: system error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_system_errors; error type: no error; + + +=========================== +log level: log_system_errors; error type: user message; + + +=========================== +log level: log_system_errors; error type: user warning; + + +=========================== +log level: log_system_errors; error type: user non-fatal error; + + +=========================== +log level: log_system_errors; error type: cpp exception; + + +=========================== +log level: log_system_errors; error type: system error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_fatal_errors; error type: no error; + + +=========================== +log level: log_fatal_errors; error type: user message; + + +=========================== +log level: log_fatal_errors; error type: user warning; + + +=========================== +log level: log_fatal_errors; error type: user non-fatal error; + + +=========================== +log level: log_fatal_errors; error type: cpp exception; + + +=========================== +log level: log_fatal_errors; error type: system error; + +115: fatal error: in "error_on_demand": fatal error + +=========================== +log level: log_nothing; error type: no error; + + +=========================== +log level: log_nothing; error type: user message; + + +=========================== +log level: log_nothing; error type: user warning; + + +=========================== +log level: log_nothing; error type: user non-fatal error; + + +=========================== +log level: log_nothing; error type: cpp exception; + + +=========================== +log level: log_nothing; error type: system error; + diff --git a/src/boost/libs/test/test/baseline-outputs/global-fixtures-test.pattern b/src/boost/libs/test/test/baseline-outputs/global-fixtures-test.pattern new file mode 100644 index 000000000..72dabb227 --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/global-fixtures-test.pattern @@ -0,0 +1,5842 @@ +*********************** +*********************** GlobalFixtureWithCtor<&good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="45"><![CDATA[GlobalFixtureWithCtor: dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="45"><![CDATA[GlobalFixtureWithCtor: dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithCtor<&almost_good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy": condition 2>3 is not satisfied [2 <= 3] +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="45"><![CDATA[GlobalFixtureWithCtor: dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors": condition 2>3 is not satisfied [2 <= 3] +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="45"><![CDATA[GlobalFixtureWithCtor: dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithCtor<&bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy": non sense +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="45"><![CDATA[GlobalFixtureWithCtor: dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 39 +- message: GlobalFixtureWithCtor: ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 45 +- message: GlobalFixtureWithCtor: dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy no errors": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy no errors": non sense +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="45"><![CDATA[GlobalFixtureWithCtor: dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 39 +- message: GlobalFixtureWithCtor: ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 45 +- message: GlobalFixtureWithCtor: dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithCtor<&very_bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 39 +- message: GlobalFixtureWithCtor: ctor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy no errors": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 39 +- message: GlobalFixtureWithCtor: ctor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithCtor<&very_bad_exception> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 39 +- message: GlobalFixtureWithCtor: ctor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy no errors": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="39"><![CDATA[GlobalFixtureWithCtor: ctor]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 39 +- message: GlobalFixtureWithCtor: ctor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithSetup<&good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="61"><![CDATA[GlobalFixtureWithSetup::setup-calling function done]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="61"><![CDATA[GlobalFixtureWithSetup::setup-calling function done]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithSetup<&almost_good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="xxx/test-macro-global-fixture.cpp" line="61"><![CDATA[GlobalFixtureWithSetup::setup-calling function done]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="xxx/test-macro-global-fixture.cpp" line="61"><![CDATA[GlobalFixtureWithSetup::setup-calling function done]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithSetup<&bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy": non sense +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="61"><![CDATA[GlobalFixtureWithSetup::setup-calling function done]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 52 +- message: GlobalFixtureWithSetup ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 59 +- message: GlobalFixtureWithSetup::setup-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 61 +- message: GlobalFixtureWithSetup::setup-calling function done + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 55 +- message: GlobalFixtureWithSetup dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy no errors": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy no errors": non sense +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="61"><![CDATA[GlobalFixtureWithSetup::setup-calling function done]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 52 +- message: GlobalFixtureWithSetup ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 59 +- message: GlobalFixtureWithSetup::setup-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 61 +- message: GlobalFixtureWithSetup::setup-calling function done + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 55 +- message: GlobalFixtureWithSetup dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithSetup<&very_bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy": very_bad_foo is fatal +Failure occurred in a following context: + some context +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 52 +- message: GlobalFixtureWithSetup ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 59 +- message: GlobalFixtureWithSetup::setup-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 55 +- message: GlobalFixtureWithSetup dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy no errors": very_bad_foo is fatal +Failure occurred in a following context: + some context +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 52 +- message: GlobalFixtureWithSetup ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 59 +- message: GlobalFixtureWithSetup::setup-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 55 +- message: GlobalFixtureWithSetup dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithSetup<&very_bad_exception> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 52 +- message: GlobalFixtureWithSetup ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 59 +- message: GlobalFixtureWithSetup::setup-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 55 +- message: GlobalFixtureWithSetup dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" name="very_bad_exception" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/very_bad_exception' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 test cases inside' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/1 bad test case inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy no errors": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="52"><![CDATA[GlobalFixtureWithSetup ctor]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="59"><![CDATA[GlobalFixtureWithSetup::setup-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><Message file="xxx/test-macro-global-fixture.cpp" line="55"><![CDATA[GlobalFixtureWithSetup dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 52 +- message: GlobalFixtureWithSetup ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 59 +- message: GlobalFixtureWithSetup::setup-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 55 +- message: GlobalFixtureWithSetup dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/almost_good_foo' +- reason: '']]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo' +- disabled test unit: 'Fake Test Suite Hierarchy no errors/1 test cases inside' +- reason: '']]></system-out> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithTeardown<&good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="77"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function done]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="71"><![CDATA[GlobalFixtureWithTeardown dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="77"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function done]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="71"><![CDATA[GlobalFixtureWithTeardown dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithTeardown<&almost_good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="xxx/test-macro-global-fixture.cpp" line="77"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function done]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="71"><![CDATA[GlobalFixtureWithTeardown dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="xxx/test-macro-global-fixture.cpp" line="77"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function done]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="71"><![CDATA[GlobalFixtureWithTeardown dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithTeardown<&bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy": non sense +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="77"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function done]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="71"><![CDATA[GlobalFixtureWithTeardown dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 68 +- message: GlobalFixtureWithTeardown ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 75 +- message: GlobalFixtureWithTeardown::teardown-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 77 +- message: GlobalFixtureWithTeardown::teardown-calling function done + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 71 +- message: GlobalFixtureWithTeardown dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy no errors": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy no errors": non sense +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="77"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function done]]></Message><Message file="xxx/test-macro-global-fixture.cpp" line="71"><![CDATA[GlobalFixtureWithTeardown dtor]]></Message></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 68 +- message: GlobalFixtureWithTeardown ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 75 +- message: GlobalFixtureWithTeardown::teardown-calling function + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 77 +- message: GlobalFixtureWithTeardown::teardown-calling function done + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 71 +- message: GlobalFixtureWithTeardown dtor + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="3" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithTeardown<&very_bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 68 +- message: GlobalFixtureWithTeardown ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 75 +- message: GlobalFixtureWithTeardown::teardown-calling function + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy no errors": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 68 +- message: GlobalFixtureWithTeardown ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 75 +- message: GlobalFixtureWithTeardown::teardown-calling function + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="1" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +*********************** +*********************** GlobalFixtureWithTeardown<&very_bad_exception> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:281: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:282: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:282: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:283: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:165: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:283: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:275: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:276: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:276: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:275: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:278: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:279: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:151: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:154: info: check true has passed +xxx/test-macro-global-fixture.cpp:158: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:160: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:279: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:278: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:281: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/test-macro-global-fixture.cpp" line="281"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="282"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/test-macro-global-fixture.cpp" line="283"><FatalError file="xxx/test-macro-global-fixture.cpp" line="165"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/test-macro-global-fixture.cpp" line="284"><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="275"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="276"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="1 bad test case inside" file="xxx/test-macro-global-fixture.cpp" line="278"><TestCase name="bad_foo" file="xxx/test-macro-global-fixture.cpp" line="279"><Error file="xxx/test-macro-global-fixture.cpp" line="151"><![CDATA[]]></Error><Message file="xxx/test-macro-global-fixture.cpp" line="153"><![CDATA[this is a message]]></Message><Info file="xxx/test-macro-global-fixture.cpp" line="154"><![CDATA[check true has passed]]></Info><Error file="xxx/test-macro-global-fixture.cpp" line="158"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/test-macro-global-fixture.cpp" line="160"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 68 +- message: GlobalFixtureWithTeardown ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 75 +- message: GlobalFixtureWithTeardown::teardown-calling function + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 153 +- message: this is a message + +INFO: +- file : test-macro-global-fixture.cpp +- line : 154 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="5" skipped="0" errors="2" failures="2" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/bad_foo +- file: test-macro-global-fixture.cpp +- line: 282 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 165 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_foo +- file: test-macro-global-fixture.cpp +- line: 283 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/very_bad_exception +- file: test-macro-global-fixture.cpp +- line: 284 +]]></system-err> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_bad_test_case_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 151 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 158 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 160 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 bad test case inside/bad_foo +- file: test-macro-global-fixture.cpp +- line: 279 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:293: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:289: Test suite "Fake Test Suite Hierarchy no errors/0 test cases inside" is skipped because disabled +xxx/test-macro-global-fixture.cpp:295: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:147: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:295: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:290: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:291: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:291: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:290: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:174: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy no errors": unknown type +xxx/test-macro-global-fixture.cpp:174: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:293: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy no errors" file="xxx/test-macro-global-fixture.cpp" line="293"><Message file="xxx/test-macro-global-fixture.cpp" line="68"><![CDATA[GlobalFixtureWithTeardown ctor]]></Message><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestCase name="almost_good_foo" file="xxx/test-macro-global-fixture.cpp" line="295"><Warning file="xxx/test-macro-global-fixture.cpp" line="147"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="1 test cases inside" file="xxx/test-macro-global-fixture.cpp" line="290"><TestCase name="good_foo" file="xxx/test-macro-global-fixture.cpp" line="291"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><Message file="xxx/test-macro-global-fixture.cpp" line="75"><![CDATA[GlobalFixtureWithTeardown::teardown-calling function]]></Message><Error file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/test-macro-global-fixture.cpp" line="174"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-out><![CDATA[MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 68 +- message: GlobalFixtureWithTeardown ctor + +MESSAGE: +- file : test-macro-global-fixture.cpp +- line : 75 +- message: GlobalFixtureWithTeardown::teardown-calling function + +]]></system-out> +<system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : test-macro-global-fixture.cpp +- line : 147 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="Fake_Test_Suite_Hierarchy_no_errors" time="0.1234"> +<testcase assertions="2" name="boost_test-setup-teardown" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : test-macro-global-fixture.cpp +- line : 174 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: test-macro-global-fixture.cpp +- line: 174 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: + boost.test global setup/teardown +]]></system-err> +</testcase> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +</testsuite> diff --git a/src/boost/libs/test/test/baseline-outputs/log-count-skipped-tests.pattern b/src/boost/libs/test/test/baseline-outputs/log-count-skipped-tests.pattern new file mode 100644 index 000000000..7a265618d --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/log-count-skipped-tests.pattern @@ -0,0 +1,363 @@ +* 1-format ******************************************************************* +Running 2 test cases... +xxx/log-count-skipped-test.cpp:143: Entering test suite "fake master test suite" +xxx/log-count-skipped-test.cpp:130: Entering test case "test_1" +xxx/log-count-skipped-test.cpp:47: info: check 2 + 2 == 4 has passed +xxx/log-count-skipped-test.cpp:130: Leaving test case "test_1" +xxx/log-count-skipped-test.cpp:131: Test case "fake master test suite/test_2" is skipped because precondition failed: test is skipped because -some precondition- +xxx/log-count-skipped-test.cpp:132: Test case "fake master test suite/test_3" is skipped because disabled +xxx/log-count-skipped-test.cpp:143: Leaving test suite "fake master test suite" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="fake master test suite" file="xxx/log-count-skipped-test.cpp" line="143"><TestCase name="test_1" file="xxx/log-count-skipped-test.cpp" line="130"><Info file="xxx/log-count-skipped-test.cpp" line="47"><![CDATA[check 2 + 2 == 4 has passed]]></Info><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="test_2" skipped="yes" reason="precondition failed: test is skipped because -some precondition-"/><TestCase name="test_3" skipped="yes" reason="disabled"/></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="2" errors="0" failures="0" id="0" name="fake_master_test_suite" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +<system-out><![CDATA[INFO: +- file : log-count-skipped-test.cpp +- line : 47 +- message: check 2 + 2 == 4 has passed + +]]></system-out> +</testcase> +<testcase assertions="0" name="test_2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite/test_2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite/test_3' +- reason: 'disabled']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="2" errors="0" failures="0" id="0" name="fake_master_test_suite" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +</testcase> +<testcase assertions="0" name="test_2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite/test_2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite/test_3' +- reason: 'disabled']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/log-count-skipped-test.cpp:143: Entering test suite "fake master test suite" +xxx/log-count-skipped-test.cpp:130: Entering test case "test_1" +xxx/log-count-skipped-test.cpp:47: info: check 2 + 2 == 4 has passed +xxx/log-count-skipped-test.cpp:130: Leaving test case "test_1" +xxx/log-count-skipped-test.cpp:131: Entering test case "test_2" +xxx/log-count-skipped-test.cpp:52: error: in "fake master test suite/test_2": check 0 == 1 has failed [0 != 1] +xxx/log-count-skipped-test.cpp:131: Leaving test case "test_2" +xxx/log-count-skipped-test.cpp:132: Test case "fake master test suite/test_3" is skipped because disabled +xxx/log-count-skipped-test.cpp:143: Leaving test suite "fake master test suite" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="fake master test suite" file="xxx/log-count-skipped-test.cpp" line="143"><TestCase name="test_1" file="xxx/log-count-skipped-test.cpp" line="130"><Info file="xxx/log-count-skipped-test.cpp" line="47"><![CDATA[check 2 + 2 == 4 has passed]]></Info><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="test_2" file="xxx/log-count-skipped-test.cpp" line="131"><Error file="xxx/log-count-skipped-test.cpp" line="52"><![CDATA[check 0 == 1 has failed [0 != 1]]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="test_3" skipped="yes" reason="disabled"/></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="1" errors="0" failures="1" id="0" name="fake_master_test_suite" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +<system-out><![CDATA[INFO: +- file : log-count-skipped-test.cpp +- line : 47 +- message: check 2 + 2 == 4 has passed + +]]></system-out> +</testcase> +<testcase assertions="1" name="test_2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-count-skipped-test.cpp +- line : 52 +- message: check 0 == 1 has failed [0 != 1] + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: fake master test suite/test_2 +- file: log-count-skipped-test.cpp +- line: 131 +]]></system-err> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite/test_3' +- reason: 'disabled']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="1" errors="0" failures="1" id="0" name="fake_master_test_suite" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +</testcase> +<testcase assertions="1" name="test_2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-count-skipped-test.cpp +- line : 52 +- message: check 0 == 1 has failed [0 != 1] + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: fake master test suite/test_2 +- file: log-count-skipped-test.cpp +- line: 131 +]]></system-err> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite/test_3' +- reason: 'disabled']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 3 test cases... +xxx/log-count-skipped-test.cpp:156: Entering test suite "fake master test suite2" +xxx/log-count-skipped-test.cpp:130: Entering test case "test_1" +xxx/log-count-skipped-test.cpp:47: info: check 2 + 2 == 4 has passed +xxx/log-count-skipped-test.cpp:130: Leaving test case "test_1" +xxx/log-count-skipped-test.cpp:131: Test case "fake master test suite2/test_2" is skipped because precondition failed: test is skipped because -some precondition- +xxx/log-count-skipped-test.cpp:132: Test case "fake master test suite2/test_3" is skipped because disabled +xxx/log-count-skipped-test.cpp:162: Test suite "fake master test suite2/child1" is skipped because disabled +xxx/log-count-skipped-test.cpp:167: Test suite "fake master test suite2/child2" is skipped because precondition failed: test is skipped because -some precondition- +xxx/log-count-skipped-test.cpp:156: Leaving test suite "fake master test suite2" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="fake master test suite2" file="xxx/log-count-skipped-test.cpp" line="156"><TestCase name="test_1" file="xxx/log-count-skipped-test.cpp" line="130"><Info file="xxx/log-count-skipped-test.cpp" line="47"><![CDATA[check 2 + 2 == 4 has passed]]></Info><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="test_2" skipped="yes" reason="precondition failed: test is skipped because -some precondition-"/><TestCase name="test_3" skipped="yes" reason="disabled"/><TestSuite name="child1" skipped="yes" reason="disabled"/><TestSuite name="child2" skipped="yes" reason="precondition failed: test is skipped because -some precondition-"/></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="6" errors="0" failures="0" id="0" name="fake_master_test_suite2" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +<system-out><![CDATA[INFO: +- file : log-count-skipped-test.cpp +- line : 47 +- message: check 2 + 2 == 4 has passed + +]]></system-out> +</testcase> +<testcase assertions="0" name="test_2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/test_2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/test_3' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t1' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t2' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child2" name="test_1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child2/test_1' +- disabled test unit: 'fake master test suite2/child2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +<testcase assertions="0" classname="child2" name="t2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child2/t2' +- disabled test unit: 'fake master test suite2/child2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="6" errors="0" failures="0" id="0" name="fake_master_test_suite2" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +</testcase> +<testcase assertions="0" name="test_2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/test_2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/test_3' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t1' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t2' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child2" name="test_1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child2/test_1' +- disabled test unit: 'fake master test suite2/child2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +<testcase assertions="0" classname="child2" name="t2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child2/t2' +- disabled test unit: 'fake master test suite2/child2' +- reason: 'precondition failed: test is skipped because -some precondition-']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 3 test cases... +xxx/log-count-skipped-test.cpp:156: Entering test suite "fake master test suite2" +xxx/log-count-skipped-test.cpp:130: Entering test case "test_1" +xxx/log-count-skipped-test.cpp:47: info: check 2 + 2 == 4 has passed +xxx/log-count-skipped-test.cpp:130: Leaving test case "test_1" +xxx/log-count-skipped-test.cpp:131: Entering test case "test_2" +xxx/log-count-skipped-test.cpp:52: error: in "fake master test suite2/test_2": check 0 == 1 has failed [0 != 1] +xxx/log-count-skipped-test.cpp:131: Leaving test case "test_2" +xxx/log-count-skipped-test.cpp:132: Test case "fake master test suite2/test_3" is skipped because disabled +xxx/log-count-skipped-test.cpp:162: Test suite "fake master test suite2/child1" is skipped because disabled +xxx/log-count-skipped-test.cpp:167: Entering test suite "child2" +xxx/log-count-skipped-test.cpp:166: Test case "fake master test suite2/child2/test_1" is skipped because disabled +xxx/log-count-skipped-test.cpp:169: Entering test case "t2" +xxx/log-count-skipped-test.cpp:47: info: check 2 + 2 == 4 has passed +xxx/log-count-skipped-test.cpp:169: Leaving test case "t2" +xxx/log-count-skipped-test.cpp:167: Leaving test suite "child2" +xxx/log-count-skipped-test.cpp:156: Leaving test suite "fake master test suite2" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="fake master test suite2" file="xxx/log-count-skipped-test.cpp" line="156"><TestCase name="test_1" file="xxx/log-count-skipped-test.cpp" line="130"><Info file="xxx/log-count-skipped-test.cpp" line="47"><![CDATA[check 2 + 2 == 4 has passed]]></Info><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="test_2" file="xxx/log-count-skipped-test.cpp" line="131"><Error file="xxx/log-count-skipped-test.cpp" line="52"><![CDATA[check 0 == 1 has failed [0 != 1]]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="test_3" skipped="yes" reason="disabled"/><TestSuite name="child1" skipped="yes" reason="disabled"/><TestSuite name="child2" file="xxx/log-count-skipped-test.cpp" line="167"><TestCase name="test_1" skipped="yes" reason="disabled"/><TestCase name="t2" file="xxx/log-count-skipped-test.cpp" line="169"><Info file="xxx/log-count-skipped-test.cpp" line="47"><![CDATA[check 2 + 2 == 4 has passed]]></Info><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="4" errors="0" failures="1" id="0" name="fake_master_test_suite2" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +<system-out><![CDATA[INFO: +- file : log-count-skipped-test.cpp +- line : 47 +- message: check 2 + 2 == 4 has passed + +]]></system-out> +</testcase> +<testcase assertions="1" name="test_2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-count-skipped-test.cpp +- line : 52 +- message: check 0 == 1 has failed [0 != 1] + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: fake master test suite2/test_2 +- file: log-count-skipped-test.cpp +- line: 131 +]]></system-err> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/test_3' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t1' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t2' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child2" name="test_1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child2/test_1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="1" classname="child2" name="t2" time="0.1234"> +<system-out><![CDATA[INFO: +- file : log-count-skipped-test.cpp +- line : 47 +- message: check 2 + 2 == 4 has passed + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="4" errors="0" failures="1" id="0" name="fake_master_test_suite2" time="0.1234"> +<testcase assertions="1" name="test_1" time="0.1234"> +</testcase> +<testcase assertions="1" name="test_2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-count-skipped-test.cpp +- line : 52 +- message: check 0 == 1 has failed [0 != 1] + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: fake master test suite2/test_2 +- file: log-count-skipped-test.cpp +- line: 131 +]]></system-err> +</testcase> +<testcase assertions="0" name="test_3" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/test_3' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t1' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child1" name="t2" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child1/t2' +- disabled test unit: 'fake master test suite2/child1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="0" classname="child2" name="test_1" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'fake master test suite2/child2/test_1' +- reason: 'disabled']]></system-out> +</testcase> +<testcase assertions="1" classname="child2" name="t2" time="0.1234"> +</testcase> +</testsuite> diff --git a/src/boost/libs/test/test/baseline-outputs/log-formatter-context-test.pattern b/src/boost/libs/test/test/baseline-outputs/log-formatter-context-test.pattern new file mode 100644 index 000000000..29961fdd1 --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/log-formatter-context-test.pattern @@ -0,0 +1,176 @@ +* 1-format ******************************************************************* +Running 1 test case... +xxx/log-formatter-test.cpp:330: Entering test suite "1 test cases inside" +xxx/log-formatter-test.cpp:331: Entering test case "context_mixed_foo" +xxx/log-formatter-test.cpp:93: info: check true has passed +Assertion occurred in a following context: + some context +unknown location:0: fatal error: in "1 test cases inside/context_mixed_foo": unknown type +xxx/log-formatter-test.cpp:93: last checkpoint +Failure occurred in a following context: + other context +xxx/log-formatter-test.cpp:331: Leaving test case "context_mixed_foo" +xxx/log-formatter-test.cpp:330: Leaving test suite "1 test cases inside" + +* 1-format ******************************************************************* +Running 1 test case... +unknown location:0: fatal error: in "1 test cases inside/context_mixed_foo": unknown type +xxx/log-formatter-test.cpp:93: last checkpoint +Failure occurred in a following context: + other context + +* 1-format ******************************************************************* +Running 1 test case... +xxx/log-formatter-test.cpp:330: Entering test suite "1 test cases inside" +xxx/log-formatter-test.cpp:331: Entering test case "context_mixed_foo" +xxx/log-formatter-test.cpp:93: info: check true has passed +Assertion occurred in a following context: + some context +unknown location:0: fatal error: in "1 test cases inside/context_mixed_foo": unknown type +xxx/log-formatter-test.cpp:93: last checkpoint +Failure occurred in a following context: + other context +xxx/log-formatter-test.cpp:331: Leaving test case "context_mixed_foo" +xxx/log-formatter-test.cpp:330: Leaving test suite "1 test cases inside" +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="1" failures="0" id="0" name="1_test_cases_inside" time="0.1234"> +<testcase assertions="2" name="context_mixed_foo" time="0.1234"> +<error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 93 + + +CONTEXT: +- 'other context' +]]></error><system-out><![CDATA[INFO: +- file : log-formatter-test.cpp +- line : 93 +- message: check true has passed +- context: + - 'some context' + + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: 1 test cases inside/context_mixed_foo +- file: log-formatter-test.cpp +- line: 331 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 1 test case... +unknown location:0: fatal error: in "1 test cases inside/context_mixed_foo": unknown type +xxx/log-formatter-test.cpp:93: last checkpoint +Failure occurred in a following context: + other context +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="1" failures="0" id="0" name="1_test_cases_inside" time="0.1234"> +<testcase assertions="2" name="context_mixed_foo" time="0.1234"> +<error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 93 + + +CONTEXT: +- 'other context' +]]></error><system-err><![CDATA[Failures detected in: +- test case: 1 test cases inside/context_mixed_foo +- file: log-formatter-test.cpp +- line: 331 +]]></system-err> +</testcase> +</testsuite> +* 2-format ******************************************************************* +<TestLog><TestSuite name="1 test cases inside" file="xxx/log-formatter-test.cpp" line="330"><TestCase name="context_mixed_foo" file="xxx/log-formatter-test.cpp" line="331"><Info file="xxx/log-formatter-test.cpp" line="93"><![CDATA[check true has passed]]><Context><Frame><![CDATA[some context]]></Frame></Context></Info><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/log-formatter-test.cpp" line="93"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[other context]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 2-format ******************************************************************* +<TestLog><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/log-formatter-test.cpp" line="93"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[other context]]></Frame></Context></Exception></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="1" failures="0" id="0" name="1_test_cases_inside" time="0.1234"> +<testcase assertions="2" name="context_mixed_foo" time="0.1234"> +<error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 93 + + +CONTEXT: +- 'other context' +]]></error><system-out><![CDATA[INFO: +- file : log-formatter-test.cpp +- line : 93 +- message: check true has passed +- context: + - 'some context' + + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: 1 test cases inside/context_mixed_foo +- file: log-formatter-test.cpp +- line: 331 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="1" failures="0" id="0" name="1_test_cases_inside" time="0.1234"> +<testcase assertions="2" name="context_mixed_foo" time="0.1234"> +<error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 93 + + +CONTEXT: +- 'other context' +]]></error><system-err><![CDATA[Failures detected in: +- test case: 1 test cases inside/context_mixed_foo +- file: log-formatter-test.cpp +- line: 331 +]]></system-err> +</testcase> +</testsuite> diff --git a/src/boost/libs/test/test/baseline-outputs/log-formatter-test.pattern b/src/boost/libs/test/test/baseline-outputs/log-formatter-test.pattern new file mode 100644 index 000000000..d7f26825c --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/log-formatter-test.pattern @@ -0,0 +1,1371 @@ +* 1-format ******************************************************************* +Running 1 test case... +xxx/log-formatter-test.cpp:159: Entering test suite "1 test cases inside" +xxx/log-formatter-test.cpp:160: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/log-formatter-test.cpp:160: Leaving test case "good_foo" +xxx/log-formatter-test.cpp:159: Leaving test suite "1 test cases inside" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="1 test cases inside" file="xxx/log-formatter-test.cpp" line="159"><TestCase name="good_foo" file="xxx/log-formatter-test.cpp" line="160"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="1_test_cases_inside" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="0" id="0" name="1_test_cases_inside" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 1 test case... +xxx/log-formatter-test.cpp:162: Entering test suite "1 bad test case inside" +xxx/log-formatter-test.cpp:163: Entering test case "bad_foo" +xxx/log-formatter-test.cpp:50: error: in "1 bad test case inside/bad_foo": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "1 bad test case inside/bad_foo": non sense +xxx/log-formatter-test.cpp:163: Leaving test case "bad_foo" +xxx/log-formatter-test.cpp:162: Leaving test suite "1 bad test case inside" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="1 bad test case inside" file="xxx/log-formatter-test.cpp" line="162"><TestCase name="bad_foo" file="xxx/log-formatter-test.cpp" line="163"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="1" id="0" name="1_bad_test_case_inside" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: 1 bad test case inside/bad_foo +- file: log-formatter-test.cpp +- line: 163 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="1" id="0" name="1_bad_test_case_inside" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: 1 bad test case inside/bad_foo +- file: log-formatter-test.cpp +- line: 163 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 1 test case... +xxx/log-formatter-test.cpp:165: Entering test suite "1 almost good test case inside" +xxx/log-formatter-test.cpp:166: Entering test case "almost_good_foo" +xxx/log-formatter-test.cpp:46: warning: in "1 almost good test case inside/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case 1 almost good test case inside/almost_good_foo did not check any assertions +xxx/log-formatter-test.cpp:166: Leaving test case "almost_good_foo" +xxx/log-formatter-test.cpp:165: Leaving test suite "1 almost good test case inside" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="1 almost good test case inside" file="xxx/log-formatter-test.cpp" line="165"><TestCase name="almost_good_foo" file="xxx/log-formatter-test.cpp" line="166"><Warning file="xxx/log-formatter-test.cpp" line="46"><![CDATA[condition 2>3 is not satisfied [2 <= 3]]]></Warning><Message file="boost.test framework" line="0"><![CDATA[Test case 1 almost good test case inside/almost_good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="0" skipped="0" errors="0" failures="0" id="0" name="1_almost_good_test_case_inside" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : log-formatter-test.cpp +- line : 46 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case 1 almost good test case inside/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="0" skipped="0" errors="0" failures="0" id="0" name="1_almost_good_test_case_inside" time="0.1234"> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/log-formatter-test.cpp:168: Entering test suite "2 test cases inside" +xxx/log-formatter-test.cpp:169: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/2 test cases inside/good_foo did not check any assertions +xxx/log-formatter-test.cpp:169: Leaving test case "good_foo" +xxx/log-formatter-test.cpp:170: Entering test case "bad_foo" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/2 test cases inside/bad_foo": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/2 test cases inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/2 test cases inside/bad_foo": non sense +xxx/log-formatter-test.cpp:170: Leaving test case "bad_foo" +xxx/log-formatter-test.cpp:168: Leaving test suite "2 test cases inside" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="2 test cases inside" file="xxx/log-formatter-test.cpp" line="168"><TestCase name="good_foo" file="xxx/log-formatter-test.cpp" line="169"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/2 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="bad_foo" file="xxx/log-formatter-test.cpp" line="170"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="0" errors="0" failures="1" id="0" name="2_test_cases_inside" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/2 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/2 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 170 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="0" errors="0" failures="1" id="0" name="2_test_cases_inside" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/2 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 170 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 3 test cases... +xxx/log-formatter-test.cpp:172: Entering test suite "3 test cases inside" +xxx/log-formatter-test.cpp:173: Entering test case "bad_foo" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/3 test cases inside/bad_foo": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/3 test cases inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/3 test cases inside/bad_foo": non sense +xxx/log-formatter-test.cpp:173: Leaving test case "bad_foo" +xxx/log-formatter-test.cpp:174: Entering test case "very_bad_foo" +xxx/log-formatter-test.cpp:64: fatal error: in "Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/log-formatter-test.cpp:174: Leaving test case "very_bad_foo" +xxx/log-formatter-test.cpp:176: Test case "Fake Test Suite Hierarchy/3 test cases inside/bad_foo2<int>" is skipped because dependency test case "Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo" has failed +xxx/log-formatter-test.cpp:172: Leaving test suite "3 test cases inside" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="3 test cases inside" file="xxx/log-formatter-test.cpp" line="172"><TestCase name="bad_foo" file="xxx/log-formatter-test.cpp" line="173"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/log-formatter-test.cpp" line="174"><FatalError file="xxx/log-formatter-test.cpp" line="64"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="bad_foo2<int>" skipped="yes" reason="dependency test case "Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo" has failed"/></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="1" errors="1" failures="1" id="0" name="3_test_cases_inside" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/3 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 173 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 64 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo +- file: log-formatter-test.cpp +- line: 174 +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo2<int>" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/bad_foo2<int>' +- reason: 'dependency test case "Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo" has failed']]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="1" errors="1" failures="1" id="0" name="3_test_cases_inside" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/3 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 173 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 64 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo +- file: log-formatter-test.cpp +- line: 174 +]]></system-err> +</testcase> +<testcase assertions="0" name="bad_foo2<int>" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/bad_foo2<int>' +- reason: 'dependency test case "Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo" has failed']]></system-out> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 4 test cases... +xxx/log-formatter-test.cpp:180: Entering test suite "4 test cases inside" +xxx/log-formatter-test.cpp:181: Entering test case "bad_foo" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo": non sense +xxx/log-formatter-test.cpp:181: Leaving test case "bad_foo" +xxx/log-formatter-test.cpp:182: Entering test case "very_bad_foo" +xxx/log-formatter-test.cpp:64: fatal error: in "Fake Test Suite Hierarchy/4 test cases inside/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/log-formatter-test.cpp:182: Leaving test case "very_bad_foo" +xxx/log-formatter-test.cpp:183: Entering test case "very_bad_exception" +xxx/log-formatter-test.cpp:73: error: in "Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception": unknown type +xxx/log-formatter-test.cpp:73: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/log-formatter-test.cpp:183: Leaving test case "very_bad_exception" +xxx/log-formatter-test.cpp:184: Entering test case "bad_foo2" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo2": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo2": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo2": non sense +xxx/log-formatter-test.cpp:184: Leaving test case "bad_foo2" +xxx/log-formatter-test.cpp:180: Leaving test suite "4 test cases inside" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="4 test cases inside" file="xxx/log-formatter-test.cpp" line="180"><TestCase name="bad_foo" file="xxx/log-formatter-test.cpp" line="181"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/log-formatter-test.cpp" line="182"><FatalError file="xxx/log-formatter-test.cpp" line="64"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/log-formatter-test.cpp" line="183"><Error file="xxx/log-formatter-test.cpp" line="73"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/log-formatter-test.cpp" line="73"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="bad_foo2" file="xxx/log-formatter-test.cpp" line="184"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="4" skipped="0" errors="2" failures="2" id="0" name="4_test_cases_inside" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 181 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 64 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_foo +- file: log-formatter-test.cpp +- line: 182 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 73 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 73 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception +- file: log-formatter-test.cpp +- line: 183 +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo2 +- file: log-formatter-test.cpp +- line: 184 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="4" skipped="0" errors="2" failures="2" id="0" name="4_test_cases_inside" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 181 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 64 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_foo +- file: log-formatter-test.cpp +- line: 182 +]]></system-err> +</testcase> +<testcase assertions="2" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 73 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 73 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception +- file: log-formatter-test.cpp +- line: 183 +]]></system-err> +</testcase> +<testcase assertions="4" name="bad_foo2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo2 +- file: log-formatter-test.cpp +- line: 184 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 11 test cases... +xxx/log-formatter-test.cpp:186: Entering test suite "Fake Test Suite Hierarchy" +xxx/log-formatter-test.cpp:157: Test suite "Fake Test Suite Hierarchy/0 test cases inside" is skipped because disabled +xxx/log-formatter-test.cpp:159: Entering test suite "1 test cases inside" +xxx/log-formatter-test.cpp:160: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/log-formatter-test.cpp:160: Leaving test case "good_foo" +xxx/log-formatter-test.cpp:219: Entering test case "bad<bool>" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/1 test cases inside/bad<bool>": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/1 test cases inside/bad<bool>": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/1 test cases inside/bad<bool>": non sense +xxx/log-formatter-test.cpp:219: Leaving test case "bad<bool>" +xxx/log-formatter-test.cpp:159: Leaving test suite "1 test cases inside" +xxx/log-formatter-test.cpp:168: Entering test suite "2 test cases inside" +xxx/log-formatter-test.cpp:169: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/2 test cases inside/good_foo did not check any assertions +xxx/log-formatter-test.cpp:169: Leaving test case "good_foo" +xxx/log-formatter-test.cpp:170: Entering test case "bad_foo" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/2 test cases inside/bad_foo": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/2 test cases inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/2 test cases inside/bad_foo": non sense +xxx/log-formatter-test.cpp:170: Leaving test case "bad_foo" +xxx/log-formatter-test.cpp:168: Leaving test suite "2 test cases inside" +xxx/log-formatter-test.cpp:180: Entering test suite "4 test cases inside" +xxx/log-formatter-test.cpp:181: Entering test case "bad_foo" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo": non sense +xxx/log-formatter-test.cpp:181: Leaving test case "bad_foo" +xxx/log-formatter-test.cpp:182: Entering test case "very_bad_foo" +xxx/log-formatter-test.cpp:64: fatal error: in "Fake Test Suite Hierarchy/4 test cases inside/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/log-formatter-test.cpp:182: Leaving test case "very_bad_foo" +xxx/log-formatter-test.cpp:183: Entering test case "very_bad_exception" +xxx/log-formatter-test.cpp:73: error: in "Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception": unknown type +xxx/log-formatter-test.cpp:73: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/log-formatter-test.cpp:183: Leaving test case "very_bad_exception" +xxx/log-formatter-test.cpp:184: Entering test case "bad_foo2" +xxx/log-formatter-test.cpp:50: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo2": +this is a message +xxx/log-formatter-test.cpp:53: info: check true has passed +xxx/log-formatter-test.cpp:57: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo2": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/log-formatter-test.cpp:59: error: in "Fake Test Suite Hierarchy/4 test cases inside/bad_foo2": non sense +xxx/log-formatter-test.cpp:184: Leaving test case "bad_foo2" +xxx/log-formatter-test.cpp:180: Leaving test suite "4 test cases inside" +xxx/log-formatter-test.cpp:172: Test suite "Fake Test Suite Hierarchy/3 test cases inside" is skipped because dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed +xxx/log-formatter-test.cpp:186: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Fake Test Suite Hierarchy" file="xxx/log-formatter-test.cpp" line="186"><TestSuite name="0 test cases inside" skipped="yes" reason="disabled"/><TestSuite name="1 test cases inside" file="xxx/log-formatter-test.cpp" line="159"><TestCase name="good_foo" file="xxx/log-formatter-test.cpp" line="160"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="bad<bool>" file="xxx/log-formatter-test.cpp" line="219"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="2 test cases inside" file="xxx/log-formatter-test.cpp" line="168"><TestCase name="good_foo" file="xxx/log-formatter-test.cpp" line="169"><Message file="boost.test framework" line="0"><![CDATA[Test case Fake Test Suite Hierarchy/2 test cases inside/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="bad_foo" file="xxx/log-formatter-test.cpp" line="170"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="4 test cases inside" file="xxx/log-formatter-test.cpp" line="180"><TestCase name="bad_foo" file="xxx/log-formatter-test.cpp" line="181"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_foo" file="xxx/log-formatter-test.cpp" line="182"><FatalError file="xxx/log-formatter-test.cpp" line="64"><![CDATA[very_bad_foo is fatal]]><Context><Frame><![CDATA[some context]]></Frame></Context></FatalError><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="very_bad_exception" file="xxx/log-formatter-test.cpp" line="183"><Error file="xxx/log-formatter-test.cpp" line="73"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Exception file="unknown location" line="0"><![CDATA[unknown type]]><LastCheckpoint file="xxx/log-formatter-test.cpp" line="73"><![CDATA[]]></LastCheckpoint><Context><Frame><![CDATA[exception context should be shown]]></Frame></Context></Exception><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="bad_foo2" file="xxx/log-formatter-test.cpp" line="184"><Error file="xxx/log-formatter-test.cpp" line="50"><![CDATA[]]></Error><Message file="xxx/log-formatter-test.cpp" line="52"><![CDATA[this is a message]]></Message><Info file="xxx/log-formatter-test.cpp" line="53"><![CDATA[check true has passed]]></Info><Error file="xxx/log-formatter-test.cpp" line="57"><![CDATA[with some message]]><Context><Frame><![CDATA[Context value=something]]></Frame><Frame><![CDATA[Context value2=something different]]></Frame></Context></Error><Error file="xxx/log-formatter-test.cpp" line="59"><![CDATA[non sense]]></Error><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestSuite name="3 test cases inside" skipped="yes" reason="dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed"/></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="8" skipped="3" errors="2" failures="4" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="1_test_cases_inside" name="bad<bool>" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 test cases inside/bad<bool> +- file: log-formatter-test.cpp +- line: 219 +]]></system-err> +</testcase> +<testcase assertions="0" classname="2_test_cases_inside" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Fake Test Suite Hierarchy/2 test cases inside/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" classname="2_test_cases_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/2 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 170 +]]></system-err> +</testcase> +<testcase assertions="0" classname="3_test_cases_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside' +- reason: 'dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed']]></system-out> +</testcase> +<testcase assertions="0" classname="3_test_cases_inside" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside' +- reason: 'dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed']]></system-out> +</testcase> +<testcase assertions="0" classname="3_test_cases_inside" name="bad_foo2<int>" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/bad_foo2<int>' +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside' +- reason: 'dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed']]></system-out> +</testcase> +<testcase assertions="4" classname="4_test_cases_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 181 +]]></system-err> +</testcase> +<testcase assertions="1" classname="4_test_cases_inside" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 64 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_foo +- file: log-formatter-test.cpp +- line: 182 +]]></system-err> +</testcase> +<testcase assertions="2" classname="4_test_cases_inside" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 73 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 73 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception +- file: log-formatter-test.cpp +- line: 183 +]]></system-err> +</testcase> +<testcase assertions="4" classname="4_test_cases_inside" name="bad_foo2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +INFO: +- file : log-formatter-test.cpp +- line : 53 +- message: check true has passed + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo2 +- file: log-formatter-test.cpp +- line: 184 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="8" skipped="3" errors="2" failures="4" id="0" name="Fake_Test_Suite_Hierarchy" time="0.1234"> +<testcase assertions="0" classname="1_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="1_test_cases_inside" name="bad<bool>" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/1 test cases inside/bad<bool> +- file: log-formatter-test.cpp +- line: 219 +]]></system-err> +</testcase> +<testcase assertions="0" classname="2_test_cases_inside" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="4" classname="2_test_cases_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/2 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 170 +]]></system-err> +</testcase> +<testcase assertions="0" classname="3_test_cases_inside" name="bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside' +- reason: 'dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed']]></system-out> +</testcase> +<testcase assertions="0" classname="3_test_cases_inside" name="very_bad_foo" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo' +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside' +- reason: 'dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed']]></system-out> +</testcase> +<testcase assertions="0" classname="3_test_cases_inside" name="bad_foo2<int>" time="0.1234"> +<skipped/> +<system-out><![CDATA[Test case disabled because of the following chain of decision: +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside/bad_foo2<int>' +- disabled test unit: 'Fake Test Suite Hierarchy/3 test cases inside' +- reason: 'dependency test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed']]></system-out> +</testcase> +<testcase assertions="4" classname="4_test_cases_inside" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo +- file: log-formatter-test.cpp +- line: 181 +]]></system-err> +</testcase> +<testcase assertions="1" classname="4_test_cases_inside" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 64 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_foo +- file: log-formatter-test.cpp +- line: 182 +]]></system-err> +</testcase> +<testcase assertions="2" classname="4_test_cases_inside" name="very_bad_exception" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 73 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><error message="unexpected exception" type="uncaught exception"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +unknown type +------------------------------------- + +Last checkpoint: +- message: "" +- file: log-formatter-test.cpp +- line: 73 + + +CONTEXT: +- 'exception context should be shown' +]]></error><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/very_bad_exception +- file: log-formatter-test.cpp +- line: 183 +]]></system-err> +</testcase> +<testcase assertions="4" classname="4_test_cases_inside" name="bad_foo2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: Fake Test Suite Hierarchy/4 test cases inside/bad_foo2 +- file: log-formatter-test.cpp +- line: 184 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 2 test cases... +xxx/log-formatter-test.cpp:193: Entering test suite "Timeout" +xxx/log-formatter-test.cpp:194: Entering test case "good_foo" +Test case Timeout/good_foo did not check any assertions +xxx/log-formatter-test.cpp:194: Leaving test case "good_foo" +xxx/log-formatter-test.cpp:195: Entering test case "timeout_foo" +unknown location:0: fatal error: in "Timeout/timeout_foo": fake timeout +xxx/log-formatter-test.cpp:195: Leaving test case "timeout_foo" +xxx/log-formatter-test.cpp:193: Leaving test suite "Timeout" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Timeout" file="xxx/log-formatter-test.cpp" line="193"><TestCase name="good_foo" file="xxx/log-formatter-test.cpp" line="194"><Message file="boost.test framework" line="0"><![CDATA[Test case Timeout/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="timeout_foo" file="xxx/log-formatter-test.cpp" line="195"><Exception file="unknown location" line="0"><![CDATA[fake timeout]]></Exception><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="1" id="0" name="Timeout" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Timeout/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="1" name="timeout_foo" time="0.1234"> +<error message="unexpected exception" type="execution timeout"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +fake timeout +-------------------------------------]]></error><system-err><![CDATA[Failures detected in: +- test case: Timeout/timeout_foo +- file: log-formatter-test.cpp +- line: 195 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="1" id="0" name="Timeout" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="1" name="timeout_foo" time="0.1234"> +<error message="unexpected exception" type="execution timeout"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +fake timeout +-------------------------------------]]></error><system-err><![CDATA[Failures detected in: +- test case: Timeout/timeout_foo +- file: log-formatter-test.cpp +- line: 195 +]]></system-err> +</testcase> +</testsuite> +* 1-format ******************************************************************* +Running 4 test cases... +xxx/log-formatter-test.cpp:198: Entering test suite "Timeout-nested" +xxx/log-formatter-test.cpp:199: Entering test case "good_foo" +Test case Timeout-nested/good_foo did not check any assertions +xxx/log-formatter-test.cpp:199: Leaving test case "good_foo" +xxx/log-formatter-test.cpp:200: Entering test suite "Timeout" +xxx/log-formatter-test.cpp:201: Entering test case "good_foo" +Test case Timeout-nested/Timeout/good_foo did not check any assertions +xxx/log-formatter-test.cpp:201: Leaving test case "good_foo" +xxx/log-formatter-test.cpp:202: Entering test case "timeout_foo" +unknown location:0: fatal error: in "Timeout-nested/Timeout/timeout_foo": fake timeout +xxx/log-formatter-test.cpp:202: Leaving test case "timeout_foo" +xxx/log-formatter-test.cpp:200: Leaving test suite "Timeout" +xxx/log-formatter-test.cpp:205: Entering test case "good_foo2" +Test case Timeout-nested/good_foo2 did not check any assertions +xxx/log-formatter-test.cpp:205: Leaving test case "good_foo2" +xxx/log-formatter-test.cpp:198: Leaving test suite "Timeout-nested" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="Timeout-nested" file="xxx/log-formatter-test.cpp" line="198"><TestCase name="good_foo" file="xxx/log-formatter-test.cpp" line="199"><Message file="boost.test framework" line="0"><![CDATA[Test case Timeout-nested/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestSuite name="Timeout" file="xxx/log-formatter-test.cpp" line="200"><TestCase name="good_foo" file="xxx/log-formatter-test.cpp" line="201"><Message file="boost.test framework" line="0"><![CDATA[Test case Timeout-nested/Timeout/good_foo did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="timeout_foo" file="xxx/log-formatter-test.cpp" line="202"><Exception file="unknown location" line="0"><![CDATA[fake timeout]]></Exception><TestingTime>ZZZ</TestingTime></TestCase></TestSuite><TestCase name="good_foo2" file="xxx/log-formatter-test.cpp" line="205"><Message file="boost.test framework" line="0"><![CDATA[Test case Timeout-nested/good_foo2 did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="1" id="0" name="Timeout-nested" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Timeout-nested/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" classname="Timeout" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Timeout-nested/Timeout/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="1" classname="Timeout" name="timeout_foo" time="0.1234"> +<error message="unexpected exception" type="execution timeout"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +fake timeout +-------------------------------------]]></error><system-err><![CDATA[Failures detected in: +- test case: Timeout-nested/Timeout/timeout_foo +- file: log-formatter-test.cpp +- line: 202 +]]></system-err> +</testcase> +<testcase assertions="0" name="good_foo2" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Timeout-nested/good_foo2 did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="3" skipped="0" errors="0" failures="1" id="0" name="Timeout-nested" time="0.1234"> +<testcase assertions="0" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="0" classname="Timeout" name="good_foo" time="0.1234"> +</testcase> +<testcase assertions="1" classname="Timeout" name="timeout_foo" time="0.1234"> +<error message="unexpected exception" type="execution timeout"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +fake timeout +-------------------------------------]]></error><system-err><![CDATA[Failures detected in: +- test case: Timeout-nested/Timeout/timeout_foo +- file: log-formatter-test.cpp +- line: 202 +]]></system-err> +</testcase> +<testcase assertions="0" name="good_foo2" time="0.1234"> +</testcase> +</testsuite> diff --git a/src/boost/libs/test/test/baseline-outputs/log-formatter-test.pattern.junit b/src/boost/libs/test/test/baseline-outputs/log-formatter-test.pattern.junit new file mode 100644 index 000000000..31fb9d4ba --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/log-formatter-test.pattern.junit @@ -0,0 +1,154 @@ +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="0" skipped="0" errors="0" failures="0" id="0" name="1_test_cases_inside" time="0.1234"> +<properties> +<property name="platform" value="BOOST_SOME_PLATFORM" /> +<property name="compiler" value="BOOST_SOME_COMPILER" /> +<property name="stl" value="BOOST_SOME_STDLIB" /> +<property name="boost" value="BOOST_1.XX.Y_SOME_VERSION" /> +</properties> +<testcase assertions="0" name="almost_good_foo" time="0.1234"> +<system-out><![CDATA[WARNING: +- file : log-formatter-test.cpp +- line : 46 +- message: condition 2>3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case 1 test cases inside/almost_good_foo did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="1" skipped="0" errors="0" failures="1" id="0" name="Timeout" time="0.1234"> +<properties> +<property name="platform" value="BOOST_SOME_PLATFORM" /> +<property name="compiler" value="BOOST_SOME_COMPILER" /> +<property name="stl" value="BOOST_SOME_STDLIB" /> +<property name="boost" value="BOOST_1.XX.Y_SOME_VERSION" /> +</properties> +<testcase assertions="0" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case Timeout/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="1" name="timeout_foo" time="0.1234"> +<error message="unexpected exception" type="execution timeout"><![CDATA[ +UNCAUGHT EXCEPTION: +- file: unknown location +- line: 0 + + +EXCEPTION STACK TRACE: -------------- +fake timeout +-------------------------------------]]></error><system-err><![CDATA[Failures detected in: +- test case: Timeout/timeout_foo +- file: log-formatter-test.cpp +- line: 262 +]]></system-err> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="4" skipped="0" errors="1" failures="2" id="0" name="1_junit_failure_is_not_error" time="0.1234"> +<testcase assertions="4" name="bad_foo" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: 1 junit failure is not error/bad_foo +- file: log-formatter-test.cpp +- line: 269 +]]></system-err> +</testcase> +<testcase assertions="1" name="very_bad_foo" time="0.1234"> +<failure message="failure" type="fatal error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 64 +- message: very_bad_foo is fatal +- context: + - 'some context' + + +]]></failure><system-err><![CDATA[Failures detected in: +- test case: 1 junit failure is not error/very_bad_foo +- file: log-formatter-test.cpp +- line: 270 +]]></system-err> +</testcase> +<testcase assertions="0" name="good_foo" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case 1 junit failure is not error/good_foo did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="4" name="bad_foo2" time="0.1234"> +<failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 50 +- message: + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 57 +- message: with some message +- context: + - 'Context value=something' + - 'Context value2=something different' + + +]]></failure><failure message="failure" type="assertion error"><![CDATA[ +ASSERTION FAILURE: +- file : log-formatter-test.cpp +- line : 59 +- message: non sense + +]]></failure><system-out><![CDATA[MESSAGE: +- file : log-formatter-test.cpp +- line : 52 +- message: this is a message + +]]></system-out> +<system-err><![CDATA[Failures detected in: +- test case: 1 junit failure is not error/bad_foo2 +- file: log-formatter-test.cpp +- line: 272 +]]></system-err> +</testcase> +</testsuite> diff --git a/src/boost/libs/test/test/baseline-outputs/messages-in-datasets-test.pattern b/src/boost/libs/test/test/baseline-outputs/messages-in-datasets-test.pattern new file mode 100644 index 000000000..a28eab8f5 --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/messages-in-datasets-test.pattern @@ -0,0 +1,85 @@ +* 1-format ******************************************************************* +Running 2 test cases... +xxx/message-in-datatestcase-test.cpp:126: Entering test suite "fake_datatest_case" +xxx/message-in-datatestcase-test.cpp:200: Entering test case "_0" +Testing update : +[context: + sample = util/test_image1.jpg; ] +Update Volume with 100 +[context: + sample = util/test_image1.jpg; ] +Test case fake_datatest_case/_0 did not check any assertions +xxx/message-in-datatestcase-test.cpp:200: Leaving test case "_0" +xxx/message-in-datatestcase-test.cpp:200: Entering test case "_1" +Testing update : +[context: + sample = util/test_image2.jpg; ] +Update Volume with 100 +[context: + sample = util/test_image2.jpg; ] +Test case fake_datatest_case/_1 did not check any assertions +xxx/message-in-datatestcase-test.cpp:200: Leaving test case "_1" +xxx/message-in-datatestcase-test.cpp:126: Leaving test suite "fake_datatest_case" + +* 2-format ******************************************************************* +<TestLog><TestSuite name="fake_datatest_case" file="xxx/message-in-datatestcase-test.cpp" line="126"><TestCase name="_0" file="xxx/message-in-datatestcase-test.cpp" line="200"><Message file="xxx/message-in-datatestcase-test.cpp" line="41"><![CDATA[Testing update :]]><Context><Frame><![CDATA[sample = util/test_image1.jpg; ]]></Frame></Context></Message><Message file="xxx/message-in-datatestcase-test.cpp" line="42"><![CDATA[Update Volume with 100]]><Context><Frame><![CDATA[sample = util/test_image1.jpg; ]]></Frame></Context></Message><Message file="boost.test framework" line="0"><![CDATA[Test case fake_datatest_case/_0 did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase><TestCase name="_1" file="xxx/message-in-datatestcase-test.cpp" line="200"><Message file="xxx/message-in-datatestcase-test.cpp" line="41"><![CDATA[Testing update :]]><Context><Frame><![CDATA[sample = util/test_image2.jpg; ]]></Frame></Context></Message><Message file="xxx/message-in-datatestcase-test.cpp" line="42"><![CDATA[Update Volume with 100]]><Context><Frame><![CDATA[sample = util/test_image2.jpg; ]]></Frame></Context></Message><Message file="boost.test framework" line="0"><![CDATA[Test case fake_datatest_case/_1 did not check any assertions]]></Message><TestingTime>ZZZ</TestingTime></TestCase></TestSuite></TestLog> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="0" errors="0" failures="0" id="0" name="fake_datatest_case" time="0.1234"> +<testcase assertions="0" name="_0" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : message-in-datatestcase-test.cpp +- line : 41 +- message: Testing update : +- context: + - 'sample = util/test_image1.jpg; ' + + +MESSAGE: +- file : message-in-datatestcase-test.cpp +- line : 42 +- message: Update Volume with 100 +- context: + - 'sample = util/test_image1.jpg; ' + + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case fake_datatest_case/_0 did not check any assertions + +]]></system-out> +</testcase> +<testcase assertions="0" name="_1" time="0.1234"> +<system-out><![CDATA[MESSAGE: +- file : message-in-datatestcase-test.cpp +- line : 41 +- message: Testing update : +- context: + - 'sample = util/test_image2.jpg; ' + + +MESSAGE: +- file : message-in-datatestcase-test.cpp +- line : 42 +- message: Update Volume with 100 +- context: + - 'sample = util/test_image2.jpg; ' + + +MESSAGE: +- file : boost.test framework +- line : 0 +- message: Test case fake_datatest_case/_1 did not check any assertions + +]]></system-out> +</testcase> +</testsuite> +* 3-format ******************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<testsuite tests="2" skipped="0" errors="0" failures="0" id="0" name="fake_datatest_case" time="0.1234"> +<testcase assertions="0" name="_0" time="0.1234"> +</testcase> +<testcase assertions="0" name="_1" time="0.1234"> +</testcase> +</testsuite> diff --git a/src/boost/libs/test/test/baseline-outputs/result-report-test.pattern b/src/boost/libs/test/test/baseline-outputs/result-report-test.pattern new file mode 100644 index 000000000..bb6087bd5 --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/result-report-test.pattern @@ -0,0 +1,248 @@ + +*** No errors detected +************************************************************************* + +Test suite "Fake Test Suite Hierarchy/1 test cases inside" has passed with: + 1 test case out of 1 passed + +************************************************************************* + +Test suite "Fake Test Suite Hierarchy/1 test cases inside" has passed with: + 1 test case out of 1 passed + + Test case "Fake Test Suite Hierarchy/1 test cases inside/good_foo" has passed + +************************************************************************* +<TestResult><TestSuite name="1 test cases inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="1 test cases inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="1 test cases inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult>************************************************************************* + +*** No errors detected +************************************************************************* + +Test suite "1 bad test case inside" has passed with: + 1 test case out of 1 passed + 1 assertion out of 1 failed + 1 expected failure + +************************************************************************* + +Test suite "1 bad test case inside" has passed with: + 1 test case out of 1 passed + 1 assertion out of 1 failed + 1 expected failure + + Test case "1 bad test case inside/bad_foo" has passed with: + 1 assertion out of 1 failed + 1 expected failure + +************************************************************************* +<TestResult><TestSuite name="1 bad test case inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="1 bad test case inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="1 bad test case inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="bad_foo" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1"></TestCase></TestSuite></TestResult>************************************************************************* + +*** No errors detected +************************************************************************* + +Test suite "1 almost good test case inside" has passed with: + 1 test case out of 1 passed with warnings + 1 failed warning + +************************************************************************* + +Test suite "1 almost good test case inside" has passed with: + 1 test case out of 1 passed with warnings + 1 failed warning + + Test case "1 almost good test case inside/almost_good_foo" has passed with: + 1 failed warning + +************************************************************************* +<TestResult><TestSuite name="1 almost good test case inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="1" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="1 almost good test case inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="1" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="1 almost good test case inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="1" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="almost_good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0"></TestCase></TestSuite></TestResult>************************************************************************* + +*** No errors detected +************************************************************************* + +Test suite "Fake Test Suite Hierarchy/2 test cases inside" has passed with: + 2 test cases out of 2 passed + 1 assertion out of 1 failed + 1 expected failure + +************************************************************************* + +Test suite "Fake Test Suite Hierarchy/2 test cases inside" has passed with: + 2 test cases out of 2 passed + 1 assertion out of 1 failed + 1 expected failure + + Test case "Fake Test Suite Hierarchy/2 test cases inside/good_foo" has passed + + Test case "Fake Test Suite Hierarchy/2 test cases inside/bad_foo" has passed with: + 1 assertion out of 1 failed + 1 expected failure + +************************************************************************* +<TestResult><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1"></TestCase></TestSuite></TestResult>************************************************************************* + +*** 2 failures are detected in the test suite "Fake Test Suite Hierarchy/3 test cases inside" +************************************************************************* + +Test suite "Fake Test Suite Hierarchy/3 test cases inside" has failed with: + 2 test cases out of 3 failed + 1 test case out of 3 skipped + 1 test case out of 3 aborted + 2 assertions out of 2 failed + +************************************************************************* + +Test suite "Fake Test Suite Hierarchy/3 test cases inside" has failed with: + 2 test cases out of 3 failed + 1 test case out of 3 skipped + 1 test case out of 3 aborted + 2 assertions out of 2 failed + + Test case "Fake Test Suite Hierarchy/3 test cases inside/bad_foo" has failed with: + 1 assertion out of 1 failed + + Test case "Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo" was aborted with: + 1 assertion out of 1 failed + + Test case "Fake Test Suite Hierarchy/3 test cases inside/bad_foo2" was skipped +************************************************************************* +<TestResult><TestSuite name="3 test cases inside" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="2" test_cases_skipped="1" test_cases_aborted="1" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="3 test cases inside" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="2" test_cases_skipped="1" test_cases_aborted="1" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="3 test cases inside" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="2" test_cases_skipped="1" test_cases_aborted="1" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="bad_foo" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="very_bad_foo" result="aborted" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo2" result="skipped" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult>************************************************************************* + +*** 2 failures are detected (1 failure is expected) in the test suite "Fake Test Suite Hierarchy" +************************************************************************* + +Test suite "Fake Test Suite Hierarchy" has failed with: + 3 test cases out of 7 passed + 1 test case out of 7 failed + 3 test cases out of 7 skipped + 2 assertions out of 2 failed + 1 expected failure + +************************************************************************* + +Test suite "Fake Test Suite Hierarchy" has failed with: + 3 test cases out of 7 passed + 1 test case out of 7 failed + 3 test cases out of 7 skipped + 2 assertions out of 2 failed + 1 expected failure + + Test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 failed + 1 assertion out of 1 failed + + Test case "Fake Test Suite Hierarchy/1 test cases inside/good_foo" has passed + + Test case "Fake Test Suite Hierarchy/1 test cases inside/bad_foo" has failed with: + 1 assertion out of 1 failed + + Test suite "Fake Test Suite Hierarchy/2 test cases inside" has passed with: + 2 test cases out of 2 passed + 1 assertion out of 1 failed + 1 expected failure + + Test case "Fake Test Suite Hierarchy/2 test cases inside/good_foo" has passed + + Test case "Fake Test Suite Hierarchy/2 test cases inside/bad_foo" has passed with: + 1 assertion out of 1 failed + 1 expected failure + + Test suite "Fake Test Suite Hierarchy/3 test cases inside" was skipped +************************************************************************* +<TestResult><TestSuite name="Fake Test Suite Hierarchy" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="1" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Fake Test Suite Hierarchy" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="1" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Fake Test Suite Hierarchy" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="1" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestSuite name="1 test cases inside" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1"></TestCase></TestSuite><TestSuite name="3 test cases inside" result="skipped" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestSuite></TestResult>************************************************************************* + +*** 1 failure is detected in the test suite "Char escaping" +************************************************************************* + +Test suite "Char escaping" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 failed + 1 assertion out of 1 failed + +************************************************************************* + +Test suite "Char escaping" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 failed + 1 assertion out of 1 failed + + Test case "Char escaping/good_foo" has passed + + Test case "Char escaping/bad_foo<h>" has failed with: + 1 assertion out of 1 failed + +************************************************************************* +<TestResult><TestSuite name="Char escaping" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Char escaping" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Char escaping" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo<h>" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult>************************************************************************* + +*** 1 failure is detected in the test suite "Timeout" +************************************************************************* + +Test suite "Timeout" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 timed-out + 1 assertion out of 1 failed + +************************************************************************* + +Test suite "Timeout" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 timed-out + 1 assertion out of 1 failed + + Test case "Timeout/good_foo" has passed + + Test case "Timeout/timeout_foo" has timed out with: + 1 assertion out of 1 failed + +************************************************************************* +<TestResult><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="timeout_foo" result="timed-out" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult>************************************************************************* + +*** 1 failure is detected in the test suite "Timeout-nested" +************************************************************************* + +Test suite "Timeout-nested" has failed with: + 3 test cases out of 4 passed + 1 test case out of 4 timed-out + 1 assertion out of 1 failed + +************************************************************************* + +Test suite "Timeout-nested" has failed with: + 3 test cases out of 4 passed + 1 test case out of 4 timed-out + 1 assertion out of 1 failed + + Test case "Timeout-nested/good_foo" has passed + + Test suite "Timeout-nested/Timeout" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 timed-out + 1 assertion out of 1 failed + + Test case "Timeout-nested/Timeout/good_foo" has passed + + Test case "Timeout-nested/Timeout/timeout_foo" has timed out with: + 1 assertion out of 1 failed + + Test case "Timeout-nested/good_foo2" has passed + +************************************************************************* +<TestResult><TestSuite name="Timeout-nested" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Timeout-nested" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult>************************************************************************* +<TestResult><TestSuite name="Timeout-nested" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="timeout_foo" result="timed-out" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite><TestCase name="good_foo2" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult>************************************************************************* diff --git a/src/boost/libs/test/test/baseline-outputs/result_report_test.pattern.default_behaviour b/src/boost/libs/test/test/baseline-outputs/result_report_test.pattern.default_behaviour new file mode 100644 index 000000000..733143b26 --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/result_report_test.pattern.default_behaviour @@ -0,0 +1,339 @@ + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** No errors detected + +* SHORT_REPORT ****************************************************************** + +Test suite "Fake Test Suite Hierarchy/1 test cases inside" has passed with: + 1 test case out of 1 passed + + +* DETAILED_REPORT *************************************************************** + +Test suite "Fake Test Suite Hierarchy/1 test cases inside" has passed with: + 1 test case out of 1 passed + + Test case "Fake Test Suite Hierarchy/1 test cases inside/good_foo" has passed + + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="1 test cases inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="1 test cases inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="1 test cases inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** No errors detected + +* SHORT_REPORT ****************************************************************** + +Test suite "1 bad test case inside" has passed with: + 1 test case out of 1 passed + 1 assertion out of 1 failed + 1 expected failure + + +* DETAILED_REPORT *************************************************************** + +Test suite "1 bad test case inside" has passed with: + 1 test case out of 1 passed + 1 assertion out of 1 failed + 1 expected failure + + Test case "1 bad test case inside/bad_foo" has passed with: + 1 assertion out of 1 failed + 1 expected failure + + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="1 bad test case inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="1 bad test case inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="1 bad test case inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="bad_foo" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1"></TestCase></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** No errors detected + +* SHORT_REPORT ****************************************************************** + +Test suite "1 almost good test case inside" has passed with: + 1 test case out of 1 passed with warnings + 1 failed warning + + +* DETAILED_REPORT *************************************************************** + +Test suite "1 almost good test case inside" has passed with: + 1 test case out of 1 passed with warnings + 1 failed warning + + Test case "1 almost good test case inside/almost_good_foo" has passed with: + 1 failed warning + + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="1 almost good test case inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="1" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="1 almost good test case inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="1" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="1 almost good test case inside" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="1" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="almost_good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="1" expected_failures="0"></TestCase></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** No errors detected + +* SHORT_REPORT ****************************************************************** + +Test suite "Fake Test Suite Hierarchy/2 test cases inside" has passed with: + 2 test cases out of 2 passed + 1 assertion out of 1 failed + 1 expected failure + + +* DETAILED_REPORT *************************************************************** + +Test suite "Fake Test Suite Hierarchy/2 test cases inside" has passed with: + 2 test cases out of 2 passed + 1 assertion out of 1 failed + 1 expected failure + + Test case "Fake Test Suite Hierarchy/2 test cases inside/good_foo" has passed + + Test case "Fake Test Suite Hierarchy/2 test cases inside/bad_foo" has passed with: + 1 assertion out of 1 failed + 1 expected failure + + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1"></TestCase></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** 2 failures are detected in the test suite "Fake Test Suite Hierarchy/3 test cases inside" + +* SHORT_REPORT ****************************************************************** + +Test suite "Fake Test Suite Hierarchy/3 test cases inside" has failed with: + 2 test cases out of 3 failed + 1 test case out of 3 skipped + 1 test case out of 3 aborted + 2 assertions out of 2 failed + + +* DETAILED_REPORT *************************************************************** + +Test suite "Fake Test Suite Hierarchy/3 test cases inside" has failed with: + 2 test cases out of 3 failed + 1 test case out of 3 skipped + 1 test case out of 3 aborted + 2 assertions out of 2 failed + + Test case "Fake Test Suite Hierarchy/3 test cases inside/bad_foo" has failed with: + 1 assertion out of 1 failed + + Test case "Fake Test Suite Hierarchy/3 test cases inside/very_bad_foo" was aborted with: + 1 assertion out of 1 failed + + Test case "Fake Test Suite Hierarchy/3 test cases inside/bad_foo2" was skipped + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="3 test cases inside" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="2" test_cases_skipped="1" test_cases_aborted="1" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="3 test cases inside" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="2" test_cases_skipped="1" test_cases_aborted="1" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="3 test cases inside" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="2" test_cases_skipped="1" test_cases_aborted="1" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="bad_foo" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="very_bad_foo" result="aborted" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo2" result="skipped" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** 2 failures are detected (1 failure is expected) in the test suite "Fake Test Suite Hierarchy" + +* SHORT_REPORT ****************************************************************** + +Test suite "Fake Test Suite Hierarchy" has failed with: + 3 test cases out of 7 passed + 1 test case out of 7 failed + 3 test cases out of 7 skipped + 2 assertions out of 2 failed + 1 expected failure + + +* DETAILED_REPORT *************************************************************** + +Test suite "Fake Test Suite Hierarchy" has failed with: + 3 test cases out of 7 passed + 1 test case out of 7 failed + 3 test cases out of 7 skipped + 2 assertions out of 2 failed + 1 expected failure + + Test suite "Fake Test Suite Hierarchy/1 test cases inside" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 failed + 1 assertion out of 1 failed + + Test case "Fake Test Suite Hierarchy/1 test cases inside/good_foo" has passed + + Test case "Fake Test Suite Hierarchy/1 test cases inside/bad_foo" has failed with: + 1 assertion out of 1 failed + + Test suite "Fake Test Suite Hierarchy/2 test cases inside" has passed with: + 2 test cases out of 2 passed + 1 assertion out of 1 failed + 1 expected failure + + Test case "Fake Test Suite Hierarchy/2 test cases inside/good_foo" has passed + + Test case "Fake Test Suite Hierarchy/2 test cases inside/bad_foo" has passed with: + 1 assertion out of 1 failed + 1 expected failure + + Test suite "Fake Test Suite Hierarchy/3 test cases inside" was skipped + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="Fake Test Suite Hierarchy" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="1" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="Fake Test Suite Hierarchy" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="1" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="Fake Test Suite Hierarchy" result="failed" assertions_passed="0" assertions_failed="2" warnings_failed="0" expected_failures="1" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestSuite name="1 test cases inside" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite><TestSuite name="2 test cases inside" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1" test_cases_passed="2" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo" result="passed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="1"></TestCase></TestSuite><TestSuite name="3 test cases inside" result="skipped" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0" test_cases_passed="0" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="3" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** 1 failure is detected in the test suite "Char escaping" + +* SHORT_REPORT ****************************************************************** + +Test suite "Char escaping" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 failed + 1 assertion out of 1 failed + + +* DETAILED_REPORT *************************************************************** + +Test suite "Char escaping" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 failed + 1 assertion out of 1 failed + + Test case "Char escaping/good_foo" has passed + + Test case "Char escaping/bad_foo<h>" has failed with: + 1 assertion out of 1 failed + + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="Char escaping" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="Char escaping" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="Char escaping" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="1" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="0" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="bad_foo<h>" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** 1 failure is detected in the test suite "Timeout" + +* SHORT_REPORT ****************************************************************** + +Test suite "Timeout" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 timed-out + 1 assertion out of 1 failed + + +* DETAILED_REPORT *************************************************************** + +Test suite "Timeout" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 timed-out + 1 assertion out of 1 failed + + Test case "Timeout/good_foo" has passed + + Test case "Timeout/timeout_foo" has timed out with: + 1 assertion out of 1 failed + + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="timeout_foo" result="timed-out" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult> +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** + +*** 1 failure is detected in the test suite "Timeout-nested" + +* SHORT_REPORT ****************************************************************** + +Test suite "Timeout-nested" has failed with: + 3 test cases out of 4 passed + 1 test case out of 4 timed-out + 1 assertion out of 1 failed + + +* DETAILED_REPORT *************************************************************** + +Test suite "Timeout-nested" has failed with: + 3 test cases out of 4 passed + 1 test case out of 4 timed-out + 1 assertion out of 1 failed + + Test case "Timeout-nested/good_foo" has passed + + Test suite "Timeout-nested/Timeout" has failed with: + 1 test case out of 2 passed + 1 test case out of 2 timed-out + 1 assertion out of 1 failed + + Test case "Timeout-nested/Timeout/good_foo" has passed + + Test case "Timeout-nested/Timeout/timeout_foo" has timed out with: + 1 assertion out of 1 failed + + Test case "Timeout-nested/good_foo2" has passed + + +* NO_REPORT ********************************************************************* + +* CONFIRMATION_REPORT *********************************************************** +<TestResult><TestSuite name="Timeout-nested" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult> +* SHORT_REPORT ****************************************************************** +<TestResult><TestSuite name="Timeout-nested" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"></TestSuite></TestResult> +* DETAILED_REPORT *************************************************************** +<TestResult><TestSuite name="Timeout-nested" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="3" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestSuite name="Timeout" result="failed" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0" test_cases_passed="1" test_cases_passed_with_warnings="0" test_cases_failed="0" test_cases_skipped="0" test_cases_aborted="0" test_cases_timed_out="1" test_suites_timed_out="0"><TestCase name="good_foo" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase><TestCase name="timeout_foo" result="timed-out" assertions_passed="0" assertions_failed="1" warnings_failed="0" expected_failures="0"></TestCase></TestSuite><TestCase name="good_foo2" result="passed" assertions_passed="0" assertions_failed="0" warnings_failed="0" expected_failures="0"></TestCase></TestSuite></TestResult>
\ No newline at end of file diff --git a/src/boost/libs/test/test/baseline-outputs/test_tools-test.pattern b/src/boost/libs/test/test/baseline-outputs/test_tools-test.pattern new file mode 100644 index 000000000..478a1cdd1 --- /dev/null +++ b/src/boost/libs/test/test/baseline-outputs/test_tools-test.pattern @@ -0,0 +1,319 @@ +warning: in "test_BOOST_WARN": condition sizeof(int) == sizeof(short) is not satisfied +info: check sizeof(unsigned char) == sizeof(char) has passed +error: in "test_BOOST_CHECK": check false has failed +error: in "test_BOOST_CHECK": check 1==2 has failed +error: in "test_BOOST_CHECK": check i==1 has failed +info: check i==2 has passed +error: in "test_BOOST_REQUIRE": not aborted +fatal error: in "test_BOOST_REQUIRE": critical check false has failed +fatal error: in "test_BOOST_REQUIRE": critical check j > 5 has failed +info: check j < 5 has passed +error: in "test_BOOST_REQUIRE": not aborted +info: check 'object size 33 is too small' has passed +error: in "test_BOOST_CHECK_MESSAGE": Well, may be that what I believe in +error: in "test_BOOST_CHECK_MESSAGE": Checking predicate failed. Some explanation +info: check 'Could it fail?' has passed +error: in "test_BOOST_CHECK_MESSAGE": Comparing 1 and 2: some explanation +fatal error: in "test_BOOST_REQUIRE_MESSAGE": Here we should stop +info: check 'That's OK' has passed +error: in "test_BOOST_REQUIRE_MESSAGE": not aborted +error: in "test_BOOST_ERROR": Fail to miss an error +fatal error: in "test_BOOST_FAIL": No! No! Show must go on. +error: in "test_BOOST_CHECK_THROW": exception my_exception expected but not raised +warning: in "test_BOOST_CHECK_THROW": exception my_exception expected but not raised +fatal error: in "test_BOOST_CHECK_THROW": exception my_exception expected but not raised +info: check 'exception "my_exception" raised as expected' has passed +error: in "test_BOOST_CHECK_EXCEPTION": exception "my_exception" raised as expected: validation on the raised exception through predicate "is_critical" +info: check 'exception "my_exception" raised as expected: validation on the raised exception through predicate "is_critical"' has passed +error: in "test_BOOST_CHECK_NO_THROW": unexpected exception thrown by throw my_exception() +error: in "test_BOOST_CHECK_EQUAL": check i == j has failed [1 != 2] +error: in "test_BOOST_CHECK_EQUAL": check str1 == str2 has failed [test1 != test12] +error: in "test_BOOST_CHECK_EQUAL": check i+1 == j has failed [4 != 2] +info: check str1 == str3+1 has passed +fatal error: in "test_BOOST_CHECK_EQUAL": critical check str1 == str2 has failed [test != null string] +warning: in "test_BOOST_CHECK_EQUAL": condition b1 == b2 is not satisfied [B(1) != B(2)] +error: in "test_BOOST_CHECK_EQUAL": check c1 == c3 has failed [C(0,100) != C(1,102)]. Index mismatch +error: in "test_BOOST_CHECK_EQUAL": check c1 == c2 has failed [C(0,100) != C(0,101)]. Id mismatch +error: in "test_BOOST_CHECK_EQUAL": check ch1 == ch2 has failed [0xfffffffe != 0xfffffffd] +error: in "test_BOOST_CHECK_LOGICAL_EXPR": check ++i != j has failed [2 == 2] +error: in "test_BOOST_CHECK_LOGICAL_EXPR": check i < j has failed [2 >= 2] +error: in "test_BOOST_CHECK_LOGICAL_EXPR": check i > j has failed [2 <= 2] +error: in "test_BOOST_CHECK_LOGICAL_EXPR": check i <= j has failed [3 > 2] +error: in "test_BOOST_CHECK_LOGICAL_EXPR": check j >= i has failed [2 < 3] +error: in "test_BOOST_CHECK_LOGICAL_EXPR": check str1 != str2 has failed [test1 == test1] +error: in "test_BOOST_CHECK_PREDICATE": check is_even( i ) has failed for ( 17 ) +error: in "test_BOOST_CHECK_PREDICATE": check not_equal_to<int>()( i, 17 ) has failed for ( 17, 17 ) +warning: in "test_BOOST_CHECK_PREDICATE": condition moo( 12, i, j ) is not satisfied for ( 12, 17, 15 ) +error: in "test_BOOST_CHECK_PREDICATE": check compare_lists( l1, l2 ) has failed for ( , ). Different sizes [2!=0] +error: in "test_BOOST_REQUIRE_PREDICATE": not aborted +fatal error: in "test_BOOST_REQUIRE_PREDICATE": critical check less_equal<int>()( arg2, arg1 ) has failed for ( 2, 1 ) +error: in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+7 } has failed. +Mismatch at position 2: 4 != 3 +Mismatch at position 5: 7 != 6 +error: in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+2 } has failed. +Collections size mismatch: 7 != 2 +error: in "test_BOOST_CHECK_BITWISE_EQUAL": check (char)0x06 =.= (char)0x16 has failed. +Mismatch at position 4 +warning: in "test_BOOST_CHECK_BITWISE_EQUAL": condition (char)0x26 =.= (char)0x04 is not satisfied. +Mismatch at position 1 +Mismatch at position 5 +fatal error: in "test_BOOST_CHECK_BITWISE_EQUAL": critical check (char)0x26 =.= (int)0x26 has failed. +Operands bit sizes mismatch: 8 != 32 +still testing +1+1=2 +2+2=4 +struct A +0x14 + 20 +fatal error: in "test_BOOST_TEST_CHECKPOINT": C string: some error +last checkpoint: Going to do a silly things +fatal error: in "test_BOOST_TEST_PASSPOINT": unknown type +last checkpoint +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + some context +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + some more context: 12 +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + info 1 + info 2 + info 3 +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + some sticky context +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + some sticky context + more context +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + some sticky context + different subcontext +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + outer context +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + outer context + inner context +error: in "test_context_logging": check false has failed +Failure occurred in a following context: + outer context +info: check true has passed +error: in "test_BOOST_TEST_basic_arithmetic_op": check false has failed +info: check bc has passed +error: in "test_BOOST_TEST_basic_arithmetic_op": check i == 2 has failed [1 != 2] +error: in "test_BOOST_TEST_basic_arithmetic_op": check i != 1 has failed [1 == 1] +error: in "test_BOOST_TEST_basic_arithmetic_op": check i > 2 has failed [1 <= 2] +error: in "test_BOOST_TEST_basic_arithmetic_op": check i < 1 has failed [1 >= 1] +error: in "test_BOOST_TEST_basic_arithmetic_op": check i <= 0 has failed [1 > 0] +error: in "test_BOOST_TEST_basic_arithmetic_op": check i >= 5 has failed [1 < 5] +error: in "test_BOOST_TEST_basic_arithmetic_op": check i+j >= 5 has failed [1 + 2 < 5] +error: in "test_BOOST_TEST_basic_arithmetic_op": check j-i == 2 has failed [2 - 1 != 2] +error: in "test_BOOST_TEST_basic_arithmetic_op": check *p == 2 has failed [1 != 2] +error: in "test_BOOST_TEST_basic_arithmetic_op": check j-*p == 0 has failed [2 - 1 != 0] +error: in "test_BOOST_TEST_basic_arithmetic_op": check FooType() has failed ['0' evaluates to false] +error: in "test_BOOST_TEST_basic_arithmetic_op": check *F has failed ['0' evaluates to false] +error: in "test_BOOST_TEST_basic_arithmetic_op": check **F has failed ['0' evaluates to false] +error: in "test_BOOST_TEST_basic_arithmetic_op": check ***F has failed ['0' evaluates to false] +error: in "test_BOOST_TEST_basic_arithmetic_op": check &F > 100 has failed [10 <= 100] +error: in "test_BOOST_TEST_basic_arithmetic_op": check &*F > 100 has failed [10 <= 100] +error: in "test_BOOST_TEST_basic_arithmetic_op": check (i == 1) & (j == 1) has failed [true & false] +error: in "test_BOOST_TEST_basic_arithmetic_op": check (i == 2) | (j == 1) has failed [false | false] +error: in "test_BOOST_TEST_basic_arithmetic_op": check ( i == 1 && j == 1 ) has failed +error: in "test_BOOST_TEST_basic_arithmetic_op": check ( i == 2 || j == 1 ) has failed +info: check true has passed +info: check true has passed +error: in "test_BOOST_TEST_basic_arithmetic_op": This message reported instead including 1 and 2 +error: in "test_BOOST_TEST_collection_comp": check v == l has failed: + - mismatch at position 1: [2 == 3] is false + - mismatch at position 2: [3 == 2] is false +error: in "test_BOOST_TEST_collection_comp": check v != v2 has failed: +Collections appear to be equal +error: in "test_BOOST_TEST_collection_comp": check v > l has failed: +Failure at position 1: + - condition [2 > 3] is false + - inverse condition [3 > 2] is true +error: in "test_BOOST_TEST_collection_comp": check v >= l has failed: +Failure at position 1: + - condition [2 >= 3] is false + - inverse condition [3 >= 2] is true +error: in "test_BOOST_TEST_fpv_comp": check d1 == d2 has failed [1.1e-05 != 1.1e-05] +error: in "test_BOOST_TEST_fpv_comp": check d1 == d2 has failed [1.1e-05 != 1.1e-05]: relative difference exceeds tolerance [0.000909091 > 1e-07] +error: in "test_BOOST_TEST_fpv_comp": check d1 != f1 has failed [1.1e-05 == 1.10000001e-05]: relative difference is within tolerance [7.81041e-09 < 1e-07] +error: in "test_BOOST_TEST_fpv_comp": check d1 > d2 has failed [1.1e-05 <= 1.1e-05] +error: in "test_BOOST_TEST_fpv_comp": check d1+1./1e20 > d2 has failed [1.1e-05 + 1e-20 <= 1.1e-05]: operation > on arguments yields 'false'. +error: in "test_BOOST_TEST_fpv_comp": check d2 <= d1 has failed [1.1e-05 > 1.1e-05]: operation == on arguments yields 'false': relative difference exceeds tolerance [0.000909091 > 1e-07]. +error: in "test_BOOST_TEST_fpv_comp": check d1-1e-5 == 0. has failed [1.1e-05 - 1e-05 != 0]: absolute value exceeds tolerance [|1e-06| > 1e-07] +error: in "test_BOOST_TEST_fpv_comp": check d1-1e-5 != 0. has failed [1.1e-05 - 1e-05 == 0]: absolute value is within tolerance [|1e-06| < 0.0001] +error: in "test_BOOST_TEST_fpv_comp": check 0. != 1e-5-d1 has failed [0 == -1e-06]: absolute value is within tolerance [|-1e-06| < 0.0001] +error: in "test_BOOST_TEST_fpv_comp": check d2-1e-5 < 0. has failed [1.1e-05 - 1e-05 >= 0]: operation < on arguments yields 'false'. +error: in "test_BOOST_TEST_fpv_comp": check 1.01 == cd has failed [1.01 != 1]: relative difference exceeds tolerance [0.01 > 0.001] +error: in "test_BOOST_TEST_cstring_comp": check str1 == str2 has failed [test1 != test12] +error: in "test_BOOST_TEST_cstring_comp": check str1 == str3 has failed [test1 != test2] +error: in "test_BOOST_TEST_cstring_comp": check str3 == str2 has failed [test2 != test12] +error: in "test_BOOST_TEST_cstring_comp": check str1 == str4 has failed [test1 != test3] +error: in "test_BOOST_TEST_cstring_comp": check str3 == str4 has failed [test2 != test3] +error: in "test_BOOST_TEST_cstring_comp": check str1 == str5 has failed [test1 != null string] +error: in "test_BOOST_TEST_cstring_comp": check str1 != (str6+1) has failed [test1 == test1] +error: in "test_BOOST_TEST_cstring_comp": check str5 != str5 has failed [null string == null string] +error: in "test_BOOST_TEST_cstring_comp": check str3 < str1 has failed [test2 >= test1] +error: in "test_BOOST_TEST_cstring_comp": check str1 >= str2 has failed [test1 < test12] +error: in "string_comparison_per_element": check s1 == s2 has failed + - mismatch at position 4: ['h' == 'g'] is false +error: in "string_comparison_per_element": check s3 == s4 has failed + - mismatch at position 3: ['l' == 'k'] is false + - mismatch at position 10: ['d' == 't'] is false +error: in "test_BOOST_TEST_bitwise": check a == b has failed [171 != 136]. Bitwise comparison failed +Mismatch at position 0 +Mismatch at position 1 +Mismatch at position 5 +error: in "test_BOOST_TEST_bitwise": check c == b has failed [138 != 136]. Bitwise comparison failed +Mismatch at position 1 +Operands bit sizes mismatch: 16 != 32 +error: in "test_BOOST_TEST_fpv_comp_on_collections": check d1 == d2 has failed [1.1e-05 != 1.11e-05]: relative difference exceeds tolerance [0.00909091 > 0.001] +info: check d1 == d2 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v1 == v2 has failed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v1 == v2 has failed + - mismatch at position 0: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] + - mismatch at position 1: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] + - mismatch at position 2: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v1f == v2f has failed + - mismatch at position 0: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 1: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 2: [1.10000001e-05 == 1.10999999e-05] is false +info: check v1 <= v2 has passed +info: check v1 < v2 has passed +info: check v1 <= v2 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v1 < v2 has failed + - mismatch at position 0: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. + - mismatch at position 1: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. + - mismatch at position 2: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. +info: check v1f < v2f has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 == v2 tolerance<double> ' 1.1e-05 != 1.11e-05 has failed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1f == v2f tolerance<double> ' 1.1e-05 != 1.11e-05 has failed +info: check 'custom error message v1 <= v2 tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v1 < v2 tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1 <= v2 high_tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v1 < v2 high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1f < v2f high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 == v2 tolerance<double> ' 1.1e-05 != 1.11e-05 has failed + - mismatch at position 0: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] + - mismatch at position 1: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] + - mismatch at position 2: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1f == v2f tolerance<double> ' 1.1e-05 != 1.11e-05 has failed + - mismatch at position 0: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 1: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 2: [1.10000001e-05 == 1.10999999e-05] is false +info: check 'custom error message v1 <= v2 tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v1 < v2 tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1 <= v2 high_tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 < v2 high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed + - mismatch at position 0: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. + - mismatch at position 1: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. + - mismatch at position 2: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. +info: check 'custom error message v1f < v2f high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 == v2 tolerance<double> ' 1.1e-05 != 1.11e-05 has failed + - mismatch at position 0: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] + - mismatch at position 1: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] + - mismatch at position 2: [1.1e-05 == 1.11e-05] is false: relative difference exceeds tolerance [0.00909091 > 0.001] +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1f == v2f tolerance<double> ' 1.1e-05 != 1.11e-05 has failed + - mismatch at position 0: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 1: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 2: [1.10000001e-05 == 1.10999999e-05] is false +info: check 'custom error message v1 <= v2 tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v1 < v2 tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1 <= v2 high_tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 < v2 high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed + - mismatch at position 0: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. + - mismatch at position 1: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. + - mismatch at position 2: [1.1e-05 < 1.11e-05] is false: operation != on arguments yields 'false': relative difference is within tolerance [0.00900901 < 0.01]. +info: check 'custom error message v1f < v2f high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 == v2 ' 1.1e-05 != 1.11e-05 has failed + - mismatch at position 0: [1.1e-05 == 1.11e-05] is false + - mismatch at position 1: [1.1e-05 == 1.11e-05] is false + - mismatch at position 2: [1.1e-05 == 1.11e-05] is false +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1f == v2f ' 1.1e-05 != 1.11e-05 has failed + - mismatch at position 0: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 1: [1.10000001e-05 == 1.10999999e-05] is false + - mismatch at position 2: [1.10000001e-05 == 1.10999999e-05] is false +info: check 'custom error message v1 <= v2 ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v1 < v2 ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1f < v2f ' 1.1e-05 >= 1.11e-05 has passed +info: check v1 <= v2 has passed +info: check v1 < v2 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v2 <= v3 has failed +Failure at position 1: + - condition [1.11e-05 <= 1.1e-05] is false: operation == on arguments yields 'false': relative difference exceeds tolerance [0.00909091 > 0.001]. + - inverse condition [1.1e-05 <= 1.11e-05] is true: operation <= on arguments yields 'true'. +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v2 < v3 has failed +Failure at position 1: + - condition [1.11e-05 < 1.1e-05] is false: operation < on arguments yields 'false'. + - inverse condition [1.1e-05 < 1.11e-05] is true +info: check v3 <= v2 has passed +info: check v3 < v2 has passed +info: check v1 <= v2 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v1 < v2 has failed +Collections appear to be equal. +info: check v2 <= v3 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v2 < v3 has failed +Collections appear to be equal. +info: check v3 <= v2 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check v3 < v2 has failed +Collections appear to be equal. +info: check 'custom error message v1 <= v2 ' 1.1e-05 != 1.11e-05 has passed +info: check 'custom error message v1 < v2 ' 1.1e-05 != 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 <= v3 ' 1.1e-05 > 1.11e-05 has failed +Failure at position 1: + - condition [1.11e-05 <= 1.1e-05] is false + - inverse condition [1.1e-05 <= 1.11e-05] is true +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 < v3 ' 1.1e-05 >= 1.11e-05 has failed +Failure at position 1: + - condition [1.11e-05 < 1.1e-05] is false + - inverse condition [1.1e-05 < 1.11e-05] is true +info: check 'custom error message v3 <= v2 ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v3 < v2 ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1 <= v2 tolerance<double> ' 1.1e-05 != 1.11e-05 has passed +info: check 'custom error message v1 < v2 tolerance<double> ' 1.1e-05 != 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 <= v3 tolerance<double> ' 1.1e-05 > 1.11e-05 has failed +Failure at position 1: + - condition [1.11e-05 <= 1.1e-05] is false: operation == on arguments yields 'false': relative difference exceeds tolerance [0.00909091 > 0.001]. + - inverse condition [1.1e-05 <= 1.11e-05] is true: operation <= on arguments yields 'true'. +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 < v3 tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed +Failure at position 1: + - condition [1.11e-05 < 1.1e-05] is false: operation < on arguments yields 'false'. + - inverse condition [1.1e-05 < 1.11e-05] is true +info: check 'custom error message v3 <= v2 tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v3 < v2 tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1 <= v2 high_tolerance<double> ' 1.1e-05 != 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 < v2 high_tolerance<double> ' 1.1e-05 != 1.11e-05 has failed +Collections appear to be equal. +info: check 'custom error message v2 <= v3 high_tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 < v3 high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed +Collections appear to be equal. +info: check 'custom error message v3 <= v2 high_tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v3 < v2 high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed +Collections appear to be equal. +info: check 'custom error message v1 <= v2 tolerance<double> ' 1.1e-05 != 1.11e-05 has passed +info: check 'custom error message v1 < v2 tolerance<double> ' 1.1e-05 != 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 <= v3 tolerance<double> ' 1.1e-05 > 1.11e-05 has failed +Failure at position 1: + - condition [1.11e-05 <= 1.1e-05] is false: operation == on arguments yields 'false': relative difference exceeds tolerance [0.00909091 > 0.001]. + - inverse condition [1.1e-05 <= 1.11e-05] is true: operation <= on arguments yields 'true'. +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 < v3 tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed +Failure at position 1: + - condition [1.11e-05 < 1.1e-05] is false: operation < on arguments yields 'false'. + - inverse condition [1.1e-05 < 1.11e-05] is true +info: check 'custom error message v3 <= v2 tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +info: check 'custom error message v3 < v2 tolerance<double> ' 1.1e-05 >= 1.11e-05 has passed +info: check 'custom error message v1 <= v2 high_tolerance<double> ' 1.1e-05 != 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v1 < v2 high_tolerance<double> ' 1.1e-05 != 1.11e-05 has failed +Collections appear to be equal. +info: check 'custom error message v2 <= v3 high_tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v2 < v3 high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed +Collections appear to be equal. +info: check 'custom error message v3 <= v2 high_tolerance<double> ' 1.1e-05 > 1.11e-05 has passed +error: in "test_BOOST_TEST_fpv_comp_on_collections": check 'custom error message v3 < v2 high_tolerance<double> ' 1.1e-05 >= 1.11e-05 has failed +Collections appear to be equal. diff --git a/src/boost/libs/test/test/execution_monitor-ts/boost_exception-test.cpp b/src/boost/libs/test/test/execution_monitor-ts/boost_exception-test.cpp new file mode 100644 index 000000000..5a8ec589d --- /dev/null +++ b/src/boost/libs/test/test/execution_monitor-ts/boost_exception-test.cpp @@ -0,0 +1,72 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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. +// +// Checks boost::exception, see https://github.com/boostorg/test/issues/147 +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/output_test_stream.hpp> + +// BOOST +#include <boost/exception/exception.hpp> +#include <boost/exception/info.hpp> +#include <boost/cstdint.hpp> + +#include <iostream> +#include <ios> + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; + +typedef boost::error_info<struct tag_error_code, boost::uint32_t> error_code; +typedef boost::error_info<struct tag_error_string, std::string> error_string; +struct myexception : std::exception, virtual boost::exception +{}; + +// this one should generate a message as it does not execute any assertion +void exception_raised() { + BOOST_THROW_EXCEPTION( myexception() << error_code(123) << error_string("error%%string") ); +} + +struct output_test_stream2 : public output_test_stream { + std::string get_stream_string_representation() const { + (void)const_cast<output_test_stream2*>(this)->output_test_stream::check_length(0, false); // to sync only!! + return output_test_stream::get_stream_string_representation(); + } +}; + +BOOST_AUTO_TEST_CASE( test_logs ) +{ + test_suite* ts_main = BOOST_TEST_SUITE( "fake master" ); + ts_main->add( BOOST_TEST_CASE( exception_raised ) ); + + output_test_stream2 test_output; + + ts_main->p_default_status.value = test_unit::RS_ENABLED; + boost::unit_test::unit_test_log.set_stream(test_output); + boost::unit_test::unit_test_log.set_threshold_level( log_successful_tests ); + + framework::finalize_setup_phase( ts_main->p_id ); + framework::run( ts_main->p_id, false ); // do not continue the test tree to have the test_log_start/end + + boost::unit_test::unit_test_log.set_stream(std::cout); + + std::string error_string(test_output.get_stream_string_representation()); + // the message is "Dynamic exception type: boost::exception_detail::clone_impl<myexception>" on Unix + // and "Dynamic exception type: boost::exception_detail::clone_impl<struct myexception>" on Windows. + // Also contains "[tag_error_code*] = 123" on Unix and "[struct tag_error_code * __ptr64] = 123" On Windows + // Also contains "[tag_error_string*] = error%%string" on Unix and "[struct tag_error_string * __ptr64] = error%%string" On Windows + BOOST_TEST(error_string.find("tag_error_code") != std::string::npos); + BOOST_TEST(error_string.find("= 123") != std::string::npos); + BOOST_TEST(error_string.find("tag_error_string") != std::string::npos); + BOOST_TEST(error_string.find("= error%%string") != std::string::npos); + BOOST_TEST(error_string.find("Dynamic exception type") != std::string::npos); + BOOST_TEST(error_string.find("boost::wrapexcept<") != std::string::npos); + BOOST_TEST(error_string.find("myexception>") != std::string::npos); +} diff --git a/src/boost/libs/test/test/execution_monitor-ts/custom-exception-test.cpp b/src/boost/libs/test/test/execution_monitor-ts/custom-exception-test.cpp new file mode 100644 index 000000000..ee389fc61 --- /dev/null +++ b/src/boost/libs/test/test/execution_monitor-ts/custom-exception-test.cpp @@ -0,0 +1,77 @@ +// (C) Copyright Gennadiy Rozental 2003-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : unit test for custon user exception translator registry +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_monitor.hpp> +using namespace boost::unit_test; + +//____________________________________________________________________________// + +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; +}; + +//____________________________________________________________________________// + +void throw_my_exception1() +{ + throw my_exception1( 12 ); +} + +void my_exception1_translator( my_exception1 ) +{ + BOOST_TEST_MESSAGE( "Caught my_exception1" ); +} + +//____________________________________________________________________________// + +void throw_my_exception2() +{ + throw my_exception2( 89 ); +} + +void my_exception2_translator( my_exception2 ) +{ + BOOST_TEST_MESSAGE( "Caught my_exception2" ); +} + +//____________________________________________________________________________// + +test_suite* +init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) { + test_suite* test = BOOST_TEST_SUITE("custom_exception_test"); + + unit_test_monitor.register_exception_translator<my_exception1>( &my_exception1_translator ); + unit_test_monitor.register_exception_translator<my_exception2>( &my_exception2_translator ); + + test->add( BOOST_TEST_CASE( &throw_my_exception1 ) ); + test->add( BOOST_TEST_CASE( &throw_my_exception2 ) ); + + return test; +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/execution_monitor-ts/errors-handling-test.cpp b/src/boost/libs/test/test/execution_monitor-ts/errors-handling-test.cpp new file mode 100644 index 000000000..fa604fa0b --- /dev/null +++ b/src/boost/libs/test/test/execution_monitor-ts/errors-handling-test.cpp @@ -0,0 +1,196 @@ +// (C) Copyright Gennadiy Rozental 2001-2015. +// (C) Copyright Beman Dawes 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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests an ability of Unit Test Framework to catch all kinds +// of test errors in a user code and properly report it. +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/output_test_stream.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/unit_test_suite.hpp> +#include <boost/test/framework.hpp> +#include <boost/test/tree/test_unit.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/output/compiler_log_formatter.hpp> +#include <boost/test/results_reporter.hpp> +#include "../framework-ts/logger-for-tests.hpp" +// STL +#include <iostream> +#include <stdexcept> + +using namespace boost::unit_test; +using namespace boost::test_tools; + +#if defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__DECCXX_VER) +#define LIMITED_TEST +#endif + +namespace { +struct this_test_log_formatter : public boost::unit_test::output::compiler_log_formatter +{ + void print_prefix( std::ostream& output, boost::unit_test::const_string, std::size_t line ) + { + output << line << ": "; + } + + void test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long ) + { + output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl; + } + +}; + +//____________________________________________________________________________// + +char const* log_level_name[] = { + "log_successful_tests", + "log_test_suites", + "log_messages", + "log_warnings", + "log_all_errors", + "log_cpp_exception_errors", + "log_system_errors", + "log_fatal_errors", + "log_nothing" +}; + +enum error_type_enum { + et_begin, + et_none = et_begin, + et_message, + et_warning, + et_user, + et_cpp_exception, +#ifdef LIMITED_TEST + et_fatal_user, +#else + et_system, + et_fatal_user, + et_fatal_system, +#endif + et_end +} error_type; + +char const* error_type_name[] = { + "no error", "user message", "user warning", + "user non-fatal error", "cpp exception", " system error", + "user fatal error", "system fatal error" +}; + +int divide_by_zero = 0; + +void error_on_demand() +{ + switch( error_type ) { + case et_none: + BOOST_CHECK_MESSAGE( divide_by_zero == 0, "no error" ); + break; + + case et_message: + BOOST_TEST_MESSAGE( "message" ); + break; + + case et_warning: + BOOST_WARN_MESSAGE( divide_by_zero != 0, "warning" ); + break; + + case et_user: + BOOST_ERROR( "non-fatal error" ); + break; + + case et_fatal_user: + BOOST_FAIL( "fatal error" ); + + BOOST_ERROR( "Should never reach this code!" ); + break; + + case et_cpp_exception: + BOOST_TEST_CHECKPOINT( "error_on_demand() throw runtime_error" ); + throw std::runtime_error( "test std::runtime error what() message" ); + +#ifndef LIMITED_TEST + case et_system: + BOOST_TEST_CHECKPOINT( "error_on_demand() divide by zero" ); + divide_by_zero = 1 / divide_by_zero; + break; + + case et_fatal_system: + BOOST_TEST_CHECKPOINT( "write to an invalid address" ); + { + int* p = 0; + *p = 0; + + BOOST_ERROR( "Should never reach this code!" ); + } + break; +#endif + default: + BOOST_ERROR( "Should never reach this code!" ); + } + return; +} + +} // local namespace + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_errors_handling ) +{ +#define PATTERN_FILE_NAME "errors-handling-test.pattern" + std::string pattern_file_name( + framework::master_test_suite().argc <= 1 + ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./baseline-outputs/" PATTERN_FILE_NAME) + : framework::master_test_suite().argv[1] ); + +#ifdef LIMITED_TEST + pattern_file_name += "2"; +#endif + + output_test_stream test_output( pattern_file_name, !runtime_config::save_pattern() ); + + test_case* test = BOOST_TEST_CASE( &error_on_demand ); + test->p_default_status.value = test_unit::RS_ENABLED; + framework::finalize_setup_phase( test->p_id ); + + // for each log level + for( log_level level = log_successful_tests; + level <= log_nothing; + level = static_cast<log_level>(level+1) ) + { + // for each error type + for( error_type = et_begin; + error_type != et_end; + error_type = static_cast<error_type_enum>(error_type+1) ) + { + test_output << "\n===========================\n" + << "log level: " << log_level_name[level] << ';' + << " error type: " << error_type_name[error_type] << ";\n" << std::endl; + { + unit_test_log.set_formatter( new this_test_log_formatter ); + log_setup_teardown holder(test_output, OF_CUSTOM_LOGGER, level); + + framework::run( test ); + + } + BOOST_CHECK( test_output.match_pattern() ); + } + } +} + +//____________________________________________________________________________// + +// EOF + diff --git a/src/boost/libs/test/test/framework-ts/check-streams-on-exit.cpp b/src/boost/libs/test/test/framework-ts/check-streams-on-exit.cpp new file mode 100644 index 000000000..decb17147 --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/check-streams-on-exit.cpp @@ -0,0 +1,45 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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 release_streams +#define BOOST_TEST_NO_MAIN +#define BOOST_TEST_ALTERNATIVE_INIT_API +#include <boost/test/included/unit_test.hpp> +#include <iostream> +namespace utf = boost::unit_test; + +// to avoid empty test bed +BOOST_AUTO_TEST_CASE(test1) +{ + BOOST_TEST(true); +} + +int main(int argc, char* argv[]) +{ + int return_value = utf::unit_test_main(init_unit_test, argc, argv); + if(return_value != 0) { + std::cerr << "Error detected while running the test bed" << std::endl; + return return_value; + } + + if( &utf::results_reporter::get_stream() != &std::cerr ) { + std::cerr << "report stream not released properly" << std::endl; + return 1; + } + + utf::output_format outputs_to_tests[] = { utf::OF_CLF, utf::OF_XML, utf::OF_JUNIT, utf::OF_CUSTOM_LOGGER}; + const char* const outputs_to_test_names[] = {"CLF", "XML", "JUNIT", "CUSTOM"}; + + for(int i = 0; i < sizeof(outputs_to_tests)/sizeof(outputs_to_tests[0]); i++) { + std::ostream* stream = utf::unit_test_log.get_stream(outputs_to_tests[i]); + if( stream && stream != &std::cout ) { + std::cerr << "logger stream not released properly for format '" << outputs_to_test_names[i] << "'" << std::endl; + return 1; + } + } + return 0; +} diff --git a/src/boost/libs/test/test/framework-ts/decorators-datatestcase-test.cpp b/src/boost/libs/test/test/framework-ts/decorators-datatestcase-test.cpp new file mode 100644 index 000000000..36b59ac19 --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/decorators-datatestcase-test.cpp @@ -0,0 +1,32 @@ +// (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. + +#define BOOST_TEST_MODULE decorators in dataset + +#include <boost/test/unit_test.hpp> +#include <boost/test/framework.hpp> +#include <boost/test/data/test_case.hpp> +#include <chrono> +#include <thread> + +using namespace boost::unit_test; + +BOOST_TEST_DECORATOR(*decorator::expected_failures(1)) +BOOST_TEST_DECORATOR(*decorator::description("checking the proper description at the test case")) +BOOST_DATA_TEST_CASE(test_expected_failure, data::make({1,2,3,4,5}), value) +{ + BOOST_TEST(false); +} + +BOOST_TEST_DECORATOR(*decorator::timeout(1)) +BOOST_DATA_TEST_CASE(test_timeout, data::xrange(2), value) +{ + // using namespace std::chrono_literals; // C++14 + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + + BOOST_TEST(true); +} diff --git a/src/boost/libs/test/test/framework-ts/log-count-skipped-test.cpp b/src/boost/libs/test/test/framework-ts/log-count-skipped-test.cpp new file mode 100644 index 000000000..c7ed50f2e --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/log-count-skipped-test.cpp @@ -0,0 +1,196 @@ +// (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 + +#define BOOST_TEST_MODULE junit count skipped tests +#include <boost/test/included/unit_test.hpp> + +// our special logger for tests +#include "logger-for-tests.hpp" + +// STL +#include <iostream> +#include <ios> + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; +namespace utf = boost::unit_test; +namespace tt = boost::test_tools; + + +struct skip_with_message +{ + static bool default_enabled; // to control the status from outside + + std::string message; + skip_with_message(std::string m) + : message(m) {} + + tt::assertion_result operator()(utf::test_unit_id) + { + tt::assertion_result ans(skip_with_message::default_enabled); + ans.message() << "test is skipped because " << message; + return ans; + } +}; +bool skip_with_message::default_enabled = false; + +void test_1() +{ + BOOST_CHECK_EQUAL( 2 + 2, 4 ); +} + +void test_2() +{ + BOOST_CHECK_EQUAL( 0, 1 ); +} + +void test_3() +{ + BOOST_CHECK_EQUAL( 0, 1 ); +} + +void check( output_test_stream& output, + output_format log_format, + test_unit_id id, + log_level ll = log_successful_tests ) +{ + class reset_status : public test_tree_visitor { + private: + virtual bool visit( test_unit const& tu ) + { + const_cast<test_unit&>(tu).p_default_status.value = test_case::RS_INHERIT; + const_cast<test_unit&>(tu).p_run_status.value = test_case::RS_INVALID; + return true; + } + } rstatus; + + { + log_setup_teardown holder(output, log_format, ll); + + // reinit the default/run status otherwise we cannot apply the decorators + // after the first run + traverse_test_tree( id, rstatus, true ); + framework::get<test_suite>(id).p_default_status.value = test_unit::RS_ENABLED; + + output << "* " << log_format << "-format *******************************************************************"; + output << std::endl; + + framework::finalize_setup_phase( id ); + framework::run( id, false ); // do not continue the test tree to have the test_log_start/end + output << std::endl; + } + + BOOST_TEST( output.match_pattern(true) ); // flushes the stream at the end of the comparison. +} + +//____________________________________________________________________________// + +void check( output_test_stream& output, test_suite* ts ) +{ + check( output, OF_CLF, ts->p_id ); + check( output, OF_XML, ts->p_id ); + check( output, OF_JUNIT, ts->p_id, log_successful_tests ); + check( output, OF_JUNIT, ts->p_id, log_cpp_exception_errors ); +} + +struct guard { + ~guard() + { + boost::unit_test::unit_test_log.set_format( runtime_config::get<output_format>( runtime_config::btrt_log_format ) ); + boost::unit_test::unit_test_log.set_stream( std::cout ); + } +}; + + +BOOST_AUTO_TEST_CASE( test_logs ) +{ + guard G; + boost::ignore_unused( G ); + +#define PATTERN_FILE_NAME "log-count-skipped-tests.pattern" + + std::string pattern_file_name( + framework::master_test_suite().argc <= 1 + ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./baseline-outputs/" PATTERN_FILE_NAME ) + : framework::master_test_suite().argv[1] ); + + output_test_stream_for_loggers test_output( pattern_file_name, + !runtime_config::save_pattern(), + true, + __FILE__ ); + + test_case* tc1 = BOOST_TEST_CASE(test_1); + test_case* tc2 = BOOST_TEST_CASE(test_2); + test_case* tc3 = BOOST_TEST_CASE(test_3); + + // add decorators to the tests, should happen only once. The status will be reset in the check. + decorator::collector_t* decorator_collector = &(*utf::precondition(skip_with_message("-some precondition-"))); + decorator_collector->store_in( *tc2 ); + decorator_collector->reset(); + + decorator_collector = &(* utf::disabled()); + decorator_collector->store_in( *tc3 ); + decorator_collector->reset(); + + test_suite* ts_main = BOOST_TEST_SUITE( "fake master test suite" ); + ts_main->add( tc1 ); + ts_main->add( tc2 ); + ts_main->add( tc3 ); + + check( test_output, ts_main ); + + // change precondition + skip_with_message::default_enabled = true; + check( test_output, ts_main ); + + // + // disabling sub suites and subtests + test_suite* ts_main2 = BOOST_TEST_SUITE( "fake master test suite2" ); + ts_main2->add( tc1 ); // active + ts_main2->add( tc2 ); // conditionally disabled + ts_main2->add( tc3 ); // disabled + + // all disabled: count increases by 2 + test_suite* ts_sub1 = BOOST_TEST_SUITE( "child1" ); + ts_sub1->add( BOOST_TEST_CASE_NAME(test_1, "t1")); + ts_sub1->add( BOOST_TEST_CASE_NAME(test_1, "t2")); + + test_case* tc_2_1 = BOOST_TEST_CASE(test_1); // disabled + test_suite* ts_sub2 = BOOST_TEST_SUITE( "child2" ); // conditionally disabled + ts_sub2->add( tc_2_1 ); + ts_sub2->add( BOOST_TEST_CASE_NAME(test_1, "t2")); + + ts_main2->add(ts_sub1); + ts_main2->add(ts_sub2); + + + decorator_collector = &(* utf::disabled()); + decorator_collector->store_in( *ts_sub1 ); + decorator_collector->reset(); + + decorator_collector = &(* utf::disabled()); + decorator_collector->store_in( *tc_2_1 ); + decorator_collector->reset(); + + decorator_collector = &(*utf::precondition(skip_with_message("-some precondition-"))); + decorator_collector->store_in( *ts_sub2 ); + decorator_collector->reset(); + + + skip_with_message::default_enabled = false; + check( test_output, ts_main2 ); + // count disabled = 2 (main) + 2 (ts_sub1) + 2 (ts_sub2) + + // change precondition + skip_with_message::default_enabled = true; + check( test_output, ts_main2 ); + // count disabled = 1 (main) + 2 (ts_sub1) + 1 (ts_sub2) +} diff --git a/src/boost/libs/test/test/framework-ts/log-formatter-test.cpp b/src/boost/libs/test/test/framework-ts/log-formatter-test.cpp new file mode 100644 index 000000000..f5db61acf --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/log-formatter-test.cpp @@ -0,0 +1,382 @@ +// (C) Copyright Raffi Enficiaud 2016. +// 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. +// +// tests Unit Test Framework logging facilities against +// pattern file +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/unit_test_suite.hpp> +#include <boost/test/framework.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/utils/nullstream.hpp> +#include <boost/test/execution_monitor.hpp> + +typedef boost::onullstream onullstream_type; + +// BOOST +#include <boost/lexical_cast.hpp> + +// our special logger for tests +#include "logger-for-tests.hpp" + +// STL +#include <iostream> +#include <ios> + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; + + + +//____________________________________________________________________________// + +// this one should generate a message as it does not execute any assertion +void good_foo() {} + +void almost_good_foo() +{ + BOOST_TEST_WARN( 2>3 ); +} + +void bad_foo() { + BOOST_ERROR( "" ); + + BOOST_TEST_MESSAGE("this is a message"); + BOOST_CHECK(true); + + BOOST_TEST_INFO("Context value=something"); + BOOST_TEST_INFO("Context value2=something different"); + BOOST_ERROR( "with some message" ); + + BOOST_CHECK_MESSAGE( 1 == 2.3, "non sense" ); +} + +void very_bad_foo() { + BOOST_TEST_CONTEXT("some context") { + BOOST_FAIL( "very_bad_foo is fatal" ); + } +} + +struct local_exception {}; + +void very_bad_exception() { + BOOST_TEST_INFO("Context value=something"); + BOOST_TEST_INFO("Context value2=something different"); + BOOST_ERROR( "with some message" ); + + BOOST_TEST_INFO("exception context should be shown"); + throw local_exception(); +} + +void bad_foo2() { bad_foo(); } // tests with clashing names + +void timeout_foo() +{ + using boost::execution_exception; + execution_exception::location dummy; + throw execution_exception( + execution_exception::timeout_error, + "fake timeout", + dummy); +} + +void context_mixed_foo() { + BOOST_TEST_CONTEXT("some context") { + BOOST_TEST( true ); + } + + BOOST_TEST_INFO("other context"); + throw local_exception(); +} + +//____________________________________________________________________________// + +void check( output_test_stream& output, + output_format log_format, + test_unit_id id, + log_level ll = log_successful_tests, + output_format additional_format = OF_INVALID) +{ + { + log_setup_teardown holder(output, log_format, ll, invalid_log_level, additional_format); + output << "* " << log_format << "-format *******************************************************************"; + output << std::endl; + framework::finalize_setup_phase( id ); + framework::run( id, false ); // do not continue the test tree to have the test_log_start/end + output << std::endl; + } + + BOOST_TEST( output.match_pattern(true) ); // flushes the stream at the end of the comparison. +} + +//____________________________________________________________________________// + +void check( output_test_stream& output, test_suite* ts ) +{ + ts->p_default_status.value = test_unit::RS_ENABLED; + + check( output, OF_CLF, ts->p_id ); + check( output, OF_XML, ts->p_id ); + check( output, OF_JUNIT, ts->p_id, log_successful_tests ); + check( output, OF_JUNIT, ts->p_id, log_cpp_exception_errors ); // should branch to the log log_all_errors +} + +//____________________________________________________________________________// + +struct guard { + ~guard() + { + boost::unit_test::unit_test_log.set_format( runtime_config::get<output_format>( runtime_config::btrt_log_format ) ); + boost::unit_test::unit_test_log.set_stream( std::cout ); + } +}; + +//____________________________________________________________________________// + +struct save_arguments { + static bool save_pattern() { + if(m_first) { + m_save_pattern = runtime_config::save_pattern(); + m_first = false; + } + return m_save_pattern; + } + + static const std::vector<std::string>& saved_argv() { + if(argv.empty()) { + for(size_t i = 0; i < static_cast<size_t>(framework::master_test_suite().argc); i++) { + argv.push_back(framework::master_test_suite().argv[i]); + } + } + return argv; + } + + static std::string get_pattern_file(const std::string &to_retrieve) { + if(argv.empty()) { + for(size_t i = 0; i < static_cast<size_t>(framework::master_test_suite().argc); i++) { + argv.push_back(framework::master_test_suite().argv[i]); + } + } + + for(size_t i = 0; i < static_cast<size_t>(framework::master_test_suite().argc); i++) { + if(argv[i].find(to_retrieve) != std::string::npos) + return argv[i]; + } + + return ""; + } + + static std::vector<std::string> argv; + static bool m_first; + static bool m_save_pattern; +}; + +bool save_arguments::m_save_pattern = false; +bool save_arguments::m_first = true; +std::vector<std::string> save_arguments::argv = std::vector<std::string>(); + +//____________________________________________________________________________// + + +BOOST_AUTO_TEST_CASE( test_logs ) +{ + guard G; + boost::ignore_unused( G ); + +#define PATTERN_FILE_NAME "log-formatter-test.pattern" + + std::string pattern_file_name( + // we cannot use runtime_config::save_arguments() as one of the test is mutating + // the arguments for testing purposes + // we have to inspect argv as b2 may run the program from an unknown location + save_arguments::saved_argv().size() <= 1 + ? (save_arguments::save_pattern() + ? PATTERN_FILE_NAME + : "./baseline-outputs/" PATTERN_FILE_NAME ) + : save_arguments::get_pattern_file(PATTERN_FILE_NAME)); + + output_test_stream_for_loggers test_output( pattern_file_name, + !save_arguments::save_pattern(), + true, + __FILE__ ); + +#line 157 + 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 ) ); + + test_suite* ts_1b = BOOST_TEST_SUITE( "1 bad test case inside" ); + ts_1b->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_1c = BOOST_TEST_SUITE( "1 almost good test case inside" ); + ts_1c->add( BOOST_TEST_CASE( almost_good_foo ) ); + + test_suite* ts_2 = BOOST_TEST_SUITE( "2 test cases inside" ); + ts_2->add( BOOST_TEST_CASE( good_foo ) ); + ts_2->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_3 = BOOST_TEST_SUITE( "3 test cases inside" ); + ts_3->add( BOOST_TEST_CASE( bad_foo ) ); + test_case* tc1 = BOOST_TEST_CASE( very_bad_foo ); + ts_3->add( tc1 ); + test_case* tc2 = BOOST_TEST_CASE_NAME( bad_foo2 , "bad_foo2<int>" ); // this is for skipped message GH-253 + ts_3->add( tc2 ); + tc2->depends_on( tc1 ); + + test_suite* ts_4 = BOOST_TEST_SUITE( "4 test cases inside" ); + ts_4->add( BOOST_TEST_CASE( bad_foo ) ); + ts_4->add( BOOST_TEST_CASE( very_bad_foo ) ); + ts_4->add( BOOST_TEST_CASE( very_bad_exception ) ); + ts_4->add( BOOST_TEST_CASE( bad_foo2 ) ); + + test_suite* ts_main = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy" ); + ts_main->add( ts_0 ); + ts_main->add( ts_1 ); + ts_main->add( ts_2 ); + ts_main->add( ts_3 ); + ts_main->add( ts_4 ); + + test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" ); + ts_timeout->add( BOOST_TEST_CASE( good_foo ) ); + test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo ); + ts_timeout->add( tc_timeout ); + + test_suite* ts_timeout_nested = BOOST_TEST_SUITE( "Timeout-nested" ); + ts_timeout_nested->add( BOOST_TEST_CASE( good_foo ) ); + test_suite* ts_timeout_internal = BOOST_TEST_SUITE( "Timeout" ); + ts_timeout_internal->add( BOOST_TEST_CASE( good_foo ) ); + test_case * tc_timeout_internal = BOOST_TEST_CASE( timeout_foo ); + ts_timeout_internal->add( tc_timeout_internal ); + ts_timeout_nested->add( ts_timeout_internal ); + ts_timeout_nested->add( BOOST_TEST_CASE_NAME( good_foo, "good_foo2" ) ); + + check( test_output, ts_1 ); + + check( test_output, ts_1b ); + + check( test_output, ts_1c ); + + check( test_output, ts_2 ); + + check( test_output, ts_3 ); + + check( test_output, ts_4 ); + + ts_1->add( BOOST_TEST_CASE_NAME( bad_foo, "bad<bool>" ) ); + ts_3->depends_on( ts_1 ); + + check( test_output, ts_main ); + + check( test_output, ts_timeout ); + + check( test_output, ts_timeout_nested ); +} + + +BOOST_AUTO_TEST_CASE( test_logs_junit_info_closing_tags ) +{ + guard G; + boost::ignore_unused( G ); + +#define PATTERN_FILE_NAME_JUNIT "log-formatter-test.pattern.junit" + + std::string pattern_file_name( + // we cannot use runtime_config::save_arguments() as one of the test is mutating + // the arguments for testing purposes + // we have to inspect argv as b2 may run the program from an unknown location + save_arguments::saved_argv().size() <= 1 + ? (save_arguments::save_pattern() + ? PATTERN_FILE_NAME_JUNIT + : "./baseline-outputs/" PATTERN_FILE_NAME_JUNIT ) + : save_arguments::get_pattern_file(PATTERN_FILE_NAME_JUNIT)); + + output_test_stream_for_loggers test_output( pattern_file_name, + !save_arguments::save_pattern(), + true, + __FILE__ ); + +#line 249 + test_suite* ts_main = BOOST_TEST_SUITE( "1 test cases inside" ); + ts_main->add( BOOST_TEST_CASE( almost_good_foo ) ); + + ts_main->p_default_status.value = test_unit::RS_ENABLED; + char const* argv[] = { "a.exe", "--run_test=*", "--build_info" }; + int argc = sizeof(argv)/sizeof(argv[0]); + boost::unit_test::runtime_config::init( argc, (char**)argv ); + boost::unit_test::framework::impl::setup_for_execution( *ts_main ); + + check( test_output, OF_JUNIT, ts_main->p_id, log_successful_tests ); + + test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" ); + ts_timeout->add( BOOST_TEST_CASE( good_foo ) ); + test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo ); + ts_timeout->add( tc_timeout ); + + check( test_output, OF_JUNIT, ts_timeout->p_id, log_successful_tests ); + + + test_suite* ts_account_failures = BOOST_TEST_SUITE( "1 junit failure is not error" ); + ts_account_failures->add( BOOST_TEST_CASE( bad_foo ) ); + ts_account_failures->add( BOOST_TEST_CASE( very_bad_foo ) ); + ts_account_failures->add( BOOST_TEST_CASE( good_foo ) ); + ts_account_failures->add( BOOST_TEST_CASE( bad_foo2 ) ); + + char const* argv2[] = { "a.exe", "--run_test=*", "--build_info=false" }; + int argc2 = sizeof(argv2)/sizeof(argv2[0]); + boost::unit_test::runtime_config::init( argc2, (char**)argv2 ); + boost::unit_test::framework::impl::setup_for_execution( *ts_account_failures ); + + check( test_output, OF_JUNIT, ts_account_failures->p_id, log_messages ); +} + + +BOOST_AUTO_TEST_CASE( test_logs_context ) +{ + guard G; + boost::ignore_unused( G ); + +#define PATTERN_FILE_NAME_CONTEXT "log-formatter-context-test.pattern" + + std::string pattern_file_name( + // we cannot use runtime_config::save_arguments() as one of the test is mutating + // the arguments for testing purposes + // we have to inspect argv as b2 may run the program from an unknown location + save_arguments::saved_argv().size() <= 1 + ? (save_arguments::save_pattern() + ? PATTERN_FILE_NAME_CONTEXT + : "./baseline-outputs/" PATTERN_FILE_NAME_CONTEXT ) + : save_arguments::get_pattern_file(PATTERN_FILE_NAME_CONTEXT)); + + output_test_stream_for_loggers test_output( pattern_file_name, + !save_arguments::save_pattern(), + true, + __FILE__ ); + +#line 330 + test_suite* ts_1 = BOOST_TEST_SUITE( "1 test cases inside" ); + ts_1->add( BOOST_TEST_CASE( context_mixed_foo ) ); + + ts_1->p_default_status.value = test_unit::RS_ENABLED; + check( test_output, OF_CLF, ts_1->p_id, log_successful_tests ); + check( test_output, OF_CLF, ts_1->p_id, log_cpp_exception_errors ); + check( test_output, OF_CLF, ts_1->p_id, log_successful_tests, OF_JUNIT ); + check( test_output, OF_CLF, ts_1->p_id, log_cpp_exception_errors, OF_JUNIT ); + + check( test_output, OF_XML, ts_1->p_id, log_successful_tests ); + check( test_output, OF_XML, ts_1->p_id, log_cpp_exception_errors ); + check( test_output, OF_JUNIT, ts_1->p_id, log_successful_tests ); + check( test_output, OF_JUNIT, ts_1->p_id, log_cpp_exception_errors ); + +} + + +// EOF diff --git a/src/boost/libs/test/test/framework-ts/logger-for-tests.hpp b/src/boost/libs/test/test/framework-ts/logger-for-tests.hpp new file mode 100644 index 000000000..4a59e5f6d --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/logger-for-tests.hpp @@ -0,0 +1,147 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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. +// +// tests Unit Test Framework logging facilities against +// pattern file +// *************************************************************************** + + +#ifndef BOOST_TEST_TESTS_LOGGER_FOR_TESTS_HPP__ +#define BOOST_TEST_TESTS_LOGGER_FOR_TESTS_HPP__ + +#include <boost/test/tools/output_test_stream.hpp> +#include <boost/test/utils/algorithm.hpp> + +using namespace boost::unit_test; +using boost::test_tools::output_test_stream; + +class output_test_stream_for_loggers : public output_test_stream { + + std::string const source_filename; + std::string const basename; + +public: + explicit output_test_stream_for_loggers( + boost::unit_test::const_string pattern_file_name = boost::unit_test::const_string(), + bool match_or_save = true, + bool text_or_binary = true, + const std::string& source_filename_ = __FILE__) + : output_test_stream(pattern_file_name, match_or_save, text_or_binary) + , source_filename(source_filename_) + , basename(get_basename(source_filename_)) + {} + + static std::string normalize_path(const std::string &str) { + const std::string to_look_for[] = {"\\"}; + const std::string to_replace[] = {"/"}; + return utils::replace_all_occurrences_of( + str, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]) + ); + } + + static std::string get_basename(const std::string &source_filename) { + std::string basename = normalize_path(source_filename); + std::string::size_type basename_pos = basename.rfind('/'); + if(basename_pos != std::string::npos) { + basename = basename.substr(basename_pos+1); + } + return basename; + } + + virtual std::string get_stream_string_representation() const { + std::string current_string = output_test_stream::get_stream_string_representation(); + + std::string pathname_fixes; + { + const std::string to_look_for[] = { source_filename, normalize_path(source_filename)}; + const std::string to_replace[] = {"xxx/" + basename, "xxx/" + basename }; + pathname_fixes = utils::replace_all_occurrences_of( + current_string, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]) + ); + } + + std::string other_vars_fixes; + { + std::ostringstream s_version; + s_version << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; + + const std::string to_look_for[] = {"time=\"*\"", + basename + "(*):", + "unknown location(*):", + "; testing time: *us\n", // removing this is far more easier than adding a testing time + "; testing time: *ms\n", + "<TestingTime>*</TestingTime>", + "condition 2>3 is not satisfied\n", + "condition 2>3 is not satisfied]", + BOOST_PLATFORM, + BOOST_STDLIB, + BOOST_COMPILER, + s_version.str() + }; + + const std::string to_replace[] = {"time=\"0.1234\"", + basename + ":*:" , + "unknown location:*:", + "\n", + "\n", + "<TestingTime>ZZZ</TestingTime>", + "condition 2>3 is not satisfied [2 <= 3]\n", + "condition 2>3 is not satisfied [2 <= 3]]", + "BOOST_SOME_PLATFORM", + "BOOST_SOME_STDLIB", + "BOOST_SOME_COMPILER", + "BOOST_1.XX.Y_SOME_VERSION", + }; + + other_vars_fixes = utils::replace_all_occurrences_with_wildcards( + pathname_fixes, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]) + ); + } + + return other_vars_fixes; + } + +}; + + +// helper for tests +struct log_setup_teardown { + log_setup_teardown( + output_test_stream& output, + output_format log_format, + log_level ll, + log_level level_to_restore = invalid_log_level, + output_format additional_log_format = OF_INVALID) + : m_previous_ll(level_to_restore) + { + boost::unit_test::unit_test_log.set_format(log_format); + if(additional_log_format != OF_INVALID) { + boost::unit_test::unit_test_log.add_format(additional_log_format); + } + boost::unit_test::unit_test_log.set_stream(output); + if(level_to_restore == invalid_log_level) { + m_previous_ll = boost::unit_test::unit_test_log.set_threshold_level(ll); + } + } + + ~log_setup_teardown() { + boost::unit_test::unit_test_log.set_format(OF_CLF); + boost::unit_test::unit_test_log.set_stream(std::cout); + boost::unit_test::unit_test_log.set_threshold_level( m_previous_ll ); + boost::unit_test::unit_test_log.configure(); // forces reconfiguration + } + + log_level m_previous_ll; +}; + +#endif /* BOOST_TEST_TESTS_LOGGER_FOR_TESTS_HPP__ */ diff --git a/src/boost/libs/test/test/framework-ts/master-test-suite-non-copyable-test.cpp b/src/boost/libs/test/test/framework-ts/master-test-suite-non-copyable-test.cpp new file mode 100644 index 000000000..ff2790a4e --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/master-test-suite-non-copyable-test.cpp @@ -0,0 +1,21 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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. + +// checks that the master test suite is not copyable (compilation failure) + +#define BOOST_TEST_MODULE "master test suite non copyable" +#include <boost/test/included/unit_test.hpp> +#include <exception> +#include <iostream> + +BOOST_AUTO_TEST_CASE( check ) +{ + using namespace boost::unit_test; + master_test_suite_t master_copy = framework::master_test_suite(); + std::cerr << "Test called with " << master_copy.argc << " arguments" << std::endl; // to prevent optimization, just in case it compiles... + throw std::runtime_error("Should not reach here "); +} diff --git a/src/boost/libs/test/test/framework-ts/message-in-datatestcase-test.cpp b/src/boost/libs/test/test/framework-ts/message-in-datatestcase-test.cpp new file mode 100644 index 000000000..1da0d9fb3 --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/message-in-datatestcase-test.cpp @@ -0,0 +1,133 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 message in dataset + +#include <boost/test/unit_test.hpp> + +#include <boost/test/unit_test_suite.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/results_collector.hpp> +#include <boost/test/data/monomorphic.hpp> +#include <boost/test/data/test_case.hpp> + +#include <boost/test/framework.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/utils/nullstream.hpp> + +#include "logger-for-tests.hpp" + +// STL +#include <iostream> +#include <ios> + + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; + + + +#line 34 +std::string filenames[] = { "util/test_image1.jpg", "util/test_image2.jpg" }; +BOOST_DATA_TEST_CASE(test_update, + boost::unit_test::data::make(filenames)) +{ + std::string field_name = "Volume"; + int value = 100; + + BOOST_TEST_MESSAGE("Testing update :"); + BOOST_TEST_MESSAGE("Update " << field_name << " with " << value); +} + +void check_pattern_loggers( + output_test_stream& output, + output_format log_format, + test_unit_id id, + bool bt_module_failed = false, + log_level ll = log_successful_tests ) +{ + { + log_setup_teardown holder(output, log_format, ll); + + // output before fixture registration + output << "* " << log_format << "-format *******************************************************************"; + output << std::endl; + + framework::finalize_setup_phase( id ); + + bool setup_error_caught = false; + try { + framework::run( id, false ); // do not continue the test tree to have the test_log_start/end + } + catch (framework::setup_error&) { + BOOST_TEST_MESSAGE("Framework setup_error caught"); + setup_error_caught = true; + } + + output << std::endl; + } + + BOOST_TEST( bt_module_failed == (( results_collector.results( id ).result_code() != 0 ) )); + BOOST_TEST( output.match_pattern(true) ); // flushes the stream at the end of the comparison. +} + +void check_pattern_loggers( + output_test_stream& output, + test_suite* ts, + bool bt_module_failed = false) +{ + ts->p_default_status.value = test_unit::RS_ENABLED; + + check_pattern_loggers( output, OF_CLF, ts->p_id, bt_module_failed ); + check_pattern_loggers( output, OF_XML, ts->p_id, bt_module_failed ); + check_pattern_loggers( output, OF_JUNIT, ts->p_id, bt_module_failed, log_successful_tests ); + check_pattern_loggers( output, OF_JUNIT, ts->p_id, bt_module_failed, log_cpp_exception_errors ); // should branch to the log log_all_errors +} + +struct guard { + ~guard() + { + boost::unit_test::unit_test_log.set_format( runtime_config::get<output_format>( runtime_config::btrt_log_format ) ); + boost::unit_test::unit_test_log.set_stream( std::cout ); + } +}; + + +//____________________________________________________________________________// + + +BOOST_AUTO_TEST_CASE( messages_in_datasets ) +{ + guard G; + boost::ignore_unused( G ); + +#define PATTERN_FILE_NAME "messages-in-datasets-test.pattern" + + std::string pattern_file_name( + framework::master_test_suite().argc == 1 + ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./baseline-outputs/" PATTERN_FILE_NAME ) + : framework::master_test_suite().argv[1] ); + + output_test_stream_for_loggers test_output( pattern_file_name, + !runtime_config::save_pattern(), + true, + __FILE__ ); + + auto dataset = boost::unit_test::data::make(filenames); + + test_unit_generator const& generator = boost::unit_test::data::ds_detail::test_case_gen<test_updatecase, decltype(dataset)>( + "fake_name", + __FILE__, + 200, + std::forward<decltype(dataset)>(dataset) ); + test_suite* ts = BOOST_TEST_SUITE( "fake_datatest_case" ); + while(test_unit *tu = generator.next()) { + ts->add(tu); + } + + check_pattern_loggers(test_output, ts); +} diff --git a/src/boost/libs/test/test/framework-ts/result-report-test.cpp b/src/boost/libs/test/test/framework-ts/result-report-test.cpp new file mode 100644 index 000000000..c43bc65cd --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/result-report-test.cpp @@ -0,0 +1,386 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests Unit Test Framework reporting facilities against +// pattern file +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/results_reporter.hpp> +#include <boost/test/tools/output_test_stream.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/unit_test_suite.hpp> +#include <boost/test/framework.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/utils/nullstream.hpp> +#include <boost/test/execution_monitor.hpp> +typedef boost::onullstream onullstream_type; + +// BOOST +#include <boost/lexical_cast.hpp> + +// STL +#include <iostream> + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; + +//____________________________________________________________________________// + +void good_foo() {} + +void almost_good_foo() { BOOST_TEST_WARN( 2>3 ); } + +void bad_foo() { + onullstream_type null_out; + unit_test_log.set_stream( null_out ); + BOOST_ERROR( "" ); + unit_test_log.set_stream( std::cout ); +} +void bad_foo2() { bad_foo(); } // preventing clashing names +struct log_guard { + ~log_guard() + { + unit_test_log.set_stream( std::cout ); + } +}; + +void very_bad_foo() { + log_guard lg; + boost::ignore_unused( lg ); + onullstream_type null_out; + unit_test_log.set_stream( null_out ); + BOOST_FAIL( "" ); +} + +void timeout_foo() +{ + log_guard lg; + boost::ignore_unused( lg ); + onullstream_type null_out; + unit_test_log.set_stream( null_out ); + using boost::execution_exception; + execution_exception::location dummy; + throw execution_exception( + execution_exception::timeout_error, + "fake timeout", + dummy); +} + +//____________________________________________________________________________// + +void check( output_test_stream& output, output_format report_format, test_unit_id id ) +{ + results_reporter::set_format( report_format ); + + results_reporter::confirmation_report( id ); + output << "*************************************************************************\n"; + BOOST_TEST( output.match_pattern() ); + + results_reporter::short_report( id ); + output << "*************************************************************************\n"; + BOOST_TEST( output.match_pattern() ); + + results_reporter::detailed_report( id ); + output << "*************************************************************************\n"; + BOOST_TEST( output.match_pattern() ); +} + +//____________________________________________________________________________// + +void check( output_test_stream& output, test_suite* ts ) +{ + ts->p_default_status.value = test_unit::RS_ENABLED; + + results_reporter::set_level( NO_REPORT ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + + check( output, OF_CLF, ts->p_id ); + check( output, OF_XML, ts->p_id ); +} + +//____________________________________________________________________________// + +struct guard { + ~guard() + { + results_reporter::set_stream( std::cerr ); + results_reporter::set_format( runtime_config::get<output_format>( + runtime_config::btrt_report_format ) ); + results_reporter::set_level( NO_REPORT ); + } +}; + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_result_reports ) +{ + guard G; + boost::ignore_unused( G ); + +#define PATTERN_FILE_NAME "result_report_test.pattern" + + std::string pattern_file_name( + framework::master_test_suite().argc == 1 + ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./baseline-outputs/" PATTERN_FILE_NAME ) + : framework::master_test_suite().argv[1] ); + + output_test_stream test_output( pattern_file_name, !runtime_config::save_pattern() ); + results_reporter::set_stream( test_output ); + + 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 ) ); + + test_suite* ts_1b = BOOST_TEST_SUITE( "1 bad test case inside" ); + ts_1b->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_1c = BOOST_TEST_SUITE( "1 almost good test case inside" ); + ts_1c->add( BOOST_TEST_CASE( almost_good_foo ) ); + + test_suite* ts_2 = BOOST_TEST_SUITE( "2 test cases inside" ); + ts_2->add( BOOST_TEST_CASE( good_foo ) ); + ts_2->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_3 = BOOST_TEST_SUITE( "3 test cases inside" ); + ts_3->add( BOOST_TEST_CASE( bad_foo ) ); + test_case* tc1 = BOOST_TEST_CASE( very_bad_foo ); + ts_3->add( tc1 ); + test_case* tc2 = BOOST_TEST_CASE( bad_foo2 ); + ts_3->add( tc2 ); + tc2->depends_on( tc1 ); + + test_suite* ts_main = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy" ); + ts_main->add( ts_0 ); + ts_main->add( ts_1 ); + ts_main->add( ts_2 ); + ts_main->add( ts_3 ); + + test_suite* ts_char_escaping = BOOST_TEST_SUITE( "Char escaping" ); + ts_char_escaping->add( BOOST_TEST_CASE( good_foo ) ); + test_case * i_have_problems = BOOST_TEST_CASE( bad_foo ); + i_have_problems->p_name.set("bad_foo<h>"); + ts_char_escaping->add( i_have_problems ); + + test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" ); + ts_timeout->add( BOOST_TEST_CASE( good_foo ) ); + test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo ); + ts_timeout->add( tc_timeout ); + + test_suite* ts_timeout_nested = BOOST_TEST_SUITE( "Timeout-nested" ); + ts_timeout_nested->add( BOOST_TEST_CASE( good_foo ) ); + test_suite* ts_timeout_internal = BOOST_TEST_SUITE( "Timeout" ); + ts_timeout_internal->add( BOOST_TEST_CASE( good_foo ) ); + test_case * tc_timeout_internal = BOOST_TEST_CASE( timeout_foo ); + ts_timeout_internal->add( tc_timeout_internal ); + ts_timeout_nested->add( ts_timeout_internal ); + ts_timeout_nested->add( BOOST_TEST_CASE_NAME( good_foo, "good_foo2" ) ); + + check( test_output, ts_1 ); + + check( test_output, ts_1b ); + + check( test_output, ts_1c ); + + check( test_output, ts_2 ); + + check( test_output, ts_3 ); + ts_1->add( BOOST_TEST_CASE( bad_foo ) ); + ts_3->depends_on( ts_1 ); + + check( test_output, ts_main ); + + check( test_output, ts_char_escaping ); + + check( test_output, ts_timeout ); + + check( test_output, ts_timeout_nested ); + + results_reporter::set_stream( std::cout ); +} + +//____________________________________________________________________________// + + +void check2( output_test_stream& output, output_format report_format, test_unit_id id ) +{ + results_reporter::set_format( report_format ); + + results_reporter::confirmation_report( id ); + output << "*************************************************************************\n"; + BOOST_TEST( output.match_pattern() ); + + results_reporter::short_report( id ); + output << "*************************************************************************\n"; + BOOST_TEST( output.match_pattern() ); + + results_reporter::detailed_report( id ); + output << "*************************************************************************\n"; + BOOST_TEST( output.match_pattern() ); +} + +//____________________________________________________________________________// + +void check2( output_test_stream& output, test_suite* ts ) +{ + ts->p_default_status.value = test_unit::RS_ENABLED; + + output << "\n* NO_REPORT *********************************************************************\n"; + results_reporter::set_level( NO_REPORT ); + results_reporter::set_format( OF_CLF ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + + output << "\n* CONFIRMATION_REPORT ***********************************************************\n"; + results_reporter::set_level( CONFIRMATION_REPORT ); + results_reporter::set_format( OF_CLF ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + + output << "\n* SHORT_REPORT ******************************************************************\n"; + results_reporter::set_level( SHORT_REPORT ); + results_reporter::set_format( OF_CLF ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + + output << "\n* DETAILED_REPORT ***************************************************************\n"; + results_reporter::set_level( DETAILED_REPORT ); + results_reporter::set_format( OF_CLF ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + + // XML + output << "\n* NO_REPORT *********************************************************************\n"; + results_reporter::set_level( NO_REPORT ); + results_reporter::set_format( OF_XML ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + + output << "\n* CONFIRMATION_REPORT ***********************************************************\n"; + results_reporter::set_level( CONFIRMATION_REPORT ); + results_reporter::set_format( OF_XML ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + + output << "\n* SHORT_REPORT ******************************************************************\n"; + results_reporter::set_level( SHORT_REPORT ); + results_reporter::set_format( OF_XML ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + + output << "\n* DETAILED_REPORT ***************************************************************\n"; + results_reporter::set_level( DETAILED_REPORT ); + results_reporter::set_format( OF_XML ); + framework::finalize_setup_phase( ts->p_id ); + framework::run( ts ); + BOOST_TEST( output.match_pattern() ); + +} + +BOOST_AUTO_TEST_CASE( test_result_reports_default_behaviour ) +{ + guard G; + boost::ignore_unused( G ); + +#define PATTERN_FILE_NAME_DEFAULT_BEHAVIOUR "result_report_test.pattern.default_behaviour" + + std::string pattern_file_name( + framework::master_test_suite().argc <= 2 + ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME_DEFAULT_BEHAVIOUR : "./baseline-outputs/" PATTERN_FILE_NAME_DEFAULT_BEHAVIOUR ) + : framework::master_test_suite().argv[2] ); + + output_test_stream test_output( pattern_file_name, !runtime_config::save_pattern() ); + results_reporter::set_stream( test_output ); + + 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 ) ); + + test_suite* ts_1b = BOOST_TEST_SUITE( "1 bad test case inside" ); + ts_1b->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_1c = BOOST_TEST_SUITE( "1 almost good test case inside" ); + ts_1c->add( BOOST_TEST_CASE( almost_good_foo ) ); + + test_suite* ts_2 = BOOST_TEST_SUITE( "2 test cases inside" ); + ts_2->add( BOOST_TEST_CASE( good_foo ) ); + ts_2->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_3 = BOOST_TEST_SUITE( "3 test cases inside" ); + ts_3->add( BOOST_TEST_CASE( bad_foo ) ); + test_case* tc1 = BOOST_TEST_CASE( very_bad_foo ); + ts_3->add( tc1 ); + test_case* tc2 = BOOST_TEST_CASE( bad_foo2 ); + ts_3->add( tc2 ); + tc2->depends_on( tc1 ); + + test_suite* ts_main = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy" ); + ts_main->add( ts_0 ); + ts_main->add( ts_1 ); + ts_main->add( ts_2 ); + ts_main->add( ts_3 ); + + test_suite* ts_char_escaping = BOOST_TEST_SUITE( "Char escaping" ); + ts_char_escaping->add( BOOST_TEST_CASE( good_foo ) ); + test_case * i_have_problems = BOOST_TEST_CASE( bad_foo ); + i_have_problems->p_name.set("bad_foo<h>"); + ts_char_escaping->add( i_have_problems ); + + test_suite* ts_timeout = BOOST_TEST_SUITE( "Timeout" ); + ts_timeout->add( BOOST_TEST_CASE( good_foo ) ); + test_case * tc_timeout = BOOST_TEST_CASE( timeout_foo ); + ts_timeout->add( tc_timeout ); + + test_suite* ts_timeout_nested = BOOST_TEST_SUITE( "Timeout-nested" ); + ts_timeout_nested->add( BOOST_TEST_CASE( good_foo ) ); + test_suite* ts_timeout_internal = BOOST_TEST_SUITE( "Timeout" ); + ts_timeout_internal->add( BOOST_TEST_CASE( good_foo ) ); + test_case * tc_timeout_internal = BOOST_TEST_CASE( timeout_foo ); + ts_timeout_internal->add( tc_timeout_internal ); + ts_timeout_nested->add( ts_timeout_internal ); + ts_timeout_nested->add( BOOST_TEST_CASE_NAME( good_foo, "good_foo2" ) ); + + check2( test_output, ts_1 ); + + check2( test_output, ts_1b ); + + check2( test_output, ts_1c ); + + check2( test_output, ts_2 ); + + check2( test_output, ts_3 ); + ts_1->add( BOOST_TEST_CASE( bad_foo ) ); + ts_3->depends_on( ts_1 ); + + check2( test_output, ts_main ); + + check2( test_output, ts_char_escaping ); + + check2( test_output, ts_timeout ); + + check2( test_output, ts_timeout_nested ); + + results_reporter::set_stream( std::cout ); +} + +// EOF diff --git a/src/boost/libs/test/test/framework-ts/run-by-name-or-label-test.cpp b/src/boost/libs/test/test/framework-ts/run-by-name-or-label-test.cpp new file mode 100644 index 000000000..45db526c2 --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/run-by-name-or-label-test.cpp @@ -0,0 +1,466 @@ +// (C) Copyright Gennadiy Rozental 2003-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. +// +// File : $RCSfile$ +// +// Version : $Revision: 62023 $ +// +// Description : unit test for class properties facility +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE Boost.Test run by name/label implementation test +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/tree/test_case_counter.hpp> +#include <boost/test/tree/traverse.hpp> + +namespace utf = boost::unit_test; + +void A() {} +void B() {} +void C() {} +void D() {} +void E() {} +void F() {} +void longnameA() {} +void Blongname() {} + +//____________________________________________________________________________// + +void +test_count( utf::test_suite* master_ts, char const** argv, int argc, unsigned expected ) +{ + argc /= sizeof(char*); + + BOOST_TEST_INFO( argv[1] ); + if( argc > 2 ) + BOOST_TEST_INFO( argv[2] ); + + utf::runtime_config::init( argc, (char**)argv ); + utf::framework::impl::setup_for_execution( *master_ts ); + + utf::test_case_counter tcc; + utf::traverse_test_tree( master_ts->p_id, tcc ); + BOOST_TEST( tcc.p_count == expected ); +} + +BOOST_AUTO_TEST_CASE( test_run_by_name ) +{ + utf::test_suite* master_ts = BOOST_TEST_SUITE("local master"); + + utf::test_suite* ts1 = BOOST_TEST_SUITE("ts1"); + ts1->add( BOOST_TEST_CASE( &C ) ); + ts1->add( BOOST_TEST_CASE( &D ) ); + + utf::test_suite* ts2 = BOOST_TEST_SUITE("ts2"); + ts2->add( BOOST_TEST_CASE( &A ) ); + ts2->add( BOOST_TEST_CASE( &C ) ); + ts2->add( BOOST_TEST_CASE( &longnameA ) ); + ts2->add( ts1 ); + + master_ts->add( BOOST_TEST_CASE( &A ) ); + master_ts->add( BOOST_TEST_CASE( &B ) ); + master_ts->add( BOOST_TEST_CASE( &longnameA ) ); + master_ts->add( BOOST_TEST_CASE( &Blongname ) ); + master_ts->add( ts2 ); + + master_ts->p_default_status.value = utf::test_unit::RS_ENABLED; + utf::framework::finalize_setup_phase( master_ts->p_id ); + { + utf::framework::impl::setup_for_execution( *master_ts ); + utf::test_case_counter tcc; + utf::traverse_test_tree( master_ts->p_id, tcc ); + BOOST_TEST( tcc.p_count == 9U ); + } + + { + char const* argv[] = { "a.exe", "--run_test=*" }; + test_count( master_ts, argv, sizeof(argv), 9 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!*" }; + test_count( master_ts, argv, sizeof(argv), 0 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=*/*" }; + test_count( master_ts, argv, sizeof(argv), 5 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!*/*" }; + test_count( master_ts, argv, sizeof(argv), 4 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=*/*/*" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + { + char const* argv[] = { "a.exe", "--run_test=!*/*/*" }; + test_count( master_ts, argv, sizeof(argv), 7 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=klmn" }; + test_count( master_ts, argv, sizeof(argv), 0 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!klmn" }; + test_count( master_ts, argv, sizeof(argv), 9 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=A" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!A" }; + test_count( master_ts, argv, sizeof(argv), 8 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=*A" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!*A" }; + test_count( master_ts, argv, sizeof(argv), 7 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=B*" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!B*" }; + test_count( master_ts, argv, sizeof(argv), 7 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=*ngn*" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2" }; + test_count( master_ts, argv, sizeof(argv), 5 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2" }; + test_count( master_ts, argv, sizeof(argv), 4 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/*" }; + test_count( master_ts, argv, sizeof(argv), 5 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/*" }; + test_count( master_ts, argv, sizeof(argv), 4 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/C" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/C" }; + test_count( master_ts, argv, sizeof(argv), 8 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/*A" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/*A" }; + test_count( master_ts, argv, sizeof(argv), 7 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/ts1" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/ts1" }; + test_count( master_ts, argv, sizeof(argv), 7 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/ts1/C" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/ts1/C" }; + test_count( master_ts, argv, sizeof(argv), 8 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/ts1/*D*" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/ts1/*D*" }; + test_count( master_ts, argv, sizeof(argv), 8 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=A,B" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!A,B" }; + test_count( master_ts, argv, sizeof(argv), 7 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=*A,B" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!*A,B" }; + test_count( master_ts, argv, sizeof(argv), 6 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/C,ts1" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/C,ts1" }; + test_count( master_ts, argv, sizeof(argv), 6 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/C,ts1/D" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts2/C,ts1/D" }; + test_count( master_ts, argv, sizeof(argv), 8 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=A", "--run_test=B" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!A", "--run_test=!B" }; + test_count( master_ts, argv, sizeof(argv), 7 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=A", "--run_test=ts2/ts1/C" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=A", "--run_test=ts2/ts1/C,D" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=A", "--run_test=ts2/ts1/C,D:longnameA" }; + test_count( master_ts, argv, sizeof(argv), 4 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2", "--run_test=!ts2/*A" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_run_by_label ) +{ + utf::test_case* tc; + + utf::test_suite* master_ts = BOOST_TEST_SUITE("local master"); + + utf::test_suite* ts1 = BOOST_TEST_SUITE("ts1"); + ts1->add_label( "f2" ); + ts1->add( tc=BOOST_TEST_CASE( &C ) ); + tc->add_label( "L1" ); + ts1->add( tc=BOOST_TEST_CASE( &D ) ); + tc->add_label( "L1" ); + tc->add_label( "l2" ); + + utf::test_suite* ts2 = BOOST_TEST_SUITE("ts2"); + ts2->add_label( "FAST" ); + ts2->add( tc=BOOST_TEST_CASE( &A ) ); + tc->add_label( "L1" ); + ts2->add( BOOST_TEST_CASE( &C ) ); + ts2->add( BOOST_TEST_CASE( &longnameA ) ); + ts2->add( ts1 ); + + master_ts->add( BOOST_TEST_CASE( &A ) ); + master_ts->add( BOOST_TEST_CASE( &B ) ); + master_ts->add( tc=BOOST_TEST_CASE( &longnameA ) ); + tc->add_label( "f2" ); + master_ts->add( BOOST_TEST_CASE( &Blongname ) ); + master_ts->add( ts2 ); + + + master_ts->p_default_status.value = utf::test_unit::RS_ENABLED; + utf::framework::finalize_setup_phase( master_ts->p_id ); + + { + char const* argv[] = { "a.exe", "--run_test=@L1" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!@INV" }; + test_count( master_ts, argv, sizeof(argv), 9 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!@L1" }; + test_count( master_ts, argv, sizeof(argv), 6 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=@l2" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=@inval" }; + test_count( master_ts, argv, sizeof(argv), 0 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=@FAST" }; + test_count( master_ts, argv, sizeof(argv), 5 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=@f2" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=@L1", "--run_test=@l2" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=@L1", "--run_test=!@l2" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_dependency_handling ) +{ + utf::test_case* tc; + utf::test_case* tcB; + + // M | + // / | \ | + // / | \ | + // TS2 TS4 TS3 | + // / \ | / \ | + // C D TS1 E F | + // / \ | + // A B | + // + // D => TS1 + // B => F + + utf::test_suite* master_ts = BOOST_TEST_SUITE("local master"); + + utf::test_suite* ts1 = BOOST_TEST_SUITE("ts1"); + ts1->add( BOOST_TEST_CASE( &A ) ); + ts1->add( tcB=BOOST_TEST_CASE( &B ) ); + + utf::test_suite* ts2 = BOOST_TEST_SUITE("ts2"); + ts2->add( BOOST_TEST_CASE( &C ) ); + ts2->add( tc=BOOST_TEST_CASE( &D ) ); + tc->depends_on( ts1 ); + + utf::test_suite* ts3 = BOOST_TEST_SUITE("ts3"); + ts3->add( BOOST_TEST_CASE( &E ) ); + ts3->add( tc=BOOST_TEST_CASE( &F ) ); + tcB->depends_on( tc ); + + utf::test_suite* ts4 = BOOST_TEST_SUITE("ts4"); + ts4->add( ts1 ); + + master_ts->add( ts2 ); + master_ts->add( ts3 ); + master_ts->add( ts4 ); + + master_ts->p_default_status.value = utf::test_unit::RS_ENABLED; + utf::framework::finalize_setup_phase( master_ts->p_id ); + + { + char const* argv[] = { "a.exe", "--run_test=ts2/C" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts3" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2/C" }; + test_count( master_ts, argv, sizeof(argv), 1 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts4/ts1/B" }; + test_count( master_ts, argv, sizeof(argv), 2 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts4/ts1" }; + test_count( master_ts, argv, sizeof(argv), 3 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=ts2" }; + test_count( master_ts, argv, sizeof(argv), 5 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!ts3/F" }; + test_count( master_ts, argv, sizeof(argv), 5 ); + } + + { + char const* argv[] = { "a.exe", "--run_test=!*/ts1" }; + test_count( master_ts, argv, sizeof(argv), 4 ); + } +} + +//____________________________________________________________________________// + +// EOF + diff --git a/src/boost/libs/test/test/framework-ts/test-macro-global-fixture.cpp b/src/boost/libs/test/test/framework-ts/test-macro-global-fixture.cpp new file mode 100644 index 000000000..9f2440f6f --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/test-macro-global-fixture.cpp @@ -0,0 +1,329 @@ +// (C) Copyright Raffi Enficiaud 2016. +// 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. + +// checks issue https://svn.boost.org/trac/boost/ticket/5563 + +#define BOOST_TEST_MODULE test_macro_in_global_fixture +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/results_collector.hpp> +#include <boost/test/unit_test_suite.hpp> +#include <boost/test/framework.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/utils/nullstream.hpp> +typedef boost::onullstream onullstream_type; +#include <boost/test/utils/algorithm.hpp> + +// BOOST +#include <boost/lexical_cast.hpp> + +// our special logger for tests +#include "logger-for-tests.hpp" + +// STL +#include <iostream> +#include <ios> + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; +namespace utf = boost::unit_test; + + +template < void (*function_to_call)() > +struct GlobalFixtureWithCtor { + GlobalFixtureWithCtor() { + BOOST_TEST_MESSAGE("GlobalFixtureWithCtor: ctor"); + (*function_to_call)(); + // having a message is ok + // although it should break existing logger consistency + } + ~GlobalFixtureWithCtor() { + BOOST_TEST_MESSAGE("GlobalFixtureWithCtor: dtor"); + } +}; + +template < void (*function_to_call)() > +struct GlobalFixtureWithSetup { + GlobalFixtureWithSetup() { + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup ctor"); + } + virtual ~GlobalFixtureWithSetup() { + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup dtor"); + } + + virtual void setup() { + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup::setup-calling function"); + (*function_to_call)(); + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup::setup-calling function done"); + } +}; + +template < void (*function_to_call)() > +struct GlobalFixtureWithTeardown { + GlobalFixtureWithTeardown() { + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown ctor"); + } + virtual ~GlobalFixtureWithTeardown() { + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown dtor"); + } + + virtual void teardown() { + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown::teardown-calling function"); + (*function_to_call)(); + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown::teardown-calling function done"); + } +}; + +template <class global_fixture_t > +void check_global_fixture( + output_test_stream& output, + output_format log_format, + test_unit_id id, + bool bt_module_failed = false, + bool has_setup_error = false, + log_level ll = log_successful_tests ) +{ + bool setup_error_caught = false; + + { + log_setup_teardown holder(output, log_format, ll); + + // output before fixture registration + output << "* " << log_format << "-format *******************************************************************"; + output << std::endl; + + // register this as a global fixture + boost::unit_test::ut_detail::global_fixture_impl<global_fixture_t> fixture_stack_element; + framework::finalize_setup_phase( id ); + + try { + framework::run( id, false ); // do not continue the test tree to have the test_log_start/end + } + catch (framework::setup_error&) { + BOOST_TEST_MESSAGE("Framework setup_error caught"); + setup_error_caught = true; + } + + output << std::endl; + } + + BOOST_TEST( setup_error_caught == has_setup_error ); + BOOST_TEST( bt_module_failed == (( results_collector.results( id ).result_code() != 0 ) || setup_error_caught )); + BOOST_TEST( output.match_pattern(true) ); // flushes the stream at the end of the comparison. +} + +template <class global_fixture_t> +void check_global_fixture( + output_test_stream& output, + test_suite* ts, + bool bt_module_failed = false, + bool has_setup_error = false) +{ + ts->p_default_status.value = test_unit::RS_ENABLED; + + check_global_fixture<global_fixture_t>( output, OF_CLF, ts->p_id, bt_module_failed, has_setup_error ); + check_global_fixture<global_fixture_t>( output, OF_XML, ts->p_id, bt_module_failed, has_setup_error ); + check_global_fixture<global_fixture_t>( output, OF_JUNIT, ts->p_id, bt_module_failed, has_setup_error, log_successful_tests ); + check_global_fixture<global_fixture_t>( output, OF_JUNIT, ts->p_id, bt_module_failed, has_setup_error, log_cpp_exception_errors ); // should branch to the log log_all_errors +} + +struct guard { + ~guard() + { + boost::unit_test::unit_test_log.set_format( runtime_config::get<output_format>( runtime_config::btrt_log_format ) ); + boost::unit_test::unit_test_log.set_stream( std::cout ); + } +}; + +// this one should generate a message as it does not execute any assertion +void good_foo() {} + +void almost_good_foo() +{ + BOOST_TEST_WARN( 2>3 ); +} + +void bad_foo() { + BOOST_ERROR( "" ); + + BOOST_TEST_MESSAGE("this is a message"); + BOOST_CHECK(true); + + BOOST_TEST_INFO("Context value=something"); + BOOST_TEST_INFO("Context value2=something different"); + BOOST_ERROR( "with some message" ); + + BOOST_CHECK_MESSAGE( 1 == 2.3, "non sense" ); +} + +void very_bad_foo() { + BOOST_TEST_CONTEXT("some context") { + BOOST_FAIL( "very_bad_foo is fatal" ); + } +} + +struct local_exception {}; + +void very_bad_exception() { + BOOST_TEST_INFO("Context value=something"); + BOOST_TEST_INFO("Context value2=something different"); + BOOST_ERROR( "with some message" ); + + BOOST_TEST_INFO("exception context should be shown"); + throw local_exception(); +} + +BOOST_AUTO_TEST_CASE( some_test ) +{ + guard G; + boost::ignore_unused( G ); +#line 275 + test_suite* ts_1 = BOOST_TEST_SUITE( "1 test cases inside" ); + ts_1->add( BOOST_TEST_CASE( good_foo ) ); + + test_suite* ts_1b = BOOST_TEST_SUITE( "1 bad test case inside" ); + ts_1b->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_main = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy" ); + ts_main->add( BOOST_TEST_CASE( bad_foo ) ); + ts_main->add( BOOST_TEST_CASE( very_bad_foo ) ); + ts_main->add( BOOST_TEST_CASE( very_bad_exception ) ); + ts_main->add( ts_1 ); + ts_main->add( ts_1b ); + + // we need another tree + test_suite* ts2_0 = BOOST_TEST_SUITE( "0 test cases inside" ); + test_suite* ts2_1 = BOOST_TEST_SUITE( "1 test cases inside" ); + ts2_1->add( BOOST_TEST_CASE( good_foo ) ); + + test_suite* ts_main_no_error = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy no errors" ); + ts_main_no_error->add( ts2_0 ); + ts_main_no_error->add( BOOST_TEST_CASE( almost_good_foo ) ); + ts_main_no_error->add( ts2_1 ); + +#define PATTERN_FILE_NAME "global-fixtures-test.pattern" + + std::string pattern_file_name( + framework::master_test_suite().argc == 1 + ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./baseline-outputs/" PATTERN_FILE_NAME ) + : framework::master_test_suite().argv[1] ); + + + output_test_stream_for_loggers test_output( pattern_file_name, + !runtime_config::save_pattern(), + true, + __FILE__ ); + + // legacy API, we test that we catch exceptions in the ctor, and tests + // in the suite are running or not depending on that + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithCtor<&good_foo> >( test_output, ts_main_no_error, false); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&almost_good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&almost_good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithCtor<&almost_good_foo> >( test_output, ts_main_no_error, false ); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&bad_foo> >( test_output, ts_main, true ); // should fail the module + check_global_fixture< GlobalFixtureWithCtor<&bad_foo> >( test_output, ts_main_no_error, true ); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&very_bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&very_bad_foo> >( test_output, ts_main, true ); // should fail the module + check_global_fixture< GlobalFixtureWithCtor<&very_bad_foo> >( test_output, ts_main_no_error, true ); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&very_bad_exception>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&very_bad_exception> >( test_output, ts_main, true ); // should fail the module + check_global_fixture< GlobalFixtureWithCtor<&very_bad_exception> >( test_output, ts_main_no_error, true ); + + // here we test only for the setup function, tests should not be + // executed when setup fails, setup should be allowed to fail + + // setup does not fail + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&good_foo> >( test_output, ts_main_no_error, false ); + + // setup does not fail, with messages + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&almost_good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&almost_good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&almost_good_foo> >( test_output, ts_main_no_error, false ); + + // setup fails + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&bad_foo> >( test_output, ts_main_no_error, true ); + + // setup fails badly + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&very_bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&very_bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&very_bad_foo> >( test_output, ts_main_no_error, true ); + + // setup fails with exception + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&very_bad_exception>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&very_bad_exception> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&very_bad_exception> >( test_output, ts_main_no_error, true ); + + // here we test only for the teardown function, tests should not be + // executed when setup fails, setup should be allowed to fail + + // teardown does not fail + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&good_foo> >( test_output, ts_main_no_error, false ); + + // teardown does not fail, with messages + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&almost_good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&almost_good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&almost_good_foo> >( test_output, ts_main_no_error, false ); + + // teardown fails + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&bad_foo> >( test_output, ts_main_no_error, true ); + + // teardown fails badly + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&very_bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_foo> >( test_output, ts_main_no_error, true ); + + // teardown fails with exception + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&very_bad_exception>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_exception> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_exception> >( test_output, ts_main_no_error, true ); + +} diff --git a/src/boost/libs/test/test/framework-ts/version-uses-module-name.cpp b/src/boost/libs/test/test/framework-ts/version-uses-module-name.cpp new file mode 100644 index 000000000..8598d67cb --- /dev/null +++ b/src/boost/libs/test/test/framework-ts/version-uses-module-name.cpp @@ -0,0 +1,18 @@ +// (C) Copyright Raffi Enficiaud 2016. +// 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. + +// explicitely not using BOOST_TEST_MODULE to check the compilation of the +// parser (prints the BOOST_TEST_MODULE if defined) +// Also this should be the included version + +#define BOOST_TEST_MAIN +#include <boost/test/included/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( check ) +{ + BOOST_TEST( true ); +} diff --git a/src/boost/libs/test/test/gen_coverage.sh b/src/boost/libs/test/test/gen_coverage.sh new file mode 100755 index 000000000..566d7e67e --- /dev/null +++ b/src/boost/libs/test/test/gen_coverage.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +which lcov 1>/dev/null 2>&1 +if [ $? != 0 ] +then + echo "You need to have lcov installed in order to generate the test coverage report" + exit 1 +fi + +bjam toolset=gcc-4.9.2 clean +bjam toolset=gcc-4.9.2 runtime-param-test + +# Generate html report +lcov --base-directory . --directory ../../../bin.v2/libs/test/test/runtime-param-test.test/gcc-4.9.2/debug/utils-ts -c -o runtime-param-test.info +lcov --remove runtime-param-test.info "/usr*" -o runtime-param-test.info # remove output for external libraries +lcov --remove runtime-param-test.info "boost" "/boost/c*" "/boost/d*" "/boost/e*" "/boost/f*" "/boost/l*" "/boost/m*" "/boost/s*" -o runtime-param-test.info # remove output for other boost libs +rm -rf ./coverage +genhtml -o ./coverage -t "runtime-param-test coverage" --num-spaces 4 runtime-param-test.info + +#Clean up +rm *.info
\ No newline at end of file diff --git a/src/boost/libs/test/test/multithreading-ts/sync-access-test.cpp b/src/boost/libs/test/test/multithreading-ts/sync-access-test.cpp new file mode 100644 index 000000000..c03f393c5 --- /dev/null +++ b/src/boost/libs/test/test/multithreading-ts/sync-access-test.cpp @@ -0,0 +1,57 @@ +// (C) Copyright Gennadiy Rozental 2008-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests Unit Test Framework usability in MT environment with +// Boost.Test calls externally synchronized +// *************************************************************************** + +#define BOOST_TEST_MODULE sync_access_test +#include <boost/test/unit_test.hpp> + +#include <boost/thread.hpp> +#include <boost/thread/barrier.hpp> +#include <boost/bind.hpp> +#include <boost/ref.hpp> + +using namespace boost; +namespace ut = boost::unit_test; + +static boost::mutex m; + +/// thread execution function +static void thread_function(boost::barrier& b) +{ + b.wait(); /// wait until memory barrier allows the execution + boost::mutex::scoped_lock lock(m); /// lock mutex + BOOST_TEST(1 ==0 ); /// produce the fault +} + +#if BOOST_PP_VARIADICS +/// test function which creates threads +BOOST_AUTO_TEST_CASE( test_multiple_assertion_faults, * ut::expected_failures(100)) +#else +BOOST_TEST_DECORATOR( + * ut::expected_failures(100) +) +BOOST_AUTO_TEST_CASE( test_multiple_assertion_faults) +#endif +{ + boost::thread_group tg; // thread group to manage all threads + boost::barrier b(100); // memory barrier, which should block all threads + // until all 100 threads were created + + for(size_t i=0; i<100; ++i) + tg.create_thread(boost::bind(thread_function, ref(b))); /// create a thread and pass it the barrier + + tg.join_all(); +} + +// EOF diff --git a/src/boost/libs/test/test/prg_exec_monitor-ts/result-code-test.cpp b/src/boost/libs/test/test/prg_exec_monitor-ts/result-code-test.cpp new file mode 100644 index 000000000..9bd57a75d --- /dev/null +++ b/src/boost/libs/test/test/prg_exec_monitor-ts/result-code-test.cpp @@ -0,0 +1,23 @@ +// (C) Copyright Gennadiy Rozental 2003-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : test the Execution Monitor logic regards cpp_main return value +// *************************************************************************** +#include <stdexcept> + +int cpp_main( int, char* [] ) // note the name +{ + return -1; +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/prg_exec_monitor-ts/system-exception-test.cpp b/src/boost/libs/test/test/prg_exec_monitor-ts/system-exception-test.cpp new file mode 100644 index 000000000..623e3f4a5 --- /dev/null +++ b/src/boost/libs/test/test/prg_exec_monitor-ts/system-exception-test.cpp @@ -0,0 +1,44 @@ +// (C) Copyright Gennadiy Rozental 2001-2015. +// (C) Copyright Beman Dawes 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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests an ability of Program Execution Monitor to catch +// system exceptions. Should fail during run. +// *************************************************************************** + +#ifdef __MWERKS__ +// Metrowerks doesn't build knowledge of what runtime libraries to link with +// into their compiler. Instead they depend on pragmas in their standard +// library headers. That creates the odd situation that certain programs +// won't link unless at least one standard header is included. Note that +// this problem is highly dependent on enviroment variables and command +// line options, so just because the problem doesn't show up on one +// system doesn't mean it has been fixed. Remove this workaround only +// when told by Metrowerks that it is safe to do so. +#include <cstddef> //Metrowerks linker needs at least one standard library +#endif + +#include <cstdio> + +int cpp_main( int, char *[] ) // note the name +{ +#if (defined(APPLE) && defined(ppc)) || defined(_ARCH_PPC) + std::printf("The ppc doesn't throw on divide-by-zero. No check.\n"); + return 1; +#else + int div = 0; + return 10 / div; +#endif +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/prg_exec_monitor-ts/uncatched-exception-test.cpp b/src/boost/libs/test/test/prg_exec_monitor-ts/uncatched-exception-test.cpp new file mode 100644 index 000000000..0e1ec2716 --- /dev/null +++ b/src/boost/libs/test/test/prg_exec_monitor-ts/uncatched-exception-test.cpp @@ -0,0 +1,42 @@ +// (C) Copyright Gennadiy Rozental 2001-2015. +// (C) Copyright Beman Dawes 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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests an ability of Program Execution Monitor to catch +// uncatched exceptions. Should fail during run. +// *************************************************************************** + +#ifdef __MWERKS__ +// Metrowerks doesn't build knowledge of what runtime libraries to link with +// into their compiler. Instead they depend on pragmas in their standard +// library headers. That creates the odd situation that certain programs +// won't link unless at least one standard header is included. Note that +// this problem is highly dependent on enviroment variables and command +// line options, so just because the problem doesn't show up on one +// system doesn't mean it has been fixed. Remove this workaround only +// when told by Metrowerks that it is safe to do so. +#include <cstddef> //Metrowerks linker needs at least one standard library +#endif + +#include <boost/test/included/prg_exec_monitor.hpp> + +int +cpp_main( int argc, char *[] ) // note the name +{ + if( argc > 0 ) // to prevent the unreachable return warning + throw "Test error by throwing C-style string exception"; + + return 0; +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/prg_exec_monitor-ts/user-fatal-exception-test.cpp b/src/boost/libs/test/test/prg_exec_monitor-ts/user-fatal-exception-test.cpp new file mode 100644 index 000000000..dc2446251 --- /dev/null +++ b/src/boost/libs/test/test/prg_exec_monitor-ts/user-fatal-exception-test.cpp @@ -0,0 +1,35 @@ +// (C) Copyright Gennadiy Rozental 2002-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests an ability of the Program Execution Monitor to catch +// user fatal exceptions. Should fail during run. But not crash. +// *************************************************************************** + +#include <cassert> + +int cpp_main( int, char *[] ) // note the name +{ +#if NDEBUG +#pragma message("assert check turned off under NDEBUG") + + return 1; +#else + int div = 0; + + assert( div != 0 ); + + return 0; +#endif +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/selfcontained.cpp b/src/boost/libs/test/test/selfcontained.cpp new file mode 100644 index 000000000..e42e65cc9 --- /dev/null +++ b/src/boost/libs/test/test/selfcontained.cpp @@ -0,0 +1,15 @@ +// selfcontained.cpp +// +// Copyright (c) 2008 +// Steven Watanabe +// +// 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) + +#define BOOST_HEADER_TEST_STRINGIZE_IMPL(x) #x +#define BOOST_HEADER_TEST_STRINGIZE(x) BOOST_HEADER_TEST_STRINGIZE_IMPL(x) + +#define BOOST_HEADER_TO_TEST BOOST_HEADER_TEST_STRINGIZE(BOOST_HEADER_TEST_NAME) + +#include BOOST_HEADER_TO_TEST diff --git a/src/boost/libs/test/test/smoke-ts/basic-smoke-test.cpp b/src/boost/libs/test/test/smoke-ts/basic-smoke-test.cpp new file mode 100644 index 000000000..31cab9795 --- /dev/null +++ b/src/boost/libs/test/test/smoke-ts/basic-smoke-test.cpp @@ -0,0 +1,25 @@ +// (C) Copyright Raffi Enficiaud 2016. +// 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 basic_smoke_test +#include <boost/test/included/unit_test.hpp> +#include <boost/test/data/test_case.hpp> +#include <boost/test/data/monomorphic.hpp> + +#include <iostream> + +namespace bdata = boost::unit_test::data; + + +BOOST_DATA_TEST_CASE( + test1, + bdata::xrange(2) * bdata::xrange(3), + xr1, xr2) +{ + std::cout << "test 1: " << xr1 << ", " << xr2 << std::endl; + BOOST_TEST((xr1 <= 2 && xr2 <= 3)); +} diff --git a/src/boost/libs/test/test/smoke-ts/basic-smoke-test2.cpp b/src/boost/libs/test/test/smoke-ts/basic-smoke-test2.cpp new file mode 100644 index 000000000..6462a283a --- /dev/null +++ b/src/boost/libs/test/test/smoke-ts/basic-smoke-test2.cpp @@ -0,0 +1,25 @@ +// (C) Copyright Raffi Enficiaud 2016. +// 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 basic_smoke_test2 +#include <boost/test/included/unit_test.hpp> +#include <boost/mpl/list.hpp> + +#include <iostream> + + +// trac 12531 +namespace ns +{ + struct X {}; +} + +typedef boost::mpl::list<ns::X> test_types; + +BOOST_AUTO_TEST_CASE_TEMPLATE(test, T, test_types) +{ +} diff --git a/src/boost/libs/test/test/smoke-ts/basic-smoke-test3.cpp b/src/boost/libs/test/test/smoke-ts/basic-smoke-test3.cpp new file mode 100644 index 000000000..f1f19355b --- /dev/null +++ b/src/boost/libs/test/test/smoke-ts/basic-smoke-test3.cpp @@ -0,0 +1,23 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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 basic_smoke_test3 +#include <boost/test/included/unit_test.hpp> + +BOOST_AUTO_TEST_SUITE(some_suite) + +BOOST_AUTO_TEST_CASE(case1) +{ + BOOST_TEST(false); +} + +BOOST_AUTO_TEST_SUITE_END(); + +BOOST_AUTO_TEST_CASE(case2) +{ + BOOST_TEST(true); +} diff --git a/src/boost/libs/test/test/smoke-ts/basic-smoke-test4.cpp b/src/boost/libs/test/test/smoke-ts/basic-smoke-test4.cpp new file mode 100644 index 000000000..88d3748d9 --- /dev/null +++ b/src/boost/libs/test/test/smoke-ts/basic-smoke-test4.cpp @@ -0,0 +1,44 @@ +// (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. + +#define BOOST_TEST_MODULE basic_smoke_test4 +#include <boost/test/included/unit_test.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/mpl/list.hpp> + +template <class U, class V> +struct my_struct { + typedef typename boost::is_same<U, V>::type type; +}; + +typedef boost::mpl::list< + my_struct<int, int>, + my_struct<int, float>, + my_struct<float, float>, + my_struct<char, float> + > test_types; + +BOOST_AUTO_TEST_CASE_TEMPLATE(test, T, test_types) +{ + BOOST_TEST((T::type::value)); +} + +BOOST_AUTO_TEST_SUITE(some_suite) + +typedef boost::mpl::list< + my_struct<float, int>, + my_struct<int, float>, + my_struct<float, float>, + my_struct<char, char> + > test_types2; + +BOOST_AUTO_TEST_CASE_TEMPLATE(test, T, test_types2) +{ + BOOST_TEST((T::type::value)); +} + +BOOST_AUTO_TEST_SUITE_END();
\ No newline at end of file diff --git a/src/boost/libs/test/test/test-organization-ts/dataset-master-test-suite-accessible-test.cpp b/src/boost/libs/test/test/test-organization-ts/dataset-master-test-suite-accessible-test.cpp new file mode 100644 index 000000000..a006a1032 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/dataset-master-test-suite-accessible-test.cpp @@ -0,0 +1,232 @@ +// (C) Copyright Raffi Enficiaud 2018 +// 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 +/// @brief tests the access to the master test suite from the datasets, trac 12953 +// *************************************************************************** + +#define BOOST_TEST_MODULE "Access master test suite arguments from datasets" +#include <boost/test/included/unit_test.hpp> + +#include <boost/test/data/test_case.hpp> +#include <iostream> + +class dataset_loader +{ +public: + enum { arity = 1 }; + + // this constructor access the master test suite + dataset_loader(); + dataset_loader(std::initializer_list<std::string> init_list) + : m_input_extension(init_list) + {} + dataset_loader(std::string s1, std::string s2) + { + m_input_extension.push_back(s1); + m_input_extension.push_back(s2); + } + + struct iterator { + iterator(std::vector<std::string>::const_iterator const& v_iterator) + : m_iterator(v_iterator) + {} + + // bug in joins, see 13380, can safely be changed to std::string once fixed + const std::string& operator*() const { return *m_iterator; } + void operator++() + { + ++m_iterator; + } + private: + std::vector<std::string>::const_iterator m_iterator; + }; + + boost::unit_test::data::size_t size() const { + return m_input_extension.size(); + } + + // iterator + iterator begin() const { return iterator(m_input_extension.begin()); } + +private: + std::vector<std::string> m_input_extension; +}; + + +dataset_loader::dataset_loader() +{ + BOOST_TEST_INFO("dataset_loader"); + + int argc = boost::unit_test::framework::master_test_suite().argc; + char** argv = boost::unit_test::framework::master_test_suite().argv; + + // not taking into account the name of the program (first argument) + for(unsigned i = 1; i != argc; i++) { + m_input_extension.push_back(argv[i]); + } +} + +//------------------------------------------------------------------------------ + +namespace boost { namespace unit_test { namespace data { + +namespace monomorphic { + template <> + struct is_dataset<dataset_loader> : boost::mpl::true_ {}; +} +}}} + +BOOST_AUTO_TEST_SUITE( concrete_testsuite ) + +// parameters passed on the command line +char const* expected[] = {"--param1=1", "--param2=2"}; + +BOOST_DATA_TEST_CASE(master_access_zips, + boost::unit_test::data::make_delayed<dataset_loader>( ) ^ boost::unit_test::data::make(expected), + input, expect) +{ + // ... + BOOST_TEST(input == expect); +} + + +BOOST_DATA_TEST_CASE(master_access_zips_flip, + boost::unit_test::data::make_delayed<dataset_loader>( ) ^ dataset_loader({"--param1=1", "--param2=2"}), + input, expect) +{ + BOOST_TEST(input == expect); +} + +// checking the forward of the arguments +BOOST_DATA_TEST_CASE(master_access_zips_args_forward, + boost::unit_test::data::make_delayed<dataset_loader>( "--param1=1", "--param2=2" ) ^ boost::unit_test::data::make_delayed<dataset_loader>( ), + input, expect) +{ + BOOST_TEST(input == expect); +} + +BOOST_DATA_TEST_CASE(master_access_grid, + boost::unit_test::data::make_delayed<dataset_loader>( ) * dataset_loader({"--param1=1", "--param2=2"}), + input, expect) +{ + BOOST_TEST((input == expect || input == "--param1=1" || expect == "--param1=1" )); +} + +BOOST_DATA_TEST_CASE(master_access_grid_flip, + dataset_loader({"--param1=1", "--param2=2"}) * boost::unit_test::data::make_delayed<dataset_loader>( ), + input, expect) +{ + BOOST_TEST((input == expect || input == "--param1=1" || expect == "--param1=1" )); +} + +int counter4 = 0; +BOOST_DATA_TEST_CASE(master_access_joins, + boost::unit_test::data::make_delayed<dataset_loader>( ) + dataset_loader({"--param1=1", "--param2=2"}), + input) +{ + static const std::string values[] = {"--param1=1", "--param2=2", "--param1=1", "--param2=2"}; + BOOST_TEST(input == values[counter4++]); +} + +int counter41 = 0; +BOOST_DATA_TEST_CASE(master_access_joins_flip, + dataset_loader({"--param2=2", "--param1=1"}) + boost::unit_test::data::make_delayed<dataset_loader>( ), + input) +{ + static const std::string values[] = {"--param2=2", "--param1=1", "--param1=1", "--param2=2"}; + BOOST_TEST(input == values[counter41++]); +} + +BOOST_AUTO_TEST_SUITE_END() + + +class dataset_loader_arity3 +{ +public: + typedef std::vector<std::string> data_type; + + data_type m_expected; + data_type m_input; + + enum { arity = 3 }; + +public: + dataset_loader_arity3(std::string some_additional) : m_some_additional(some_additional) + { + int argc = boost::unit_test::framework::master_test_suite().argc; + char** argv = boost::unit_test::framework::master_test_suite().argv; + + + for(unsigned i = 1; i != argc; i++) { + std::string current(argv[i]); + std::cout << "current " << current << std::endl; + if(current.find("--param1") != std::string::npos) { + m_expected.push_back(current); + } + else { + m_input.push_back(current); + } + } + } + + struct iterator { + iterator( + data_type::const_iterator v_expected, + data_type::const_iterator v_input, + std::string additional) + : m_input(v_input) + , m_expected(v_expected) + , m_additional(additional) + {} + + // bug in joins, see 13380. We should return a non temporary + std::tuple<std::string, std::string, std::string> operator*() const { + return std::tuple<std::string, std::string, std::string>(*m_input, *m_expected, *m_input + " -" + m_additional + "- " + *m_expected); + } + void operator++() + { + ++m_input; + ++m_expected; + } + private: + data_type::const_iterator m_input, m_expected; + std::string m_additional; + }; + + boost::unit_test::data::size_t size() const { + using namespace boost; + BOOST_TEST_I_ASSRT( m_expected.size() == m_input.size(), "Lists of strings of different size" ); + return m_input.size(); + } + + // iterator + iterator begin() const { + using namespace boost; + BOOST_TEST_I_ASSRT( m_expected.size() == m_input.size(), "Lists of strings of different size" ); + return iterator(m_expected.begin(), m_input.begin(), m_some_additional); } + +private: + std::string m_some_additional; + +}; + +namespace boost { namespace unit_test { namespace data { + +namespace monomorphic { + template <> + struct is_dataset<dataset_loader_arity3> : boost::mpl::true_ {}; +} +}}} + +BOOST_DATA_TEST_CASE(master_access_make_ds_with_arity, + boost::unit_test::data::make_delayed<dataset_loader_arity3>( "something-in-the-middle"), + input, expected, additional) +{ + std::cout << "input: " << input << " -- expected: " << expected << " -- additional: " << additional << std::endl; + BOOST_TEST(true); +} diff --git a/src/boost/libs/test/test/test-organization-ts/dataset-variadic_and_move_semantic-test.cpp b/src/boost/libs/test/test/test-organization-ts/dataset-variadic_and_move_semantic-test.cpp new file mode 100644 index 000000000..3d5de0fa2 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/dataset-variadic_and_move_semantic-test.cpp @@ -0,0 +1,139 @@ +// (C) Copyright Raffi Enficiaud 2016. +// 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 +/// Tests the variadic sample element support and the respect of move semantics +/// for the datasets definitions +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE test movable return type on datasets test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/test_case.hpp> + +#include <boost/test/data/monomorphic/singleton.hpp> +#include <boost/test/data/monomorphic/collection.hpp> +#include <boost/test/data/for_each_sample.hpp> + + +namespace utf=boost::unit_test; +namespace bdata=utf::data; + +#include <vector> +#include <list> + + +class non_copyable_type +{ +public: + static int nb_rvalue_construct; + static int nb_rvalue_assignment; + static int nb_destructs; + + non_copyable_type(const non_copyable_type&) = delete; + non_copyable_type& operator=(const non_copyable_type&) = delete; + + ~non_copyable_type() { + nb_destructs++; + } + + non_copyable_type(non_copyable_type&& rhs) + { + value_ = rhs.value_; + rhs.value_ = -1; + nb_rvalue_construct++; + } + non_copyable_type& operator=(non_copyable_type&& rhs) { + value_ = rhs.value_; + rhs.value_ = -1; + nb_rvalue_assignment++; + return *this; + } + + explicit non_copyable_type(const int value) + { + value_ = value; + } + + friend std::ostream& operator<<(std::ostream& ost, const non_copyable_type& rhs) + { + ost << "non_copyable_type: " << rhs.value_ << std::endl; + return ost; + } + + int get() const { + return value_; + } + +private: + int value_; +}; + +int non_copyable_type::nb_rvalue_construct = 0; +int non_copyable_type::nb_rvalue_assignment = 0; +int non_copyable_type::nb_destructs = 0; + +// Dataset generating a Fibonacci sequence +// The return type is either a regular int or a non-movable type +template <class return_t = int> +class fibonacci_dataset { +public: + enum { arity = 1 }; + + struct iterator { + + iterator() : a(1), b(1) {} + + return_t operator*() const { return return_t(b); } + void operator++() + { + a = a + b; + std::swap(a, b); + } + private: + int a; + int b; // b is the output + }; + + fibonacci_dataset() {} + + // size is infinite + bdata::size_t size() const { return bdata::BOOST_TEST_DS_INFINITE_SIZE; } + + // iterator + iterator begin() const { return iterator(); } +}; + +namespace boost { namespace unit_test { namespace data { namespace monomorphic { + // registering fibonacci_dataset as a proper dataset + template <> + struct is_dataset< fibonacci_dataset<int> > : boost::mpl::true_ {}; + + template <> + struct is_dataset< fibonacci_dataset<non_copyable_type> > : boost::mpl::true_ {}; +}}}} + +// Creating a test-driven dataset +BOOST_DATA_TEST_CASE( + test1, + fibonacci_dataset<int>() ^ bdata::make( { 1, 2, 3, 5, 8, 13, 21, 34, 55 } ), + fib_sample, exp) +{ + BOOST_TEST(fib_sample == exp); +} + +BOOST_DATA_TEST_CASE( + test2, + fibonacci_dataset<non_copyable_type>() ^ bdata::make( { 1, 2, 3, 5, 8, 13, 21, 34, 55 } ), + fib_sample, exp) +{ + BOOST_TEST(fib_sample.get() == exp); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/array-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/array-test.cpp new file mode 100644 index 000000000..997176f34 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/array-test.cpp @@ -0,0 +1,81 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +/// @file +/// Tests C array based dataset +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/array.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_array ) +{ + int arr1[] = {1,2,3}; + BOOST_TEST( data::make( arr1 ).size() == 3 ); + + double const arr2[] = {7.4,3.2}; + BOOST_TEST( data::make( arr2 ).size() == 2 ); + + bool arr3[] = {true, true, false}; + BOOST_TEST( data::make( arr3 ).size() == 3 ); + + typedef bool (arr_type)[3]; + arr_type const& arr3_ref = arr3; + BOOST_TEST( data::make( arr3_ref ).size() == 3 ); + + int arr4[] = {7,11,13,17}; + data::for_each_sample( data::make( arr4 ), check_arg_type<int>() ); + + int c = 0; + int* ptr4 = arr4; + data::for_each_sample( data::make( arr4 ), [&c,ptr4](int i) { + BOOST_TEST( i == ptr4[c++] ); + }); + + data::for_each_sample( data::make( arr4 ), expected_call_count{ 4 } ); + data::for_each_sample( data::make( arr4 ), expected_call_count{ 2 }, 2 ); + data::for_each_sample( data::make( arr4 ), expected_call_count{ 0 }, 0 ); + + copy_count::value() = 0; + copy_count arr5[] = { copy_count(), copy_count() }; + data::for_each_sample( data::make( arr5 ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + copy_count const arr6[] = { copy_count(), copy_count() }; + data::for_each_sample( data::make( arr6 ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_array_make_type ) +{ + int arr1[] = {1,2,3}; + + typedef int (&arr_t)[3]; + BOOST_STATIC_ASSERT(( boost::is_array< boost::remove_reference<arr_t>::type >::value ) ); + + typedef data::result_of::make<int (&)[3]>::type dataset_array_type; + dataset_array_type res = data::make( arr1 ); + BOOST_TEST( res.size() == 3 ); + + double const arr2[] = {7.4,3.2}; + typedef data::result_of::make<double const (&)[2]>::type dataset_array_double_type; + dataset_array_double_type res2 = data::make( arr2 ); + + BOOST_TEST( res2.size() == 2 ); +} + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/collection-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/collection-test.cpp new file mode 100644 index 000000000..6dfd94fe8 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/collection-test.cpp @@ -0,0 +1,159 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests stl collection based dataset +// *************************************************************************** + +// Boost.Test + +#include <boost/test/data/monomorphic/singleton.hpp> +#include <boost/test/data/monomorphic/collection.hpp> +#include <boost/test/data/for_each_sample.hpp> + +#include <boost/test/unit_test.hpp> +namespace utf=boost::unit_test; +namespace data=utf::data; + +#include "datasets-test.hpp" +#include <vector> +#include <list> + +//____________________________________________________________________________// + +template <typename> +struct forwarded_to_collection : std::false_type {}; + +template <typename T> +struct forwarded_to_collection< data::monomorphic::collection<T> > : std::true_type {}; + +BOOST_AUTO_TEST_CASE( test_forwarded_to_collection) +{ + { + std::vector<int> samples1; + BOOST_TEST(boost::unit_test::is_container_forward_iterable<decltype(samples1)>::value, "forward iterable"); + BOOST_TEST((forwarded_to_collection<decltype(data::make( samples1 ))>::value), + "not properly forwarded to a collection"); + } + { + int samples1(0); + boost::ignore_unused( samples1 ); + + BOOST_TEST(!boost::unit_test::is_container_forward_iterable<decltype(samples1)>::value, "forward iterable"); + BOOST_TEST(!(forwarded_to_collection<decltype(data::make( samples1 ))>::value), + "not properly forwarded to a collection"); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_collection_sizes ) +{ + BOOST_TEST( data::make( std::vector<int>() ).size() == 0 ); + BOOST_TEST( data::make( std::vector<int>( 3 ) ).size() == 3 ); + BOOST_TEST( data::make( std::list<double>() ).size() == 0 ); + BOOST_TEST( data::make( std::list<double>( 2 ) ).size() == 2 ); + + data::for_each_sample( data::make( std::vector<int>( 3 ) ), check_arg_type<int>() ); + data::for_each_sample( data::make( std::list<double>( 2 ) ), check_arg_type<double>() ); + + invocation_count ic; + + ic.m_value = 0; + data::for_each_sample( data::make( std::vector<int>( 3 ) ), ic ); + BOOST_TEST( ic.m_value == 3 ); + + ic.m_value = 0; + data::for_each_sample( data::make( std::list<double>( 2 ) ), ic, 4 ); + BOOST_TEST( ic.m_value == 2 ); + + ic.m_value = 0; + data::for_each_sample( data::make( std::vector<int>( 3 ) ), ic, 1 ); + BOOST_TEST( ic.m_value == 1 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_collection ) +{ + std::vector<int> samples1; + samples1.push_back(5); + samples1.push_back(567); + samples1.push_back(13); + + int c = 0; + data::for_each_sample( data::make( samples1 ), [&c,samples1](int i) { + BOOST_TEST( i == samples1[c++] ); + }); + + std::list<char const*> samples2; + samples2.push_back("sd"); + samples2.push_back("bg"); + samples2.push_back( "we3eq3" ); + + auto it = samples2.begin(); + data::for_each_sample( data::make( samples2 ), [&it](char const* str ) { + BOOST_TEST( str == *it++ ); + }); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_collection_copies ) +{ + // number of copies due to the dataset make + int exp_copy_count = 0; + + // number of copies due to the vector constructor + copy_count::value() = 0; + int std_vector_constructor_count = 0; + { + std::vector<copy_count> v(2); // we cannot do better than std::vector constructor + std_vector_constructor_count = copy_count::value()/2; + } + + copy_count::value() = 0; + int std_list_constructor_count = 0; + { + std::list<copy_count> v(2); // we cannot do better than std::vector constructor + std_list_constructor_count = copy_count::value()/2; + } + + copy_count::value() = 0; + + data::for_each_sample( data::make( std::vector<copy_count>( 2 ) ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == (exp_copy_count + std_vector_constructor_count) * 2); + + copy_count::value() = 0; + std::vector<copy_count> samples3( 2 ); + data::for_each_sample( data::make( samples3 ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == (exp_copy_count + std_vector_constructor_count) * 2); + + copy_count::value() = 0; + std::vector<copy_count> const samples4( 2 ); + data::for_each_sample( data::make( samples4 ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == (exp_copy_count + std_vector_constructor_count) * 2); + + copy_count::value() = 0; + auto ds1 = data::make( make_copy_count_collection() ); + BOOST_TEST( ds1.size() == 3 ); + BOOST_TEST( copy_count::value() == (exp_copy_count + std_vector_constructor_count) * 3); + data::for_each_sample( ds1, check_arg_type<copy_count>() ); + + copy_count::value() = 0; + auto ds2 = data::make( make_copy_count_const_collection() ); + BOOST_TEST( ds2.size() == 3 ); + data::for_each_sample( ds2, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == (exp_copy_count + std_list_constructor_count + 1) * 3 ); // no rvalue constructor for the dataset +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/datasets-test.hpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/datasets-test.hpp new file mode 100644 index 000000000..646fdafe7 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/datasets-test.hpp @@ -0,0 +1,207 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : datasets test helpers +// *************************************************************************** + +#ifndef BOOST_TEST_TEST_DATASETS_HPP +#define BOOST_TEST_TEST_DATASETS_HPP + +// Boost +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_convertible.hpp> + +#include <iostream> +#include <vector> +#include <list> + +//____________________________________________________________________________// + +class copy_count { +public: + copy_count() {} + copy_count( copy_count const& ) { + value()++; + } + copy_count( copy_count&& ) BOOST_NOEXCEPT_OR_NOTHROW {} // noexcept is important indeed + copy_count( copy_count const&& ) {} +// ~copy_count() { std::cout << "~copy_count" << std::endl; } + + static int& value() { static int s_value; return s_value; }; + + static copy_count make() { return copy_count(); } + static copy_count const make_const() { return copy_count(); } +}; + +//____________________________________________________________________________// + +template<typename T> +struct check_arg_type { + template<typename S> + void operator()( S const& ) const + { + BOOST_CHECK_MESSAGE( (boost::is_same<S,T>::value), "Sample type does not match expected" ); + } +}; + +//____________________________________________________________________________// + +template<typename T1, typename T2> +struct check_arg_type<std::tuple<T1,T2>> { + template<typename S1, typename S2> + void operator()( S1 const&, S2 const& ) const + { + BOOST_CHECK_MESSAGE( (boost::is_same<S1,T1>::value), "S1 type does not match expected" ); + BOOST_CHECK_MESSAGE( (boost::is_same<S2,T2>::value), "S2 type does not match expected" ); + } +}; + +//____________________________________________________________________________// + +template<typename T1, typename T2, typename T3> +struct check_arg_type<std::tuple<T1,T2,T3>> { + template<typename S1, typename S2, typename S3> + void operator()( S1 const&, S2 const&, S3 const& ) const + { + BOOST_CHECK_MESSAGE( (boost::is_same<S1,T1>::value), "S1 type does not match expected" ); + BOOST_CHECK_MESSAGE( (boost::is_same<S2,T2>::value), "S2 type does not match expected" ); + BOOST_CHECK_MESSAGE( (boost::is_same<S3,T3>::value), "S3 type does not match expected" ); + } +}; + +//____________________________________________________________________________// + +template<typename T> +struct check_arg_type_like { + template<typename S> + void operator()( S const& ) const + { + BOOST_CHECK_MESSAGE( (boost::is_convertible<S,T>::value), "Sample type does not match expected" ); + } +}; + +//____________________________________________________________________________// + +template<typename T1, typename T2> +struct check_arg_type_like<std::tuple<T1,T2>> { + template<typename S1, typename S2> + void operator()( S1 const&, S2 const& ) const + { + BOOST_CHECK_MESSAGE( (boost::is_convertible<S1,T1>::value), "S1 type does not match expected" ); + BOOST_CHECK_MESSAGE( (boost::is_convertible<S2,T2>::value), "S2 type does not match expected" ); + } +}; + +//____________________________________________________________________________// + +template<typename T1, typename T2, typename T3> +struct check_arg_type_like<std::tuple<T1,T2,T3>> { + template<typename S1, typename S2, typename S3> + void operator()( S1 const&, S2 const&, S3 const& ) const + { + BOOST_CHECK_MESSAGE( (boost::is_convertible<S1,T1>::value), "S1 type does not match expected" ); + BOOST_CHECK_MESSAGE( (boost::is_convertible<S2,T2>::value), "S2 type does not match expected" ); + BOOST_CHECK_MESSAGE( (boost::is_convertible<S3,T3>::value), "S3 type does not match expected" ); + } +}; + +//____________________________________________________________________________// + +struct invocation_count { + invocation_count() : m_value( 0 ) {} + + template<typename S> + void operator()( S const& ) const + { + m_value++; + } + template<typename S1,typename S2> + void operator()( S1 const&, S2 const& ) const + { + m_value++; + } + template<typename S1,typename S2,typename S3> + void operator()( S1 const&, S2 const&, S3 const& ) const + { + m_value++; + } + + mutable int m_value; + +private: + invocation_count(invocation_count const&); +}; + +//____________________________________________________________________________// + +struct expected_call_count { + explicit expected_call_count( int exp_count ) + : m_call_count( 0 ) + , m_exp_count( exp_count ) + {} + expected_call_count(expected_call_count const&) = delete; + void operator=(expected_call_count const&) = delete; + + ~expected_call_count() + { + BOOST_TEST( m_exp_count == m_call_count ); + } + + template<typename S> + void operator()( S const& ) const + { + m_call_count++; + } + template<typename S1,typename S2> + void operator()( S1 const&, S2 const& ) const + { + m_call_count++; + } + template<typename S1,typename S2,typename S3> + void operator()( S1 const&, S2 const&, S3 const& ) const + { + m_call_count++; + } + + mutable int m_call_count; + int m_exp_count; + +}; + +//____________________________________________________________________________// + +struct print_sample { + template<typename T> + void operator()( T const& sample ) const + { + std::cout << "S has type: " << typeid(T).name() << " and value " << sample << std::endl; + } +}; + +//____________________________________________________________________________// + +inline std::vector<copy_count> +make_copy_count_collection() +{ + return std::vector<copy_count>( 3 ); +} + +//____________________________________________________________________________// + +inline std::list<copy_count> const +make_copy_count_const_collection() +{ + return std::list<copy_count>( 3 ); +} + +//____________________________________________________________________________// + +#endif // BOOST_TEST_TEST_DATASETS_HPP diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/implicit-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/implicit-test.cpp new file mode 100644 index 000000000..99215850e --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/implicit-test.cpp @@ -0,0 +1,82 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests implicit interfaces +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_implicit_for_each ) +{ + data::for_each_sample( 2, check_arg_type<int>() ); + + data::for_each_sample( "ch", check_arg_type<char const*>() ); + data::for_each_sample( 2., check_arg_type<double>() ); + data::for_each_sample( std::vector<int>( 3 ), check_arg_type<int>() ); + data::for_each_sample( std::list<double>( 2 ), check_arg_type<double>() ); + invocation_count ic; + + ic.m_value = 0; + data::for_each_sample( std::vector<int>( 3 ), ic ); + BOOST_TEST( ic.m_value == 3 ); + + ic.m_value = 0; + data::for_each_sample( std::list<double>( 2 ), ic, 1 ); + BOOST_TEST( ic.m_value == 1 ); + + std::vector<copy_count> samples1( 2 ); + copy_count::value() = 0; // we do not test the construction of the vector + data::for_each_sample( samples1, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + copy_count samples2[] = { copy_count(), copy_count() }; + data::for_each_sample( samples2, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_implicit_join ) +{ + auto ds = data::make( 5 ); + BOOST_TEST( (1 + ds).size() == 2 ); + BOOST_TEST( (ds + 1).size() == 2 ); + + BOOST_TEST( (1 + data::make( 5 )).size() == 2 ); + BOOST_TEST( (data::make( 5 ) + 1).size() == 2 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_implicit_zip ) +{ + auto ds = data::make( 5 ); + BOOST_TEST( (1 ^ ds).size() == 1 ); + BOOST_TEST( (ds ^ 1).size() == 1 ); + + BOOST_TEST( (1 ^ data::make( 5 )).size() == 1 ); + BOOST_TEST( (data::make( 5 ) ^ 1).size() == 1 ); +} + +//____________________________________________________________________________// + +// EOF + + diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/initializer_list-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/initializer_list-test.cpp new file mode 100644 index 000000000..eb16e6001 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/initializer_list-test.cpp @@ -0,0 +1,76 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +/// @file +/// Tests C array based dataset +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/initializer_list.hpp> +#include <boost/test/data/monomorphic/singleton.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_initializer_list ) +{ + BOOST_TEST( data::make( {1,2,3} ).size() == 3 ); + + BOOST_TEST( data::make( {7.4,3.2} ).size() == 2 ); + + BOOST_TEST( data::make( {true, true, false} ).size() == 3 ); + + data::for_each_sample( data::make( {7,11,13,17} ), check_arg_type<int>() ); + + int c = 0; + int exp[] = {7,11,13,17}; + data::for_each_sample( data::make( {7,11,13,17} ), [&c,&exp](int i) { + BOOST_TEST( i == exp[c++] ); + }); + + data::for_each_sample( data::make( {1,2,3,4} ), expected_call_count{ 4 } ); + data::for_each_sample( data::make( {1,2,3,4} ), expected_call_count{ 2 }, 2 ); + data::for_each_sample( data::make( {1,2,3,4} ), expected_call_count{ 0 }, 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( { copy_count(), copy_count() } ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 2 ); // this is copied in this case, because of the initializer_list +} + +#ifndef BOOST_TEST_ERRONEOUS_INIT_LIST + +BOOST_AUTO_TEST_CASE( test_initializer_list_variadic_template ) +{ + BOOST_TEST( data::make( 1,2,3 ).size() == 3 ); + + BOOST_TEST( data::make( 7.4,3.2 ).size() == 2 ); + + BOOST_TEST( data::make( true, true, false ).size() == 3 ); + + data::for_each_sample( data::make( 7,11,13,17 ), check_arg_type<int>() ); + + int c = 0; + int exp[] = {7,11,13,17}; + data::for_each_sample( data::make( 7,11,13,17 ), [&c,&exp](int i) { + BOOST_TEST( i == exp[c++] ); + }); + + data::for_each_sample( data::make( 1,2,3,4 ), expected_call_count{ 4 } ); + data::for_each_sample( data::make( 1,2,3,4 ), expected_call_count{ 2 }, 2 ); + data::for_each_sample( data::make( 1,2,3,4 ), expected_call_count{ 0 }, 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count(), copy_count() ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); +} +#endif + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-grid-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-grid-test.cpp new file mode 100644 index 000000000..8c2ef4a4c --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-grid-test.cpp @@ -0,0 +1,187 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +/// @file +/// @brief tests monomorphic grid +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/grid.hpp> +#include <boost/test/data/monomorphic/singleton.hpp> +#include <boost/test/data/monomorphic/array.hpp> +#include <boost/test/data/monomorphic/collection.hpp> +#include <boost/test/data/monomorphic/generators/xrange.hpp> +#include <boost/test/data/for_each_sample.hpp> + +namespace data = boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_grid_size_and_composition ) +{ + BOOST_TEST( (data::make( 1 ) * data::make( 5 )).size() == 1 ); + BOOST_TEST( (data::make( std::vector<int>(2) ) * data::make( std::list<float>(2) )).size() == 4 ); + BOOST_TEST( (data::make( std::vector<int>(2) ) * data::make( 5. )).size() == 2 ); + BOOST_TEST( (data::make( std::vector<int>(3) ) * data::make( std::list<int>(1) )).size() == 3 ); + + BOOST_TEST( (data::make( std::vector<int>(3) ) * data::make( std::list<std::string>(3) ) * data::make( 5 )).size() == 9 ); + BOOST_TEST( (data::make( std::vector<int>(1) ) * data::make( std::list<int>(3) ) * data::make( 5 )).size() == 3 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_grid_with_xrange ) +{ + auto ds1 = data::make(1); + auto ds2 = data::xrange(5); + + BOOST_TEST( (ds1 * ds2).size() == 5 ); + BOOST_TEST( (ds1 * ds2).size() == 5 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_grid_cpp11_features ) +{ + int arr1[] = {1,2}; + char const* arr2[] = {"a","b"}; + int* exp1 = arr1; + char const** exp2 = arr2; + invocation_count ic; + + auto samples1 = data::make( arr1 ) * data::make( arr2 ); + + BOOST_TEST( samples1.size() == 4 ); + + ic.m_value = 0; + data::for_each_sample( samples1, ic ); + BOOST_TEST( ic.m_value == 4 ); + + data::for_each_sample( samples1, check_arg_type_like<std::tuple<int,char const*>>() ); + + int c = 0; + data::for_each_sample( samples1, [&c,exp1,exp2](int i,char const* s) { + BOOST_TEST( i == exp1[c/2] ); + BOOST_TEST( s == exp2[c%2] ); + ++c; + }); + + std::vector<double> vec1; + vec1.push_back(2.1); + vec1.push_back(3.2); + vec1.push_back(4.7); + int arr3[] = {4,2,1}; + + auto samples2 = data::make( vec1 ) * data::make( "qqq" ) * data::make( arr3 ); + + BOOST_TEST( samples2.size() == 9 ); + + ic.m_value = 0; + data::for_each_sample( samples2, ic ); + BOOST_TEST( ic.m_value == 9 ); + + data::for_each_sample( samples2, check_arg_type_like<std::tuple<double,char const*,int>>() ); + + int* exp3 = arr3; + c = 0; + + data::for_each_sample( samples2, [&c,&vec1,exp3](double a1,char const* a2,int a3) { + BOOST_TEST( a1 == vec1[c/3] ); + BOOST_TEST( a2 == "qqq" ); + BOOST_TEST( a3 == exp3[c%3] ); + ++c; + }); + +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_grid_number_of_copies ) +{ + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) * data::make( copy_count() ), check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) * data::make( copy_count() ) * data::make( copy_count() ), + check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) * (data::make( copy_count() ) * data::make( copy_count() )), + check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_grid_number_of_copies_auto ) +{ + auto ds1 = data::make( copy_count() ); + auto const ds2 = data::make( copy_count() ); + + copy_count::value() = 0; + data::for_each_sample( ds1 * ds1, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds2 * ds2, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 * ds2, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + auto zp1 = ds1 * data::make( copy_count() ); + BOOST_TEST( zp1.size() == 1 ); + data::for_each_sample( zp1, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) * ds1, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 * ds2 * ds1, check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 * (ds1 * ds2), check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + int std_vector_constructor_count = 0; + { + std::vector<copy_count> v(2); // we cannot do better than std::vector constructor + std_vector_constructor_count = copy_count::value()/2; + } + + copy_count::value() = 0; + auto ds3 = data::make( make_copy_count_collection() ) * data::make( make_copy_count_collection() ); + BOOST_TEST( ds3.size() == 9 ); + data::for_each_sample( ds3, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == std_vector_constructor_count *2 *3); +} + +BOOST_AUTO_TEST_CASE( test_mono_grid_variadic_dimension ) +{ + // tests that the grid dimension can be > 3 + + BOOST_TEST( (data::make( 1 ) * data::make( 5 ) * data::make( 1 )).size() == 1 ); + BOOST_TEST( (data::make( 1 ) * data::make( 5 ) * data::make( 1 ) * data::make( 1 )).size() == 1 ); + + BOOST_TEST( (data::xrange(2) * data::xrange(2) * data::xrange(2) * data::xrange(2)).size() == (1 << 4)); +} + +//____________________________________________________________________________// + +// EOF + diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-join-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-join-test.cpp new file mode 100644 index 000000000..43fbaa517 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-join-test.cpp @@ -0,0 +1,158 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +/// @file +/// @brief tests monomorphic join +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/join.hpp> +#include <boost/test/data/monomorphic/singleton.hpp> +#include <boost/test/data/monomorphic/array.hpp> +#include <boost/test/data/monomorphic/collection.hpp> +#include <boost/test/data/monomorphic/fwd.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include <boost/test/data/test_case.hpp> + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_join ) +{ + BOOST_TEST( (data::make( 1 ) + data::make( 5 )).size() == 2 ); + BOOST_TEST( (data::make( std::vector<int>(2) ) + data::make( std::list<int>(3) )).size() == 5 ); + + int arr1[] = {1,2}; + int arr2[] = {7,19}; + BOOST_TEST( (data::make( arr1 ) + data::make( arr2 )).size() == 4 ); + + BOOST_TEST( (data::make( 1 ) + data::make( 5 ) + data::make( 19 )).size() == 3 ); + + BOOST_TEST( (data::make( std::vector<int>(2) ) + data::make( 1 ) + data::make( arr2 ) + data::make( 17 )).size() == 6 ); + + int expected[] = {1,2,5,7,19,37}; + int* exp = expected; + int c = 0; + invocation_count ic; + + auto samples1 = data::make( std::vector<int>(arr1,arr1+2) ) + data::make( 5 ) + data::make( arr2 ) + data::make( 37 ); + + ic.m_value = 0; + data::for_each_sample( samples1, ic ); + BOOST_TEST( ic.m_value == 6 ); + + c = 0; + data::for_each_sample( samples1, [&c,exp](int i) { + BOOST_TEST( i == exp[c++] ); + }); + + auto samples2 = data::make( std::vector<int>(arr1,arr1+2) ) + (data::make( 5 ) + (data::make( arr2 ) + data::make( 37 ))); + + ic.m_value = 0; + data::for_each_sample( samples2, ic ); + BOOST_TEST( ic.m_value == 6 ); + + c = 0; + data::for_each_sample( samples2, [&c,exp](int i) { + BOOST_TEST( i == exp[c++] ); + }); + + auto samples3 = (data::make( std::vector<int>(arr1,arr1+2) ) + data::make( 5 )) + (data::make( arr2 ) + data::make( 37 )); + + ic.m_value = 0; + data::for_each_sample( samples3, ic ); + BOOST_TEST( ic.m_value == 6 ); + + c = 0; + data::for_each_sample( samples3, [&c,exp](int i) { + BOOST_TEST( i == exp[c++] ); + }); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) + data::make( copy_count() ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) + data::make( copy_count() ) + data::make( copy_count() ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) + (data::make( copy_count() ) + data::make( copy_count() )), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + copy_count::value() = 0; + data::for_each_sample( (data::make( copy_count() ) + data::make( copy_count() )) + + (data::make( copy_count() ) + data::make( copy_count() )), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + auto ds1 = data::make( copy_count() ); + auto const ds2 = data::make( copy_count() ); + + copy_count::value() = 0; + data::for_each_sample( ds1 + ds1, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds2 + ds2, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 + ds2, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + auto jn1 = ds1 + data::make( copy_count() ); + data::for_each_sample( jn1, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) + ds1, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 + ds2 + ds1, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 + (ds1 + ds2), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( (ds1 + ds1) + (ds2 + ds2), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + int std_vector_constructor_count = 0; + { + std::vector<copy_count> v(2); // we cannot do better than std::vector constructor + std_vector_constructor_count = copy_count::value()/2; + } + + copy_count::value() = 0; + auto ds3 = data::make( make_copy_count_collection() ) + data::make( make_copy_count_collection() ); + BOOST_TEST( ds3.size() == 6 ); + data::for_each_sample( ds3, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == std_vector_constructor_count * 2 * 3 ); +} + +//____________________________________________________________________________// + +// ticket 13380 +// note that the test relies on the fact that the references to temporaries are properly +// escalated as errors. Currently only on clang. +BOOST_DATA_TEST_CASE( + sampleTest, + (data::make(1) ^ data::make(2)) + (data::make(3) ^ data::make(4)), + var1, + var2) +{ + std::cout << var1 << "," << var2 << std::endl; +} +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-zip-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-zip-test.cpp new file mode 100644 index 000000000..a4c661f51 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/mono-zip-test.cpp @@ -0,0 +1,158 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests monomorphic zip +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/zip.hpp> +#include <boost/test/data/monomorphic/singleton.hpp> +#include <boost/test/data/monomorphic/array.hpp> +#include <boost/test/data/monomorphic/collection.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_zip_sizes ) +{ + BOOST_TEST( (data::make( 1 ) ^ data::make( 5 )).size() == 1 ); + BOOST_TEST( (data::make( std::vector<int>(2) ) ^ data::make( std::list<float>(2) )).size() == 2 ); + BOOST_TEST( (data::make( std::vector<int>(2) ) ^ data::make( 5. )).size() == 2 ); + BOOST_TEST( (data::make( std::vector<int>(3) ) ^ data::make( std::list<int>(1) )).size() == 3 ); + + BOOST_TEST( (data::make( std::vector<int>(3) ) ^ data::make( std::list<std::string>(3) ) ^ data::make( 5 )).size() == 3 ); + BOOST_TEST( (data::make( std::vector<int>(1) ) ^ data::make( std::list<int>(3) ) ^ data::make( 5 )).size() == 3 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mono_zip ) +{ + int arr1[] = {1,2}; + char const* arr2[] = {"a","b"}; + int* exp1 = arr1; + char const** exp2 = arr2; + int c = 0; + invocation_count ic; + + auto samples1 = data::make( arr1 ) ^ data::make( arr2 ); + + BOOST_TEST( samples1.size() == 2 ); + + ic.m_value = 0; + data::for_each_sample( samples1, ic ); + BOOST_TEST( ic.m_value == 2 ); + + data::for_each_sample( samples1, check_arg_type_like<std::tuple<int,char const*>>() ); + + c = 0; + data::for_each_sample( samples1, [&c,exp1,exp2](int i,char const* s) { + BOOST_TEST( i == exp1[c] ); + BOOST_TEST( s == exp2[c] ); + ++c; + }); + + std::vector<double> vec1; + vec1.push_back(2.1); + vec1.push_back(3.2); + vec1.push_back(4.7); + int arr3[] = {4,2,1}; + + auto samples2 = data::make( vec1 ) ^ data::make( "qqq" ) ^ data::make( arr3 ); + + BOOST_TEST( samples2.size() == 3 ); + + ic.m_value = 0; + data::for_each_sample( samples2, ic ); + BOOST_TEST( ic.m_value == 3 ); + + data::for_each_sample( samples2, check_arg_type_like<std::tuple<double,char const*,int>>() ); + + c = 0; + int* exp3 = arr3; + + data::for_each_sample( samples2, [&c,&vec1,exp3](double a1,char const* a2,int a3) { + BOOST_TEST( a1 == vec1[c] ); + BOOST_TEST( a2 == "qqq" ); + BOOST_TEST( a3 == exp3[c] ); + ++c; + }); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) ^ data::make( copy_count() ), check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) ^ data::make( copy_count() ) ^ data::make( copy_count() ), + check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) ^ (data::make( copy_count() ) ^ data::make( copy_count() )), + check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + auto ds1 = data::make( copy_count() ); + auto const ds2 = data::make( copy_count() ); + + copy_count::value() = 0; + data::for_each_sample( ds1 ^ ds1, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds2 ^ ds2, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 ^ ds2, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + auto zp1 = ds1 ^ data::make( copy_count() ); + BOOST_TEST( zp1.size() == 1 ); + data::for_each_sample( zp1, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ) ^ ds1, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 ^ ds2 ^ ds1, check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + copy_count::value() = 0; + data::for_each_sample( ds1 ^ (ds1 ^ ds2), check_arg_type<std::tuple<copy_count,copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == 0 ); + + + + copy_count::value() = 0; + int std_vector_constructor_count = 0; + { + std::vector<copy_count> v(2); // we cannot do better than std::vector constructor + std_vector_constructor_count = copy_count::value()/2; + } + + copy_count::value() = 0; + auto ds3 = data::make( make_copy_count_collection() ) ^ data::make( make_copy_count_collection() ); + BOOST_TEST( ds3.size() == 3 ); + data::for_each_sample( ds3, check_arg_type<std::tuple<copy_count,copy_count>>() ); + BOOST_TEST( copy_count::value() == std_vector_constructor_count *2 *3 ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/random-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/random-test.cpp new file mode 100644 index 000000000..a5a04e3fe --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/random-test.cpp @@ -0,0 +1,133 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +//! @file +//! @brief tests random dataset +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/generators/random.hpp> +#include <boost/test/data/monomorphic/zip.hpp> +#include <boost/test/data/monomorphic/array.hpp> +#include <boost/test/data/monomorphic/grid.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_default ) +{ + BOOST_TEST( data::random().size() == data::BOOST_TEST_DS_INFINITE_SIZE ); + + auto ds = data::random(); + + BOOST_CHECK_THROW( data::for_each_sample( ds, [](double ) {}), std::logic_error ); + + invocation_count ic; + + ic.m_value = 0; + data::for_each_sample( ds, ic, 10 ); + BOOST_TEST( ic.m_value == 10 ); + + ic.m_value = 0; + int arr[] = {1,2,3,4,5}; + data::for_each_sample( ds^arr, ic ); + BOOST_TEST( ic.m_value == 5 ); + + BOOST_CHECK_THROW( (ds * arr).size(), std::logic_error ); + BOOST_CHECK_THROW( (arr * ds).size(), std::logic_error ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_uniform_range ) +{ + auto ds1 = data::random(1,5); + + data::for_each_sample( ds1, [](int s) { + BOOST_TEST(s>=1); + BOOST_TEST(s<=5); + }, 10); + + auto ds2 = data::random(1.,2.); + + data::for_each_sample( ds2, [](double s) { + BOOST_TEST(s>=1.); + BOOST_TEST(s<=2.); + }, 100); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_parameterized_init ) +{ + auto ds1 = data::random(data::distribution = std::normal_distribution<>(5.,2)); + typedef decltype(ds1) DS1; + + BOOST_TEST(( std::is_same<DS1::generator_type::distr_type, + std::normal_distribution<>>::value )); + BOOST_TEST(( std::is_same<DS1::generator_type::sample,double>::value )); + BOOST_TEST(( std::is_same<DS1::generator_type::engine_type, + std::default_random_engine>::value )); + + auto ds2 = data::random(data::distribution = std::discrete_distribution<>()); + typedef decltype(ds2) DS2; + + BOOST_TEST(( std::is_same<DS2::generator_type::distr_type, + std::discrete_distribution<>>::value )); + BOOST_TEST(( std::is_same<DS2::generator_type::sample,int>::value )); + BOOST_TEST(( std::is_same<DS2::generator_type::engine_type, + std::default_random_engine>::value )); + + auto ds3 = data::random(data::engine = std::minstd_rand()); + typedef decltype(ds3) DS3; + + BOOST_TEST(( std::is_same<DS3::generator_type::distr_type, + std::uniform_real_distribution<>>::value )); + BOOST_TEST(( std::is_same<DS3::generator_type::sample,double>::value )); + BOOST_TEST(( std::is_same<DS3::generator_type::engine_type, + std::minstd_rand>::value )); + + auto ds4 = data::random(data::seed = 100UL); + typedef decltype(ds4) DS4; + + BOOST_TEST(( std::is_same<DS4::generator_type::distr_type, + std::uniform_real_distribution<>>::value )); + BOOST_TEST(( std::is_same<DS4::generator_type::sample,double>::value )); + BOOST_TEST(( std::is_same<DS4::generator_type::engine_type, + std::default_random_engine>::value )); + + auto ds5 = data::random(data::seed = 100UL); + + std::list<double> vals; + data::for_each_sample( ds4, [&vals](double s) { + vals.push_back( s ); + }, 10); + data::for_each_sample( ds5, [&vals](double s) { + BOOST_TEST( vals.front() == s ); + vals.pop_front(); + }, 10); + + auto ds6 = data::random(( data::engine = std::minstd_rand(), + data::distribution = std::normal_distribution<>(5.,2), + data::seed = 20UL )); + typedef decltype(ds6) DS6; + + BOOST_TEST(( std::is_same<DS6::generator_type::distr_type, + std::normal_distribution<>>::value )); + BOOST_TEST(( std::is_same<DS6::generator_type::sample,double>::value )); + BOOST_TEST(( std::is_same<DS6::generator_type::engine_type, + std::minstd_rand>::value )); +} + +//____________________________________________________________________________// + +// EOF + diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/seed-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/seed-test.cpp new file mode 100644 index 000000000..3386e0f00 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/seed-test.cpp @@ -0,0 +1,64 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +/// @file +/// Tests C array based dataset +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/test_case.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_seed_with_singleton ) +{ + BOOST_TEST( (data::ds_detail::seed{} ->* 1).size() == 1 ); + + struct TT {}; + BOOST_TEST( (data::ds_detail::seed{} ->* TT{}).size() == 1 ); + + int arr[] = {1,2,3}; + BOOST_TEST( (data::ds_detail::seed{} ->* arr).size() == 3 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_seed_with_zip ) +{ + int arr[] = {1,2,3}; + BOOST_TEST( (data::ds_detail::seed{} ->* 1 ^ arr).size() == 3 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_seed_with_join ) +{ + int arr[] = {1,2,3}; + BOOST_TEST( (data::ds_detail::seed{} ->* 1 + arr).size() == 4 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_seed_with_grid ) +{ + int arr1[] = {1,2,3}; + int arr2[] = {1,2,3}; + BOOST_TEST( (data::ds_detail::seed{} ->* arr1 * arr2).size() == 9 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_seed_with_init_list ) +{ + BOOST_TEST( (data::ds_detail::seed{} ->* data::make({1,2,3})).size() == 3 ); +} + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/singleton-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/singleton-test.cpp new file mode 100644 index 000000000..a2c3d2cf5 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/singleton-test.cpp @@ -0,0 +1,79 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +/// @file +/// @brief tests singleton dataset +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/singleton.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_singleton ) +{ + BOOST_TEST( data::make( 1 ).size() == 1 ); + BOOST_TEST( data::make( 2.3 ).size() == 1 ); + BOOST_TEST( data::make( "1" ).size() == 1 ); + + data::for_each_sample( data::make( 2 ), check_arg_type<int>() ); + data::for_each_sample( data::make( "ch" ), check_arg_type<char const*>() ); + data::for_each_sample( data::make( 2. ), check_arg_type<double>() ); + + invocation_count ic; + + ic.m_value = 0; + data::for_each_sample( data::make( 2 ), ic ); + BOOST_TEST( ic.m_value == 1 ); + + ic.m_value = 0; + data::for_each_sample( data::make( 2 ), ic, 2 ); + BOOST_TEST( ic.m_value == 1 ); + + ic.m_value = 0; + data::for_each_sample( data::make( 2 ), ic, 0 ); + BOOST_TEST( ic.m_value == 0 ); + + data::for_each_sample( data::make( 2 ), [] (int s) { + BOOST_TEST( s == 2 ); + }); + int exp_copy_count = 0; + + copy_count::value() = 0; + data::for_each_sample( data::make( copy_count() ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == exp_copy_count ); + + copy_count::value() = 0; + copy_count cc1; + data::for_each_sample( data::make( cc1 ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == exp_copy_count ); + + copy_count::value() = 0; + copy_count const cc2; + data::for_each_sample( data::make( cc2 ), check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == exp_copy_count ); + + copy_count::value() = 0; + auto ds1 = data::make( copy_count::make() ); + data::for_each_sample( ds1, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == exp_copy_count ); + + copy_count::value() = 0; + auto ds2 = data::make( copy_count::make_const() ); + data::for_each_sample( ds2, check_arg_type<copy_count>() ); + BOOST_TEST( copy_count::value() == exp_copy_count ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/test_case_interface-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/test_case_interface-test.cpp new file mode 100644 index 000000000..56577ca96 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/test_case_interface-test.cpp @@ -0,0 +1,215 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests singleton dataset +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> + +#include <boost/test/data/test_case.hpp> +#include <boost/test/data/monomorphic.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +int samples1[] = {1,2,3}; +int index1 = 0; + +BOOST_DATA_TEST_CASE( test_case_interface_01, data::make({1,2,3}) ) +{ + BOOST_TEST( sample == samples1[index1++] ); +} + +//____________________________________________________________________________// + +std::vector<std::string> samples2 = {"qwerty","asdfg"}; +int index2 = 0; + +BOOST_DATA_TEST_CASE( test_case_interface_02, samples2, str ) +{ + BOOST_TEST( str == samples2[index2++] ); +} + +//____________________________________________________________________________// + +int samples3[] = {7,9}; +int index3 = 0; + +BOOST_DATA_TEST_CASE( test_case_interface_03, data::make({1,2,3}) + samples3, val ) +{ + if( index3 < 3 ) + BOOST_TEST( val == samples1[index3] ); + else + BOOST_TEST( val == samples3[index3-3] ); + + ++index3; +} + +//____________________________________________________________________________// + +int index4 = 0; + +BOOST_DATA_TEST_CASE( test_case_interface_04, samples2 ^ data::make({7,9}), str, intval ) +{ + BOOST_TEST( str == samples2[index4] ); + BOOST_TEST( intval == samples3[index4] ); + + ++index4; +} + +//____________________________________________________________________________// + +int index5 = 0; + +BOOST_DATA_TEST_CASE( test_case_interface_05, samples1 * samples2, sample0, sample1 ) +{ + BOOST_TEST( sample0 == samples1[index5/2] ); + BOOST_TEST( sample1 == samples2[index5%2] ); + + ++index5; +} + +//____________________________________________________________________________// + +int index6 = 0; + +BOOST_DATA_TEST_CASE( test_case_interface_06, samples1 * samples2 * samples3, intval, str, val2 ) +{ + BOOST_TEST( intval == samples1[index6/4] ); + BOOST_TEST( str == samples2[(index6/2)%2] ); + BOOST_TEST( val2 == samples3[index6%2] ); + + ++index6; +} + +//____________________________________________________________________________// + +// test dataset dim > 3 +int index7 = 0; + +float samples4[] = {1E3f, 1E-3f, 3.14f}; + +#define sizeoftable(x) (sizeof(x)/sizeof(x[0])) + +BOOST_DATA_TEST_CASE( test_case_interface_07, samples1 * samples2 * samples3 * samples4, intval, str, val2, floatval ) +{ + BOOST_TEST_CONTEXT("index7 " << index7) { + BOOST_TEST( intval == samples1[index7/(sizeoftable(samples4)*sizeoftable(samples3)*samples2.size())] ); + BOOST_TEST( str == samples2[(index7/(sizeoftable(samples4)*sizeoftable(samples3)))%samples2.size()] ); + BOOST_TEST( val2 == samples3[(index7/sizeoftable(samples4))%sizeoftable(samples3)] ); + BOOST_TEST( floatval == samples4[index7%sizeoftable(samples4)] ); + } + ++index7; +} + +//____________________________________________________________________________// + +static int index8 = 1; + +struct SharedFixture { + SharedFixture() + : m_expected(index8++) + { + } + + int m_expected; +}; + +BOOST_DATA_TEST_CASE_F( SharedFixture, test_case_interface_08, data::make({1,2,3}) ) +{ + BOOST_TEST( sample == m_expected ); +} + +//____________________________________________________________________________// + +BOOST_DATA_TEST_CASE(test_case_interface_correct_file_line_declaration, samples2) +{ + boost::unit_test::test_case const& current_test_case = boost::unit_test::framework::current_test_case(); + BOOST_TEST(current_test_case.p_line_num == 136); + BOOST_TEST(current_test_case.p_file_name == __FILE__); +} + +//____________________________________________________________________________// +// ticket 13443 + +BOOST_DATA_TEST_CASE( + test_arity_above_9, + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ) ^ + data::make( { 1, 2, 3, 5 } ), + sample1, sample2, sample3, sample4, sample5, sample6, sample7, sample8, sample9, sample10) +{ +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_has_dataset ) +{ + using t1 = decltype(data::make( 1 )); + BOOST_TEST((data::monomorphic::has_dataset<t1>::value)); + + BOOST_TEST((data::monomorphic::has_dataset<int, t1>::value)); + BOOST_TEST((!data::monomorphic::has_dataset<int, float>::value)); +} + +//____________________________________________________________________________// + + +static int index_fixture_setup_teardown = 0; + +struct SharedFixtureSetupTeardown { + SharedFixtureSetupTeardown() + : m_expected(1 + index_fixture_setup_teardown) + {} + + void setup() { + m_expected *= m_expected; + } + + void teardown() { + index_fixture_setup_teardown++; + } + + int m_expected; +}; + +BOOST_DATA_TEST_CASE_F( SharedFixtureSetupTeardown, test_case_interface_setup_teardown, data::make({0,1,2,3}) ) +{ + BOOST_TEST( sample == index_fixture_setup_teardown ); + BOOST_TEST( m_expected == (1+sample)*(1+sample)); +} + +//____________________________________________________________________________// +// GH-217 + +#ifndef BOOST_TEST_ERRONEOUS_INIT_LIST + +const bool ExpectedValues[] = { false, true, true, true, false, false}; +BOOST_DATA_TEST_CASE(BoostDataTest + , boost::unit_test::data::make({ false, true, true, true, false, false }) ^ + boost::unit_test::data::make(ExpectedValues) + , value, expectedValue) +{ + BOOST_TEST(value == expectedValue); +} +#endif + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/datasets-test/xrange-test.cpp b/src/boost/libs/test/test/test-organization-ts/datasets-test/xrange-test.cpp new file mode 100644 index 000000000..a68da9941 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/datasets-test/xrange-test.cpp @@ -0,0 +1,88 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests singleton dataset +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/monomorphic/generators/xrange.hpp> +#include <boost/test/data/monomorphic/join.hpp> +#include <boost/test/data/for_each_sample.hpp> +namespace data=boost::unit_test::data; + +#include "datasets-test.hpp" + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_single_range ) +{ + BOOST_TEST( data::xrange( 5 ).size() == 5 ); + BOOST_TEST( data::xrange( 3. ).size() == 3 ); + BOOST_CHECK_THROW( data::xrange( -5 ), std::logic_error ); + BOOST_CHECK_THROW( data::xrange( 0 ), std::logic_error ); + + BOOST_TEST( data::xrange( 1, 5 ).size() == 4 ); + BOOST_TEST( data::xrange( -5, 0 ).size() == 5 ); + BOOST_TEST( data::xrange( 1., 7.5 ).size() == 7 ); + BOOST_CHECK_THROW( data::xrange( 0, 0 ), std::logic_error ); + BOOST_CHECK_THROW( data::xrange( 3, 1 ), std::logic_error ); + + BOOST_TEST( data::xrange( 3, 9, 2 ).size() == 3 ); + BOOST_TEST( data::xrange( 5, 0, -1 ).size() == 5 ); + BOOST_TEST( data::xrange( 1, 10, 2 ).size() == 5 ); + BOOST_TEST( data::xrange( 1, 10, 3 ).size() == 3 ); + BOOST_TEST( data::xrange( 1, 10, 8 ).size() == 2 ); + BOOST_TEST( data::xrange( 0., 3., 0.4 ).size() == 8 ); + BOOST_TEST( data::xrange( 1e-6, 2.e-6, 1e-9 ).size() == 1000 ); + + BOOST_TEST( data::xrange<int>(( data::begin = 9, data::end = 15 )).size() == 6 ); + BOOST_TEST( data::xrange<double>(( data::step = 0.5, data::end = 3 )).size() == 6 ); + + int c = 0; + data::for_each_sample( data::xrange( 3 ), [&c](int a) { + BOOST_TEST( a == c++ ); + }); + + c = 1; + data::for_each_sample( data::xrange( 1, 10, 2 ), [&c](int a) { + BOOST_TEST( a == c ); + c += 2; + }); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_range_join ) +{ + auto ds = data::xrange( 1, 4 ) + data::xrange( 7, 11 ); + + BOOST_TEST( ds.size() == 7 ); + + invocation_count ic; + ic.m_value = 0; + data::for_each_sample( ds, ic ); + BOOST_TEST( ic.m_value == 7 ); + + int arr[] = {1,2,3,7,8,9,10}; + int* exp = arr; + int c = 0; + + data::for_each_sample( ds, [&c,exp](int a) { + BOOST_TEST( a == exp[c++] ); + }); +} + +//____________________________________________________________________________// + +// EOF + + diff --git a/src/boost/libs/test/test/test-organization-ts/parameterized_test-test.cpp b/src/boost/libs/test/test/test-organization-ts/parameterized_test-test.cpp new file mode 100644 index 000000000..a897ba512 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/parameterized_test-test.cpp @@ -0,0 +1,233 @@ +// (C) Copyright Gennadiy Rozental 2002-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. +// +// Description : tests parameterized tests +// Note: this file should be compatible with C++03 compilers (features in boost.test v2) +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/parameterized_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/results_collector.hpp> +#include <boost/test/utils/nullstream.hpp> +typedef boost::onullstream onullstream_type; + +namespace ut = boost::unit_test; + +// BOOST +#include <boost/scoped_ptr.hpp> + +// STL +#include <list> +#include <iostream> + +//____________________________________________________________________________// + +void test0( int i ) +{ + BOOST_TEST( (i%2 == 0) ); // amounts to BOOST_CHECK, for backward compatibility wrt. boost.test v2 +} + +//____________________________________________________________________________// + +void test1( int i ) +{ + BOOST_TEST( (i%2 == 0) ); + if( i%3 == 0 ) { + throw 124; + } +} + +//____________________________________________________________________________// + +static void +setup_tree( ut::test_suite* master_tu ) +{ + master_tu->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( master_tu->p_id ); +} + +//____________________________________________________________________________// + +struct logger_guard { + logger_guard(std::ostream& s_out) { + ut::unit_test_log.set_stream( s_out ); + } + ~logger_guard() { + ut::unit_test_log.set_stream( std::cout ); + } +}; + +BOOST_AUTO_TEST_CASE( test_case1 ) +{ + // if an exception is thrown in the test, this object is destructed when we reach the logger + // for logging the exception. This happens for instance if the test->add throws: + // - test case aborted, null_output destructed but still refered from the logger + // - exception caught by the framework, and exception content logged + // - reference to a non-existing log stream + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 2, 2, 2 }; + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 0U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_case2 ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 1, 2, 2 }; + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 1U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_case3 ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 1, 1, 2 }; + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 2U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_case4 ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 1, 1, 1 }; + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 3U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_case5 ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 6, 6, 6 }; + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 3U ); + BOOST_TEST( !tr.p_aborted ); + BOOST_TEST( !tr.passed() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_case6 ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 0, 3, 9 }; + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 5U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_case7 ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 2, 3, 9 }; + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 4U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_case8 ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + int test_data[] = { 3, 2, 6 }; + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + + setup_tree( test ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 3U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/test-tree-management-test.cpp b/src/boost/libs/test/test/test-organization-ts/test-tree-management-test.cpp new file mode 100644 index 000000000..97a22804f --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test-tree-management-test.cpp @@ -0,0 +1,329 @@ +// (C) Copyright Gennadiy Rozental 2007-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : test tree management unit test +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE test tree management test +#include <boost/test/unit_test.hpp> +using namespace boost::unit_test; + +#include <boost/mpl/vector.hpp> + +//____________________________________________________________________________// + +// some empty test suites/cases + +BOOST_AUTO_TEST_SUITE( S1 ) + +#if BOOST_PP_VARIADICS +BOOST_AUTO_TEST_CASE( tc1, * expected_failures(1) ) +#else +BOOST_TEST_DECORATOR(*boost::unit_test::expected_failures(1)) BOOST_AUTO_TEST_CASE( tc1 ) /* on the same line, otherwise some test below should be updated */ +#endif +{ BOOST_ERROR(""); } + +BOOST_AUTO_TEST_CASE( tc2 ) {} + +BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE( S1 ) + +void tc3() {} +void tc4() {} + +struct myreg { + myreg() { + framework::current_auto_test_suite().add( BOOST_TEST_CASE( &tc3 ) ); + framework::current_auto_test_suite().add( BOOST_TEST_CASE( &tc4 ) ); + } +} myreg_; + +BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE( S2 ) + +BOOST_AUTO_TEST_CASE( tc1 ) {} +BOOST_AUTO_TEST_CASE( tc2 ) {} + +BOOST_AUTO_TEST_SUITE( S21 ) + +#if BOOST_PP_VARIADICS +BOOST_AUTO_TEST_CASE( tc1, * expected_failures(1) ) +#else +BOOST_TEST_DECORATOR(*boost::unit_test::expected_failures(1)) BOOST_AUTO_TEST_CASE( tc1 ) /* on the same line, otherwise some test below should be updated (the test is sensitive to line numbers) */ +#endif +{ BOOST_ERROR( "" ); } + +BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE( S3 ) + +BOOST_AUTO_TEST_SUITE_END() + +struct F1 { + F1() { BOOST_TEST_MESSAGE( "In F1" ); } +}; + +BOOST_AUTO_TEST_SUITE( S4 ) + +typedef boost::mpl::vector<int,float,char> test_types; +BOOST_FIXTURE_TEST_CASE_TEMPLATE( tctempl, T, test_types, F1 ) +{ +} + +BOOST_AUTO_TEST_SUITE_END() + +struct F2 { + F2() { BOOST_TEST_MESSAGE( "In F2" ); } +}; + +BOOST_FIXTURE_TEST_SUITE( S5, F2 ) + +typedef boost::mpl::vector<int,float,char,double,short int> test_types; +BOOST_AUTO_TEST_CASE_TEMPLATE( tctempl, T, test_types ) +{ +} + +BOOST_AUTO_TEST_SUITE_END() + +//____________________________________________________________________________// + +// VC9 defines a function called void empty(); in ivec.h +void empty_() {} + +BOOST_AUTO_TEST_CASE( manual_test_case_creation_test ) +{ + test_case* tc1 = BOOST_TEST_CASE( &empty_ ); + + BOOST_TEST( tc1->p_type == TUT_CASE ); + BOOST_TEST( tc1->p_type_name == const_string( "case" ) ); + BOOST_TEST( tc1->p_parent_id == INV_TEST_UNIT_ID ); + BOOST_TEST( tc1->p_id != INV_TEST_UNIT_ID ); + + BOOST_TEST( tc1->p_expected_failures == 0U ); + BOOST_TEST( tc1->p_timeout == 0U ); + BOOST_TEST( tc1->p_name == const_string( "empty_" ) ); + BOOST_TEST( tc1->p_test_func ); + BOOST_TEST( tc1->p_default_status == test_unit::RS_INHERIT ); + BOOST_TEST( tc1->p_run_status == test_unit::RS_INVALID ); + BOOST_TEST( !tc1->is_enabled() ); + + BOOST_TEST( &framework::get<test_case>( tc1->p_id ) == tc1 ); + BOOST_TEST( &framework::get( tc1->p_id, TUT_CASE ) == tc1 ); + + BOOST_CHECK_THROW( framework::get( tc1->p_id, TUT_SUITE ), framework::internal_error ); + + test_case* tc2 = make_test_case( &empty_, "my test case", "test_file_name", 1 ); + BOOST_TEST( tc2->p_name == const_string( "my test case" ) ); + BOOST_TEST( tc2->p_file_name == const_string( "test_file_name" ) ); + BOOST_TEST( tc2->p_line_num == 1U ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( manual_test_suite_creation ) +{ + test_suite* ts1 = BOOST_TEST_SUITE( "TestSuite" ); + + BOOST_TEST( ts1->p_type == TUT_SUITE ); + BOOST_TEST( ts1->p_type_name == const_string( "suite" ) ); + BOOST_TEST( ts1->p_parent_id == INV_TEST_UNIT_ID ); + BOOST_TEST( ts1->p_id != INV_TEST_UNIT_ID ); + const_string fn(ts1->p_file_name); + const_string::size_type pos = fn.rfind( "/" ); + if( pos != const_string::npos ) + fn.trim_left( pos+1 ); + pos = fn.rfind( "\\" ); + if( pos != const_string::npos ) + fn.trim_left( pos+1 ); + BOOST_TEST( fn == const_string( "test-tree-management-test.cpp" ) ); + BOOST_TEST( ts1->p_line_num == 138U ); + + BOOST_TEST( ts1->p_expected_failures == 0U ); + BOOST_TEST( ts1->p_timeout == 0U ); + BOOST_TEST( ts1->p_name == const_string( "TestSuite" ) ); + BOOST_TEST( ts1->p_default_status == test_unit::RS_INHERIT ); + BOOST_TEST( ts1->p_run_status == test_unit::RS_INVALID ); + BOOST_TEST( !ts1->is_enabled() ); + BOOST_TEST( ts1->size() == 0U ); + + BOOST_TEST( &framework::get<test_suite>( ts1->p_id ) == ts1 ); + BOOST_TEST( &framework::get( ts1->p_id, TUT_SUITE ) == ts1 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( manual_test_unit_registration ) +{ + test_suite* ts1 = BOOST_TEST_SUITE( "TestSuite" ); + + std::size_t line_num = 1; + + test_case* tc1 = make_test_case( &empty_, "empty1", "file_name", line_num ); + + ts1->add( tc1, 1, 10U ); + BOOST_TEST( ts1->size() == 1U ); + + BOOST_TEST( tc1->p_expected_failures == 1U ); + BOOST_TEST( tc1->p_timeout == 10U ); + BOOST_TEST( ts1->p_expected_failures == 1U ); + + test_case* tc2 = make_test_case( &empty_, "empty2", "file_name", line_num ); + + ts1->add( tc2, 2U ); + BOOST_TEST( ts1->size() == 2U ); + + BOOST_TEST( tc2->p_expected_failures == 2U ); + BOOST_TEST( tc2->p_timeout == 0U ); + BOOST_TEST( ts1->p_expected_failures == 3U ); + + test_suite* ts2 = BOOST_TEST_SUITE( "TestSuite2" ); + + ts1->add( ts2 ); + BOOST_TEST( ts1->size() == 3U ); + + BOOST_TEST( ts2->p_expected_failures == 0U ); + BOOST_TEST( ts1->p_expected_failures == 3U ); + + BOOST_TEST( ts1->get( "empty1" ) == tc1->p_id ); + BOOST_TEST( ts1->get( "empty2" ) == tc2->p_id ); + BOOST_TEST( ts1->get( "TestSuite2" ) == ts2->p_id ); + BOOST_TEST( ts1->get( "another name" ) == INV_TEST_UNIT_ID ); + + ts1->remove( tc1->p_id ); + BOOST_TEST( ts1->size() == 2U ); + BOOST_TEST( ts1->get( "empty1" ) == INV_TEST_UNIT_ID ); + +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( automated_test_units_registration ) +{ + test_suite& mts = framework::master_test_suite(); + + BOOST_TEST( mts.size() == 10U ); + BOOST_TEST( mts.p_expected_failures == 2U ); + + BOOST_TEST( framework::get<test_case>( mts.get( "automated_test_units_registration" ) ).p_expected_failures == 0U ); + + test_suite& S1 = framework::get<test_suite>( mts.get( "S1" ) ); + + BOOST_TEST( S1.size() == 4U ); + BOOST_TEST( S1.p_expected_failures == 1U ); + + test_suite& S2 = framework::get<test_suite>( mts.get( "S2" ) ); + + BOOST_TEST( S2.size() == 3U ); + BOOST_TEST( S2.p_expected_failures == 1U ); + + test_suite& S3 = framework::get<test_suite>( mts.get( "S3" ) ); + + BOOST_TEST( S3.size() == 0U ); + BOOST_TEST( S3.p_expected_failures == 0U ); + + test_suite& S21 = framework::get<test_suite>( S2.get( "S21" ) ); + + BOOST_TEST( S21.size() == 1U ); + BOOST_TEST( S1.p_expected_failures == 1U ); + + test_suite& S4 = framework::get<test_suite>( mts.get( "S4" ) ); + + BOOST_TEST( S4.size() == 3U ); + + test_suite& S5 = framework::get<test_suite>( mts.get( "S5" ) ); + + BOOST_TEST( S5.size() == 5U ); +} + +//____________________________________________________________________________// + +struct A { + A() : i(0){} + virtual ~A(){} + void test_methodA1() { i++; } + void test_methodA2() { i++; } + + int i; +}; + +struct B : public A { + void test_methodB() { i--; } +}; + +struct C { + C() : i( 0 ) {} + virtual ~C(){} + void virtual test_method() = 0; + + int i; +}; + +struct D : public C { + void virtual test_method() { i++; } +}; + +struct E : public C { + void virtual test_method() { i+=2; } +}; + +BOOST_AUTO_TEST_CASE( user_class_test_case ) +{ + boost::shared_ptr<A> instA( new A ); + test_case* tc1 = BOOST_CLASS_TEST_CASE( &A::test_methodA1, instA ); + test_case* tc2 = BOOST_CLASS_TEST_CASE( &A::test_methodA2, instA ); + + BOOST_TEST( tc1->p_name == const_string( "A__test_methodA1" ) ); + BOOST_TEST( tc2->p_name == const_string( "A__test_methodA2" ) ); + + BOOST_TEST( instA->i == 0 ); + tc1->p_test_func.get()(); + BOOST_TEST( instA->i == 1 ); + tc2->p_test_func.get()(); + BOOST_TEST( instA->i == 2 ); + + boost::shared_ptr<B> instB( new B ); + test_case* tc3 = BOOST_CLASS_TEST_CASE( &A::test_methodA1, instB ); + test_case* tc4 = BOOST_CLASS_TEST_CASE( &B::test_methodB, instB ); + + BOOST_TEST( tc3->p_name == const_string( "A__test_methodA1" ) ); + BOOST_TEST( tc4->p_name == const_string( "B__test_methodB" ) ); + + BOOST_TEST( instB->i == 0 ); + tc3->p_test_func.get()(); + BOOST_TEST( instB->i == 1 ); + tc4->p_test_func.get()(); + BOOST_TEST( instB->i == 0 ); + + boost::shared_ptr<C> instC1( new D ); + test_case* tc5 = BOOST_CLASS_TEST_CASE( &C::test_method, instC1 ); + + BOOST_TEST( tc5->p_name == const_string( "C__test_method" ) ); + + tc5->p_test_func.get()(); + BOOST_TEST( instC1->i == 1 ); + + boost::shared_ptr<C> instC2( new E ); + test_case* tc6 = BOOST_CLASS_TEST_CASE( &C::test_method, instC2 ); + + BOOST_TEST( tc6->p_name == const_string( "C__test_method" ) ); + + tc6->p_test_func.get()(); + BOOST_TEST( instC2->i == 2 ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl-1.hpp b/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl-1.hpp new file mode 100644 index 000000000..8b4efe2d3 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl-1.hpp @@ -0,0 +1,23 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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. + +// first file, should be exactly the same as second file except for the test name +BOOST_AUTO_TEST_SUITE(data) +BOOST_AUTO_TEST_SUITE(foo) + +BOOST_AUTO_TEST_CASE(test1) +{ + BOOST_TEST(true); +} +BOOST_TEST_DECORATOR(* boost::unit_test::description("with description")) +BOOST_AUTO_TEST_CASE(test11) +{ + BOOST_TEST(true); +} + +BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl-2.hpp b/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl-2.hpp new file mode 100644 index 000000000..9f4d9c3c0 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl-2.hpp @@ -0,0 +1,23 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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. + +// second file, should be exactly the same as second file except for the test name +BOOST_AUTO_TEST_SUITE(data) +BOOST_AUTO_TEST_SUITE(foo) + +BOOST_AUTO_TEST_CASE(test2) +{ + BOOST_TEST(true); +} +BOOST_TEST_DECORATOR(* boost::unit_test::description("with description")) +BOOST_AUTO_TEST_CASE(test21) +{ + BOOST_TEST(true); +} + +BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl.cpp b/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl.cpp new file mode 100644 index 000000000..1b64027c0 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test-tree-several-suite-decl.cpp @@ -0,0 +1,12 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 several test suite decl +#include <boost/test/unit_test.hpp> + +#include "test-tree-several-suite-decl-1.hpp" +#include "test-tree-several-suite-decl-2.hpp" diff --git a/src/boost/libs/test/test/test-organization-ts/test_case_template-test.cpp b/src/boost/libs/test/test/test-organization-ts/test_case_template-test.cpp new file mode 100644 index 000000000..f76d24062 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_case_template-test.cpp @@ -0,0 +1,199 @@ +// (C) Copyright Gennadiy Rozental 2003-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests function template test case +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/results_collector.hpp> +#include <boost/test/utils/nullstream.hpp> +typedef boost::onullstream onullstream_type; + +// BOOST +#include <boost/mpl/range_c.hpp> +#include <boost/mpl/list_c.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/scoped_ptr.hpp> + +#include <boost/config.hpp> + +namespace ut = boost::unit_test; +namespace mpl = boost::mpl; + +// STL +#include <iostream> + +struct logger_guard { + logger_guard(std::ostream& s_out) { + ut::unit_test_log.set_stream( s_out ); + } + ~logger_guard() { + ut::unit_test_log.set_stream( std::cout ); + } +}; + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test0, Number ) +{ + BOOST_TEST( 2 == (int)Number::value ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test1, Number ) +{ + BOOST_TEST( 6 == (int)Number::value ); + BOOST_TEST_REQUIRE( 2 <= (int)Number::value ); + BOOST_TEST( 3 == (int)Number::value ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test2, Number ) +{ + throw Number(); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test0_only_2 ) +{ + // if an exception is thrown in the test, this object is destructed when we reach the logger + // for logging the exception. This happens for instance if the test->add throws: + // - test case aborted, null_output destructed but still refered from the logger + // - exception caught by the framework, and exception content logged + // - reference to a non-existing log stream + onullstream_type null_output; + logger_guard G( null_output ); + + typedef boost::mpl::list_c<int,2> only_2; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test0, only_2 ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 0U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test0_one_to_ten ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + typedef boost::mpl::range_c<int,0,10> one_to_ten; + + test->add( BOOST_TEST_CASE_TEMPLATE( test0, one_to_ten ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 9U ); + BOOST_TEST( !tr.p_aborted ); + +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test1_one_to_five ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + typedef boost::mpl::range_c<int,1,5> one_to_five; + test->add( BOOST_TEST_CASE_TEMPLATE( test1, one_to_five ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 7U ); + BOOST_TEST( !tr.p_aborted ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test2_one_to_three ) +{ + onullstream_type null_output; + logger_guard G( null_output ); + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + typedef boost::mpl::range_c<int,1,3> one_to_three; + test->add( BOOST_TEST_CASE_TEMPLATE( test2, one_to_three ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 2U ); + BOOST_TEST( !tr.p_aborted ); + BOOST_TEST( !tr.passed() ); +} + +//____________________________________________________________________________// + +// checks if volatile, const, ... are properly handled +typedef boost::mpl::vector<int,int const, int volatile,int const volatile> test_types_ints_variations; +BOOST_AUTO_TEST_CASE_TEMPLATE( tctempl2, T, test_types_ints_variations ) +{ + BOOST_TEST( sizeof(T) == sizeof(int) ); +} + +// checks if references are properly handled +typedef boost::mpl::vector< + int + , int& +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + , int&& +#endif + , int const + , int const& +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + , int const&& +#endif +> test_types_ints_ref_variations; +BOOST_AUTO_TEST_CASE_TEMPLATE( tctempl3, T, test_types_ints_ref_variations ) +{ + BOOST_TEST( (sizeof(T) == sizeof(int&) || sizeof(T) == sizeof(int)) ); +} + +// checks if pointers are properly handled +typedef boost::mpl::vector<int,int*,int const*, int const volatile*, int const*const, int*&> test_types_ints_pointer_variations; +BOOST_AUTO_TEST_CASE_TEMPLATE( tctempl4, T, test_types_ints_pointer_variations ) +{ + BOOST_TEST( (sizeof(T) == sizeof(int*) || sizeof(T) == sizeof(int))); +} + + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/test_case_template-with-tuples-test.cpp b/src/boost/libs/test/test/test-organization-ts/test_case_template-with-tuples-test.cpp new file mode 100644 index 000000000..438ef0844 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_case_template-with-tuples-test.cpp @@ -0,0 +1,148 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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) + +// Checks the instanciation of template test cases with tuples instead of mpl::list +// See trac #12092 https://svn.boost.org/trac10/ticket/12092 +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE template_test_case_with_tuples +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/results_collector.hpp> +#include <boost/test/utils/nullstream.hpp> +typedef boost::onullstream onullstream_type; + +#include <boost/mpl/integral_c.hpp> +#include <tuple> + +namespace ut = boost::unit_test; +namespace mpl = boost::mpl; + +#include <iostream> + +struct logger_guard { + logger_guard(std::ostream& s_out) { + ut::unit_test_log.set_stream( s_out ); + } + ~logger_guard() { + ut::unit_test_log.set_stream( std::cout ); + } +}; + + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test0, Number ) +{ + BOOST_TEST( 2 == (int)Number::value ); +} + +BOOST_AUTO_TEST_CASE( test0_only_2 ) +{ + onullstream_type null_output; + logger_guard G(null_output); + + typedef std::tuple< mpl::integral_c<int,2> > only_2; + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test0, only_2 ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 0U ); + BOOST_TEST( !tr.p_aborted ); +} + +BOOST_AUTO_TEST_CASE( test1_with_9_errors ) +{ + onullstream_type null_output; + logger_guard G(null_output); + + typedef std::tuple< + mpl::integral_c<int,0>, + mpl::integral_c<int,1>, + mpl::integral_c<int,2>, + mpl::integral_c<int,3>, + mpl::integral_c<int,4>, + mpl::integral_c<int,5>, + mpl::integral_c<int,6>, + mpl::integral_c<int,7>, + mpl::integral_c<int,8>, + mpl::integral_c<int,9> + > range_10; + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test0, range_10 ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 9U ); + BOOST_TEST( !tr.p_aborted ); +} + + +int counter = 0; +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test_counter, Number ) +{ + BOOST_TEST( counter++ == (int)Number::value ); +} + +BOOST_AUTO_TEST_CASE( test_left_to_right_evaluation ) +{ + onullstream_type null_output; + logger_guard G(null_output); + + typedef std::tuple< + mpl::integral_c<int,0>, + mpl::integral_c<int,1>, + mpl::integral_c<int,2>, + mpl::integral_c<int,3>, + mpl::integral_c<int,4>, + mpl::integral_c<int,5>, + mpl::integral_c<int,6>, + mpl::integral_c<int,7>, + mpl::integral_c<int,8>, + mpl::integral_c<int,9> + > range_10; + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test_counter, range_10 ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 0U ); + BOOST_TEST( !tr.p_aborted ); +} + + +typedef std::tuple< + mpl::integral_c<int,1>, + mpl::integral_c<int,3>, + mpl::integral_c<int,5>, + mpl::integral_c<int,6>, + mpl::integral_c<int,7>, + mpl::integral_c<int,8>, + mpl::integral_c<int,9> +> range_special; + +BOOST_AUTO_TEST_CASE_TEMPLATE(odd_or_above_5, T, range_special) { + BOOST_TEST( (T::value % 2 || T::value >= 5 ) ); +} diff --git a/src/boost/libs/test/test/test-organization-ts/test_case_template-with-variadic-typelist.cpp b/src/boost/libs/test/test/test-organization-ts/test_case_template-with-variadic-typelist.cpp new file mode 100644 index 000000000..b5400671e --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_case_template-with-variadic-typelist.cpp @@ -0,0 +1,158 @@ +// (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) + +// Extends #12092 with arbitrary type list +// see https://svn.boost.org/trac10/ticket/13418 and +// https://github.com/boostorg/test/issues/141 +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE template_test_case_with_variadic +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/results_collector.hpp> +#include <boost/test/utils/nullstream.hpp> +typedef boost::onullstream onullstream_type; + +#include <boost/mpl/integral_c.hpp> + +// tuple already done in another test module +// #include <tuple> + + + +namespace ut = boost::unit_test; +namespace mpl = boost::mpl; + +#include <iostream> + +struct logger_guard { + logger_guard(std::ostream& s_out) { + ut::unit_test_log.set_stream( s_out ); + } + ~logger_guard() { + ut::unit_test_log.set_stream( std::cout ); + } +}; + +template <class ... T> +struct dummy1 { + +}; + + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test0, Number ) +{ + BOOST_TEST( 2 == (int)Number::value ); +} + +BOOST_AUTO_TEST_CASE( test0_only_2 ) +{ + onullstream_type null_output; + logger_guard G(null_output); + + typedef dummy1< mpl::integral_c<int,2> > only_2; + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test0, only_2 ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 0U ); + BOOST_TEST( !tr.p_aborted ); +} + +BOOST_AUTO_TEST_CASE( test1_with_9_errors ) +{ + onullstream_type null_output; + logger_guard G(null_output); + + typedef dummy1< + mpl::integral_c<int,0>, + mpl::integral_c<int,1>, + mpl::integral_c<int,2>, + mpl::integral_c<int,3>, + mpl::integral_c<int,4>, + mpl::integral_c<int,5>, + mpl::integral_c<int,6>, + mpl::integral_c<int,7>, + mpl::integral_c<int,8>, + mpl::integral_c<int,9> + > range_10; + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test0, range_10 ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 9U ); + BOOST_TEST( !tr.p_aborted ); +} + + +int counter = 0; +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test_counter, Number ) +{ + BOOST_TEST( counter++ == (int)Number::value ); +} + +BOOST_AUTO_TEST_CASE( test_left_to_right_evaluation ) +{ + onullstream_type null_output; + logger_guard G(null_output); + + typedef dummy1< + mpl::integral_c<int,0>, + mpl::integral_c<int,1>, + mpl::integral_c<int,2>, + mpl::integral_c<int,3>, + mpl::integral_c<int,4>, + mpl::integral_c<int,5>, + mpl::integral_c<int,6>, + mpl::integral_c<int,7>, + mpl::integral_c<int,8>, + mpl::integral_c<int,9> + > range_10; + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test_counter, range_10 ) ); + + test->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( test->p_id ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_TEST( tr.p_assertions_failed == 0U ); + BOOST_TEST( !tr.p_aborted ); +} + + +typedef dummy1< + mpl::integral_c<int,1>, + mpl::integral_c<int,3>, + mpl::integral_c<int,5>, + mpl::integral_c<int,6>, + mpl::integral_c<int,7>, + mpl::integral_c<int,8>, + mpl::integral_c<int,9> +> range_special; + +BOOST_AUTO_TEST_CASE_TEMPLATE(odd_or_above_5, T, range_special) { + BOOST_TEST( (T::value % 2 || T::value >= 5 ) ); +} diff --git a/src/boost/libs/test/test/test-organization-ts/test_unit-nested-suite-dependency.cpp b/src/boost/libs/test/test/test-organization-ts/test_unit-nested-suite-dependency.cpp new file mode 100644 index 000000000..34d731e82 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_unit-nested-suite-dependency.cpp @@ -0,0 +1,84 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 +//! checking the nested suites activation, ticket trac #13149 +// ***************************************************************************** + +#define BOOST_TEST_MODULE test_nested_dependency +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/tree/test_case_counter.hpp> +#include <boost/test/tree/traverse.hpp> + +// initial reproducing snippet on the corresponding ticket +#if 0 +BOOST_AUTO_TEST_SUITE(suite1, *boost::unit_test::depends_on("suite2")) + BOOST_AUTO_TEST_SUITE(suite1_nested) + BOOST_AUTO_TEST_CASE(suite1_test1) + { + BOOST_CHECK(true); + } + BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE(suite2) + BOOST_AUTO_TEST_CASE(suite2_test2) + { + BOOST_CHECK(true); + } +BOOST_AUTO_TEST_SUITE_END() +#endif + +void suite1_test1() +{ + BOOST_CHECK(true); +} + +void suite2_test2() +{ + BOOST_CHECK(true); +} + +BOOST_AUTO_TEST_CASE( some_test ) +{ + using namespace boost::unit_test; + + // test tree + test_suite* master_ts = BOOST_TEST_SUITE("local master"); + test_suite* t_suite1 = BOOST_TEST_SUITE( "suite1" ); + test_suite* t_suite1_nested = BOOST_TEST_SUITE( "suite1_nested" ); + t_suite1_nested->add( BOOST_TEST_CASE( suite1_test1 ) ); + t_suite1->add(t_suite1_nested); + + test_suite* t_suite2 = BOOST_TEST_SUITE( "suite2" ); + t_suite2->add( BOOST_TEST_CASE( suite2_test2 ) ); + + master_ts->add(t_suite1); + master_ts->add(t_suite2); + + // dependencies + t_suite1->depends_on( t_suite2 ); + + // running + char const* argv[] = { "dummy-test-module.exe", "--log_level=all", "--run_test=suite1/suite1_nested"}; + int argc = sizeof(argv)/sizeof(argv[0]); + + master_ts->p_default_status.value = test_unit::RS_ENABLED; + framework::finalize_setup_phase( master_ts->p_id ); + + runtime_config::init( argc, (char**)argv ); + framework::impl::setup_for_execution( *master_ts ); + + // no need to run + //framework::run( master_ts ); + + // we should have 2 test cases enabled with this run parameters + test_case_counter tcc; + traverse_test_tree( master_ts->p_id, tcc ); + BOOST_TEST( tcc.p_count == 2 ); +} diff --git a/src/boost/libs/test/test/test-organization-ts/test_unit-order-shuffled-test.cpp b/src/boost/libs/test/test/test-organization-ts/test_unit-order-shuffled-test.cpp new file mode 100644 index 000000000..058865653 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_unit-order-shuffled-test.cpp @@ -0,0 +1,149 @@ +// (C) Copyright Raffi Enficiaud 2016. +// 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 +/// @brief tests order of the running unit tests under shuffling +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE test unit order shuffled test +#include <boost/test/included/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/tree/visitor.hpp> +#include <boost/test/utils/string_cast.hpp> + +#include <boost/test/utils/nullstream.hpp> +typedef boost::onullstream onullstream_type; +namespace ut = boost::unit_test; +namespace tt = boost::test_tools; + +#include <cstddef> +#include <iostream> + +//____________________________________________________________________________// + +void some_test() {} +#define TC( name ) \ +boost::unit_test::make_test_case( boost::function<void ()>(some_test), \ + BOOST_TEST_STRINGIZE( name ), \ + __FILE__, __LINE__ ) + +//____________________________________________________________________________// + +struct tu_order_collector : ut::test_observer { + virtual void test_unit_start( ut::test_unit const& tu ) + { + //std::cout << "## TU: " << tu.full_name() << std::endl; + m_order.push_back( tu.p_id ); + } + + std::vector<ut::test_unit_id> m_order; +}; + +//____________________________________________________________________________// + +static tu_order_collector +run_tree( ut::test_suite* master ) +{ + std::cout << "## TU: START" << std::endl; + tu_order_collector c; + ut::framework::register_observer( c ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( master->p_id ); + ut::framework::impl::setup_for_execution( *master ); + + onullstream_type null_output; + ut::unit_test_log.set_stream( null_output ); + + ut::framework::run( master ); + ut::unit_test_log.set_stream( std::cout ); + + ut::framework::deregister_observer( c ); + + return c; +} + +//____________________________________________________________________________// + +struct test_tree { + test_tree() { + master = BOOST_TEST_SUITE( "master" ); + + std::size_t nb_ts = (std::max)(3, std::rand() % 17); + std::vector<ut::test_suite*> tsuites(1, master); // master is in there + + for(std::size_t s = 0; s < nb_ts; s++) + { + tsuites.push_back(BOOST_TEST_SUITE( "ts1_" + boost::unit_test::utils::string_cast(s))); + master->add( tsuites.back() ); + } + + std::size_t nb_ts2 = (std::max)(3, std::rand() % 11); + for(std::size_t s = 0; s < nb_ts2; s++) + { + tsuites.push_back(BOOST_TEST_SUITE( "ts2_" + boost::unit_test::utils::string_cast(s))); + tsuites[std::rand() % nb_ts]->add( tsuites.back() ); // picking a random one in the first level + } + + // generating N tests units, associating them to an aribtrary test suite + for(std::size_t s = 0; s < 10; s++) + { + ut::test_case* tc = boost::unit_test::make_test_case( + boost::function<void ()>(some_test), + "tc_" + boost::unit_test::utils::string_cast(s), + __FILE__, __LINE__ ); + tsuites[std::rand() % tsuites.size()]->add(tc); + } + + } + + ut::test_suite* master; +}; + +//____________________________________________________________________________// +BOOST_FIXTURE_TEST_CASE( test_no_seed, test_tree ) +{ + // no seed set + ut::runtime_config::s_arguments_store.set<unsigned int>(ut::runtime_config::btrt_random_seed, 0); + + tu_order_collector res1 = run_tree( master ); + tu_order_collector res2 = run_tree( master ); + + BOOST_TEST( res1.m_order == res2.m_order, tt::per_element() ); +} + +BOOST_FIXTURE_TEST_CASE( test_seed_to_time, test_tree ) +{ + // seed = 1 means current time is used. + ut::runtime_config::s_arguments_store.set<unsigned int>(ut::runtime_config::btrt_random_seed, 1); + + tu_order_collector res1 = run_tree( master ); + tu_order_collector res2 = run_tree( master ); + + BOOST_TEST( res1.m_order != res2.m_order ); // some elements might be the same, but not the full sequences +} + +BOOST_FIXTURE_TEST_CASE( test_seed_identical, test_tree ) +{ + // seed = 1 means current time is used. + unsigned int seed = static_cast<unsigned int>( std::time( 0 ) ); + ut::runtime_config::s_arguments_store.set<unsigned int>(ut::runtime_config::btrt_random_seed, seed); + tu_order_collector res1 = run_tree( master ); + + ut::runtime_config::s_arguments_store.set<unsigned int>(ut::runtime_config::btrt_random_seed, seed); + tu_order_collector res2 = run_tree( master ); + + BOOST_TEST( res1.m_order == res2.m_order, tt::per_element() ); + + // using time seed now + ut::runtime_config::s_arguments_store.set<unsigned int>(ut::runtime_config::btrt_random_seed, 1); + tu_order_collector res3 = run_tree( master ); + BOOST_TEST( res1.m_order != res3.m_order ); // some elements might be the same, but not the full sequences + + +} diff --git a/src/boost/libs/test/test/test-organization-ts/test_unit-order-test.cpp b/src/boost/libs/test/test/test-organization-ts/test_unit-order-test.cpp new file mode 100644 index 000000000..a3b639b44 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_unit-order-test.cpp @@ -0,0 +1,383 @@ +// (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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests proper order of test unis in case of various dependencies specifications +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE test unit order test +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/tree/visitor.hpp> + +#include <boost/test/utils/nullstream.hpp> +typedef boost::onullstream onullstream_type; +namespace ut = boost::unit_test; +namespace tt = boost::test_tools; + +#include <iostream> + +//____________________________________________________________________________// + +void some_test() {} +#define TC( name ) \ +boost::unit_test::make_test_case( boost::function<void ()>(some_test), \ + BOOST_TEST_STRINGIZE( name ), \ + __FILE__, __LINE__ ) + +//____________________________________________________________________________// + +struct tu_order_collector : ut::test_observer { + virtual void test_unit_start( ut::test_unit const& tu ) + { + // std::cout << "## TU: " << tu.full_name() << std::endl; + m_order.push_back( tu.p_id ); + } + + std::vector<ut::test_unit_id> m_order; +}; + +//____________________________________________________________________________// + +static tu_order_collector +run_tree( ut::test_suite* master ) +{ + tu_order_collector c; + ut::framework::register_observer( c ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + ut::framework::finalize_setup_phase( master->p_id ); + + onullstream_type null_output; + ut::unit_test_log.set_stream( null_output ); + + //hrf_content_reporter reporter( std::cout ); + //ut::traverse_test_tree( *master, reporter, true ); + + ut::framework::run( master ); + ut::unit_test_log.set_stream( std::cout ); + + ut::framework::deregister_observer( c ); + + return c; +} + +//____________________________________________________________________________// + +struct _3cases { + _3cases() { + master = BOOST_TEST_SUITE( "master" ); + + tc1 = TC( test1 ); + tc2 = TC( test2 ); + tc3 = TC( test3 ); + + master->add( tc1 ); + master->add( tc2 ); + master->add( tc3 ); + } + + void test_run( std::vector<ut::test_unit_id> const& expected_order ) + { + tu_order_collector res = run_tree( master ); + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST( expected_order == res.m_order, tt::per_element() ); +#else + BOOST_CHECK_EQUAL_COLLECTIONS(expected_order.begin(), expected_order.end(), + res.m_order.begin(), res.m_order.end()); +#endif + } + + ut::test_suite* master; + + ut::test_case* tc1; + ut::test_case* tc2; + ut::test_case* tc3; +}; + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_simple_order, _3cases ) +{ + ut::test_unit_id order[] = {master->p_id, tc1->p_id, tc2->p_id, tc3->p_id}; + std::vector<ut::test_unit_id> expected_order(order, order+4); + + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_simple_dep1, _3cases ) +{ + tc1->depends_on( tc2 ); + + ut::test_unit_id order[] = {master->p_id, tc2->p_id, tc3->p_id, tc1->p_id}; + std::vector<ut::test_unit_id> expected_order(order, order+4); + + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_simple_dep2, _3cases ) +{ + tc1->depends_on( tc2 ); + tc2->depends_on( tc3 ); + + ut::test_unit_id order[] = {master->p_id, tc3->p_id, tc2->p_id, tc1->p_id}; + std::vector<ut::test_unit_id> expected_order(order, order+4); + + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_simple_loop1, _3cases ) +{ + tc1->depends_on( tc2 ); + tc2->depends_on( tc1 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_simple_loop2, _3cases ) +{ + tc1->depends_on( tc2 ); + tc2->depends_on( tc3 ); + tc3->depends_on( tc1 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +struct _2suites_4_cases { + _2suites_4_cases() { + master = BOOST_TEST_SUITE( "master" ); + + s1 = BOOST_TEST_SUITE( "s1" ); + s2 = BOOST_TEST_SUITE( "s2" ); + + tc1 = TC( test1 ); + tc2 = TC( test2 ); + tc3 = TC( test3 ); + tc4 = TC( test4 ); + + s1->add( tc1 ); + s1->add( tc2 ); + + s2->add( tc3 ); + s2->add( tc4 ); + + master->add( s1 ); + master->add( s2 ); + } + + void test_run( std::vector<ut::test_unit_id> const& expected_order ) + { + tu_order_collector res = run_tree( master ); + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST( expected_order == res.m_order, tt::per_element() ); +#else + BOOST_CHECK_EQUAL_COLLECTIONS(expected_order.begin(), expected_order.end(), + res.m_order.begin(), res.m_order.end()); +#endif + + } + + ut::test_suite* master; + ut::test_suite* s1; + ut::test_suite* s2; + + ut::test_case* tc1; + ut::test_case* tc2; + ut::test_case* tc3; + ut::test_case* tc4; +}; + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_normal_order, _2suites_4_cases ) +{ + ut::test_unit_id order[] = { master->p_id, + s1->p_id, tc1->p_id, tc2->p_id, + s2->p_id, tc3->p_id, tc4->p_id }; + std::vector<ut::test_unit_id> expected_order(order, order+7); + + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_simple_dep, _2suites_4_cases ) +{ + tc1->depends_on( tc2 ); + tc3->depends_on( tc4 ); + + ut::test_unit_id order[] = { master->p_id, + s1->p_id, tc2->p_id, tc1->p_id, + s2->p_id, tc4->p_id, tc3->p_id }; + std::vector<ut::test_unit_id> expected_order(order, order+7); + + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_cross_dep1, _2suites_4_cases ) +{ + tc1->depends_on( tc3 ); + + ut::test_unit_id order[] = { master->p_id, + s2->p_id, tc3->p_id, tc4->p_id, + s1->p_id, tc1->p_id, tc2->p_id }; + std::vector<ut::test_unit_id> expected_order(order, order+7); + + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_cross_dep2, _2suites_4_cases ) +{ + tc2->depends_on( tc4 ); + tc1->depends_on( tc2 ); + + ut::test_unit_id order[] = { master->p_id, + s2->p_id, tc3->p_id, tc4->p_id, + s1->p_id, tc2->p_id, tc1->p_id}; + + std::vector<ut::test_unit_id> expected_order(order, order+7); + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_on_suite_dep, _2suites_4_cases ) +{ + s1->depends_on( s2 ); + + ut::test_unit_id order[] = { master->p_id, + s2->p_id, tc3->p_id, tc4->p_id, + s1->p_id, tc1->p_id, tc2->p_id }; + + std::vector<ut::test_unit_id> expected_order(order, order+7); + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_on_case_dep, _2suites_4_cases ) +{ + s1->depends_on( tc3 ); + + ut::test_unit_id order[] = { master->p_id, + s2->p_id, tc3->p_id, tc4->p_id, + s1->p_id, tc1->p_id, tc2->p_id }; + + std::vector<ut::test_unit_id> expected_order(order, order+7); + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_case_on_suite_dep, _2suites_4_cases ) +{ + tc1->depends_on( s2 ); + ut::test_unit_id order[] = { master->p_id, + s2->p_id, tc3->p_id, tc4->p_id, + s1->p_id, tc1->p_id, tc2->p_id }; + + std::vector<ut::test_unit_id> expected_order(order, order+7); + test_run( expected_order ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_loop1, _2suites_4_cases ) +{ + tc1->depends_on( tc3 ); + tc3->depends_on( tc2 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_loop2, _2suites_4_cases ) +{ + tc1->depends_on( tc3 ); + tc4->depends_on( tc2 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_loop3, _2suites_4_cases ) +{ + s1->depends_on( tc3 ); + s2->depends_on( tc2 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_loop4, _2suites_4_cases ) +{ + s1->depends_on( tc1 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_loop5, _2suites_4_cases ) +{ + tc1->depends_on( s1 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +BOOST_FIXTURE_TEST_CASE( test_suite_loop6, _2suites_4_cases ) +{ + tc1->depends_on( s2 ); + tc3->depends_on( s1 ); + + master->p_default_status.value = ut::test_unit::RS_ENABLED; + BOOST_CHECK_THROW( ut::framework::finalize_setup_phase( master->p_id ), + ut::framework::setup_error ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/test-organization-ts/test_unit-report-clashing-names.cpp b/src/boost/libs/test/test/test-organization-ts/test_unit-report-clashing-names.cpp new file mode 100644 index 000000000..f0598a11d --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_unit-report-clashing-names.cpp @@ -0,0 +1,101 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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 +//! checking the clashing names, ticket trac #12597 +// ***************************************************************************** + +#define BOOST_TEST_MODULE test_clashing_names +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/string_cast.hpp> +#include <boost/mpl/list.hpp> +#include <boost/bind.hpp> + +void suite1_test1() +{ + BOOST_CHECK(true); +} + +BOOST_AUTO_TEST_CASE( test_clashing_suites ) +{ + using namespace boost::unit_test; + test_suite* master_ts = BOOST_TEST_SUITE("local master"); + test_suite* t_suite1 = BOOST_TEST_SUITE( "suite1" ); + test_suite* t_suite2 = BOOST_TEST_SUITE( "suite1" ); + master_ts->add(t_suite1); + BOOST_CHECK_NO_THROW( master_ts->add(t_suite2) ); + + master_ts->p_default_status.value = test_unit::RS_ENABLED; + BOOST_CHECK_THROW(framework::finalize_setup_phase( master_ts->p_id ), + boost::unit_test::framework::setup_error ); +} + +BOOST_AUTO_TEST_CASE( test_clashing_cases ) +{ + using namespace boost::unit_test; + test_suite* master_ts = BOOST_TEST_SUITE("local master"); + test_suite* t_suite1 = BOOST_TEST_SUITE( "suite1" ); + test_suite* t_suite2 = BOOST_TEST_SUITE( "suite2" ); + master_ts->add(t_suite1); + master_ts->add(t_suite2); + + t_suite1->add( BOOST_TEST_CASE( suite1_test1 ) ); + BOOST_CHECK_NO_THROW( t_suite1->add( BOOST_TEST_CASE( suite1_test1 ) ) ); + BOOST_CHECK_THROW(framework::finalize_setup_phase( master_ts->p_id ), + boost::unit_test::framework::setup_error ); + + BOOST_CHECK_NO_THROW( t_suite2->add( BOOST_TEST_CASE( suite1_test1 ) ) ); +} + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( template_test_case, T ) +{ + BOOST_TEST( sizeof(T) == 4U ); +} + +BOOST_AUTO_TEST_CASE( test_clashing_cases_template_test_case ) +{ + using namespace boost::unit_test; + test_suite* master_ts = BOOST_TEST_SUITE("local master"); + test_suite* t_suite1 = BOOST_TEST_SUITE( "suite1" ); + test_suite* t_suite2 = BOOST_TEST_SUITE( "suite2" ); + master_ts->add(t_suite1); + master_ts->add(t_suite2); + + typedef boost::mpl::list<int, long, unsigned char> test_types1; + typedef boost::mpl::list<int, long, unsigned char, int> test_types2; + + BOOST_CHECK_NO_THROW( t_suite2->add( BOOST_TEST_CASE_TEMPLATE( template_test_case, test_types1 ) ) ); + BOOST_CHECK_NO_THROW(framework::finalize_setup_phase( master_ts->p_id )); + + BOOST_CHECK_NO_THROW( t_suite1->add( BOOST_TEST_CASE_TEMPLATE( template_test_case, test_types2 ) ) ); + BOOST_CHECK_THROW(framework::finalize_setup_phase( master_ts->p_id ), + boost::unit_test::framework::setup_error ); +} + +void test2(int value) +{ + BOOST_TEST(value >= 0); +} + + +BOOST_AUTO_TEST_CASE( test_clashing_cases_with_name ) +{ + using namespace boost::unit_test; + test_suite* master_ts = BOOST_TEST_SUITE("local master"); + + test_suite* t_suite1 = BOOST_TEST_SUITE( "suite1" ); + master_ts->add(t_suite1); + t_suite1->add( BOOST_TEST_CASE( suite1_test1 ) ); + t_suite1->add( BOOST_TEST_CASE( boost::bind( test2, 0 ) ) ); + BOOST_CHECK_NO_THROW( t_suite1->add( BOOST_TEST_CASE( boost::bind( test2, 0 ) ) ) ); + BOOST_CHECK_THROW(framework::finalize_setup_phase( master_ts->p_id ), + boost::unit_test::framework::setup_error ); + + for(int i = 0; i < 10; i++) { + t_suite1->add( BOOST_TEST_CASE_NAME( boost::bind( test2, i ), "test-X-" + boost::unit_test::utils::string_cast(i) ) ); + } +} diff --git a/src/boost/libs/test/test/test-organization-ts/test_unit-sanitize-names.cpp b/src/boost/libs/test/test/test-organization-ts/test_unit-sanitize-names.cpp new file mode 100644 index 000000000..0bc4f8737 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_unit-sanitize-names.cpp @@ -0,0 +1,67 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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 +//! checking the clashing names, ticket trac #12596 +// ***************************************************************************** + +#define BOOST_TEST_MODULE test_name_sanitize +#include <boost/test/unit_test.hpp> +#include <boost/mpl/list.hpp> + +void suite1_test1() +{ + BOOST_CHECK(true); +} + +BOOST_AUTO_TEST_CASE( test_suites_sanitize ) +{ + using namespace boost::unit_test; + test_suite* master_ts = BOOST_TEST_SUITE("local master"); + test_suite* t_suite1 = BOOST_TEST_SUITE( "!suite1" ); + master_ts->add(t_suite1); + BOOST_TEST( t_suite1->p_name.value == "_suite1" ); + BOOST_TEST( master_ts->get("!suite1") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get("_suite1") != INV_TEST_UNIT_ID ); + + test_suite* t_suite2 = BOOST_TEST_SUITE( " /suite2/@label" ); + master_ts->add(t_suite2); + BOOST_TEST( t_suite2->p_name.value == "_suite2__label" ); + BOOST_TEST( master_ts->get(" /suite2/@label") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get("_suite2__label") != INV_TEST_UNIT_ID ); + + // spaces trimming + test_suite* t_suite3 = BOOST_TEST_SUITE( " /suite3/@label " ); + master_ts->add(t_suite3); + BOOST_TEST( t_suite3->p_name.value == "_suite3__label" ); + BOOST_TEST( master_ts->get(" /suite3/@label ") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get("/suite3/@label") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get(" _suite3__label ") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get("_suite3__label") != INV_TEST_UNIT_ID ); +} + +BOOST_AUTO_TEST_CASE( test_case_sanitize ) +{ + using namespace boost::unit_test; + test_suite* master_ts = BOOST_TEST_SUITE("local master"); + test_case* tc1 = make_test_case(suite1_test1, "my@whateve!r test case", __FILE__, __LINE__); + master_ts->add( tc1 ); + BOOST_TEST( master_ts->get("my@whateve!r test case") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get("my_whateve_r test case") == tc1->p_id ); + + test_case* tc2 = make_test_case(suite1_test1, " my@whateve!r test case 2 ", __FILE__, __LINE__); + master_ts->add( tc2 ); + BOOST_TEST( master_ts->get("my@whateve!r test case 2") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get(" my_whateve_r test case 2 ") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get("my_whateve_r test case 2") == tc2->p_id ); + + test_case* tc3 = make_test_case(suite1_test1, " some_type < bla, blabla> ", __FILE__, __LINE__); + master_ts->add( tc3 ); + BOOST_TEST( master_ts->get("some_type < bla, blabla>") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get(" some_type < bla, blabla> ") == INV_TEST_UNIT_ID ); + BOOST_TEST( master_ts->get("some_type < bla_ blabla>") == tc3->p_id ); +} diff --git a/src/boost/libs/test/test/test-organization-ts/test_unit-several-ts-same-name.cpp b/src/boost/libs/test/test/test-organization-ts/test_unit-several-ts-same-name.cpp new file mode 100644 index 000000000..f43cc1f71 --- /dev/null +++ b/src/boost/libs/test/test/test-organization-ts/test_unit-several-ts-same-name.cpp @@ -0,0 +1,28 @@ +// (C) Copyright Raffi Enficiaud 2018. +// 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 +//! Allowing for suites with same name, ticket trac #12597 +// ***************************************************************************** + +#define BOOST_TEST_MODULE test_clashing_names_suites_ok +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_SUITE( dummy_suite ) +BOOST_AUTO_TEST_CASE( ts1 ) +{ + BOOST_CHECK(true); +} +BOOST_AUTO_TEST_SUITE_END() + + +BOOST_AUTO_TEST_SUITE( dummy_suite ) +BOOST_AUTO_TEST_CASE( ts2 ) +{ + BOOST_CHECK(true); +} +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/boost/libs/test/test/usage-variants-ts/shared-library-custom-init-test.cpp b/src/boost/libs/test/test/usage-variants-ts/shared-library-custom-init-test.cpp new file mode 100644 index 000000000..590f65a52 --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/shared-library-custom-init-test.cpp @@ -0,0 +1,41 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : shared library usage variant with custom init test +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +bool init_unit_test() { + boost::unit_test::framework::master_test_suite().p_name.value = "Custom init func"; + + return true; +} + +//____________________________________________________________________________// + +int main(int argc, char* argv[]) +{ + return boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/shared-library-custom-main-test.cpp b/src/boost/libs/test/test/usage-variants-ts/shared-library-custom-main-test.cpp new file mode 100644 index 000000000..d95ccc64d --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/shared-library-custom-main-test.cpp @@ -0,0 +1,35 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : shared library usage variant with custom main test +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE shared library test +#define BOOST_TEST_NO_MAIN +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +int main(int argc, char* argv[]) +{ + return boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/shared-library-test.cpp b/src/boost/libs/test/test/usage-variants-ts/shared-library-test.cpp new file mode 100644 index 000000000..f7abaa4dc --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/shared-library-test.cpp @@ -0,0 +1,27 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : shared library usage variant test +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE shared library test +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/single-header-custom-init-test.cpp b/src/boost/libs/test/test/usage-variants-ts/single-header-custom-init-test.cpp new file mode 100644 index 000000000..e105ac6c3 --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/single-header-custom-init-test.cpp @@ -0,0 +1,35 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : header-only usage variant with custom init test +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_ALTERNATIVE_INIT_API +#include <boost/test/included/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +bool init_unit_test() { + boost::unit_test::framework::master_test_suite().p_name.value = "Custom init func"; + + return true; +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/single-header-custom-main-test.cpp b/src/boost/libs/test/test/usage-variants-ts/single-header-custom-main-test.cpp new file mode 100644 index 000000000..ab79c5023 --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/single-header-custom-main-test.cpp @@ -0,0 +1,32 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// Description : header-only usage variant with custom main test +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE header only test +#define BOOST_TEST_NO_MAIN +#define BOOST_TEST_ALTERNATIVE_INIT_API +#include <boost/test/included/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +int main(int argc, char* argv[]) +{ + return boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/single-header-multiunit-1-test.cpp b/src/boost/libs/test/test/usage-variants-ts/single-header-multiunit-1-test.cpp new file mode 100644 index 000000000..65653848a --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/single-header-multiunit-1-test.cpp @@ -0,0 +1,38 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// Description : header-only usage variant with multiple translation units test +// *************************************************************************** + +// this test requires that the linking has not been manipulated +// Since this is way impossible to make it work from B2, the undef of the +// auto linking variables is done here in the source. +// should be done before any include and in all translation units +#if defined(BOOST_TEST_NO_LIB) +#undef BOOST_TEST_NO_LIB +#endif + +#if defined(BOOST_ALL_NO_LIB) +#undef BOOST_ALL_NO_LIB +#endif + +#define BOOST_TEST_MODULE header-only multiunit test +#include <boost/test/included/unit_test.hpp> + +#if defined(BOOST_TEST_NO_LIB) || defined(BOOST_ALL_NO_LIB) +#error BOOST_TEST_NO_LIB/BOOST_ALL_NO_LIB defined (post boost inclusion)!! +#endif + +BOOST_AUTO_TEST_CASE( test1 ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/single-header-multiunit-2-test.cpp b/src/boost/libs/test/test/usage-variants-ts/single-header-multiunit-2-test.cpp new file mode 100644 index 000000000..cea1f8096 --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/single-header-multiunit-2-test.cpp @@ -0,0 +1,37 @@ +// (C) Copyright Gennadiy Rozental 2001-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. + +// Description : header-only usage variant with multiple translation units test +// *************************************************************************** + +// this test requires that the linking has not been manipulated +// Since this is way impossible to make it work from B2, the undef of the +// auto linking variables is done here in the source. +// should be done before any include and in all translation units +#if defined(BOOST_TEST_NO_LIB) +#undef BOOST_TEST_NO_LIB +#endif + +#if defined(BOOST_ALL_NO_LIB) +#undef BOOST_ALL_NO_LIB +#endif + +#include <boost/test/unit_test.hpp> + +#if defined(BOOST_TEST_NO_LIB) || defined(BOOST_ALL_NO_LIB) +#error BOOST_TEST_NO_LIB/BOOST_ALL_NO_LIB defined (post boost inclusion)!! +#endif + +BOOST_AUTO_TEST_CASE( test2 ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/single-header-test.cpp b/src/boost/libs/test/test/usage-variants-ts/single-header-test.cpp new file mode 100644 index 000000000..58285f37a --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/single-header-test.cpp @@ -0,0 +1,24 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// Description : header-only usage variant test +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE header only test +#include <boost/test/included/unit_test.hpp> +using namespace boost::unit_test; + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/static-library-custom-init-test.cpp b/src/boost/libs/test/test/usage-variants-ts/static-library-custom-init-test.cpp new file mode 100644 index 000000000..9f346c12d --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/static-library-custom-init-test.cpp @@ -0,0 +1,35 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : static library usage variant with custom init test +// *************************************************************************** + +// Boost.Test +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +boost::unit_test::test_suite* +init_unit_test_suite( int /*argc*/, char* [] /*argv*/ ) { + boost::unit_test::framework::master_test_suite().p_name.value = "Custom init func"; + + return 0; +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/usage-variants-ts/static-library-test.cpp b/src/boost/libs/test/test/usage-variants-ts/static-library-test.cpp new file mode 100644 index 000000000..f27273597 --- /dev/null +++ b/src/boost/libs/test/test/usage-variants-ts/static-library-test.cpp @@ -0,0 +1,27 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : static library usage variant test +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE static library test +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 1; + BOOST_CHECK( i*i == 1 ); +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/utils-ts/algorithm-test.cpp b/src/boost/libs/test/test/utils-ts/algorithm-test.cpp new file mode 100644 index 000000000..cff314926 --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/algorithm-test.cpp @@ -0,0 +1,178 @@ +// (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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : unit test for class properties facility +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE Boost.Test algorithms test +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/class_properties.hpp> +#include <boost/test/utils/basic_cstring/basic_cstring.hpp> +#include <boost/test/utils/algorithm.hpp> +namespace utf = boost::unit_test; +namespace utu = boost::unit_test::utils; +using utf::const_string; + +// STL +#include <cctype> +#include <functional> + +# ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::toupper; } +# endif + +#ifdef BOOST_NO_CXX11_DECLTYPE +#define TEST_SURROUND_EXPRESSION(x) (x) +#else +#define TEST_SURROUND_EXPRESSION(x) x +#endif + +#ifdef BOOST_NO_CXX98_BINDERS +#define REF_FUN(x) std::function<bool(char,char)>(x) +#else +#define REF_FUN(x) std::ptr_fun(x) +#endif + +//____________________________________________________________________________// + +bool predicate( char c1, char c2 ) { return (std::toupper)( c1 ) == (std::toupper)( c2 ); } + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mismatch ) +{ + const_string cs1( "test_string" ); + const_string cs2( "test_stream" ); + + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::mismatch( cs1.begin(), cs1.end(), cs2.begin(), cs2.end() ).first - cs1.begin()) == 8 ); + + cs2 = "trest"; + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::mismatch( cs1.begin(), cs1.end(), cs2.begin(), cs2.end() ).first - cs1.begin()) == 1 ); + + cs2 = "test_string_klmn"; + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::mismatch( cs1.begin(), cs1.end(), cs2.begin(), cs2.end() ).first - cs1.begin()) == 11 ); + + cs2 = "TeSt_liNk"; + BOOST_TEST( + TEST_SURROUND_EXPRESSION(utu::mismatch( cs1.begin(), cs1.end(), cs2.begin(), cs2.end(), REF_FUN( predicate ) ).first - cs1.begin()) == 5 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_find_first_not_of ) +{ + const_string cs( "test_string" ); + const_string another( "tes" ); + + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::find_first_not_of( cs.begin(), cs.end(), another.begin(), another.end() ) - cs.begin()) == 4 ); + + another = "T_sE"; + BOOST_TEST( + TEST_SURROUND_EXPRESSION(utu::find_first_not_of( cs.begin(), cs.end(), another.begin(), another.end(), REF_FUN( predicate ) ) - cs.begin()) == 7 ); + + another = "tes_ring"; + BOOST_TEST( utu::find_last_not_of( cs.begin(), cs.end(), another.begin(), another.end() ) == cs.end() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_find_last_of ) +{ + const_string cs( "test_string" ); + const_string another( "tes" ); + + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::find_last_of( cs.begin(), cs.end(), another.begin(), another.end() ) - cs.begin()) == 6 ); + + another = "_Se"; + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::find_last_of( cs.begin(), cs.end(), another.begin(), another.end(), REF_FUN( predicate ) ) - cs.begin()) == 5 ); + + another = "qw"; + BOOST_TEST( utu::find_last_of( cs.begin(), cs.end(), another.begin(), another.end() ) == cs.end() ); + + cs = "qerty"; + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::find_last_of( cs.begin(), cs.end(), another.begin(), another.end() ) - cs.begin()) == 0 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_find_last_not_of ) +{ + const_string cs( "test_string" ); + const_string another( "string" ); + + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::find_last_not_of( cs.begin(), cs.end(), another.begin(), another.end() ) - cs.begin()) == 4 ); + + another = "_SeG"; + BOOST_TEST( TEST_SURROUND_EXPRESSION(utu::find_last_not_of( cs.begin(), cs.end(), another.begin(), another.end(), REF_FUN( predicate ) ) - cs.begin()) == 9 ); + + another = "e_string"; + BOOST_TEST( utu::find_last_not_of( cs.begin(), cs.end(), another.begin(), another.end() ) == cs.end() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_replace_all ) +{ + { + std::string cs( "cstring: cstring is a const string that can be transformed to an std::string" ); + + const std::string to_look_for[] = {"cstring", "const"}; + const std::string to_replace[] = { "const_string", "constant" }; + + BOOST_TEST( utu::replace_all_occurrences_of( + cs, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0])) + == + "constant_string: constant_string is a constant string that can be transformed to an std::string" + ); + } + + { + std::string cs( "some\\file\\with\\wrong:.path" ); + + const std::string to_look_for[] = {"\\", ":"}; + const std::string to_replace[] = { "/", "_" }; + + BOOST_TEST( utu::replace_all_occurrences_of( + cs, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0])) + == + "some/file/with/wrong_.path" + ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_replace_with_wildcards ) +{ + { + std::string cs( "this string contains x='374'u elements of size y='24'u and y='75'z" ); + + const std::string to_look_for[] = {"x='*'u", "y='*'u"}; + const std::string to_replace[] = { "x='27'q", "k='*0'p" }; + + BOOST_TEST( utu::replace_all_occurrences_with_wildcards( + cs, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0])) + == + "this string contains x='27'q elements of size k='240'p and y='75'z" + ); + } +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/utils-ts/basic_cstring-test.cpp b/src/boost/libs/test/test/utils-ts/basic_cstring-test.cpp new file mode 100644 index 000000000..361b1a30a --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/basic_cstring-test.cpp @@ -0,0 +1,519 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : basic_cstring unit test +// ***************************************************************************** + +#ifdef _MSC_VER +#pragma warning(disable: 4996) +#pragma warning(disable: 4267) +#endif + +// Boost.Test +#include <boost/test/unit_test.hpp> + +#include <boost/test/utils/basic_cstring/basic_cstring.hpp> +#include <boost/test/utils/basic_cstring/compare.hpp> +#include <boost/test/utils/basic_cstring/io.hpp> +#include <boost/test/tools/output_test_stream.hpp> +namespace utf = boost::unit_test; +namespace tt = boost::test_tools; +using utf::const_string; + +// Boost +#include <boost/mpl/list.hpp> +#include <boost/mpl/joint_view.hpp> +#include <boost/mpl/transform.hpp> +#include <boost/type_traits/add_const.hpp> + +// STL +#include <cctype> +#include <ctime> +#include <iomanip> +#include <iostream> +#include <stdexcept> + +namespace mpl = boost::mpl; + +typedef mpl::list2<char const,wchar_t const> base_const_char_types; +typedef mpl::list3<char,unsigned char,wchar_t> mutable_char_types; +typedef mpl::transform<mutable_char_types,boost::add_const<mpl::_1> >::type const_char_types; +typedef mpl::joint_view<const_char_types,mutable_char_types> char_types; +typedef mpl::list2<char,const char> io_test_types; + +//____________________________________________________________________________// + +template<typename CharT> +struct string_literal { + typedef typename boost::remove_const<CharT>::type mutable_char; + + string_literal() {} + string_literal( char const* orig, std::size_t orig_size ) + { + assign(orig, orig_size); + } + + CharT* begin() const { return const_cast<CharT*>(buff.c_str()); } + + void assign( char const* orig, std::size_t orig_size ) + { + buff.resize( orig_size ); + for (size_t index = 0; index < orig_size; ++index) + buff[index] = orig[index]; + } + + std::basic_string<mutable_char> buff; +}; + +//____________________________________________________________________________// + +template<typename CharT> +CharT* +test_string( CharT* = 0 ) +{ + static string_literal<CharT> l( "test_string", 11 ); + + return l.begin(); +} +#define TEST_STRING test_string<CharT>( (CharT*)0 ) + +//____________________________________________________________________________// + +template<typename CharT> +CharT* +static_literal(char const* orig, std::size_t orig_size) +{ + static string_literal<CharT> l; + + l.assign(orig, orig_size); + + return l.begin(); +} +#define LITERAL( s ) static_literal<CharT>( s, sizeof( s ) ) + +#define LOCAL_DEF( name, s ) \ +string_literal<CharT> BOOST_JOIN( sl, __LINE__)(s, sizeof( s )); \ +utf::basic_cstring<CharT> name( (CharT*)(BOOST_JOIN( sl, __LINE__).begin()))\ +/**/ + + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( constructors_test, CharT ) +{ + { + utf::basic_cstring<CharT> bcs; + BOOST_TEST( bcs.size() == 0U ); + BOOST_TEST( bcs.is_empty() ); + } + + { + utf::basic_cstring<CharT> bcs( utf::basic_cstring<CharT>::null_str() ); + BOOST_TEST( bcs.size() == 0U ); + BOOST_TEST( bcs.is_empty() ); + } + + { + utf::basic_cstring<CharT> bcs( 0 ); + BOOST_TEST( bcs.size() == 0U ); + BOOST_TEST( bcs.is_empty() ); + } + + { + typedef typename utf::basic_cstring<CharT>::traits_type traits; + + utf::basic_cstring<CharT> bcs( TEST_STRING ); + BOOST_TEST( traits::compare( bcs.begin(), TEST_STRING, bcs.size() ) == 0 ); + BOOST_TEST( bcs.size() == traits::length( TEST_STRING ) ); + + utf::basic_cstring<CharT> bcs1( bcs ); + BOOST_TEST( traits::compare( bcs1.begin(), TEST_STRING, bcs1.size() ) == 0 ); + } + + { + typedef typename utf::basic_cstring<CharT>::traits_type traits; + + utf::basic_cstring<CharT> bcs( TEST_STRING, 4 ); + BOOST_TEST( traits::compare( bcs.begin(), LITERAL( "test" ), bcs.size() ) == 0 ); + } + + { + typedef typename utf::basic_cstring<CharT>::traits_type traits; + + utf::basic_cstring<CharT> bcs( TEST_STRING, TEST_STRING + 6 ); + BOOST_TEST( traits::compare( bcs.begin(), LITERAL( "test_s" ), bcs.size() ) == 0 ); + } +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( constructors_std_string_test, CharT ) +{ + typedef typename utf::basic_cstring<CharT>::traits_type traits; + + { + typename utf::basic_cstring<CharT>::std_string l( TEST_STRING ); + + utf::basic_cstring<CharT> bcs( l ); + BOOST_TEST( traits::compare( bcs.begin(), TEST_STRING, bcs.size() ) == 0 ); + } + +} + +//____________________________________________________________________________// + +void array_construction_test() +{ + const_string bcs_array[] = { "str1", "str2" }; + + BOOST_TEST( const_string::traits_type::compare( bcs_array[0].begin(), "str1", bcs_array[0].size() ) == 0 ); + BOOST_TEST( const_string::traits_type::compare( bcs_array[1].begin(), "str2", bcs_array[1].size() ) == 0 ); + + const_string bcs( "abc" ); + BOOST_TEST( const_string::traits_type::compare( bcs.begin(), "abc", bcs.size() ) == 0 ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( data_access_test, CharT ) +{ + typedef typename utf::basic_cstring<CharT>::traits_type traits_type; + + utf::basic_cstring<CharT> bcs1( TEST_STRING ); + BOOST_TEST( traits_type::compare( bcs1.begin(), TEST_STRING, bcs1.size() ) == 0 ); + BOOST_TEST( traits_type::compare( bcs1.begin(), bcs1.begin(), bcs1.size() ) == 0 ); + + BOOST_TEST( bcs1[0] == 't' ); + BOOST_TEST( bcs1[4] == '_' ); + BOOST_TEST( bcs1[bcs1.size()-1] == 'g' ); + + BOOST_TEST( bcs1[0] == bcs1.at( 0 ) ); + BOOST_TEST( bcs1[2] == bcs1.at( 5 ) ); + BOOST_TEST( bcs1.at( bcs1.size() - 1 ) == 'g' ); + BOOST_TEST( bcs1.at( bcs1.size() ) == 0 ); + BOOST_TEST( bcs1.at( bcs1.size()+1 ) == 0 ); + + BOOST_TEST( utf::first_char( bcs1 ) == 't' ); + BOOST_TEST( utf::last_char( bcs1 ) == 'g' ); + + BOOST_TEST( utf::first_char( utf::basic_cstring<CharT>() ) == 0 ); + BOOST_TEST( utf::last_char( utf::basic_cstring<CharT>() ) == 0 ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( size_test, CharT ) +{ + utf::basic_cstring<CharT> bcs1; + + BOOST_TEST( bcs1.size() == 0U ); + BOOST_TEST( bcs1.is_empty() ); + + bcs1 = TEST_STRING; + BOOST_TEST( bcs1.size() == 11U ); + + bcs1.clear(); + BOOST_TEST( bcs1.size() == 0U ); + BOOST_TEST( bcs1.is_empty() ); + + bcs1 = utf::basic_cstring<CharT>( TEST_STRING, 4 ); + BOOST_TEST( bcs1.size() == 4U ); + + bcs1.resize( 5 ); + BOOST_TEST( bcs1.size() == 4U ); + + bcs1.resize( 3 ); + BOOST_TEST( bcs1.size() == 3U ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( asignment_test, CharT ) +{ + typedef typename utf::basic_cstring<CharT>::traits_type traits_type; + + utf::basic_cstring<CharT> bcs1; + string_literal<CharT> l( "test", 4 ); + + bcs1 = l.begin(); + BOOST_TEST( traits_type::compare( bcs1.begin(), LITERAL( "test" ), bcs1.size() ) == 0 ); + + utf::basic_cstring<CharT> bcs2( TEST_STRING ); + bcs1 = bcs2; + BOOST_TEST( traits_type::compare( bcs1.begin(), TEST_STRING, bcs1.size() ) == 0 ); + + bcs1.assign( l.begin() ); + BOOST_TEST( traits_type::compare( bcs1.begin(), LITERAL( "test" ), bcs1.size() ) == 0 ); + + bcs1.assign( l.begin()+1, l.begin()+3 ); + BOOST_TEST( traits_type::compare( bcs1.begin(), LITERAL( "est" ), bcs1.size() ) == 0 ); + + bcs1.assign( bcs2, 4, 3 ); + BOOST_TEST( traits_type::compare( bcs1.begin(), LITERAL( "_st" ), bcs1.size() ) == 0 ); + + bcs1.swap( bcs2 ); + BOOST_TEST( traits_type::compare( bcs1.begin(), TEST_STRING, bcs1.size() ) == 0 ); + BOOST_TEST( traits_type::compare( bcs2.begin(), LITERAL( "_st" ), bcs2.size() ) == 0 ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( asignment_std_string_test, CharT ) +{ + typedef typename utf::basic_cstring<CharT>::traits_type traits_type; + + utf::basic_cstring<CharT> bcs1; + typename utf::basic_cstring<CharT>::std_string l( TEST_STRING ); + + bcs1 = l; + BOOST_TEST( traits_type::compare( bcs1.begin(), TEST_STRING, bcs1.size() ) == 0 ); + + bcs1.assign( l ); + BOOST_TEST( traits_type::compare( bcs1.begin(), TEST_STRING, bcs1.size() ) == 0 ); + + bcs1.assign( l, 1, 2 ); + BOOST_TEST( traits_type::compare( bcs1.begin(), LITERAL( "es" ), bcs1.size() ) == 0 ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( comparison_test, CharT ) +{ + utf::basic_cstring<CharT> bcs1( TEST_STRING ); + utf::basic_cstring<CharT> bcs2( TEST_STRING ); + + BOOST_TEST(( bcs1 == TEST_STRING )); + BOOST_TEST(( TEST_STRING == bcs1 )); + BOOST_TEST(( bcs1 == bcs2 )); + + bcs1.resize( 4 ); + + BOOST_TEST(( bcs1 == LITERAL( "test" ) )); + + BOOST_TEST(( bcs1 != TEST_STRING )); + BOOST_TEST(( TEST_STRING != bcs1 )); + BOOST_TEST(( bcs1 != bcs2 )); + + LOCAL_DEF( bcs3, "TeSt" ); + BOOST_TEST( utf::case_ins_eq( bcs1, bcs3 ) ); +} + +//____________________________________________________________________________// + +BOOST_TEST_DONT_PRINT_LOG_VALUE( std::wstring ) + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( comparison_std_string_test, CharT ) +{ + utf::basic_cstring<CharT> bcs1( TEST_STRING ); + typename utf::basic_cstring<CharT>::std_string l( TEST_STRING ); + + BOOST_TEST( bcs1 == l ); + BOOST_TEST( l == bcs1 ); + + bcs1.resize( 4 ); + + BOOST_TEST( bcs1 != l ); + BOOST_TEST( l != bcs1 ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( ordering_test, CharT ) +{ + LOCAL_DEF( bcs1, "aBcd" ); + LOCAL_DEF( bcs2, "aBbdd" ); + LOCAL_DEF( bcs3, "aBbde" ); + LOCAL_DEF( bcs4, "abab" ); + + BOOST_TEST(( bcs1 < bcs2 )); + BOOST_TEST(( bcs2 < bcs3 )); + BOOST_TEST(( bcs1 < bcs3 )); + BOOST_TEST(( bcs1 < bcs4 )); + + utf::case_ins_less<CharT> cil; + BOOST_TEST( cil( bcs4, bcs1 ) ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( trim_test, CharT ) +{ + LOCAL_DEF( bcs0, "tes" ); + + bcs0.trim_right( 1 ); + BOOST_TEST( bcs0.size() == 2U ); + BOOST_TEST( bcs0[0] == 't' ); + + bcs0.trim_left( 1 ); + BOOST_TEST( bcs0.size() == 1U ); + BOOST_TEST( bcs0[0] == 'e' ); + + bcs0.trim_left( 1 ); + BOOST_TEST( bcs0.is_empty() ); + + bcs0 = TEST_STRING; + bcs0.trim_left( 11 ); + BOOST_TEST( bcs0.is_empty() ); + + bcs0 = TEST_STRING; + bcs0.trim_right( 11 ); + BOOST_TEST( bcs0.is_empty() ); + + bcs0 = TEST_STRING; + bcs0.trim_right( bcs0.size() - bcs0.find( LITERAL( "t_s" ) ) - 3 ); + BOOST_TEST( bcs0 == LITERAL( "test_s" ) ); + + bcs0.trim_left( bcs0.find( LITERAL( "t_s" ) ) ); + BOOST_TEST( bcs0 == LITERAL( "t_s" ) ); + + LOCAL_DEF( bcs1, "abcd " ); + LOCAL_DEF( bcs2, " abcd" ); + LOCAL_DEF( bcs3, " abcd " ); + + bcs1.trim_right(); + BOOST_TEST( bcs1 == LITERAL( "abcd" ) ); + + bcs2.trim_left(); + BOOST_TEST( bcs2 == LITERAL( "abcd" ) ); + + bcs3.trim( LITERAL( "\"" ) ); + BOOST_TEST( bcs3 == LITERAL( " abcd " ) ); + + bcs3.trim(); + BOOST_TEST( bcs3 == LITERAL( "abcd" ) ); + + bcs3.trim(); + BOOST_TEST( bcs3 == LITERAL( "abcd" ) ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( io_test, CharT ) +{ + utf::basic_cstring<CharT> bcs1( TEST_STRING ); + bcs1.trim_right( 7 ); + + tt::output_test_stream ostr; + + ostr << std::setw( 6 ) << bcs1; + BOOST_TEST( ostr.is_equal( " test" ) ); + + ostr << std::setw( 3 ) << bcs1; + BOOST_TEST( ostr.is_equal( "test" ) ); + + ostr << std::setw( 5 ) << std::setiosflags( std::ios::left ) << bcs1; + BOOST_TEST( ostr.is_equal( "test " ) ); +} + +//____________________________________________________________________________// + +BOOST_TEST_CASE_TEMPLATE_FUNCTION( find_test, CharT ) +{ + typedef typename utf::basic_cstring<CharT>::size_type size; + utf::basic_cstring<CharT> bcs1( TEST_STRING ); + + size not_found = (size)utf::basic_cstring<CharT>::npos; + + BOOST_TEST( bcs1.find( utf::basic_cstring<CharT>() ) == not_found ); + BOOST_TEST( bcs1.find( LITERAL( "test" ) ) == (size)0 ); + BOOST_TEST( bcs1.find( TEST_STRING ) == (size)0 ); + BOOST_TEST( bcs1.find( LITERAL( "test_string " ) ) == not_found ); + BOOST_TEST( bcs1.find( LITERAL( " test_string" ) ) == not_found ); + BOOST_TEST( bcs1.find( LITERAL( "est" ) ) == (size)1 ); + BOOST_TEST( bcs1.find( LITERAL( "t_st" ) ) == (size)3 ); + BOOST_TEST( bcs1.find( LITERAL( "ing" ) ) == (size)8 ); + BOOST_TEST( bcs1.find( LITERAL( "tst" ) ) == not_found ); + + BOOST_TEST( bcs1.rfind( utf::basic_cstring<CharT>() ) == not_found ); + BOOST_TEST( bcs1.rfind( LITERAL( "test" ) ) == (size)0 ); + BOOST_TEST( bcs1.rfind( TEST_STRING ) == (size)0 ); + BOOST_TEST( bcs1.rfind( LITERAL( "test_string " ) ) == not_found ); + BOOST_TEST( bcs1.rfind( LITERAL( " test_string" ) ) == not_found ); + BOOST_TEST( bcs1.rfind( LITERAL( "est" ) ) == (size)1 ); + BOOST_TEST( bcs1.rfind( LITERAL( "t_st" ) ) == (size)3 ); + BOOST_TEST( bcs1.rfind( LITERAL( "ing" ) ) == (size)8 ); + BOOST_TEST( bcs1.rfind( LITERAL( "tst" ) ) == not_found ); +} + +//____________________________________________________________________________// + +void const_conversion() +{ + char arr[] = { "ABC" }; + + utf::basic_cstring<char> str1( arr ); + utf::basic_cstring<char const> str2; + + str2.assign( str1 ); + + BOOST_TEST( str1 == "ABC" ); + BOOST_TEST( str2 == "ABC" ); +} + +//____________________________________________________________________________// + +#if defined(BOOST_TEST_STRING_VIEW) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( string_view_support, CharT ) +{ + using namespace std::literals; + typedef std::basic_string_view<CharT> string_view_t; + namespace utf = boost::unit_test; + + { + string_view_t sv = LITERAL(""); + + utf::stringview_cstring_helper<CharT, string_view_t> svh = sv; + BOOST_TEST( svh.size() == 0U ); + BOOST_TEST( svh.is_empty() ); + } + + + { + string_view_t sv = LITERAL("bla"); + + utf::stringview_cstring_helper<CharT, string_view_t> svh = sv; + BOOST_TEST( svh.size() == 3U ); + BOOST_TEST( !svh.is_empty() ); + } +} +#endif + + +//____________________________________________________________________________// + +utf::test_suite* +init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) +{ + utf::test_suite* test= BOOST_TEST_SUITE("basic_cstring test"); + + test->add( BOOST_TEST_CASE_TEMPLATE( constructors_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( constructors_std_string_test, base_const_char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( asignment_std_string_test, base_const_char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( comparison_std_string_test, base_const_char_types ) ); + test->add( BOOST_TEST_CASE( array_construction_test ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( data_access_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( size_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( asignment_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( comparison_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( ordering_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( trim_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( io_test, io_test_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( find_test, char_types ) ); + test->add( BOOST_TEST_CASE( &const_conversion ) ); + +#if defined(BOOST_TEST_STRING_VIEW) + test->add( BOOST_TEST_CASE_TEMPLATE( string_view_support, char_types ) ); +#endif + + return test; +} + +// EOF diff --git a/src/boost/libs/test/test/utils-ts/class_properties-test.cpp b/src/boost/libs/test/test/utils-ts/class_properties-test.cpp new file mode 100644 index 000000000..808672656 --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/class_properties-test.cpp @@ -0,0 +1,191 @@ +// (C) Copyright Gennadiy Rozental 2003-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. +// +// Description : unit test for class properties facility +// Note: this file should be compatible with C++03 compilers (features in boost.test v2) +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE Class Properties test +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/class_properties.hpp> + +// STL +#include <vector> + +using namespace boost::unit_test; + +//____________________________________________________________________________// + +struct A { + operator bool() const { return true; } +} a; + +struct B { + int foo() const { return 1; } + int foo() { return 2; } + + operator int() const { return 1; } +}; + +BOOST_READONLY_PROPERTY( B*, (C) ) p_b_ptr; + +class C { +public: + static void init() + { + p_b_ptr.value = new B; + } +}; + +BOOST_READONLY_PROPERTY( A*, (D)(E) ) p_a_ptr; + +class D { +public: + static void init() + { + p_a_ptr.value = new A; + } +}; + +class E { +public: + static void reset() + { + delete p_a_ptr; + p_a_ptr.value = new A; + } +}; + +BOOST_AUTO_TEST_CASE( test_readonly_property ) +{ + readonly_property<int> p_zero; + readonly_property<int> p_one( 1 ); + readonly_property<int> p_two( 2 ); + + readonly_property<bool> p_true( true ); + readonly_property<bool> p_false( false ); + readonly_property<std::string> p_str( "abcd" ); + readonly_property<std::string> p_str2( "abc" ); + + readonly_property<B> p_b; + readonly_property<A> p_a; + + BOOST_TEST( p_one ); + BOOST_TEST( !!p_one ); + + int i = p_one; + + BOOST_TEST( p_one == i ); + + double d = p_one; + + BOOST_TEST( p_one == d ); + + BOOST_TEST( p_one != 0 ); + BOOST_TEST( 0 != p_one ); + BOOST_TEST( !(p_one == 0) ); + BOOST_TEST( !(0 == p_one) ); + + float fzero = 0; + + BOOST_TEST( p_one != fzero ); + BOOST_TEST( fzero != p_one ); + + BOOST_TEST( p_one >= 1 ); + BOOST_TEST( 2 > p_one ); + + BOOST_TEST( !(p_one == p_two) ); + BOOST_TEST( p_one != p_two ); + BOOST_TEST( p_one < p_two ); + + BOOST_TEST( p_zero == 0 ); + + BOOST_TEST( (p_one - 1) == 0 ); + BOOST_TEST( (-p_one + 1) == 0 ); + + BOOST_TEST( p_true ); + BOOST_TEST( !p_false ); + + BOOST_TEST(( (i > 0) && p_true )); + BOOST_TEST(( p_true && (i > 0) )); + BOOST_TEST(( (i > 0) || p_false )); + BOOST_TEST(( p_false || (i > 0) )); + + BOOST_TEST(( a && p_true )); + BOOST_TEST(( a || p_true )); + + BOOST_TEST(( p_true && a )); + BOOST_TEST(( p_true && a )); + + std::string s( "abcd" ); + + BOOST_TEST( p_str == s ); + BOOST_TEST( s == p_str ); + BOOST_TEST( p_str2 != p_str ); + + BOOST_TEST( p_b->foo() == 1 ); + + BOOST_TEST( (p_one ^ 3) == 2 ); // ^ has lower precedence than == +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + // complex expressions (on the left) not understood by boost.test v3 in C++03 mode + BOOST_TEST( p_two / 2 == 1 ); // / has higher precedence than == +#endif + + BOOST_TEST( !p_b_ptr ); + + C::init(); + BOOST_TEST( p_b_ptr ); + + BOOST_TEST( !p_a_ptr ); + D::init(); + BOOST_TEST( p_a_ptr ); + E::reset(); + BOOST_TEST( p_a_ptr ); + + if( p_a_ptr ) + delete p_a_ptr.get(); + + if( p_b_ptr ) + delete p_b_ptr.get(); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_readwrite_property ) +{ + readwrite_property<int> p_int; + + BOOST_TEST( !p_int ); + BOOST_TEST( p_int == 0 ); + BOOST_TEST( p_int != 1 ); + + BOOST_TEST( p_int < 5 ); + BOOST_TEST( p_int >= -5 ); + + p_int.value = 2; + + BOOST_TEST( p_int == 2 ); + BOOST_TEST( p_int ); + + p_int.set( 3 ); + + BOOST_TEST( p_int == 3 ); + + readwrite_property<B> p_bb1; + + BOOST_TEST( p_bb1->foo() == 2 ); + + readwrite_property<B> const p_bb2; + + BOOST_TEST( p_bb2->foo() == 1 ); +} + +//____________________________________________________________________________// + + +// EOF diff --git a/src/boost/libs/test/test/utils-ts/foreach-test.cpp b/src/boost/libs/test/test/utils-ts/foreach-test.cpp new file mode 100644 index 000000000..d481cb39e --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/foreach-test.cpp @@ -0,0 +1,116 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : BOOST_TEST_FOREACH compile only test +// ***************************************************************************** + +// STL +#include <iostream> +#include <list> +#include <vector> +#include <string> + +#include <boost/test/utils/foreach.hpp> + +#ifdef BOOST_MSVC +#pragma warning(disable:4702) // Unreachable code +#endif + +template<class T> +void baz( std::list<T>const& list_of_T ) +{ + // an example of using BOOST_TEST_FOREACH with dependent types + BOOST_TEST_FOREACH( T const&, t, list_of_T ) + { + std::cout << t << std::endl; + } +} + +int main() +{ + std::list<int> int_list; + int_list.push_back( 1 ); + int_list.push_back( 2 ); + int_list.push_back( 3 ); + + // use BOOST_TEST_FOREACH with a STL container, and a reference as the loop variable. + BOOST_TEST_FOREACH( int&, i, int_list ) + { + ++i; + std::cout << i << std::endl; + } + + std::cout << std::endl; + + // use BOOST_TEST_FOREACH with a std::vector + std::vector<int> int_vec; + int_vec.push_back( 1 ); + int_vec.push_back( 2 ); + int_vec.push_back( 3 ); + int_vec.push_back( 3 ); + int_vec.push_back( 3 ); + + BOOST_TEST_FOREACH( int const&, i, int_vec ) + { + std::cout << i << std::endl; + if( i == 3 ) + break; + } + + std::cout << std::endl; + + // use BOOST_TEST_FOREACH with dependent types + baz( int_list ); + std::cout << std::endl; + + // iterate over characters in a std::string + std::string str( "hello" ); + + BOOST_TEST_FOREACH( char&, ch, str ) + { + std::cout << ch; + // mutate the string + ++ch; + } + std::cout << std::endl; + std::cout << std::endl; + + BOOST_TEST_FOREACH( char, ch, str ) + { + // break work as you would expect + std::cout << ch; + break; + } + std::cout << std::endl; + std::cout << std::endl; + + BOOST_TEST_FOREACH( char, ch, str ) + { + // continue work as you would expect + if( ch == 'm' ) + continue; + + std::cout << ch; + } + std::cout << std::endl; + std::cout << std::endl; + + // use BOOST_TEST_FOREACH with const reference. + std::vector<int> const& int_vec_const_ref = int_vec; + + BOOST_TEST_FOREACH( int const&, i, int_vec_const_ref ) + { + std::cout << (i+1) << std::endl; + } + std::cout << std::endl; + + return 0; +} diff --git a/src/boost/libs/test/test/utils-ts/named_params-test.cpp b/src/boost/libs/test/test/utils-ts/named_params-test.cpp new file mode 100644 index 000000000..11f7575ba --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/named_params-test.cpp @@ -0,0 +1,540 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : unit test for named function parameters framework +// ***************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE Named function parameters test +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/named_params.hpp> +namespace utf = boost::unit_test; +namespace nfp = boost::nfp; + +namespace test_single_int_parameter { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<int, struct k2_t> k2; + +template<typename Params> +void dotest0( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1] == 7 ); +} + +template<typename Params> +void dotest1( Params const& p ) +{ + BOOST_TEST_REQUIRE( !p.has(k1) ); +} + +BOOST_AUTO_TEST_CASE( test_single_int_parameter ) +{ + dotest0( k1=7 ); + dotest1( k2=7 ); +} + +} // test_single_int_parameter + +//____________________________________________________________________________// + +namespace test_single_string_parameter { + +nfp::typed_keyword<std::string, struct k1_t> k1; +nfp::typed_keyword<char const*, struct k2_t> k2; + +template<typename Params> +void dotest0( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1] == "abc" ); +} + +template<typename Params> +void dotest1( Params const& p ) +{ + BOOST_TEST_REQUIRE( !p.has(k1) ); +} + +BOOST_AUTO_TEST_CASE( test_single_string_parameter ) +{ + dotest0( k1="abc" ); + dotest1( k2="cba" ); +} + +} // test_single_string_parameter + +//____________________________________________________________________________// + +namespace test_single_bool_parameter { + +nfp::typed_keyword<bool, struct k1_t> k1; +nfp::typed_keyword<bool, struct k2_t> k2; + +template<typename Params> +void dotest0( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1] ); +} + +template<typename Params> +void dotest1( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( !p[k1] ); +} + +template<typename Params> +void dotest2( Params const& p ) +{ + BOOST_TEST_REQUIRE( !p.has(k1) ); +} + +BOOST_AUTO_TEST_CASE( test_single_bool_parameter ) +{ + dotest0( k1 ); + dotest1( !k1 ); + dotest2( k2 ); +} + +} // test_single_bool_parameter + +//____________________________________________________________________________// + +namespace test_parameter_combination { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<std::string, struct k2_t> k2; +nfp::typed_keyword<bool, struct k3_t> k3; + +template<typename Params> +void dotest0( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST_REQUIRE( p.has(k2) ); + BOOST_TEST_REQUIRE( !p.has(k3) ); + BOOST_TEST( p[k1] == 6 ); + BOOST_TEST( p[k2] == "123" ); +} + +template<typename Params> +void dotest1( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST_REQUIRE( !p.has(k2) ); + BOOST_TEST_REQUIRE( p.has(k3) ); + BOOST_TEST( p[k1] == 6 ); + BOOST_TEST( p[k3] ); +} + +template<typename Params> +void dotest2( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST_REQUIRE( p.has(k2) ); + BOOST_TEST_REQUIRE( p.has(k3) ); + BOOST_TEST( p[k1] == 5 ); + BOOST_TEST( p[k2] == "1q" ); + BOOST_TEST( !p[k3] ); +} + +BOOST_AUTO_TEST_CASE( test_parameter_combination ) +{ + dotest0(( k1=6, k2="123" )); + dotest1(( k3, k1=6 )); + dotest2(( k2 = "1q", !k3, k1=5 )); +} + +} // test_parameter_combination + +//____________________________________________________________________________// + +namespace test_const_arg { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<char const*, struct k2_t> k2; + +template<typename Params> +void dotest0( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST_REQUIRE( p.has(k2) ); + BOOST_TEST( p[k1] == 3 ); + BOOST_TEST( p[k2] == "123" ); +} + +BOOST_AUTO_TEST_CASE( test_const_arg ) +{ + int const val = 3; + dotest0(( k1=val, k2="123" )); +} + +} // test_const_arg + +//____________________________________________________________________________// + +// the unit tests below assert functionality for non copyable classes, C++11 only +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \ + && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) \ + && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) + +namespace test_mutable_arg { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<std::string, struct k2_t> k2; + +template<typename Params> +void dotest0( Params&& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1] == 2 ); + BOOST_TEST( p[k2] == "qwe" ); + p[k1] += 2; + BOOST_TEST( p[k1] == 4 ); + p[k2] = "asd"; +} + +BOOST_AUTO_TEST_CASE( test_mutable_arg ) +{ + int val = 2; + std::string str = "qwe"; + dotest0(( k1=val, k2=str )); + BOOST_TEST( val == 4 ); + BOOST_TEST( str == "asd" ); +} + +} // test_mutable_arg + +//____________________________________________________________________________// + + +namespace test_noncopyable_arg { + +struct NC { + NC( int v ) : val( v ) {} + int val; + + NC( NC const& ) = delete; + NC( NC&& ) = delete; + void operator=( NC const& ) = delete; + void operator=( NC&& ) = delete; +}; + +nfp::typed_keyword<NC, struct k1_t> k1; + +template<typename Params> +void dotest0( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1].val == 9 ); +} + +BOOST_AUTO_TEST_CASE( test_noncopyable_arg ) +{ + dotest0(( k1=NC{ 9 } )); +} + +} // test_noncopyable_arg + + +#endif /* C++11 only */ + +//____________________________________________________________________________// + +namespace test_required_arg { + +nfp::typed_keyword<int, struct k1_t, true> k1; +nfp::typed_keyword<int, struct k2_t, true> k2; + +template<typename Params> +void dotest0( Params const& p ) +{ +// won't compile BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1] == 11 ); + BOOST_TEST( p[k2] == 10 ); +} + +BOOST_AUTO_TEST_CASE( test_required_arg ) +{ + dotest0(( k1=11, k2=10 )); +// won't compile dotest0(( k1=11 )); +} + +} // test_required_arg + +//____________________________________________________________________________// + +namespace test_argument_erasure { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<int, struct k2_t> k2; +nfp::typed_keyword<int, struct k3_t> k3; + +template<typename Params> +void dotest0_in( Params const& p ) +{ + BOOST_TEST_REQUIRE( !p.has(k1) ); + BOOST_TEST_REQUIRE( p.has(k2) ); + BOOST_TEST_REQUIRE( p.has(k3) ); + BOOST_TEST( p[k2] == 12 ); + BOOST_TEST( p[k3] <= 0 ); +} + +template<typename Params> +void dotest0( Params const& p ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST_REQUIRE( p.has(k2) ); + BOOST_TEST_REQUIRE( p.has(k3) ); + + p.erase(k1); + + dotest0_in( p ); +} + +template<typename Params> +void dotest1_in( Params const& p ) +{ + BOOST_TEST_REQUIRE( !p.has(k1) ); + BOOST_TEST_REQUIRE( !p.has(k2) ); + BOOST_TEST_REQUIRE( p.has(k3) ); + BOOST_TEST( p[k3] <= 0 ); +} + +template<typename Params> +void dotest1( Params const& p ) +{ + p.erase(k1); + p.erase(k2); + + dotest1_in( p ); +} + +BOOST_AUTO_TEST_CASE( test_argument_erasure ) +{ + dotest0(( k1=7, k2=12, k3=0 )); + dotest0(( k2=12, k1=7, k3=-1 )); + dotest0(( k3=-2, k2=12, k1=7 )); + + dotest1(( k1=7, k2=12, k3=0 )); +} + +} // test_argument_erasure + +//____________________________________________________________________________// + +namespace test_polymorphic_arg { + +nfp::keyword<struct k1_t> k1; + +template<typename Params, typename T> +void dotest0( Params const& p, T const& arg ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1] == arg ); +} + +BOOST_AUTO_TEST_CASE( test_polymorphic_arg ) +{ + dotest0( k1=11, 11 ); + dotest0( k1=std::string("qwe"), "qwe" ); +} + +} // test_polymorphic_arg + +//____________________________________________________________________________// + +namespace test_optional_assign { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<int, struct k2_t> k2; + +template<typename Params, typename T> +void dotest0( Params const& p, T& targ ) +{ + nfp::opt_assign( targ, p, k1 ); +} + +BOOST_AUTO_TEST_CASE( test_optional_assign ) +{ + int value = 0; + dotest0( k1=11, value ); + BOOST_TEST( value == 11 ); + + dotest0( k2=12, value ); + BOOST_TEST( value == 11 ); +} + +} // test_optional_assign + +//____________________________________________________________________________// + +namespace test_optional_get { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<int, struct k2_t> k2; + +template<typename Params, typename T> +void dotest0( Params const& p, T& targ ) +{ + targ = nfp::opt_get( p, k1, T() ); +} + +BOOST_AUTO_TEST_CASE( test_optional_get ) +{ + int value = 0; + dotest0( k1=11, value ); + BOOST_TEST( value == 11 ); + + dotest0( k2=12, value ); + BOOST_TEST( value == 0 ); +} + +} // namespace test_optional_get + +//____________________________________________________________________________// + +namespace test_is_named_param_pack { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<int, struct k2_t> k2; + +template<typename Params> +void dotest0( Params const& ) +{ + BOOST_TEST( nfp::is_named_param_pack<Params>::value ); +} + +BOOST_AUTO_TEST_CASE( test_is_named_param_pack ) +{ + dotest0( k1=11 ); + dotest0(( k1=11, k2=10 )); + + BOOST_TEST( !nfp::is_named_param_pack<int>::value ); + BOOST_TEST( !nfp::is_named_param_pack<bool>::value ); + BOOST_TEST( !nfp::is_named_param_pack<k1_t>::value ); + typedef nfp::typed_keyword<int, struct k1_t> kw_t; + BOOST_TEST( !nfp::is_named_param_pack<kw_t>::value ); +} + +} // test_is_named_param_pack + +//____________________________________________________________________________// + +namespace test_param_type { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<bool, struct k2_t> k2; +nfp::keyword<struct k3_t> k3; +nfp::keyword<struct k4_t> k4; + +template<typename T, typename D, typename Params, typename KW> +void dotest0( Params const&, KW const& ) +{ + typedef boost::is_same<typename nfp::param_type<Params,KW,D>::type,T> check; + BOOST_TEST( check::value ); +} + +BOOST_AUTO_TEST_CASE( test_param_type ) +{ + dotest0<int,void>(( k1=11, k2, k3="abc" ), k1 ); + dotest0<bool,void>(( k1=11, k2, k3="abc" ), k2 ); + dotest0<bool,void>(( k1=11, !k2, k3="abc" ), k2 ); + dotest0<double,void>(( k1=11, k2, k3=1.2 ), k3 ); + dotest0<void,void>(( k1=11, k2, k3="abc" ), k4 ); + int const c = 1; + dotest0<int const*,void>(( k4=&c, k3=1.2 ), k4 ); +} + +} // test_param_type + +//____________________________________________________________________________// + +namespace test_has_param { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<bool, struct k2_t, true> k2; +nfp::keyword<struct k3_t> k3; +nfp::typed_keyword<float, struct k4_t> k4; + +template<typename Params, typename KW> +void dotest0( Params const&, KW const&, bool exp ) +{ + BOOST_TEST( (nfp::has_param<Params,KW>::value) == exp ); +} + +BOOST_AUTO_TEST_CASE( test_has_param ) +{ + dotest0(( k1=11, k2, k3="abc" ), k1, true ); + dotest0(( k1=11, !k2, k3="abc" ), k2, true ); + dotest0(( k2, k1=11, k3="abc" ), k2, true ); + dotest0(( k1=11, k2, k3="abc" ), k3, true ); + dotest0(( k1=11, k2, k3="abc" ), k4, false ); +} + +} // test_has_param + +//____________________________________________________________________________// + +namespace test_optional_append { + +nfp::typed_keyword<int, struct k1_t> k1; +nfp::typed_keyword<int, struct k2_t> k2; + +template<typename Params> +void dotest0( Params const& p, int exp ) +{ + BOOST_TEST_REQUIRE( p.has(k1) ); + BOOST_TEST( p[k1] == exp ); +} + +template<typename Params, typename NP> +void dotest0_fwd( Params const& p, NP const& np, int exp ) +{ + dotest0( nfp::opt_append( p, np ), exp ); +} + +BOOST_AUTO_TEST_CASE( test_optional_append ) +{ + dotest0_fwd( k1=11, k2=10, 11 ); + dotest0_fwd( k2=10, k1=11, 11 ); + dotest0_fwd( (k1=9,k2=10), k1=11, 9 ); + dotest0_fwd( (k2=10,k1=9), k1=11, 9 ); +} + +} // test_optional_append + +//____________________________________________________________________________// + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \ + && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) \ + && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) + +namespace test_no_params { + +nfp::typed_keyword<int, struct k1_t> k1; + +template<typename Params=nfp::no_params_type> +void dotest0( bool exp, Params const& p = nfp::no_params ) +{ + BOOST_TEST_REQUIRE( p.has(k1) == exp ); +} + +BOOST_AUTO_TEST_CASE( test_no_params ) +{ + dotest0( false ); + dotest0( true, k1=11 ); +} + +} // test_no_params +#endif diff --git a/src/boost/libs/test/test/utils-ts/runtime-param-test.cpp b/src/boost/libs/test/test/utils-ts/runtime-param-test.cpp new file mode 100644 index 000000000..e2dc1ea46 --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/runtime-param-test.cpp @@ -0,0 +1,1175 @@ +// (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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : unit test for runtime parameter framework +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE Boost.Test CLA parser test +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/runtime/parameter.hpp> +#include <boost/test/utils/runtime/finalize.hpp> +#include <boost/test/utils/runtime/cla/argv_traverser.hpp> +#include <boost/test/utils/runtime/cla/parser.hpp> +#include <boost/test/utils/runtime/env/fetch.hpp> +namespace utf = boost::unit_test; +namespace rt = boost::runtime; + +#include <iostream> + +BOOST_AUTO_TEST_SUITE( test_argv_traverser ) + +BOOST_AUTO_TEST_CASE( test_construction ) +{ + char const* argv1[] = { "test.exe" }; + rt::cla::argv_traverser tr1( sizeof(argv1)/sizeof(char const*), argv1 ); + + BOOST_TEST( tr1.eoi() ); + BOOST_TEST( tr1.remainder() == 1 ); + + char const* argv2[] = { "test.exe", "--abc=1" }; + rt::cla::argv_traverser tr2( sizeof(argv2)/sizeof(char const*), argv2 ); + + BOOST_TEST( !tr2.eoi() ); + BOOST_TEST( tr2.remainder() == 2 ); + + char const* argv3[] = { "test.exe", "" }; + rt::cla::argv_traverser tr3( sizeof(argv3)/sizeof(char const*), argv3 ); + + BOOST_TEST( !tr3.eoi() ); + BOOST_TEST( tr3.remainder() == 2 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_next_token ) +{ + char const* argv1[] = { "test.exe", "a", "b", "" }; + rt::cla::argv_traverser tr( sizeof(argv1)/sizeof(char const*), argv1 ); + + tr.next_token(); + BOOST_TEST( tr.remainder() == 3 ); + BOOST_TEST( argv1[0] == "test.exe" ); + BOOST_TEST( argv1[1] == "b" ); + BOOST_TEST( argv1[2] == "" ); + + tr.next_token(); + BOOST_TEST( tr.remainder() == 2 ); + BOOST_TEST( argv1[0] == "test.exe" ); + BOOST_TEST( argv1[1] == "" ); + + tr.next_token(); + BOOST_TEST( tr.remainder() == 1 ); + BOOST_TEST( argv1[0] == "test.exe" ); + BOOST_TEST( tr.eoi() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_current_token ) +{ + char const* argv1[] = { "test.exe", "abc", "zxcvb", "as kl", "--ooo=111", "a", "" }; + rt::cla::argv_traverser tr( sizeof(argv1)/sizeof(char const*), argv1 ); + + BOOST_TEST( tr.current_token() == "abc" ); + tr.next_token(); + BOOST_TEST( tr.current_token() == "zxcvb" ); + tr.next_token(); + BOOST_TEST( tr.current_token() == "as kl" ); + tr.next_token(); + BOOST_TEST( tr.current_token() == "--ooo=111" ); + tr.next_token(); + BOOST_TEST( tr.current_token() == "a" ); + tr.next_token(); + BOOST_TEST( !tr.eoi() ); + BOOST_TEST( tr.current_token() == rt::cstring() ); + tr.next_token(); + BOOST_TEST( tr.eoi() ); + BOOST_TEST( tr.current_token() == rt::cstring() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_save_token ) +{ + char const* argv1[] = { "test.exe", "a", "b", "" }; + rt::cla::argv_traverser tr( sizeof(argv1)/sizeof(char const*), argv1 ); + + tr.save_token(); + BOOST_TEST( tr.remainder() == 4 ); + BOOST_TEST( tr.current_token() == "b" ); + + tr.save_token(); + BOOST_TEST( tr.remainder() == 4 ); + BOOST_TEST( tr.current_token() == "" ); + + tr.save_token(); + BOOST_TEST( tr.remainder() == 4 ); + BOOST_TEST( tr.eoi() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_remainder ) +{ + char const* argv[] = { "test.exe", "abcjkl", "zx vb", " 3 ", "" }; + rt::cla::argv_traverser tr( sizeof(argv)/sizeof(char const*), argv ); + + tr.next_token(); + tr.save_token(); + tr.next_token(); + tr.save_token(); + + BOOST_TEST( tr.remainder() == 3 ); + BOOST_TEST( argv[0] == "test.exe" ); + BOOST_TEST( argv[1] == "zx vb" ); + BOOST_TEST( argv[2] == "" ); +} + +BOOST_AUTO_TEST_SUITE_END() + +//____________________________________________________________________________// +//____________________________________________________________________________// +//____________________________________________________________________________// + +BOOST_AUTO_TEST_SUITE( test_parameter_specification, + * utf::depends_on("test_argv_traverser") ) + +BOOST_AUTO_TEST_CASE( test_param_construction ) +{ + rt::parameter<int> p1( "P1" ); + + BOOST_TEST( p1.p_name == "P1" ); + BOOST_TEST( p1.p_description == "" ); + BOOST_TEST( p1.p_env_var == "" ); + BOOST_TEST( p1.p_optional ); + BOOST_TEST( !p1.p_repeatable ); + BOOST_TEST( !p1.p_has_optional_value ); + + rt::parameter<int,rt::REQUIRED_PARAM> p2( "P2", ( + rt::description = "123", + rt::env_var = "E2" + )); + + BOOST_TEST( p2.p_name == "P2" ); + BOOST_TEST( p2.p_description == "123" ); + BOOST_TEST( p2.p_env_var == "E2" ); + BOOST_TEST( !p2.p_optional ); + BOOST_TEST( !p2.p_repeatable ); + BOOST_TEST( !p2.p_has_optional_value ); + + rt::parameter<int,rt::REPEATABLE_PARAM> p4( "P4", ( + rt::description = "123", + rt::env_var = "E4" + )); + + BOOST_TEST( p4.p_name == "P4" ); + BOOST_TEST( p4.p_description == "123" ); + BOOST_TEST( p4.p_env_var == "E4" ); + BOOST_TEST( p4.p_optional ); + BOOST_TEST( p4.p_repeatable ); + BOOST_TEST( !p4.p_has_optional_value ); + + rt::option p5( "P5", ( + rt::description = "bool arg", + rt::env_var = "E5" + )); + p5.add_cla_id( "-", "b", " " ); + + BOOST_TEST( p5.p_name == "P5" ); + BOOST_TEST( p5.p_description == "bool arg" ); + BOOST_TEST( p5.p_env_var == "E5" ); + BOOST_TEST( p5.p_optional ); + BOOST_TEST( !p5.p_repeatable ); + BOOST_TEST( p5.p_has_optional_value ); + + rt::option p6( "P6", ( + rt::description = "option with true default", + rt::env_var = "E6", + rt::default_value = true + )); + p6.add_cla_id( "-", "b", " " ); + + BOOST_TEST( p6.p_name == "P6" ); + BOOST_TEST( p6.p_description == "option with true default" ); + BOOST_TEST( p6.p_env_var == "E6" ); + BOOST_TEST( p6.p_optional ); + BOOST_TEST( !p6.p_repeatable ); + BOOST_TEST( p6.p_has_optional_value ); + + rt::parameter<int> p3( "P3" ); + p3.add_cla_id( "/", "P3", ":" ); + p3.add_cla_id( "-", "p+p_p", " " ); + + BOOST_TEST( p3.cla_ids().size() == 3U ); + BOOST_TEST( p3.cla_ids()[1].m_prefix == "/" ); + BOOST_TEST( p3.cla_ids()[1].m_tag == "P3" ); + BOOST_TEST( p3.cla_ids()[1].m_value_separator == ":" ); + BOOST_TEST( p3.cla_ids()[2].m_prefix == "-" ); + BOOST_TEST( p3.cla_ids()[2].m_tag == "p+p_p" ); + BOOST_TEST( p3.cla_ids()[2].m_value_separator == "" ); + + BOOST_CHECK_THROW( p3.add_cla_id( "^", "p", " " ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( " ", "p", " " ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( "", "p", " " ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( "-", "-abc", " " ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( "-", "b c", " " ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( "-", "", " " ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( "-", "a", "-" ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( "-", "a", "/" ), rt::invalid_cla_id ); + BOOST_CHECK_THROW( p3.add_cla_id( "-", "a", "" ), rt::invalid_cla_id ); + + rt::parameter<int> p7( "P7", rt::optional_value = 1); + BOOST_CHECK_THROW( p7.add_cla_id( "-", "a", " " ), rt::invalid_cla_id ); + + BOOST_CHECK_THROW( (rt::parameter<int,rt::REQUIRED_PARAM>( "P", rt::default_value = 1)), rt::invalid_param_spec ); + BOOST_CHECK_THROW( (rt::parameter<int,rt::REPEATABLE_PARAM>( "P", rt::default_value = std::vector<int>{1})), rt::invalid_param_spec ); + BOOST_CHECK_THROW( (rt::parameter<int,rt::REPEATABLE_PARAM>( "P", rt::optional_value = std::vector<int>{1})), rt::invalid_param_spec ); + + enum EnumType { V1, V2 }; + rt::enum_parameter<EnumType> p8( "P8", ( + rt::enum_values<EnumType>::value = { + {"V1", V1}, + {"V2", V2}}, + rt::default_value = V1 + )); + + BOOST_TEST( p8.p_optional ); + BOOST_TEST( !p8.p_repeatable ); + BOOST_TEST( !p8.p_has_optional_value ); + BOOST_TEST( p8.p_has_default_value ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_params_store ) +{ + rt::parameter<int> p1( "P1" ); + rt::parameter<int> p2( "P2" ); + rt::parameter<int> p3( "P1" ); + + rt::parameters_store S; + + BOOST_TEST( S.is_empty() ); + + S.add( p1 ); + S.add( p2 ); + + BOOST_CHECK_THROW( S.add( p3 ), rt::duplicate_param ); + BOOST_TEST( !S.is_empty() ); + BOOST_TEST( S.all().size() == 2U ); + BOOST_TEST( S.get("P1")->p_name == "P1" ); + BOOST_TEST( S.get("P2")->p_name == "P2" ); + BOOST_CHECK_THROW( S.get("P3"), rt::unknown_param ); +} + +BOOST_AUTO_TEST_SUITE_END() + +//____________________________________________________________________________// +//____________________________________________________________________________// +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_param_trie_construction, + * utf::depends_on("test_parameter_specification") ) +{ + // make sure this does not crash + rt::parameters_store store; + rt::cla::parser parser( store ); + + rt::parameters_store store1; + + rt::parameter<int> p1( "P1" ); + p1.add_cla_id( "--", "param_one", " " ); + p1.add_cla_id( "-", "p1", " " ); + store1.add( p1 ); + + rt::parameter<int> p2( "P2" ); + p2.add_cla_id( "--", "param_two", " " ); + p2.add_cla_id( "-", "p2", " " ); + store1.add( p2 ); + + rt::parameter<int> p3( "P3" ); + p3.add_cla_id( "--", "another_", " " ); + p3.add_cla_id( "/", "p3", " " ); + store1.add( p3 ); + + rt::parameter<int> p4( "P4" ); + p4.add_cla_id( "-", "param_one", " " ); + store1.add( p4 ); + + rt::cla::parser parser1( store1 ); + + rt::parameters_store store2; + + rt::parameter<int> p5( "P5" ); + p5.add_cla_id( "-", "paramA", " " ); + store2.add( p5 ); + + rt::parameter<int> p6( "P6" ); + p6.add_cla_id( "-", "paramA", " " ); + store2.add( p6 ); + + BOOST_CHECK_THROW( rt::cla::parser testparser( store2 ), rt::conflicting_param ); + + rt::parameters_store store3; + + rt::parameter<int> p7( "P7" ); + p7.add_cla_id( "-", "paramA", " " ); + store3.add( p7 ); + + rt::parameter<int> p8( "P8" ); + p8.add_cla_id( "-", "param", " " ); + store3.add( p8 ); + + BOOST_CHECK_THROW( rt::cla::parser testparser( store3 ), rt::conflicting_param ); + + rt::parameters_store store4; + + rt::parameter<int> p9( "P9" ); + p9.add_cla_id( "-", "param", " " ); + store4.add( p9 ); + + rt::parameter<int> p10( "P10" ); + p10.add_cla_id( "-", "paramA", " " ); + store4.add( p10 ); + + BOOST_CHECK_THROW( rt::cla::parser testparser( store4 ), rt::conflicting_param ); +} + +//____________________________________________________________________________// +//____________________________________________________________________________// +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_arguments_store ) +{ + rt::arguments_store store; + + BOOST_TEST( store.size() == 0U ); + BOOST_TEST( !store.has( "P1" ) ); + BOOST_TEST( !store.has( "P2" ) ); + BOOST_TEST( !store.has( "P3" ) ); + BOOST_TEST( !store.has( "P4" ) ); + BOOST_TEST( !store.has( "P5" ) ); + + store.set( "P1", 10 ); + store.set( "P2", std::string("abc") ); + store.set( "P3", rt::cstring("abc") ); + store.set( "P4", true ); + store.set( "P5", std::vector<int>( 1, 12 ) ); + + BOOST_TEST( store.has( "P1" ) ); + BOOST_TEST( store.has( "P2" ) ); + BOOST_TEST( store.has( "P3" ) ); + BOOST_TEST( store.has( "P4" ) ); + BOOST_TEST( store.has( "P5" ) ); + BOOST_TEST( store.size() == 5U ); + + BOOST_TEST( store.get<int>( "P1" ) == 10 ); + BOOST_TEST( store.get<std::string>( "P2" ) == "abc" ); + BOOST_TEST( store.get<rt::cstring>( "P3" ) == "abc" ); + BOOST_TEST( store.get<bool>( "P4" ) == true); + BOOST_TEST( store.get<std::vector<int>>( "P5" ) == std::vector<int>( 1, 12 ) ); + + store.set( "P1", 20 ); + BOOST_TEST( store.get<int>( "P1" ) == 20 ); + + BOOST_CHECK_THROW( store.get<int>( "P0" ), rt::access_to_missing_argument ); + BOOST_CHECK_THROW( store.get<long>( "P1" ), rt::arg_type_mismatch ); +} + +//____________________________________________________________________________// +//____________________________________________________________________________// +//____________________________________________________________________________// + +BOOST_AUTO_TEST_SUITE( test_cla_parsing, + * utf::depends_on("test_argv_traverser") + * utf::depends_on("test_parameter_specification") + * utf::depends_on("test_arguments_store") ) + +BOOST_AUTO_TEST_CASE( test_basic_parsing ) +{ + rt::parameters_store params_store; + + rt::parameter<std::string> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "p1", " " ); + params_store.add( p1 ); + + rt::parameter<std::string> p2( "P2" ); + p2.add_cla_id( "--", "param_two", "=" ); + p2.add_cla_id( "-", "p2", " " ); + params_store.add( p2 ); + + rt::cla::parser testparser( params_store ); + + char const* argv1[] = { "test.exe" }; + rt::arguments_store args_store1; + + testparser.parse( sizeof(argv1)/sizeof(char const*), (char**)argv1, args_store1 ); + + BOOST_TEST( args_store1.size() == 0U ); + + char const* argv2[] = { "test.exe", "--param_one=abc" }; + rt::arguments_store args_store2; + + testparser.parse( sizeof(argv2)/sizeof(char const*), (char**)argv2, args_store2 ); + + BOOST_TEST( args_store2.size() == 1U ); + BOOST_TEST( args_store2.has( "P1" ) ); + BOOST_TEST( args_store2.get<std::string>( "P1" ) == "abc" ); + + char const* argv3[] = { "test.exe", "--param_two=12" }; + rt::arguments_store args_store3; + + testparser.parse( sizeof(argv3)/sizeof(char const*), (char**)argv3, args_store3 ); + + BOOST_TEST( args_store3.size() == 1U ); + BOOST_TEST( args_store3.has( "P2" ) ); + BOOST_TEST( args_store3.get<std::string>( "P2" ) == "12" ); + + char const* argv4[] = { "test.exe", "-p1", "aaa", "-p2", "37" }; + rt::arguments_store args_store4; + + testparser.parse( sizeof(argv4)/sizeof(char const*), (char**)argv4, args_store4 ); + + BOOST_TEST( args_store4.size() == 2U ); + BOOST_TEST( args_store4.has( "P1" ) ); + BOOST_TEST( args_store4.get<std::string>( "P1" ) == "aaa" ); + BOOST_TEST( args_store4.has( "P2" ) ); + BOOST_TEST( args_store4.get<std::string>( "P2" ) == "37" ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_typed_argument_parsing ) +{ + rt::parameters_store params_store; + + rt::parameter<double> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "p1", " " ); + params_store.add( p1 ); + + rt::parameter<int> p2( "P2" ); + p2.add_cla_id( "--", "param_two", "=" ); + p2.add_cla_id( "-", "p2", " " ); + params_store.add( p2 ); + + rt::option p3( "P3" ); + p3.add_cla_id( "--", "third", "=" ); + p3.add_cla_id( "-", "p3", " " ); + params_store.add( p3 ); + + rt::parameter<rt::cstring> p4( "P4" ); + p4.add_cla_id( "--", "another", "=" ); + p4.add_cla_id( "-", "p4", " " ); + params_store.add( p4 ); + + rt::cla::parser testparser( params_store ); + + char const* argv1[] = { "test.exe", "--another=some thing", "-p1", "1.2", "-p2", "37", "--third=Y" }; + rt::arguments_store args_store1; + + testparser.parse( sizeof(argv1)/sizeof(char const*), (char**)argv1, args_store1 ); + + BOOST_TEST( args_store1.size() == 4U ); + BOOST_TEST( args_store1.has( "P1" ) ); + BOOST_TEST( args_store1.get<double>( "P1" ) == 1.2 ); + BOOST_TEST( args_store1.has( "P2" ) ); + BOOST_TEST( args_store1.get<int>( "P2" ) == 37 ); + BOOST_TEST( args_store1.has( "P3" ) ); + BOOST_TEST( args_store1.get<bool>( "P3" ) ); + BOOST_TEST( args_store1.has( "P4" ) ); + BOOST_TEST( args_store1.get<rt::cstring>( "P4" ) == "some thing" ); + + char const* argv2[] = { "test.exe", "-p3" }; + rt::arguments_store args_store2; + + testparser.parse( sizeof(argv2)/sizeof(char const*), (char**)argv2, args_store2 ); + BOOST_TEST( args_store2.size() == 1U ); + BOOST_TEST( args_store2.has( "P3" ) ); + BOOST_TEST( args_store2.get<bool>( "P3" ) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_parameter_name_guessing ) +{ + rt::parameters_store params_store; + + rt::parameter<int> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "one", " " ); + params_store.add( p1 ); + + rt::parameter<int> p2( "P2" ); + p2.add_cla_id( "--", "param_two", "=" ); + p2.add_cla_id( "-", "two", " " ); + params_store.add( p2 ); + + rt::cla::parser testparser( params_store ); + + char const* argv1[] = { "test.exe", "--param_o=1", "-t", "2" }; + rt::arguments_store args_store1; + + testparser.parse( sizeof(argv1)/sizeof(char const*), (char**)argv1, args_store1 ); + + BOOST_TEST( args_store1.size() == 2U ); + BOOST_TEST( args_store1.has( "P1" ) ); + BOOST_TEST( args_store1.has( "P2" ) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_repeatable_parameters ) +{ + rt::parameters_store params_store; + + rt::parameter<int,rt::REPEATABLE_PARAM> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "one", " " ); + params_store.add( p1 ); + + rt::cla::parser testparser( params_store ); + rt::arguments_store args_store; + + char const* argv[] = { "test.exe", "-one", "1", "-one", "2" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + + BOOST_TEST( args_store.size() == 1U ); + BOOST_TEST( args_store.has( "P1" ) ); + + std::vector<int> P1_expected{1, 2}; + BOOST_TEST( args_store.get<std::vector<int>>( "P1" ) == P1_expected ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_parameter_with_optional_value ) +{ + rt::parameters_store params_store; + + rt::parameter<int> p1( "P1", rt::optional_value = 5 ); + p1.add_cla_id( "--", "param_one", "=" ); + params_store.add( p1 ); + + rt::cla::parser testparser( params_store ); + + rt::arguments_store args_store1; + char const* argv1[] = { "test.exe", "--param_one=1" }; + testparser.parse( sizeof(argv1)/sizeof(char const*), (char**)argv1, args_store1 ); + + BOOST_TEST( args_store1.size() == 1U ); + BOOST_TEST( args_store1.has( "P1" ) ); + BOOST_TEST( args_store1.get<int>( "P1" ) == 1 ); + + rt::arguments_store args_store2; + char const* argv2[] = { "test.exe", "--param_one" }; + testparser.parse( sizeof(argv2)/sizeof(char const*), (char**)argv2, args_store2 ); + + BOOST_TEST( args_store2.size() == 1U ); + BOOST_TEST( args_store2.has( "P1" ) ); + BOOST_TEST( args_store2.get<int>( "P1" ) == 5 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_validations ) +{ + rt::parameters_store params_store; + + rt::parameter<int> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "one", " " ); + params_store.add( p1 ); + + rt::parameter<int> p2( "P2" ); + p2.add_cla_id( "--", "param_two", "=" ); + p2.add_cla_id( "-", "two", " " ); + params_store.add( p2 ); + + rt::option p3( "P3" ); + p3.add_cla_id( "--", "option", "=" ); + params_store.add( p3 ); + + rt::cla::parser testparser( params_store ); + rt::arguments_store args_store; + + { + char const* argv[] = { "test.exe", "--=1" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } + + { + char const* argv[] = { "test.exe", "--param_one:1" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } + + { + char const* argv[] = { "test.exe", "--param_one=" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } + + { + char const* argv[] = { "test.exe", "--param_one=1", "--param_one=2" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::duplicate_arg ); + } + + { + char const* argv[] = { "test.exe", "--param=1" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::ambiguous_param ); + } + + { + char const* argv[] = { "test.exe", "--opt=Yeah" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } + + { + char const* argv[] = { "test.exe", "param_one=1" }; + BOOST_TEST( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ) == 2 ); + } + + { + char const* argv[] = { "test.exe", "---param_one=1" }; + BOOST_TEST( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ) == 2 ); + } + + { + char const* argv[] = { "test.exe", "=1" }; + BOOST_TEST( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ) == 2 ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_unrecognized_param_suggestions ) +{ + rt::parameters_store params_store; + + rt::parameter<int> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "p1", " " ); + params_store.add( p1 ); + + rt::parameter<int> p2( "P2" ); + p2.add_cla_id( "--", "param_two", "=" ); + params_store.add( p2 ); + + rt::parameter<int> p3( "P3" ); + p3.add_cla_id( "--", "param_three", "=" ); + params_store.add( p3 ); + + rt::cla::parser testparser( params_store ); + rt::arguments_store args_store; + + { + char const* argv[] = { "test.exe", "--laram_one=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + []( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{"param_one"}; + }); + } + + { + char const* argv[] = { "test.exe", "--paran_one=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + []( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{"param_one"}; + }); + } + + { + char const* argv[] = { "test.exe", "--param_onw=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + []( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{"param_one"}; + }); + } + + { + char const* argv[] = { "test.exe", "--param_to=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + ([]( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{"param_three", "param_two"}; + })); + } + + { + char const* argv[] = { "test.exe", "--paramtwo=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + ([]( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{"param_two"}; + })); + } + + { + char const* argv[] = { "test.exe", "--parum_=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + ([]( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{}; + })); + } + + { + char const* argv[] = { "test.exe", "--param__one=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + ([]( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{"param_one"}; + })); + } + + { + char const* argv[] = { "test.exe", "--param_twoo=1" }; + BOOST_CHECK_EXCEPTION( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), + rt::unrecognized_param, + ([]( rt::unrecognized_param const& ex ) -> bool { + return ex.m_typo_candidates == std::vector<rt::cstring>{"param_two"}; + })); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_end_of_params ) +{ + rt::parameters_store params_store; + + rt::parameter<int> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "p1", " " ); + params_store.add( p1 ); + + rt::parameter<int> p2( "P2" ); + p2.add_cla_id( "--", "param_two", "=" ); + params_store.add( p2 ); + + BOOST_CHECK_THROW( rt::cla::parser testparser( params_store, rt::end_of_params = "==" ), rt::invalid_cla_id ); + + rt::cla::parser testparser( params_store, rt::end_of_params = "--" ); + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--param_one=1", "--", "/abc" }; + int new_argc = testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + + BOOST_TEST( args_store.size() == 1U ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( args_store.get<int>( "P1" ) == 1 ); + BOOST_TEST( new_argc == 2 ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "-p1", "1", "--", "--param_two=2" }; + int new_argc = testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + + BOOST_TEST( args_store.size() == 1U ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( !args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<int>( "P1" ) == 1 ); + BOOST_TEST( new_argc == 2 ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_negation_prefix ) +{ + rt::parameters_store params_store; + + rt::parameter<int> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "p1", " " ); + params_store.add( p1 ); + + rt::option p2( "P2" ); + p2.add_cla_id( "--", "param_two", "=", true ); + p2.add_cla_id( "-", "p2", " ", true ); + p2.add_cla_id( "-", "p3", " " ); + params_store.add( p2 ); + + BOOST_CHECK_THROW( rt::cla::parser testparser( params_store, rt::negation_prefix = "no:" ), rt::invalid_cla_id ); + + rt::cla::parser testparser( params_store, rt::negation_prefix = "no_" ); + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--no_param_two" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + + BOOST_TEST( args_store.size() == 1U ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<bool>( "P2" ) == false ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "-no_p2" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + + BOOST_TEST( args_store.size() == 1U ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<bool>( "P2" ) == false ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--no_param_one" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--no_param_two=Y" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "-no_p3" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_enum_parameter ) +{ + rt::parameters_store params_store; + + enum EnumType { V1, V2, V3 }; + rt::enum_parameter<EnumType> p1( "P1", ( + rt::enum_values<EnumType>::value = { + {"V1", V1}, + {"V2", V2}}, + rt::default_value = V3 + )); + + p1.add_cla_id( "--", "param_one", "=" ); + params_store.add( p1 ); + + rt::enum_parameter<EnumType, rt::REPEATABLE_PARAM> p2( "P2", ( + rt::enum_values<EnumType>::value = { + {"V1", V1}, + {"V2", V2}, + {"V2alt", V2}, + {"V3", V3}} + )); + p2.add_cla_id( "--", "param_two", " " ); + params_store.add( p2 ); + + rt::cla::parser testparser( params_store ); + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--param_one=V1" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( args_store.get<EnumType>( "P1" ) == V1 ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--param_one=V2" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + rt::finalize_arguments( params_store, args_store ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( args_store.get<EnumType>( "P1" ) == V2 ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + rt::finalize_arguments( params_store, args_store ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( args_store.get<EnumType>( "P1" ) == V3 ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--param_one=V3" }; + BOOST_CHECK_THROW( testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ), rt::format_error ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe", "--param_two", "V2alt", "--param_two", "V1", "--param_two", "V3" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + rt::finalize_arguments( params_store, args_store ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<std::vector<EnumType>>( "P2" ) == (std::vector<EnumType>{V2, V1, V3}) ); + } + + { + rt::arguments_store args_store; + char const* argv[] = { "test.exe" }; + testparser.parse( sizeof(argv)/sizeof(char const*), (char**)argv, args_store ); + rt::finalize_arguments( params_store, args_store ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<std::vector<EnumType>>( "P2" ) == std::vector<EnumType>{} ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_SUITE_END() + +//____________________________________________________________________________// +//____________________________________________________________________________// +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_fetch_from_environment ) +{ + rt::parameters_store params_store; + + rt::parameter<int> p1( "P1", rt::env_var = "P1VAR"); + params_store.add( p1 ); + + rt::option p2( "P2", rt::env_var = "P2VAR"); + params_store.add( p2 ); + + rt::option p3( "P3"); + params_store.add( p3 ); + + { + rt::arguments_store args_store; + + auto env_read = []( rt::cstring ) -> std::pair<rt::cstring,bool> + { + return std::make_pair( rt::cstring(), false ); + }; + + rt::env::env_detail::fetch_absent( params_store, args_store, env_read ); + + BOOST_TEST( args_store.size() == 0U ); + } + + { + rt::arguments_store args_store; + args_store.set( "P1", 3 ); + args_store.set( "P2", true ); + + auto env_read = []( rt::cstring ) -> std::pair<rt::cstring,bool> + { + return std::make_pair( rt::cstring(), false ); + }; + + rt::env::env_detail::fetch_absent( params_store, args_store, env_read ); + + BOOST_TEST( args_store.size() == 2U ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( !args_store.has( "P1VAR" ) ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<int>( "P1" ) == 3 ); + BOOST_TEST( args_store.get<bool>( "P2" ) == true ); + } + + { + rt::arguments_store args_store; + + auto env_read = []( rt::cstring var_name ) -> std::pair<rt::cstring,bool> + { + if( var_name == "P1VAR" ) + return std::make_pair( rt::cstring("5"), true ); + + if( var_name == "P2VAR" ) + return std::make_pair( rt::cstring("Y"), true ); + + return std::make_pair( rt::cstring(), false ); + }; + + rt::env::env_detail::fetch_absent( params_store, args_store, env_read ); + + BOOST_TEST( args_store.size() == 2U ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( !args_store.has( "P1VAR" ) ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<int>( "P1" ) == 5 ); + BOOST_TEST( args_store.get<bool>( "P2" ) == true ); + } + + { + rt::arguments_store args_store; + + auto env_read = []( rt::cstring var_name ) -> std::pair<rt::cstring,bool> + { + if( var_name == "P2VAR" ) + return std::make_pair( rt::cstring("No"), true ); + + return std::make_pair( rt::cstring(), false ); + }; + + rt::env::env_detail::fetch_absent( params_store, args_store, env_read ); + + BOOST_TEST( args_store.size() == 1U ); + BOOST_TEST( !args_store.has( "P1" ) ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<bool>( "P2" ) == false ); + } + + { + rt::arguments_store args_store; + + auto env_read = []( rt::cstring var_name ) -> std::pair<rt::cstring,bool> + { + if( var_name == "P2VAR" ) + return std::make_pair( rt::cstring(), true ); + + return std::make_pair( rt::cstring(), false ); + }; + + rt::env::env_detail::fetch_absent( params_store, args_store, env_read ); + + BOOST_TEST( args_store.size() == 1U ); + BOOST_TEST( !args_store.has( "P1" ) ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<bool>( "P2" ) == true ); + } + + { + rt::arguments_store args_store; + + auto env_read = []( rt::cstring var_name ) -> std::pair<rt::cstring,bool> + { + if( var_name == "P1VAR" ) + return std::make_pair( rt::cstring("one"), true ); + + return std::make_pair( rt::cstring(), false ); + }; + + BOOST_CHECK_THROW( rt::env::env_detail::fetch_absent( params_store, args_store, env_read ), + rt::format_error ); + } + + { + rt::arguments_store args_store; + + auto env_read = []( rt::cstring var_name ) -> std::pair<rt::cstring,bool> + { + if( var_name == "P1VAR" ) + return std::make_pair( rt::cstring(), true ); + + return std::make_pair( rt::cstring(), false ); + }; + + BOOST_CHECK_THROW( rt::env::env_detail::fetch_absent( params_store, args_store, env_read ), + rt::format_error ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_finalize_arguments ) +{ + rt::parameters_store params_store; + + rt::parameter<int,rt::REQUIRED_PARAM> p1( "P1" ); + p1.add_cla_id( "--", "param_one", "=" ); + p1.add_cla_id( "-", "p1", " " ); + params_store.add( p1 ); + + rt::parameter<int> p2( "P2", rt::default_value = 10 ); + params_store.add( p2 ); + + rt::option p3( "P3" ); + params_store.add( p3 ); + + rt::option p4( "P4", rt::default_value = true ); + + params_store.add( p4 ); + + { + rt::arguments_store args_store; + args_store.set( "P1", 3 ); + + rt::finalize_arguments( params_store, args_store ); + + BOOST_TEST( args_store.size() == 4U ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.has( "P3" ) ); + BOOST_TEST( args_store.has( "P4" ) ); + BOOST_TEST( args_store.get<int>( "P1" ) == 3 ); + BOOST_TEST( args_store.get<int>( "P2" ) == 10 ); + BOOST_TEST( args_store.get<bool>( "P3" ) == false ); + BOOST_TEST( args_store.get<bool>( "P4" ) == true ); + } + + { + rt::arguments_store args_store; + args_store.set( "P1", 3 ); + args_store.set( "P2", 4 ); + + rt::finalize_arguments( params_store, args_store ); + + BOOST_TEST( args_store.size() == 4U ); + BOOST_TEST( args_store.has( "P1" ) ); + BOOST_TEST( args_store.has( "P2" ) ); + BOOST_TEST( args_store.get<int>( "P1" ) == 3 ); + BOOST_TEST( args_store.get<int>( "P2" ) == 4 ); + } + + { + rt::arguments_store args_store; + + BOOST_CHECK_THROW( rt::finalize_arguments( params_store, args_store ), rt::missing_req_arg ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_param_callback ) +{ + rt::parameters_store params_store; + + int counter = 0; + auto cb = [&counter](rt::cstring param_name ) + { + BOOST_TEST( param_name == "P1" ); + counter++; + }; + + rt::parameter<int> p1( "P1", rt::callback = cb ); + params_store.add( p1 ); + + rt::parameter<int> p2( "P2" ); + params_store.add( p2 ); + + { + rt::arguments_store args_store; + args_store.set( "P1", 3 ); + + rt::finalize_arguments( params_store, args_store ); + BOOST_TEST( counter == 1 ); + } + + { + rt::arguments_store args_store; + args_store.set( "P2", 3 ); + + rt::finalize_arguments( params_store, args_store ); + BOOST_TEST( counter == 1 ); + } +} + +// EOF + +// cla help/usage +// build info diff --git a/src/boost/libs/test/test/utils-ts/string_cast-test.cpp b/src/boost/libs/test/test/utils-ts/string_cast-test.cpp new file mode 100644 index 000000000..e2c363d21 --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/string_cast-test.cpp @@ -0,0 +1,114 @@ +// (C) Copyright Gennadiy Rozental 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. +// +/// @file +/// @brief string_cast unit test +// ***************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE string_cast unit test +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/string_cast.hpp> + +namespace utu = boost::unit_test::utils; + +//____________________________________________________________________________// + +struct A { + A(int i_) : i(i_) {} + int i; +}; + +inline std::ostream& +operator<<(std::ostream& ostr, A const& a) { return ostr << "A{i=" << a.i << "}"; } + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_string_cast ) +{ + BOOST_TEST( utu::string_cast( 1 ) == "1" ); + BOOST_TEST( utu::string_cast( 1.1 ) == "1.1" ); + BOOST_TEST( utu::string_cast( -1 ) == "-1" ); + BOOST_TEST( utu::string_cast( 1U ) == "1" ); + BOOST_TEST( utu::string_cast( 100000000000L ) == "100000000000" ); + BOOST_TEST( utu::string_cast( 1LL << 55 ) == "36028797018963968" ); + BOOST_TEST( utu::string_cast( 'a' ) == "a" ); + BOOST_TEST( utu::string_cast( "abc" ) == "abc" ); + BOOST_TEST( utu::string_cast( A(12) ) == "A{i=12}" ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_string_as ) +{ + int ival; + + BOOST_TEST( utu::string_as<int>( "1", ival ) ); + BOOST_TEST( ival == 1 ); + + BOOST_TEST( utu::string_as<int>( " 2", ival ) ); + BOOST_TEST( ival == 2 ); + + BOOST_TEST( utu::string_as<int>( "+3", ival ) ); + BOOST_TEST( ival == 3 ); + + BOOST_TEST( utu::string_as<int>( "-2", ival ) ); + BOOST_TEST( ival == -2 ); + + double dval; + + BOOST_TEST( utu::string_as<double>( "0.32", dval ) ); + BOOST_TEST( dval == 0.32 ); + + BOOST_TEST( utu::string_as<double>( "-1e-3", dval ) ); + BOOST_TEST( dval == -0.001 ); + + unsigned uval; + + BOOST_TEST( utu::string_as<unsigned>( "123", uval ) ); + BOOST_TEST( uval == 123U ); + + long lval; + + BOOST_TEST( utu::string_as<long>( "909090", lval ) ); + BOOST_TEST( lval == 909090 ); + + long long llval; + + BOOST_TEST( utu::string_as<long long>( "1234123412341234", llval ) ); + BOOST_TEST( llval == 1234123412341234LL ); + + std::string sval; + + BOOST_TEST( utu::string_as<std::string>( "abc", sval ) ); + BOOST_TEST( sval == "abc" ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_string_as_validations ) +{ + int ival; + + BOOST_TEST( !utu::string_as<int>( "1a", ival ) ); + BOOST_TEST( !utu::string_as<int>( "1 ", ival ) ); + + double dval; + + BOOST_TEST( !utu::string_as<double>( "1e-0.1", dval ) ); + BOOST_TEST( !utu::string_as<double>( "1.001.1 ", dval ) ); + + unsigned uval; + + BOOST_TEST( !utu::string_as<unsigned>( "1.1", uval ) ); + + std::string sval; + + BOOST_TEST( !utu::string_as<std::string>( "a b", sval ) ); +} + +// EOF diff --git a/src/boost/libs/test/test/utils-ts/token_iterator-test.cpp b/src/boost/libs/test/test/utils-ts/token_iterator-test.cpp new file mode 100644 index 000000000..6b9e07b4f --- /dev/null +++ b/src/boost/libs/test/test/utils-ts/token_iterator-test.cpp @@ -0,0 +1,189 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : string_token_iterator unit test +// ***************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE string_token_iterator unit test +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/iterator/token_iterator.hpp> + +// BOOST +#include <boost/iterator/transform_iterator.hpp> + +// STL +#include <iostream> +#include <list> +#include <iterator> + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::toupper; using ::tolower; } +#endif + +namespace utu= boost::unit_test::utils; + +//____________________________________________________________________________// + +static utu::string_token_iterator sti_end; +static utu::wstring_token_iterator wsti_end; + +BOOST_TEST_DONT_PRINT_LOG_VALUE( utu::string_token_iterator ) +BOOST_TEST_DONT_PRINT_LOG_VALUE( utu::wstring_token_iterator ) + +BOOST_AUTO_TEST_CASE( test_default_delim_policy ) +{ + utu::string_token_iterator tit( "This is\n, a \ttest" ); + char const* res[] = { "This", "is", ",", "a", "test" }; + + BOOST_CHECK_EQUAL_COLLECTIONS( tit, sti_end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_wide ) +{ + utu::wstring_token_iterator tit( L"\317\356\367\345\354\363 \341\373 \350 \355\345\362" ); + wchar_t const* res[4] = { L"\317\356\367\345\354\363", L"\341\373", L"\350", L"\355\345\362" }; + + BOOST_CHECK_EQUAL_COLLECTIONS( tit, wsti_end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_custom_drop_delim ) +{ + utu::string_token_iterator tit( "My:-:\t: :string, :", utu::dropped_delimeters = ":" ); + char const* res[] = { "My", "-", "\t", " ", "string", ",", " " }; + + BOOST_CHECK_EQUAL_COLLECTIONS( tit, sti_end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_custom_keep_delim ) +{ + utu::string_token_iterator tit( "abc = \t\t 123, int", utu::kept_delimeters = "=," ); + char const* res[] = { "abc", "=", "123", ",", "int" }; + + BOOST_CHECK_EQUAL_COLLECTIONS( tit, sti_end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_keep_empty_tokens ) +{ + utu::string_token_iterator tit( "fld,, 456,a==4=,", + (utu::dropped_delimeters = " ,", + utu::kept_delimeters = "=", + utu::keep_empty_tokens )); + char const* res[] = { "fld", "", "", "456", "a", "=", "", "=", "4", "=", "", "" }; + + BOOST_CHECK_EQUAL_COLLECTIONS( tit, sti_end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_max_tokens ) +{ + utu::string_token_iterator tit( "aa bb dd", utu::max_tokens = 2 ); + char const* res[] = { "aa", "bb dd" }; + + BOOST_CHECK_EQUAL_COLLECTIONS( tit, sti_end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +struct ci_comp { + bool operator()( char c1, char c2 ) + { + return (std::toupper)( c1 ) == (std::toupper)( c2 ); + } +}; + +BOOST_AUTO_TEST_CASE( test_custom_compare ) +{ + typedef utu::basic_string_token_iterator<char,ci_comp> my_token_iterator; + + my_token_iterator tit( "093514T120104", utu::dropped_delimeters = "t" ); + char const* res[] = { "093514", "120104" }; + + my_token_iterator end; + BOOST_CHECK_EQUAL_COLLECTIONS( tit, end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_range_token_iterator ) +{ + typedef utu::range_token_iterator<std::list<char>::iterator> my_token_iterator; + + std::list<char> l; + char const* pattern = "a bc , cd"; + std::copy( pattern, pattern+9, std::back_inserter( l ) ); + + my_token_iterator tit( l.begin(), l.end() ); + char const* res[] = { "a", "bc", ",", "cd" }; + + my_token_iterator end; + BOOST_CHECK_EQUAL_COLLECTIONS( tit, end, res, res + sizeof(res)/sizeof(char const*) ); +} + +//____________________________________________________________________________// + +template<typename Iter> +void moo( Iter b ) +{ + char const* res[6] = { "ABC", "SDF", " ", "SD", "FG", " " }; + + Iter end; + BOOST_CHECK_EQUAL_COLLECTIONS( b, end, res, res+sizeof(res)/sizeof(char const*) ); +} + +template<typename Iter> +void foo( Iter b, Iter e ) +{ + moo( utu::make_range_token_iterator( b, e, (utu::kept_delimeters = utu::dt_isspace, utu::dropped_delimeters = "2" )) ); +} + +inline char loo( char c ) { return (char)(std::toupper)( c ); } + +BOOST_AUTO_TEST_CASE( test_make_range_token_iterator ) +{ + char const* str = "Abc22sdf sd2fg "; + + foo( boost::make_transform_iterator( str, loo ), + boost::make_transform_iterator( str+15, loo ) ); +} + +//____________________________________________________________________________// + +#if DEBUG_ONLY + +BOOST_AUTO_TEST_CASE( test_istream_token_iterator ) +{ + typedef utu::range_token_iterator<std::istream_iterator<char> > my_token_iterator; + + std::istream_iterator<char> in_it( std::cin ); + + my_token_iterator tit( in_it, std::istream_iterator<char>(), utu::dropped_delimeters = ":" ); + + while( tit != my_token_iterator() ) { + std::cout << '<' << *tit << '>'; + ++tit; + } +} + +#endif + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/assertion-construction-test.cpp b/src/boost/libs/test/test/writing-test-ts/assertion-construction-test.cpp new file mode 100644 index 000000000..ad791aea9 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/assertion-construction-test.cpp @@ -0,0 +1,707 @@ +// (C) Copyright Gennadiy Rozental 2011-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. +// +// File : $RCSfile$ +// +// Version : $Revision: 62023 $ +// +// Description : unit test for new assertion construction based on input expression +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE Boost.Test assertion consruction test +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/assertion.hpp> +#include <boost/test/utils/is_forward_iterable.hpp> + +#include <boost/noncopyable.hpp> + +#include <map> +#include <set> + +namespace utf = boost::unit_test; + +//____________________________________________________________________________// + +#define EXPR_TYPE( expr ) ( assertion::seed() ->* expr ) + + +#if !defined(BOOST_TEST_FWD_ITERABLE_CXX03) +// some broken compilers do not implement properly decltype on expressions +// partial implementation of is_forward_iterable when decltype not available +struct not_fwd_iterable_1 { + typedef int const_iterator; + typedef int value_type; + + bool size(); +}; + +struct not_fwd_iterable_2 { + typedef int const_iterator; + typedef int value_type; + + bool begin(); +}; + +struct not_fwd_iterable_3 { + typedef int value_type; + bool begin(); + bool size(); +}; + +// this one does not have const_iterator, but should be forward iterable +struct fwd_iterable_4 { + typedef int value_type; + struct iterator { + typedef unsigned int value_type; + }; + iterator begin(); + iterator end(); + bool size(); +}; + +struct fwd_iterable_custom { + typedef std::vector<int>::const_iterator custom_iterator; // named "exotic" on purpose + + custom_iterator begin() const { return values.begin(); } + custom_iterator end() const { return values.end(); } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC_FULL_VER > 180040629) +#define MY_TEST_HAS_INIT_LIST + fwd_iterable_custom(std::initializer_list<int> ilist) : values{ilist} + {} +#else + fwd_iterable_custom(int v1, int v2, int v3) { + values.push_back(v1); + values.push_back(v2); + values.push_back(v3); + } +#endif +private: + std::vector<int> values; +}; + +BOOST_AUTO_TEST_CASE( test_forward_iterable_concept ) +{ + { + typedef std::vector<int> type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + // should also work for references, but from is_forward_iterable + typedef std::vector<int>& type; + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + + { + typedef std::list<int> type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + typedef std::map<int, int> type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + typedef std::set<int> type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + + { + typedef float type; + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(!utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + typedef not_fwd_iterable_1 type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(!utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + + + { + typedef not_fwd_iterable_2 type; + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(!utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + typedef not_fwd_iterable_3 type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(!utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + typedef fwd_iterable_4 type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + // for this one we should be able to get the size + typedef fwd_iterable_custom type; + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + +#ifdef MY_TEST_HAS_INIT_LIST + fwd_iterable_custom a{3,4,5}; +#else + fwd_iterable_custom a(3,4,5); +#endif + BOOST_TEST( utf::bt_iterator_traits<fwd_iterable_custom>::size(a) == 3 ); + } + { + typedef char type; + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(!utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + // C-tables are in the forward_iterable concept, but are not containers + typedef int type[10]; + BOOST_CHECK_MESSAGE(!utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(!utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + } + + { + // basic_cstring should be forward iterable and container + typedef boost::unit_test::basic_cstring<char> type; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(utf::is_container_forward_iterable< type >::value, "is_container_forward_iterable failed"); + + typedef boost::unit_test::basic_cstring<const char> type2; + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_size<type2>::value, "has_member_size failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_begin<type2>::value, "has_member_begin failed"); + BOOST_CHECK_MESSAGE(utf::ut_detail::has_member_end<type2>::value, "has_member_end failed"); + BOOST_CHECK_MESSAGE(utf::is_forward_iterable< type2 >::value, "is_forward_iterable failed"); + BOOST_CHECK_MESSAGE(utf::is_container_forward_iterable< type2 >::value, "is_container_forward_iterable failed"); + } +} + + +//is_container_forward_iterable_impl +#endif + +BOOST_AUTO_TEST_CASE( test_basic_value_expression_construction ) +{ + using namespace boost::test_tools; + + { + predicate_result const& res = EXPR_TYPE( 1 ).evaluate(); + BOOST_TEST( res ); + BOOST_TEST( res.message().is_empty() ); + } + + { + predicate_result const& res = EXPR_TYPE( 0 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['0' evaluates to false]" ); + } + + { + predicate_result const& res = EXPR_TYPE( true ).evaluate(); + BOOST_TEST( res ); + BOOST_TEST( res.message().is_empty() ); + } + + { + predicate_result const& res = EXPR_TYPE( 1.5 ).evaluate(); + BOOST_TEST( res ); + } + + { + predicate_result const& res = EXPR_TYPE( "abc" ).evaluate(); + BOOST_TEST( res ); + } + + { + predicate_result const& res = EXPR_TYPE( 1>2 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [1 <= 2]" ); + } + +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_comparison_expression ) +{ + using namespace boost::test_tools; + + { + predicate_result const& res = EXPR_TYPE( 1>2 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [1 <= 2]" ); + } + + { + predicate_result const& res = EXPR_TYPE( 100 < 50 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [100 >= 50]" ); + } + + { + predicate_result const& res = EXPR_TYPE( 5 <= 4 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [5 > 4]" ); + } + + { + predicate_result const& res = EXPR_TYPE( 10>=20 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [10 < 20]" ); + } + + { + int i = 10; + predicate_result const& res = EXPR_TYPE( i != 10 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [10 == 10]" ); + } + + { + int i = 5; + predicate_result const& res = EXPR_TYPE( i == 3 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [5 != 3]" ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_arithmetic_ops ) +{ + using namespace boost::test_tools; + + { + int i = 3; + int j = 5; + predicate_result const& res = EXPR_TYPE( i+j !=8 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [3 + 5 == 8]" ); + } + + { + int i = 3; + int j = 5; + predicate_result const& res = EXPR_TYPE( 2*i-j > 1 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [2 * 3 - 5 <= 1]" ); + } + + { + int j = 5; + predicate_result const& res = EXPR_TYPE( 2<<j < 30 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [2 << 5 >= 30]" ); + } + + { + int i = 2; + int j = 5; + predicate_result const& res = EXPR_TYPE( i&j ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [2 & 5]" ); + } + + { + int i = 3; + int j = 5; + predicate_result const& res = EXPR_TYPE( i^j^6 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [3 ^ 5 ^ 6]" ); + } + + // do not support + // EXPR_TYPE( 99/2 == 48 || 101/2 > 50 ); + // EXPR_TYPE( a ? 100 < 50 : 25*2 == 50 ); + // EXPR_TYPE( true,false ); +} + +//____________________________________________________________________________// + +struct Testee { + static int s_copy_counter; + + Testee() : m_value( false ) {} + Testee( Testee const& ) : m_value(false) { s_copy_counter++; } + Testee( Testee&& ) : m_value(false) {} + Testee( Testee const&& ) : m_value(false) {} + + bool foo() { return m_value; } + operator bool() const { return m_value; } + + friend std::ostream& operator<<( std::ostream& ostr, Testee const& ) { return ostr << "Testee"; } + + bool m_value; +}; + +int Testee::s_copy_counter = 0; + +Testee get_obj() { return Testee(); } +Testee const get_const_obj() { return Testee(); } + +class NC : boost::noncopyable { +public: + NC() {} + + bool operator==(NC const&) const { return false; } + friend std::ostream& operator<<(std::ostream& ostr, NC const&) + { + return ostr << "NC"; + } +}; + +BOOST_AUTO_TEST_CASE( test_objects ) +{ + using namespace boost::test_tools; + + int expected_copy_count = 0; + + { + Testee obj; + Testee::s_copy_counter = 0; + + predicate_result const& res = EXPR_TYPE( obj ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['Testee' evaluates to false]" ); + BOOST_TEST( Testee::s_copy_counter == expected_copy_count ); + } + + { + Testee const obj; + Testee::s_copy_counter = 0; + + predicate_result const& res = EXPR_TYPE( obj ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['Testee' evaluates to false]" ); + BOOST_TEST( Testee::s_copy_counter == expected_copy_count ); + } + + { + Testee::s_copy_counter = 0; + + predicate_result const& res = EXPR_TYPE( get_obj() ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['Testee' evaluates to false]" ); + BOOST_TEST( Testee::s_copy_counter == expected_copy_count ); + } + + { + Testee::s_copy_counter = 0; + + predicate_result const& res = EXPR_TYPE( get_const_obj() ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['Testee' evaluates to false]" ); + BOOST_TEST( Testee::s_copy_counter == expected_copy_count ); + } + + { + Testee::s_copy_counter = 0; + + Testee t1; + Testee t2; + + predicate_result const& res = EXPR_TYPE( t1 != t2 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [Testee == Testee]" ); + BOOST_TEST( Testee::s_copy_counter == 0 ); + } + + { + NC nc1; + NC nc2; + + predicate_result const& res = EXPR_TYPE( nc1 == nc2 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [NC != NC]" ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_pointers ) +{ + using namespace boost::test_tools; + + { + Testee* ptr = 0; + + predicate_result const& res = EXPR_TYPE( ptr ).evaluate(); + BOOST_TEST( !res ); + } + + { + Testee obj1; + Testee obj2; + + predicate_result const& res = EXPR_TYPE( &obj1 == &obj2 ).evaluate(); + BOOST_TEST( !res ); + } + + { + Testee obj; + Testee* ptr =&obj; + + predicate_result const& res = EXPR_TYPE( *ptr ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['Testee' evaluates to false]" ); + } + + { + Testee obj; + Testee* ptr =&obj; + bool Testee::* mem_ptr =&Testee::m_value; + + predicate_result const& res = EXPR_TYPE( ptr->*mem_ptr ).evaluate(); + BOOST_TEST( !res ); + } + + // do not support + // Testee obj; + // bool Testee::* mem_ptr =&Testee::m_value; + // EXPR_TYPE( obj.*mem_ptr ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_mutating_ops ) +{ + using namespace boost::test_tools; + + { + int j = 5; + + predicate_result const& res = EXPR_TYPE( j = 0 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['0' evaluates to false]" ); + BOOST_TEST( j == 0 ); + } + + { + int j = 5; + + predicate_result const& res = EXPR_TYPE( j -= 5 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['0' evaluates to false]" ); + BOOST_TEST( j == 0 ); + } + + { + int j = 5; + + predicate_result const& res = EXPR_TYPE( j *= 0 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['0' evaluates to false]" ); + BOOST_TEST( j == 0 ); + } + + { + int j = 5; + + predicate_result const& res = EXPR_TYPE( j /= 10 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['0' evaluates to false]" ); + BOOST_TEST( j == 0 ); + } + + { + int j = 4; + + predicate_result const& res = EXPR_TYPE( j %= 2 ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['0' evaluates to false]" ); + BOOST_TEST( j == 0 ); + } + + { + int j = 5; + + predicate_result const& res = EXPR_TYPE( j ^= j ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " ['0' evaluates to false]" ); + BOOST_TEST( j == 0 ); + } +} + +BOOST_AUTO_TEST_CASE( test_specialized_comparator_string ) +{ + using namespace boost::test_tools; + + { + std::string s("abc"); + + predicate_result const& res = EXPR_TYPE( s == "a" ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [abc != a]" ); + BOOST_TEST( s == "abc" ); + } + + { + predicate_result const& res = EXPR_TYPE( std::string("abc") == "a" ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [abc != a]" ); + } + + { + predicate_result const& res = EXPR_TYPE( "abc" == std::string("a") ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [abc != a]" ); + } + + { + predicate_result const& res = EXPR_TYPE( std::string("abc") == std::string("a") ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [abc != a]" ); + } +} + +BOOST_AUTO_TEST_CASE( test_comparison_with_arrays ) +{ + using namespace boost::test_tools; + + { + char c_string_array[] = "abc"; + + predicate_result const& res = EXPR_TYPE( c_string_array == "a" ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [abc != a]" ); + BOOST_TEST( c_string_array == "abc" ); + } + + { + char c_string_array[] = "abc"; + + predicate_result const& res = EXPR_TYPE( "a" == c_string_array ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [a != abc]" ); + BOOST_TEST( "abc" == c_string_array ); + } + + { + char const c_string_array[] = "abc"; + + predicate_result const& res = EXPR_TYPE( c_string_array == "a" ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [abc != a]" ); + BOOST_TEST( c_string_array == "abc" ); + } + + { + char const c_string_array[] = "abc"; + + predicate_result const& res = EXPR_TYPE( "a" == c_string_array ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == " [a != abc]" ); + BOOST_TEST( "abc" == c_string_array ); + } + + + { + long int c_long_array[] = {3,4,7}; + std::vector<long int> v_long_array(c_long_array, c_long_array + sizeof(c_long_array)/sizeof(c_long_array[0])); + std::swap(v_long_array[1], v_long_array[2]); + + predicate_result const& res = EXPR_TYPE( c_long_array == v_long_array ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == ": \n - mismatch at position 1: [4 == 7] is false\n - mismatch at position 2: [7 == 4] is false" ); + + std::swap(v_long_array[1], v_long_array[2]); + BOOST_TEST( c_long_array == v_long_array ); + } + + { + long int c_long_array[] = {3,4,7}; + + std::vector<long int> v_long_array(c_long_array, c_long_array + sizeof(c_long_array)/sizeof(c_long_array[0])); + std::swap(v_long_array[1], v_long_array[2]); + + predicate_result const& res = EXPR_TYPE( v_long_array == c_long_array ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == ": \n - mismatch at position 1: [7 == 4] is false\n - mismatch at position 2: [4 == 7] is false" ); + std::swap(v_long_array[1], v_long_array[2]); + BOOST_TEST( c_long_array == v_long_array ); + } + + { + long int const c_long_array[] = {3,4,7}; + std::vector<long int> v_long_array(c_long_array, c_long_array + sizeof(c_long_array)/sizeof(c_long_array[0])); + std::swap(v_long_array[1], v_long_array[2]); + + predicate_result const& res = EXPR_TYPE( c_long_array == v_long_array ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == ": \n - mismatch at position 1: [4 == 7] is false\n - mismatch at position 2: [7 == 4] is false" ); + + std::swap(v_long_array[1], v_long_array[2]); + BOOST_TEST( c_long_array == v_long_array ); + } + + { + long int const c_long_array[] = {3,4,7}; + + std::vector<long int> v_long_array(c_long_array, c_long_array + sizeof(c_long_array)/sizeof(c_long_array[0])); + std::swap(v_long_array[1], v_long_array[2]); + + predicate_result const& res = EXPR_TYPE( v_long_array == c_long_array ).evaluate(); + BOOST_TEST( !res ); + BOOST_TEST( res.message() == ": \n - mismatch at position 1: [7 == 4] is false\n - mismatch at position 2: [4 == 7] is false" ); + std::swap(v_long_array[1], v_long_array[2]); + BOOST_TEST( c_long_array == v_long_array ); + } + +} + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/boost_check_equal-str-test.cpp b/src/boost/libs/test/test/writing-test-ts/boost_check_equal-str-test.cpp new file mode 100644 index 000000000..16ac436f2 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/boost_check_equal-str-test.cpp @@ -0,0 +1,214 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : unit test for string comparison specializations +// ***************************************************************************** + +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/utils/is_cstring.hpp> + +BOOST_AUTO_TEST_CASE( check_is_cstring_concept ) +{ + namespace bp = boost::unit_test; + BOOST_TEST((bp::is_cstring<char const*>::value)); + BOOST_TEST((bp::is_cstring<char const []>::value)); + BOOST_TEST((bp::is_cstring<char []>::value)); + BOOST_TEST((bp::is_cstring<char *>::value)); + BOOST_TEST((!bp::is_cstring<std::string>::value)); + BOOST_TEST((!bp::is_cstring< bp::basic_cstring<char> >::value)); + + BOOST_TEST((!bp::is_cstring< std::vector<char> >::value)); +} + +#if defined(BOOST_TEST_STRING_VIEW) +BOOST_AUTO_TEST_CASE( check_is_cstring_concept_string_view ) +{ + namespace bp = boost::unit_test; + BOOST_TEST((!bp::is_cstring< std::string_view >::value)); +} +#endif + +BOOST_AUTO_TEST_CASE( check_is_cstring_comparable_concept ) +{ + namespace bp = boost::unit_test; + BOOST_TEST((bp::is_cstring_comparable<char const*>::value)); + BOOST_TEST((bp::is_cstring_comparable<char const []>::value)); + BOOST_TEST((bp::is_cstring_comparable<char []>::value)); + BOOST_TEST((bp::is_cstring_comparable<char *>::value)); + BOOST_TEST((bp::is_cstring_comparable<std::string>::value)); + BOOST_TEST((bp::is_cstring_comparable< bp::basic_cstring<char> >::value)); + + BOOST_TEST((!bp::is_cstring_comparable< std::vector<char> >::value)); +} + +#if defined(BOOST_TEST_STRING_VIEW) +BOOST_AUTO_TEST_CASE( check_is_cstring_comparable_concept_string_view ) +{ + namespace bp = boost::unit_test; + BOOST_TEST((bp::is_cstring_comparable< std::string_view >::value)); +} +#endif + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( check_string_compare ) +{ + + char const* buf_ptr_cch = "0abc"; + char const buf_array_cch[] = "1abc"; + char buf_array_ch[] = "2abc"; + char* buf_ptr_ch = buf_array_ch + 1; + std::string buf_str = "3abc"; + + buf_ptr_cch++; + buf_str = buf_str.substr(1); + + BOOST_TEST((void*)buf_ptr_cch != (void*)(buf_array_cch + 1)); + BOOST_TEST((void*)buf_ptr_cch != (void*)(buf_array_ch + 1)); + BOOST_TEST((void*)(buf_array_cch +1) != (void*)(buf_array_ch + 1)); + + BOOST_TEST(buf_ptr_cch == buf_ptr_cch); +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST(buf_ptr_cch == (buf_array_cch + 1)); + BOOST_TEST(buf_ptr_cch == (buf_array_ch + 1)); + BOOST_TEST(buf_ptr_cch == buf_ptr_ch); + BOOST_TEST(buf_ptr_cch == buf_str); +#endif + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST((buf_array_cch + 1) == buf_ptr_cch); + BOOST_TEST((buf_array_cch + 1) == (buf_array_cch + 1)); + BOOST_TEST((buf_array_cch + 1) == buf_ptr_ch); + BOOST_TEST((buf_array_cch + 1) == (buf_array_ch + 1)); + BOOST_TEST((buf_array_cch + 1) == buf_str); +#endif + + BOOST_TEST(buf_ptr_ch == buf_ptr_ch); +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST(buf_ptr_ch == buf_ptr_cch); + BOOST_TEST(buf_ptr_ch == (buf_array_cch + 1)); + BOOST_TEST(buf_ptr_ch == (buf_array_ch + 1)); + BOOST_TEST(buf_ptr_ch == buf_str); +#endif + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST((buf_array_ch + 1) == buf_ptr_cch); + BOOST_TEST((buf_array_ch + 1) == (buf_array_cch + 1)); + BOOST_TEST((buf_array_ch + 1) == buf_ptr_ch); + BOOST_TEST((buf_array_ch + 1) == (buf_array_ch + 1)); + BOOST_TEST((buf_array_ch + 1) == buf_str); +#endif + + BOOST_TEST(buf_str == buf_ptr_cch); + BOOST_TEST(buf_str == (buf_array_cch + 1)); + BOOST_TEST(buf_str == buf_ptr_ch); + BOOST_TEST(buf_str == (buf_array_ch + 1)); + BOOST_TEST(buf_str == buf_str); + + BOOST_TEST(buf_ptr_cch == buf_str); + //BOOST_TEST((buf_array_cch + 1) == buf_str); // does not compile + BOOST_TEST(buf_ptr_ch == buf_str); + //BOOST_TEST((buf_array_ch + 1) == buf_str); // does not compile + BOOST_TEST(buf_str == buf_str); + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST( buf_ptr_cch == buf_ptr_cch, boost::test_tools::per_element() ); + BOOST_TEST( buf_ptr_cch <= "abd" , boost::test_tools::per_element() ); + BOOST_TEST( buf_ptr_cch >= "aba" , boost::test_tools::per_element() ); + BOOST_TEST( buf_str == buf_ptr_cch , boost::test_tools::per_element() ); + BOOST_TEST( buf_str <= "abd" , boost::test_tools::per_element() ); + BOOST_TEST( buf_str >= "aba" , boost::test_tools::per_element() ); + + BOOST_TEST( buf_ptr_cch <= buf_ptr_cch, boost::test_tools::lexicographic() ); + BOOST_TEST( buf_ptr_cch >= buf_ptr_cch, boost::test_tools::lexicographic() ); + BOOST_TEST( buf_ptr_cch <= "abc" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_ptr_cch < "abd" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_ptr_cch < "abcd" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_ptr_cch >= "abc" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_ptr_cch > "aba" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_ptr_cch > "abad" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_str <= buf_ptr_cch , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_str >= buf_ptr_cch , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_str <= "abc" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_str < "abd" , boost::test_tools::lexicographic() ); + BOOST_TEST( buf_str > "aba" , boost::test_tools::lexicographic() ); +#endif + +} + +#if defined(BOOST_TEST_STRING_VIEW) +BOOST_AUTO_TEST_CASE( check_string_view_compare ) +{ + namespace bp = boost::unit_test; + using namespace std::literals; + + std::string str = "str"; + std::string_view sv = "sv"; + + BOOST_TEST((!bp::is_cstring< decltype(sv) >::value)); + + BOOST_TEST_CHECK(str == str); + BOOST_TEST_CHECK(sv == sv); + BOOST_TEST_CHECK(str != sv); + BOOST_TEST_CHECK(sv != str); + + // comparisons based on size + BOOST_TEST_CHECK(str >= sv); + BOOST_TEST_CHECK(sv <= str); + BOOST_TEST_CHECK(str > sv); + BOOST_TEST_CHECK(sv < str); + + BOOST_TEST_CHECK(str <= sv, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK(sv >= str, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK(str < sv, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK(sv > str, boost::test_tools::lexicographic()); + + std::string_view s1 = "this_is_string_view"sv; + BOOST_TEST(s1 == s1); + BOOST_TEST(s1 <= s1); + BOOST_TEST(s1 >= s1); + BOOST_TEST(s1 == "this_is_string_view"s); + + BOOST_TEST(s1 <= "this_is_string_view2"sv); + + // lexicographic compare + BOOST_TEST_CHECK("str" <= sv, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK(sv >= "str", boost::test_tools::lexicographic()); + BOOST_TEST_CHECK("str" < sv, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK(sv > "str", boost::test_tools::lexicographic()); + + BOOST_TEST_CHECK("str"sv <= sv, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK(sv >= "str"sv, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK("str"sv < sv, boost::test_tools::lexicographic()); + BOOST_TEST_CHECK(sv > "str"sv, boost::test_tools::lexicographic()); + + // per element, left-right operand + BOOST_TEST( "sv" <= sv , boost::test_tools::per_element() ); + BOOST_TEST( "sv" >= sv , boost::test_tools::per_element() ); + BOOST_TEST( "sv" == sv , boost::test_tools::per_element() ); + + BOOST_TEST( sv <= "sv" , boost::test_tools::per_element() ); + BOOST_TEST( sv >= "sv" , boost::test_tools::per_element() ); + BOOST_TEST( sv == "sv" , boost::test_tools::per_element() ); + + BOOST_TEST( "rv" <= sv , boost::test_tools::per_element() ); + BOOST_TEST( "tv" >= sv , boost::test_tools::per_element() ); + BOOST_TEST( "tw" != sv , boost::test_tools::per_element() ); + + BOOST_TEST( sv <= "tv" , boost::test_tools::per_element() ); + BOOST_TEST( sv >= "rv" , boost::test_tools::per_element() ); + BOOST_TEST( sv != "ru" , boost::test_tools::per_element() ); + +} +#endif + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/collection-comparison-test.cpp b/src/boost/libs/test/test/writing-test-ts/collection-comparison-test.cpp new file mode 100644 index 000000000..982f02ab6 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/collection-comparison-test.cpp @@ -0,0 +1,193 @@ +// (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. +// +/// @file +/// @brief tests collection comparison implementation +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MODULE Test collection`s comparisons +#include <boost/test/unit_test.hpp> +namespace tt = boost::test_tools; +namespace ut = boost::unit_test; + +BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(std::vector<int>) + +#define VALIDATE_OP( op ) \ +{ \ + BOOST_TEST_INFO( "validating operator " #op ); \ + bool expected = (c1 op c2); \ + auto const& res = (tt::assertion::seed()->* c1 op c2).evaluate(); \ + BOOST_TEST( expected == !!res ); \ +} \ +/**/ + +template<typename Col> +void +validate_comparisons(Col const& c1, Col const& c2 ) +{ + VALIDATE_OP( == ) + VALIDATE_OP( != ) + VALIDATE_OP( < ) + VALIDATE_OP( > ) + VALIDATE_OP( <= ) + VALIDATE_OP( >= ) +} + +BOOST_AUTO_TEST_CASE( test_against_overloaded_comp_op ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + std::vector<int> c{1, 2, 3}; + std::vector<int> d{1, 2, 3, 4}; + + BOOST_TEST_CONTEXT( "validating comparisons of a and b" ) + validate_comparisons(a, b); + BOOST_TEST_CONTEXT( "validating comparisons of a and c" ) + validate_comparisons(a, c); + BOOST_TEST_CONTEXT( "validating comparisons of a and d" ) + validate_comparisons(a, d); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_per_element_eq, * ut::expected_failures(2) ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( a == b, tt::per_element() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_per_element_ne, * ut::expected_failures(1) ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( a != b, tt::per_element() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_per_element_lt, * ut::expected_failures(2) ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( a < b, tt::per_element() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_per_element_ge, * ut::expected_failures(1) ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( b >= a, tt::per_element() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_lexicographic_lt ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( a < b, tt::lexicographic() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_lexicographic_le ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( a <= b, tt::lexicographic() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_lexicographic_gt ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( b > a, tt::lexicographic() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_lexicographic_ge ) +{ + std::vector<int> a{1, 2, 3}; + std::vector<int> b{1, 3, 2}; + + BOOST_TEST( b >= a, tt::lexicographic() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_collection_of_collection_comp ) +{ + BOOST_TEST( std::string("abc") == std::string("abc") ); +} + +//____________________________________________________________________________// + +// this one does not have const_iterator nor a size, but should be forward iterable +// and possible to use in the collection comparison +struct fwd_iterable_custom { + typedef std::vector<int>::const_iterator custom_iterator; // named "exotic" on purpose + + custom_iterator begin() const { return values.begin(); } + custom_iterator end() const { return values.end(); } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC_FULL_VER > 180040629) +#define MY_TEST_HAS_INIT_LIST + // this does not work on VC++ 2013 update 5 + fwd_iterable_custom(std::initializer_list<int> ilist) : values{ilist} + {} +#else + fwd_iterable_custom(int v1, int v2, int v3) { + values.push_back(v1); + values.push_back(v2); + values.push_back(v3); + } +#endif +private: + std::vector<int> values; +}; + +BOOST_AUTO_TEST_CASE( test_collection_requirement_type ) +{ +#ifdef MY_TEST_HAS_INIT_LIST + fwd_iterable_custom a{3,4,5}; + fwd_iterable_custom b{3,4,6}; + fwd_iterable_custom c{3,4,5}; +#else + fwd_iterable_custom a(3,4,5); + fwd_iterable_custom b(3,4,6); + fwd_iterable_custom c(3,4,5); +#endif + + BOOST_TEST( a == a, tt::per_element() ); + //BOOST_TEST( a != b, tt::per_element() ); + BOOST_TEST( a == c, tt::per_element() ); + + BOOST_TEST( a < b, tt::lexicographic() ); + BOOST_TEST( a <= c, tt::lexicographic() ); + BOOST_TEST( b > c, tt::lexicographic() ); + + BOOST_TEST( a <= b, tt::per_element() ); + BOOST_TEST( a <= c, tt::per_element() ); +} + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/dont_print_log_value-test.cpp b/src/boost/libs/test/test/writing-test-ts/dont_print_log_value-test.cpp new file mode 100644 index 000000000..0d103f9dc --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/dont_print_log_value-test.cpp @@ -0,0 +1,55 @@ +// (C) Copyright Marek Kurdej 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 +//! BOOST_TEST_DONT_PRINT_LOG_VALUE unit test +// ***************************************************************************** + +#define BOOST_TEST_MODULE BOOST_TEST_DONT_PRINT_LOG_VALUE unit test +#include <boost/test/unit_test.hpp> +#include <boost/test/data/test_case.hpp> +#include <boost/test/data/monomorphic.hpp> + +#include <vector> + +struct dummy_class { + operator bool() const { return true; } + + bool operator==(dummy_class const&) const { return true; } + bool operator!=(dummy_class const&) const { return false; } +}; + +BOOST_TEST_DONT_PRINT_LOG_VALUE(dummy_class) + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE(single_object) +{ + dummy_class actual, expected; + BOOST_TEST(actual == expected); +} + +//____________________________________________________________________________// + +// this one tests for contexts printing in dataset tests +std::vector<dummy_class> generate_vector() +{ + std::vector<dummy_class> out; + out.push_back(dummy_class()); + out.push_back(dummy_class()); + out.push_back(dummy_class()); + return out; +} + +//____________________________________________________________________________// + +BOOST_DATA_TEST_CASE( test_data_case, boost::unit_test::data::make(generate_vector())) +{ + BOOST_TEST(sample); +} + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/fp-comparisons-test.cpp b/src/boost/libs/test/test/writing-test-ts/fp-comparisons-test.cpp new file mode 100644 index 000000000..c6703420d --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/fp-comparisons-test.cpp @@ -0,0 +1,309 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests floating point comparison algorithms +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> + +// Boost +#include <boost/mpl/list.hpp> +#include <boost/bind/bind.hpp> + +// STL +#include <functional> + +using namespace boost; +using namespace boost::unit_test; +using namespace boost::test_tools; +namespace tt=boost::test_tools; + +bool not_func( bool argb ) { return !argb; } + +//____________________________________________________________________________// + +typedef boost::mpl::list<float,double,long double> test_types; + +BOOST_AUTO_TEST_CASE_TEMPLATE( test_fp_comparizon_with_percent_tolerance, FPT, test_types ) +{ +#define CHECK_CLOSE( first, second, e ) \ + fp1 = static_cast<FPT>(first); \ + fp2 = static_cast<FPT>(second); \ + epsilon = static_cast<FPT>(e); \ + \ + BOOST_TEST( fp1 == fp2, epsilon% tt::tolerance() ) \ +/**/ + +#define CHECK_NOT_CLOSE( first, second, e ) \ + fp1 = static_cast<FPT>(first); \ + fp2 = static_cast<FPT>(second); \ + epsilon = static_cast<FPT>(e); \ + \ + BOOST_TEST( fp1 != fp2, epsilon% tt::tolerance() ) \ +/**/ + + FPT fp1, fp2, epsilon; + + CHECK_CLOSE( 1, 1, 0 ); + + CHECK_CLOSE( 0, 1e-20, 1e-5 ); + CHECK_CLOSE( 0, 1e-30, 1e-5 ); + CHECK_CLOSE( 0, -1e-10, 0.1 ); + CHECK_NOT_CLOSE( 0.123456, 0.123457, 1e-4 ); + + CHECK_CLOSE( 0.123456, 0.123457, 1e-3 ); + + CHECK_NOT_CLOSE( 0.123456, -0.123457, 1e-3 ); + + CHECK_CLOSE( 1.23456e28, 1.23457e28, 1e-3 ); + + CHECK_CLOSE( 1.23456e-10, 1.23457e-10, 1e-3 ); + CHECK_NOT_CLOSE( 1.111e-10, 1.112e-10, 0.0899 ); + CHECK_CLOSE( 1.112e-10, 1.111e-10, 0.1 ); + + CHECK_CLOSE( 1, 1.0001, 1.1e-2 ); + CHECK_CLOSE( 1.0002, 1.0001, 1.1e-2 ); + + CHECK_NOT_CLOSE( 1, 1.0002, 1.1e-2 ); + +#undef CHECK_CLOSE +#undef CHECK_NOT_CLOSE +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE_TEMPLATE( test_fp_comparizon_with_fraction_tolerance, FPT, test_types ) +{ +#define CHECK_CLOSE( first, second, e ) \ + fp1 = static_cast<FPT>(first); \ + fp2 = static_cast<FPT>(second); \ + epsilon = static_cast<FPT>(e); \ + \ + BOOST_TEST( fp1 == fp2, tt::tolerance(epsilon) ); \ +/**/ + +#define CHECK_NOT_CLOSE( first, second, e ) \ + fp1 = static_cast<FPT>(first); \ + fp2 = static_cast<FPT>(second); \ + epsilon = static_cast<FPT>(e); \ + \ + BOOST_TEST( fp1 != fp2, tt::tolerance(epsilon) ); \ +/**/ + + + FPT fp1, fp2, epsilon; + + CHECK_CLOSE( 1, 1, 0 ); + + CHECK_CLOSE( 0, 1e-20, 1e-5 ); + CHECK_CLOSE( 0, 1e-30, 1e-5 ); + CHECK_CLOSE( 0, -1e-10, 0.1 ); + CHECK_NOT_CLOSE( 0.123456, 0.123457, 1e-6 ); + + CHECK_CLOSE( 0.123456, 0.123457, 1e-3 ); + + CHECK_NOT_CLOSE( 0.123456, -0.123457, 1e-3 ); + + CHECK_CLOSE( 1.23456e28, 1.23457e28, 1e-3 ); + + CHECK_CLOSE( 1.23456e-10, 1.23457e-10, 1e-3 ); + CHECK_NOT_CLOSE( 1.111e-10, 1.112e-10, 0.000899 ); + CHECK_CLOSE( 1.112e-10, 1.111e-10, 0.1 ); + + CHECK_CLOSE( 1, 1.0001, 1.1e-2 ); + CHECK_CLOSE( 1.0002, 1.0001, 1.1e-2 ); + + CHECK_NOT_CLOSE( 1, 1.0002, 1.1e-4 ); + +#undef CHECK_CLOSE +#undef CHECK_NOT_CLOSE +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_type_mismatch ) +{ + BOOST_CHECK_CLOSE_FRACTION( 2., 2.1, 0.06 ); + BOOST_CHECK_CLOSE( 2.1, 2., 6. ); + BOOST_CHECK_CLOSE( 2.1, 2.f, 6. ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_strong_weak, * expected_failures( 4 ) ) +{ + BOOST_TEST(1./3 == 1./2, tt::tolerance(1.)); + BOOST_TEST(1./3 == 1./2, tt::tolerance(0.4)); // will fail 1/2 > 0.4 + BOOST_TEST(1./3 == 1./2, tt::tolerance(1./3)); // will fail; both 1/3 and 1/2 > 1/3 + BOOST_TEST(1./3 != 1./2, tt::tolerance(1.)); // will fail; both 1/3 and 1/2 < 1 + BOOST_TEST(1./3 != 1./2, tt::tolerance(0.4)); // will fail 1/3 < 0.4 + BOOST_TEST(1./3 != 1./2, tt::tolerance(1./3)); +} + +BOOST_AUTO_TEST_CASE(test_strict_order_operations_ne, + * boost::unit_test::tolerance(0.01) + * expected_failures( 1 ) ) +{ + double x = 10.00; + double y = 10.01; // diff within tolerance + BOOST_TEST(x == y); + BOOST_TEST(x != y); // fails + BOOST_TEST(x <= y); + BOOST_TEST(x >= y); +} + +BOOST_AUTO_TEST_CASE(test_strict_order_operations_lt, + * boost::unit_test::tolerance(0.01) + * expected_failures( 3 ) ) +{ + double x = 10.00; + double y = 10.01; // diff within tolerance + BOOST_TEST(x == y); + BOOST_TEST(x != y); // fails + BOOST_TEST(x <= y); + BOOST_TEST(y <= x); + BOOST_TEST(x < y); // fails y ~= x + BOOST_TEST(y < x); // fails, y > x +} + +BOOST_AUTO_TEST_CASE(test_strict_order_operations_lt_0, + * boost::unit_test::tolerance(0.02) + * expected_failures( 3 ) ) +{ + double x = 0.00; + double y = 0.01; + BOOST_TEST(x == y); + BOOST_TEST(x != y); // fails + BOOST_TEST(x <= y); + BOOST_TEST(y <= x); + BOOST_TEST(x < y); // fails, too close to 0 + BOOST_TEST(y < x); // fails, y > x +} + +BOOST_AUTO_TEST_CASE(test_strict_order_operations_le, + * boost::unit_test::tolerance(0.01) + * expected_failures( 1 ) ) +{ + double x = 10.01; + double y = 10.00; // diff within tolerance + BOOST_TEST(x == y); + BOOST_TEST(x != y); // fails + BOOST_TEST(x <= y); +} + + +BOOST_AUTO_TEST_CASE(test_strict_order_operations_gt, + * boost::unit_test::tolerance(0.01) + * expected_failures( 3 ) ) +{ + double x = 10.00; + double y = 10.01; // diff within tolerance + BOOST_TEST(x == y); + BOOST_TEST(x != y); // fails + BOOST_TEST(x > y); // fails + BOOST_TEST(y > x); // fails +} + +BOOST_AUTO_TEST_CASE(test_strict_order_operations_ge, + * boost::unit_test::tolerance(0.01) + * expected_failures( 1 ) ) +{ + double x = 10.00; + double y = 10.01; // diff within tolerance + BOOST_TEST(x == y); + BOOST_TEST(x != y); // fails + BOOST_TEST(x >= y); + BOOST_TEST(y >= x); +} + +BOOST_AUTO_TEST_CASE(test_strict_order_operations_gt_0, + * boost::unit_test::tolerance(0.02) + * expected_failures( 3 ) ) +{ + double x = 0.00; + double y = 0.01; + BOOST_TEST(x == y); + BOOST_TEST(x != y); // fails + BOOST_TEST(x >= y); + BOOST_TEST(y >= x); + BOOST_TEST(x <= y); + BOOST_TEST(y <= x); + BOOST_TEST(x > y); // fails, too close to 0 + BOOST_TEST(y > x); // fails, too close to 0 +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_CHECK_SMALL ) +{ + BOOST_CHECK_SMALL( 1e-6, 1e-5 ); + BOOST_CHECK_SMALL( -1e-6, 1e-5 ); + + BOOST_TEST( 1e-6 != 0., 1e-7 ); +} + +//____________________________________________________________________________// + +namespace fpc = boost::math::fpc; + +BOOST_AUTO_TEST_CASE( test_close_at_tolerance ) +{ + double fp1 = 1.00000001; + double fp2 = 1.00000002; + double epsilon = 1e-6; + + ::fpc::close_at_tolerance<double> pred( ::fpc::percent_tolerance( epsilon ), ::fpc::FPC_WEAK ); + BOOST_CHECK_PREDICATE( pred, (fp1)(fp2) ); + +#ifndef BOOST_TEST_NO_OLD_TOOLS + BOOST_TEST( !check_is_close( fp1, fp2, ::fpc::percent_tolerance( epsilon ) ) ); +#endif + + fp1 = 1.23456e-10; + fp2 = 1.23457e-10; + epsilon = 8.1e-4; + + BOOST_CHECK_PREDICATE( ::fpc::close_at_tolerance<double>( ::fpc::percent_tolerance( epsilon ), ::fpc::FPC_WEAK ), (fp1)(fp2) ); + + BOOST_TEST( !::fpc::close_at_tolerance<double>( ::fpc::percent_tolerance( epsilon ) )(fp1, fp2) ); +} + + +BOOST_AUTO_TEST_CASE( test_comparison_if_one_is_FPV, * boost::unit_test::tolerance(1E-6) ) +{ + BOOST_TEST(1.000001 == 1); + BOOST_TEST(1 == 1.000001); + + BOOST_TEST(0.000001 == 0); + BOOST_TEST(0 == 0.000001); +} + +BOOST_AUTO_TEST_CASE( test_comparison_if_one_is_FPV_2 ) +{ + BOOST_TEST(1.000001 == 1, tt::tolerance(1E-6)); + BOOST_TEST(1 == 1.000001, tt::tolerance(1E-6)); + + BOOST_TEST(0.000001 == 0, tt::tolerance(1E-6)); + BOOST_TEST(0 == 0.000001, tt::tolerance(1E-6)); +} + +BOOST_AUTO_TEST_CASE( test_check_close ) +{ + // GH-162 BOOST_CHECK_CLOSE(0, smallnumber) fails + BOOST_CHECK_SMALL(-4.37113883e-08, 1.); + // does not compile with the old tools disabled + // never compiled with the old tools + //BOOST_CHECK_SMALL(-4.37113883e-08, 1); +} + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/fp-multiprecision-comparison-test.cpp b/src/boost/libs/test/test/writing-test-ts/fp-multiprecision-comparison-test.cpp new file mode 100644 index 000000000..d03863156 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/fp-multiprecision-comparison-test.cpp @@ -0,0 +1,170 @@ +// 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) + +// Copyright Paul A. Bristow 2013 +// Copyright Christopher Kormanyos 2013. +// Copyright John Maddock 2013. + +#ifdef _MSC_VER +# pragma warning (disable : 4512) +# pragma warning (disable : 4996) +#endif + +#define BOOST_TEST_MAIN +#define BOOST_LIB_DIAGNOSTIC "on"// Show library file details. + + + +//[expression_template_1 + +#include <limits> +#include <iostream> +#include <boost/multiprecision/cpp_dec_float.hpp> + +#include <boost/test/tools/floating_point_comparison.hpp> // Extra test tool for FP comparison. +#include <boost/test/unit_test.hpp> + + +typedef boost::multiprecision::number< + boost::multiprecision::cpp_dec_float<50>, + boost::multiprecision::et_off> cpp_dec_float_50_noet; + +typedef boost::multiprecision::number< + boost::multiprecision::cpp_dec_float<50>, + boost::multiprecision::et_on> cpp_dec_float_50_et; + + +// there is no need for this anymore, however this could be defined by +// the user in order to support additional types for floating point +// comparison. +#if 0 +namespace boost { namespace math { namespace fpc { + + template <class A, boost::multiprecision::expression_template_option B> + struct tolerance_based< boost::multiprecision::number< + A, + B > > : boost::mpl::true_ {}; + + template <class tag, class Arg1, class Arg2, class Arg3, class Arg4> + struct tolerance_based< + boost::multiprecision::detail::expression< + tag, Arg1, Arg2, Arg3, Arg4> > : boost::mpl::true_ {}; + +} } } +#endif + + + + + +/*`To define a 50 decimal digit type using `cpp_dec_float`, +you must pass two template parameters to `boost::multiprecision::number`. + +It may be more legible to use a two-staged type definition such as this: + +`` +typedef boost::multiprecision::cpp_dec_float<50> mp_backend; +typedef boost::multiprecision::number<mp_backend, boost::multiprecision::et_off> cpp_dec_float_50_noet; +`` + +Here, we first define `mp_backend` as `cpp_dec_float` with 50 digits. +The second step passes this backend to `boost::multiprecision::number` +with `boost::multiprecision::et_off`, an enumerated type. + + typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<50>, boost::multiprecision::et_off> + cpp_dec_float_50_noet; + +You can reduce typing with a `using` directive `using namespace boost::multiprecision;` +if desired, as shown below. +*/ + +using namespace boost::multiprecision; + +#if 0 +BOOST_AUTO_TEST_CASE(multiprecision_types_are_arithmetic) +{ + typedef number<cpp_dec_float<50>, et_off> cpp_dec_float_50_noet; + BOOST_TEST((std::numeric_limits<cpp_dec_float_50_noet>::is_specialized)); +} +#endif + + +/*`Now `cpp_dec_float_50_noet` or `cpp_dec_float_50_et` +can be used as a direct replacement for built-in types like `double` etc. +*/ + +BOOST_AUTO_TEST_CASE(cpp_float_test_check_close_noet) +{ // No expression templates/ + typedef number<cpp_dec_float<50>, et_off> cpp_dec_float_50_noet; + + std::cout.precision(std::numeric_limits<cpp_dec_float_50_noet>::digits10); // All significant digits. + std::cout << std::showpoint << std::endl; // Show trailing zeros. + + cpp_dec_float_50_noet a ("1.0"); + cpp_dec_float_50_noet b ("1.0"); + b += std::numeric_limits<cpp_dec_float_50_noet>::epsilon(); // Increment least significant decimal digit. + + cpp_dec_float_50_noet eps = std::numeric_limits<cpp_dec_float_50_noet>::epsilon(); + + std::cout <<"a = " << a << ",\nb = " << b << ",\neps = " << eps << std::endl; + + BOOST_CHECK_CLOSE(a, b, eps * 100); // Expected to pass (because tolerance is as percent). + BOOST_CHECK_CLOSE_FRACTION(a, b, eps); // Expected to pass (because tolerance is as fraction). + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + namespace tt = boost::test_tools; + BOOST_TEST( a == b, tt::tolerance( tt::fpc::percent_tolerance( eps * 100 ) ) ); + BOOST_TEST( a == b, tt::tolerance( eps ) ); +#endif + +//] [/expression_template_1]git + +} // BOOST_AUTO_TEST_CASE(cpp_float_test_check_close) + +BOOST_AUTO_TEST_CASE(cpp_float_test_check_close_et) +{ // Using expression templates. + typedef number<cpp_dec_float<50>, et_on> cpp_dec_float_50_et; + + std::cout.precision(std::numeric_limits<cpp_dec_float_50_et>::digits10); // All significant digits. + std::cout << std::showpoint << std::endl; // Show trailing zeros. + + cpp_dec_float_50_et a("1.0"); + cpp_dec_float_50_et b("1.0"); + b += std::numeric_limits<cpp_dec_float_50_et>::epsilon(); // Increment least significant decimal digit. + + cpp_dec_float_50_et eps = std::numeric_limits<cpp_dec_float_50_et>::epsilon(); + + std::cout << "a = " << a << ",\nb = " << b << ",\neps = " << eps << std::endl; + + BOOST_CHECK_CLOSE(a, b, eps * 100); // Expected to pass (because tolerance is as percent). + BOOST_CHECK_CLOSE_FRACTION(a, b, eps); // Expected to pass (because tolerance is as fraction). + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + namespace tt = boost::test_tools; + BOOST_TEST( a == b, tt::tolerance( tt::fpc::percent_tolerance<cpp_dec_float_50_et>( eps * 100 ) ) ); + BOOST_TEST( a == b, tt::tolerance( eps ) ); +#endif + /*`Using `cpp_dec_float_50` with the default expression template use switched on, + the compiler error message for `BOOST_CHECK_CLOSE_FRACTION(a, b, eps); would be: + */ + // failure floating_point_comparison.hpp(59): error C2440: 'static_cast' : + // cannot convert from 'int' to 'boost::multiprecision::detail::expression<tag,Arg1,Arg2,Arg3,Arg4>' + //] [/expression_template_1] + +} // BOOST_AUTO_TEST_CASE(cpp_float_test_check_close) + +/* + +Output: + + Description: Autorun "J:\Cpp\big_number\Debug\test_cpp_float_close_fraction.exe" + Running 1 test case... + + a = 1.0000000000000000000000000000000000000000000000000, + b = 1.0000000000000000000000000000000000000000000000001, + eps = 1.0000000000000000000000000000000000000000000000000e-49 + + *** No errors detected + +*/ diff --git a/src/boost/libs/test/test/writing-test-ts/fp-no-comparison-for-incomplete-types-test.cpp b/src/boost/libs/test/test/writing-test-ts/fp-no-comparison-for-incomplete-types-test.cpp new file mode 100644 index 000000000..21ef7d02e --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/fp-no-comparison-for-incomplete-types-test.cpp @@ -0,0 +1,42 @@ +// (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. + +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> + +// https://github.com/boostorg/test/issues/209 +// no floating point comparison for abstract types. +struct abstract +{ + virtual ~abstract() = 0; + bool operator==(const abstract &) const { return true; } +}; + +std::ostream &operator<<(std::ostream &ostr, const abstract &) { + return ostr << "compared"; +} + +// the test is checking the compilation of the following snippet +void foo(abstract &a) +{ + // pre-C++11 compilers use a copy of the arguments in the + // expansion of the BOOST_TEST macro +#if !defined(BOOST_TEST_MACRO_LIMITED_SUPPORT) + BOOST_TEST(a == a); + BOOST_TEST_CHECK(a == a); + BOOST_TEST_REQUIRE(a == a); + BOOST_TEST_WARN(a == a); +#endif + BOOST_CHECK_EQUAL(a, a); +} + +// we need at least one test +BOOST_AUTO_TEST_CASE(dummy) +{ + const int x = 1; + BOOST_TEST(x == 1); +} diff --git a/src/boost/libs/test/test/writing-test-ts/fp-relational-operator.cpp b/src/boost/libs/test/test/writing-test-ts/fp-relational-operator.cpp new file mode 100644 index 000000000..f9eea65c5 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/fp-relational-operator.cpp @@ -0,0 +1,198 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 ticket #13011 + +#define BOOST_TEST_MODULE fp_check_relational_op +#include <boost/test/unit_test.hpp> +namespace utf = boost::unit_test; +namespace tt = boost::test_tools; + +// +// with zeros +// + +BOOST_AUTO_TEST_CASE(EQ_zero_on_left, * utf::expected_failures(2)) +{ + BOOST_TEST(0.0 == 1.0); + BOOST_TEST(0.0 == 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(NE_zero_on_left) +{ + BOOST_TEST(0.0 != 1.0); + BOOST_TEST(0.0 != 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(EQ_zero_on_right, * utf::expected_failures(2)) +{ + BOOST_TEST(1.0 == 0.0); + BOOST_TEST(1.0 == 0.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(NE_zero_on_right) +{ + BOOST_TEST(1.0 != 0.0); + BOOST_TEST(1.0 != 0.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(EQ_zero_on_left_right) +{ + BOOST_TEST(0.0 == 0.0); + BOOST_TEST(0.0 == 0.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(NE_zero_on_left_right, * utf::expected_failures(2)) +{ + BOOST_TEST(0.0 != 0.0); + BOOST_TEST(0.0 != 0.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(LT_zero_on_left) +{ + BOOST_TEST(0.0 < 1.0); + BOOST_TEST(0.0 < 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GT_zero_on_left, * utf::expected_failures(2) ) +{ + BOOST_TEST(0.0 > 1.0); + BOOST_TEST(0.0 > 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GT_zero_on_right) +{ + BOOST_TEST(1.0 > 0.0); + BOOST_TEST(1.0 > 0.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(LT_zero_on_right, * utf::expected_failures(2) ) +{ + BOOST_TEST(1.0 < 0.0); + BOOST_TEST(1.0 < 0.0, tt::tolerance(0.001)); +} + +// with equality + +BOOST_AUTO_TEST_CASE(LE_zero_on_left) +{ + BOOST_TEST(0.0 <= 1.0); + BOOST_TEST(0.0 <= 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GE_zero_on_left, * utf::expected_failures(2) ) +{ + BOOST_TEST(0.0 >= 1.0); + BOOST_TEST(0.0 >= 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GE_zero_on_right) +{ + BOOST_TEST(1.0 >= 0.0); + BOOST_TEST(1.0 >= 0.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(LE_zero_on_right, * utf::expected_failures(2) ) +{ + BOOST_TEST(1.0 <= 0.0); + BOOST_TEST(1.0 <= 0.0, tt::tolerance(0.001)); +} + +// +// with numbers +// + +BOOST_AUTO_TEST_CASE(LT_smaller_on_left) +{ + BOOST_TEST(1.0 < 2.0); + BOOST_TEST(1.0 < 2.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GT_smaller_on_left, * utf::expected_failures(2) ) +{ + BOOST_TEST(1.0 > 2.0); + BOOST_TEST(1.0 > 2.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GT_smaller_on_right) +{ + BOOST_TEST(2.0 > 1.0); + BOOST_TEST(2.0 > 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(LT_smaller_on_right, * utf::expected_failures(2) ) +{ + BOOST_TEST(2.0 < 1.0); + BOOST_TEST(2.0 < 1.0, tt::tolerance(0.001)); +} + +// with equality + +BOOST_AUTO_TEST_CASE(LE_smaller_on_left) +{ + BOOST_TEST(1.0 <= 2.0); + BOOST_TEST(1.0 <= 2.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GE_smaller_on_left, * utf::expected_failures(2) ) +{ + BOOST_TEST(1.0 >= 2.0); + BOOST_TEST(1.0 >= 2.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(GE_smaller_on_right) +{ + BOOST_TEST(2.0 >= 1.0); + BOOST_TEST(2.0 >= 1.0, tt::tolerance(0.001)); +} + +BOOST_AUTO_TEST_CASE(LE_smaller_on_right, * utf::expected_failures(2) ) +{ + BOOST_TEST(2.0 <= 1.0); + BOOST_TEST(2.0 <= 1.0, tt::tolerance(0.001)); +} + +// infinity +BOOST_AUTO_TEST_CASE(infinity_comparison) +{ + //BOOST_TEST(2.0 <= 1.0); + BOOST_TEST(0 < std::numeric_limits<float>::infinity()); + BOOST_TEST(std::numeric_limits<float>::infinity() == std::numeric_limits<float>::infinity()); + BOOST_TEST(std::numeric_limits<float>::infinity() >= std::numeric_limits<float>::infinity()); + //BOOST_TEST(2.0 <= 1.0); + + float a = std::numeric_limits<float>::infinity(); + BOOST_TEST(a == std::numeric_limits<float>::infinity()); + BOOST_TEST(std::numeric_limits<float>::infinity() == a); + + float b = a; + BOOST_TEST(b == a); + BOOST_TEST(a == b); +} + +BOOST_AUTO_TEST_CASE(infinity_comparison_with_tolerance, + *utf::tolerance<float>(boost::math::fpc::percent_tolerance<float>(0.01)) +) { + BOOST_TEST(0 < std::numeric_limits<float>::infinity()); + BOOST_TEST(std::numeric_limits<float>::infinity() == std::numeric_limits<float>::infinity()); + BOOST_TEST(std::numeric_limits<float>::infinity() >= std::numeric_limits<float>::infinity()); + + float a = std::numeric_limits<float>::infinity(); + BOOST_TEST(a == std::numeric_limits<float>::infinity()); + BOOST_TEST(std::numeric_limits<float>::infinity() == a); + + float b = a; + BOOST_TEST(b == a); + BOOST_TEST(a == b); + BOOST_TEST((b == a)); + BOOST_TEST((a == b)); + + BOOST_TEST(-a <= b); + BOOST_TEST(-a < b); + + BOOST_TEST(a == b, tt::tolerance(0.f)); + BOOST_TEST(a == b, tt::tolerance(10.f)); + BOOST_TEST(a == b, tt::tolerance(1E10f)); +} diff --git a/src/boost/libs/test/test/writing-test-ts/nullptr-support-test.cpp b/src/boost/libs/test/test/writing-test-ts/nullptr-support-test.cpp new file mode 100644 index 000000000..0d94b463b --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/nullptr-support-test.cpp @@ -0,0 +1,21 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 nullptr_support +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(test1) +{ + int *p = nullptr; + BOOST_TEST(p == nullptr); +} + +BOOST_AUTO_TEST_CASE(test2) +{ + int *p = nullptr; + BOOST_CHECK_EQUAL(p, nullptr); +} diff --git a/src/boost/libs/test/test/writing-test-ts/output_test_stream-test.cpp b/src/boost/libs/test/test/writing-test-ts/output_test_stream-test.cpp new file mode 100644 index 000000000..734d36725 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/output_test_stream-test.cpp @@ -0,0 +1,191 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests output_test_stream test tool functionality +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/output_test_stream.hpp> +using boost::test_tools::output_test_stream; + +// STL +#include <iomanip> + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_constructor ) +{ + { + output_test_stream output; + BOOST_TEST( !output.match_pattern() ); + BOOST_TEST( output.is_empty() ); + } + { + output_test_stream output( (char const*)0 ); + BOOST_TEST( !output.match_pattern() ); + BOOST_TEST( output.is_empty() ); + } + { + output_test_stream output( "" ); + BOOST_TEST( !output.match_pattern() ); + BOOST_TEST( output.is_empty() ); + } + { + output_test_stream output( "%&^$%&$%" ); + BOOST_TEST( !output.match_pattern() ); + BOOST_TEST( output.is_empty() ); + } + { + output_test_stream output( "pattern.temp" ); + BOOST_TEST( !output.match_pattern() ); + BOOST_TEST( output.is_empty() ); + } + { + output_test_stream output( "pattern.temp2", false ); + BOOST_TEST( output.match_pattern() ); + BOOST_TEST( output.is_empty() ); + } + { + output_test_stream output( "pattern.temp2" ); + BOOST_TEST( output.match_pattern() ); + BOOST_TEST( output.is_empty() ); + } +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_is_empty ) +{ + output_test_stream output; + BOOST_TEST( output.is_empty() ); + + output << 12345; + BOOST_TEST( !output.is_empty() ); + BOOST_TEST( output.is_empty() ); + + output << ""; + BOOST_TEST( output.is_empty() ); + + output << '\0'; + BOOST_TEST( !output.is_empty( false ) ); + BOOST_TEST( !output.is_empty() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_check_length ) +{ + output_test_stream output; + BOOST_TEST( output.check_length( 0 ) ); + + output << ""; + BOOST_TEST( output.check_length( 0 ) ); + + output << '\0'; + BOOST_TEST( output.check_length( 1 ) ); + + output << 1220; + BOOST_TEST( output.check_length( 4 ) ); + + output << "Text message"; + BOOST_TEST( output.check_length( 12, false ) ); + BOOST_TEST( output.check_length( 12 ) ); + + output.width( 20 ); + output << "Text message"; + BOOST_TEST( output.check_length( 20 ) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_is_equal ) +{ + output_test_stream output; + BOOST_TEST( output.is_equal( "" ) ); + + output << 1; + BOOST_TEST( output.is_equal( "1" ) ); + + output << ""; + BOOST_TEST( output.is_equal( "" ) ); + + output << '\0'; + BOOST_TEST( output.is_equal( boost::unit_test::const_string( "", 1 ) ) ); + + output << std::setw( 10 ) << "qwerty" << '\n'; + BOOST_TEST( output.is_equal( " qwerty\n" ) ); + + std::string s( "test string" ); + + output << s << std::endl; + BOOST_TEST( output.is_equal( "test string\n", false ) ); + + output << s << std::endl; + BOOST_TEST( output.is_equal( "test string\ntest string\n" ) ); + + char const* literal_string = "asdfghjkl"; + std::string substr1( literal_string, 5 ); + std::string substr2( literal_string+5, 4 ); + + output << substr1; + BOOST_TEST( output.is_equal( boost::unit_test::const_string( literal_string, 5 ), false ) ); + + output << substr2; + BOOST_TEST( output.is_equal( boost::unit_test::const_string( literal_string, 9 ) ) ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_match_pattern ) +{ + for( int i1 = 0; i1 < 2; i1++ ) { + output_test_stream output( "pattern.test", i1 == 1 ); + + output << "text1\n"; + BOOST_TEST( output.match_pattern() ); + output << "text2\n"; + BOOST_TEST( output.match_pattern() ); + output << "text3\n"; + BOOST_TEST( output.match_pattern() ); + } + + { + output_test_stream output( "pattern.test" ); + + output << "text4\n"; + BOOST_TEST( !output.match_pattern() ); + output << "text2\n"; + BOOST_TEST( output.match_pattern() ); + output << "text3\n"; + BOOST_TEST( output.match_pattern() ); + } + { + output_test_stream output( "pattern.test" ); + + output << "text\n"; + BOOST_TEST( !output.match_pattern() ); + output << "text2\n"; + BOOST_TEST( !output.match_pattern() ); + output << "text3\n"; + BOOST_TEST( !output.match_pattern() ); + } + + for( int i2 = 0; i2 < 2; i2++ ) { + output_test_stream output( "pattern.test", i2 == 1, false ); + + output << "text\rmore text\n"; + BOOST_TEST( output.match_pattern() ); + } +} + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/test-dataset-over-tuples.cpp b/src/boost/libs/test/test/writing-test-ts/test-dataset-over-tuples.cpp new file mode 100644 index 000000000..50a46a5d9 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-dataset-over-tuples.cpp @@ -0,0 +1,30 @@ +// (C) Copyright Tony Lewis 2016. +// 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. +// +// Description : checks that datasets over tuples are supported +// see issue https://svn.boost.org/trac/boost/ticket/12241 +// *************************************************************************** + +#define BOOST_TEST_MODULE boost_test_tuple_prob + +#include <boost/test/unit_test.hpp> +#include <boost/test/data/test_case.hpp> +#include <boost/test/data/monomorphic.hpp> + +#include <tuple> +#include <vector> +#include <iostream> + +const std::vector< std::tuple<int, int>> values = { + std::tuple<int, int>{ 1, 11 }, + std::tuple<int, int>{ 2, 12 }, + std::tuple<int, int>{ 3, 13 }, +}; + +BOOST_DATA_TEST_CASE( test1, boost::unit_test::data::make( values ), var1, var2 ) { + std::cout << var1 << ", " << var2 << "\n"; +} diff --git a/src/boost/libs/test/test/writing-test-ts/test-fixture-detect-setup-teardown-cpp11.cpp b/src/boost/libs/test/test/writing-test-ts/test-fixture-detect-setup-teardown-cpp11.cpp new file mode 100644 index 000000000..9c5f7b529 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-fixture-detect-setup-teardown-cpp11.cpp @@ -0,0 +1,68 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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. + +// checks issue https://svn.boost.org/trac/boost/ticket/5563 in particular +// the ability of the framework to detect new fixture signatures. + +#define BOOST_TEST_MODULE test_fixture_detect_setup_teardown_cpp11 +#include <boost/test/unit_test.hpp> +#include <iostream> +#include <boost/test/unit_test_suite.hpp> +#include <boost/test/framework.hpp> + +using namespace boost::unit_test; + +class fixture_without { +public: + fixture_without() {} + ~fixture_without() {} +}; + +class fixture_with { +public: + fixture_with() {} + void setup() {} + void teardown() {} + ~fixture_with() {} +}; + +class fixture_with_child : public fixture_with { +public: + fixture_with_child() {} + ~fixture_with_child() {} +}; + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect ) +{ + BOOST_CHECK(!impl_fixture::has_setup<fixture_without>::value); + BOOST_CHECK(!impl_fixture::has_setup<fixture_without>::value); + + fixture_without obj; + setup_conditional(obj); + teardown_conditional(obj); +} + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect_both ) +{ + BOOST_CHECK(impl_fixture::has_setup<fixture_with>::value); + BOOST_CHECK(impl_fixture::has_setup<fixture_with>::value); + + fixture_with obj; + setup_conditional(obj); + teardown_conditional(obj); +} + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect_both_from_child ) +{ + // should detect this with the C++11/declspec approach + BOOST_CHECK(impl_fixture::has_setup<fixture_with_child>::value); + BOOST_CHECK(impl_fixture::has_setup<fixture_with_child>::value); + + fixture_with_child obj; + setup_conditional(obj); + teardown_conditional(obj); +} diff --git a/src/boost/libs/test/test/writing-test-ts/test-fixture-detect-setup-teardown.cpp b/src/boost/libs/test/test/writing-test-ts/test-fixture-detect-setup-teardown.cpp new file mode 100644 index 000000000..d475cb27d --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-fixture-detect-setup-teardown.cpp @@ -0,0 +1,72 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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. + +// checks issue https://svn.boost.org/trac/boost/ticket/5563 in particular +// the ability of the framework to detect new fixture signatures. + +#define BOOST_TEST_MODULE test_fixture_detect_setup_teardown +#include <boost/test/unit_test.hpp> +#include <iostream> +#include <boost/test/unit_test_suite.hpp> +#include <boost/test/framework.hpp> + +using namespace boost::unit_test; + +class fixture_without { +public: + fixture_without() {} + ~fixture_without() {} +}; + +class fixture_with { +public: + fixture_with() {} + void setup() {} + void teardown() {} + ~fixture_with() {} +}; + +class fixture_with_child : public fixture_with { +public: + fixture_with_child() {} + ~fixture_with_child() {} +}; + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect ) +{ + BOOST_CHECK(!impl_fixture::has_setup<fixture_without>::value); + BOOST_CHECK(!impl_fixture::has_setup<fixture_without>::value); + + fixture_without obj; + setup_conditional(obj); + teardown_conditional(obj); +} + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect_both ) +{ + BOOST_CHECK(impl_fixture::has_setup<fixture_with>::value); + BOOST_CHECK(impl_fixture::has_setup<fixture_with>::value); + + fixture_with obj; + setup_conditional(obj); + teardown_conditional(obj); +} + +#if defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect_both_from_child ) +{ + // cannot detect this with the C++03 approach + BOOST_CHECK(!impl_fixture::has_setup<fixture_with_child>::value); + BOOST_CHECK(!impl_fixture::has_setup<fixture_with_child>::value); + + fixture_with_child obj; + setup_conditional(obj); + teardown_conditional(obj); +} + +#endif diff --git a/src/boost/libs/test/test/writing-test-ts/test-timeout-fail.cpp b/src/boost/libs/test/test/writing-test-ts/test-timeout-fail.cpp new file mode 100644 index 000000000..e1dea8d2f --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-timeout-fail.cpp @@ -0,0 +1,19 @@ +// (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. + +#define BOOST_TEST_MODULE timeout-error +#include <boost/test/unit_test.hpp> +#include <chrono> +#include <thread> + +namespace utf = boost::unit_test; + +BOOST_AUTO_TEST_CASE(test_fail, * utf::timeout(1)) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(2000)); + BOOST_TEST(true); +} diff --git a/src/boost/libs/test/test/writing-test-ts/test-timeout-suite-fail.cpp b/src/boost/libs/test/test/writing-test-ts/test-timeout-suite-fail.cpp new file mode 100644 index 000000000..5339026c8 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-timeout-suite-fail.cpp @@ -0,0 +1,42 @@ +// (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. + +#define BOOST_TEST_MODULE timeout-error-suite +#include <boost/test/unit_test.hpp> +#include <boost/test/data/test_case.hpp> +#include <chrono> +#include <thread> + +namespace utf = boost::unit_test; + +// each of the test case of the data set has a timeout of 1 sec +// some of them will fail +BOOST_TEST_DECORATOR(* utf::timeout(1)) +BOOST_DATA_TEST_CASE(test_success, utf::data::make({0,1,2,3})) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(100*5*sample)); + BOOST_TEST(sample >= 0); +} + +// the full test suite has a timeout of 1s, some of the data test +// cases will not be executed +BOOST_TEST_DECORATOR(* utf::timeout(1)) + +BOOST_AUTO_TEST_SUITE(test_suite_timeout) +BOOST_DATA_TEST_CASE(test_success, utf::data::make({0,1,2,3,4,5,6,7,8})) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(300)); + BOOST_TEST((sample >= 0 && sample < 5)); +} + + +BOOST_AUTO_TEST_CASE(failure_should_not_be_executed) +{ + BOOST_TEST(false); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/boost/libs/test/test/writing-test-ts/test-timeout-suite.cpp b/src/boost/libs/test/test/writing-test-ts/test-timeout-suite.cpp new file mode 100644 index 000000000..2c3431c0d --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-timeout-suite.cpp @@ -0,0 +1,33 @@ +// (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. + +#define BOOST_TEST_MODULE timeout-error-suite +#include <boost/test/unit_test.hpp> +#include <boost/test/data/test_case.hpp> +#include <chrono> +#include <thread> + +namespace utf = boost::unit_test; + +// each of the test case of the data set has a timeout of 1 sec +BOOST_TEST_DECORATOR(* utf::timeout(1)) +BOOST_DATA_TEST_CASE(test_success, utf::data::make({0,1,2,3})) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + BOOST_TEST(sample >= 0); +} + +// the full test suite has a timeout of 1s +BOOST_TEST_DECORATOR(* utf::timeout(1)) + +BOOST_AUTO_TEST_SUITE(test_suite_success) +BOOST_DATA_TEST_CASE(test_success, utf::data::make({0,1,2,3,4,5,6,7})) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + BOOST_TEST(sample >= 0); +} +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/boost/libs/test/test/writing-test-ts/test-timeout.cpp b/src/boost/libs/test/test/writing-test-ts/test-timeout.cpp new file mode 100644 index 000000000..7beb54a4b --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-timeout.cpp @@ -0,0 +1,25 @@ +// (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. + +#define BOOST_TEST_MODULE timeout-error +#include <boost/test/unit_test.hpp> +#include <chrono> +#include <thread> + +namespace utf = boost::unit_test; + +BOOST_AUTO_TEST_CASE(test1, * utf::timeout(1)) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + BOOST_TEST(true); +} + +BOOST_AUTO_TEST_CASE(test2, * utf::timeout(3)) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + BOOST_TEST(true); +} diff --git a/src/boost/libs/test/test/writing-test-ts/test-with-precondition.cpp b/src/boost/libs/test/test/writing-test-ts/test-with-precondition.cpp new file mode 100644 index 000000000..f1d3ee4dd --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test-with-precondition.cpp @@ -0,0 +1,46 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 +//! checking the preconditions and dependencies +// ***************************************************************************** + +#define BOOST_TEST_MODULE test_preconditions +#include <boost/test/unit_test.hpp> + +bool returning_false() { + return false; +} + +BOOST_AUTO_TEST_CASE(not_running, + *boost::unit_test::precondition([](boost::unit_test::test_unit_id){ + return returning_false(); + } + )) +{ + BOOST_TEST(true); +} +BOOST_AUTO_TEST_CASE(success) +{ + BOOST_TEST(true); +} + +BOOST_AUTO_TEST_SUITE(s1) + BOOST_AUTO_TEST_CASE(test1) + { + BOOST_TEST(true); + } + BOOST_AUTO_TEST_CASE(test2, * boost::unit_test::depends_on("not_running") ) + { + BOOST_TEST(false); + } +BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_CASE(test5, * boost::unit_test::depends_on("s1")) +{ + BOOST_TEST(true); +} diff --git a/src/boost/libs/test/test/writing-test-ts/test_tools-test.cpp b/src/boost/libs/test/test/writing-test-ts/test_tools-test.cpp new file mode 100644 index 000000000..6a6052673 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/test_tools-test.cpp @@ -0,0 +1,1046 @@ +// (C) Copyright Gennadiy Rozental 2001-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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : tests all Test Tools but output_test_stream +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test_log.hpp> +#include <boost/test/tools/output_test_stream.hpp> +#include <boost/test/execution_monitor.hpp> +#include <boost/test/unit_test_parameters.hpp> +#include <boost/test/output/compiler_log_formatter.hpp> +#include <boost/test/framework.hpp> +#include <boost/core/noncopyable.hpp> +#include <boost/test/detail/suppress_warnings.hpp> + +// Boost +#include <boost/bind/bind.hpp> +#include <boost/noncopyable.hpp> + +// STL +#include <iostream> +#include <iomanip> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4702) // unreachable code +#endif + +#include "../framework-ts/logger-for-tests.hpp" + +namespace ut=boost::unit_test; +namespace tt=boost::test_tools; + +// GH-179 char can be unsigned on some archs +namespace boost{ namespace test_tools{ namespace tt_detail{ +template<> +struct print_log_value<signed char> { +void operator()( std::ostream& ostr, signed char t ) +{ + ostr << std::hex + #if BOOST_TEST_USE_STD_LOCALE + << std::showbase + #else + << "0x" + #endif + << static_cast<int>(t); +} +}; +}}} + +//____________________________________________________________________________// + +#define CHECK_CRITICAL_TOOL_USAGE( tool_usage ) \ +{ \ + bool throw_ = false; \ + try { \ + tool_usage; \ + } catch( boost::execution_aborted const& ) { \ + throw_ = true; \ + } \ + \ + BOOST_CHECK_MESSAGE( throw_, "not aborted" ); \ +} \ +/**/ + +//____________________________________________________________________________// + +// thanks to http://stackoverflow.com/questions/9226400/portable-printing-of-exponent-of-a-double-to-c-iostreams +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1900) +struct ScientificNotationExponentOutputNormalizer { + ScientificNotationExponentOutputNormalizer() : m_old_format(_set_output_format(_TWO_DIGIT_EXPONENT)) {} + + ~ScientificNotationExponentOutputNormalizer() { _set_output_format(m_old_format); } +private: + unsigned m_old_format; +}; +#else +struct ScientificNotationExponentOutputNormalizer {}; +#endif + +//____________________________________________________________________________// + +class bool_convertible +{ + struct Tester {}; +public: + operator Tester*() const { return static_cast<Tester*>( 0 ) + 1; } +}; + +//____________________________________________________________________________// + +struct shorten_lf : public boost::unit_test::output::compiler_log_formatter +{ + void print_prefix( std::ostream& output, boost::unit_test::const_string, std::size_t line ) + { + } +}; + +//____________________________________________________________________________// + +std::string match_file_name( "./baseline-outputs/test_tools-test.pattern" ); +std::string save_file_name( "test_tools-test.pattern" ); + +static tt::output_test_stream& +ots() +{ + static boost::shared_ptr<tt::output_test_stream> inst; + + if( !inst ) { + inst.reset( + ut::framework::master_test_suite().argc <= 1 + ? new tt::output_test_stream( ut::runtime_config::save_pattern() ? save_file_name : match_file_name, !ut::runtime_config::save_pattern() ) + : new tt::output_test_stream( ut::framework::master_test_suite().argv[1], !ut::runtime_config::save_pattern() ) ); + } + + return *inst; +} + +//____________________________________________________________________________// + +#define TEST_CASE( name ) \ +static void name ## _impl(); \ +static void name ## _impl_defer(); \ + \ +BOOST_AUTO_TEST_CASE( name ) \ +{ \ + ut::test_case* impl = ut::make_test_case(&name ## _impl, \ + #name, \ + __FILE__, \ + __LINE__ ); \ + impl->p_default_status.value = ut::test_unit::RS_ENABLED; \ + \ + /* to detect for issues concerning the file pattern, we take + the stream now */ \ + tt::output_test_stream& stream = ots(); \ + \ + { \ + ut::log_level ll = ut::runtime_config::get<ut::log_level>( \ + ut::runtime_config::btrt_log_level ); \ + ut::unit_test_log.set_formatter( new shorten_lf ); \ + log_setup_teardown holder(stream, \ + OF_CUSTOM_LOGGER, \ + ut::log_nothing, \ + ll != ut::invalid_log_level ? \ + ll \ + : ut::log_all_errors ); \ + \ + ut::framework::finalize_setup_phase( impl->p_id ); \ + ut::framework::run( impl ); \ + \ + } \ + \ + BOOST_CHECK( stream.match_pattern() ); \ +} \ + \ +void name ## _impl() \ +{ \ + ut::unit_test_log.set_threshold_level( ut::log_all_errors ); \ + \ + name ## _impl_defer(); \ + \ + ut::unit_test_log.set_threshold_level( ut::log_nothing ); \ +} \ + \ +void name ## _impl_defer() \ +/**/ + +#line 162 +// should be line 162 _______________________________________________________// + +TEST_CASE( test_BOOST_WARN ) +{ + ut::unit_test_log.set_threshold_level( ut::log_warnings ); + BOOST_WARN( sizeof(int) == sizeof(short) ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + BOOST_WARN( sizeof(unsigned char) == sizeof(char) ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK ) +{ + // check correct behavior in if clause + if( true ) + BOOST_CHECK( true ); + + // check correct behavior in else clause + if( false ) + {} + else + BOOST_CHECK( true ); + + bool_convertible bc; + BOOST_CHECK( bc ); + + int i=2; + + BOOST_CHECK( false ); + BOOST_CHECK( 1==2 ); + BOOST_CHECK( i==1 ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + BOOST_CHECK( i==2 ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_REQUIRE ) +{ + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( true ) ); + + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( false ) ); + + int j = 3; + + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( j > 5 ) ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( j < 5 ) ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_WARN_MESSAGE ) +{ + BOOST_WARN_MESSAGE( sizeof(int) == sizeof(short), "memory won't be used efficiently" ); + int obj_size = 33; + + BOOST_WARN_MESSAGE( obj_size <= 8, + "object size " << obj_size << " is too big to be efficiently passed by value" ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + BOOST_WARN_MESSAGE( obj_size > 8, "object size " << obj_size << " is too small" ); +} + +//____________________________________________________________________________// + +boost::test_tools::predicate_result +test_pred1() +{ + boost::test_tools::predicate_result res( false ); + + res.message() << "Some explanation"; + + return res; +} + +TEST_CASE( test_BOOST_CHECK_MESSAGE ) +{ + BOOST_CHECK_MESSAGE( 2+2 == 5, "Well, may be that what I believe in" ); + + BOOST_CHECK_MESSAGE( test_pred1(), "Checking predicate failed" ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + BOOST_CHECK_MESSAGE( 2+2 == 4, "Could it fail?" ); + + int i = 1; + int j = 2; + std::string msg = "some explanation"; + BOOST_CHECK_MESSAGE( i > j, "Comparing " << i << " and " << j << ": " << msg ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_REQUIRE_MESSAGE ) +{ + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_MESSAGE( false, "Here we should stop" ) ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_MESSAGE( true, "That's OK" ) ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_ERROR ) +{ + BOOST_ERROR( "Fail to miss an error" ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_FAIL ) +{ + CHECK_CRITICAL_TOOL_USAGE( BOOST_FAIL( "No! No! Show must go on." ) ); +} + +//____________________________________________________________________________// + +struct my_exception { + explicit my_exception( int ec = 0 ) : m_error_code( ec ) {} + + int m_error_code; +}; + +bool is_critical( my_exception const& ex ) { return ex.m_error_code < 0; } + +TEST_CASE( test_BOOST_CHECK_THROW ) +{ + int i=0; + BOOST_CHECK_THROW( i++, my_exception ); + + ut::unit_test_log.set_threshold_level( ut::log_warnings ); + BOOST_WARN_THROW( i++, my_exception ); + + ut::unit_test_log.set_threshold_level( ut::log_all_errors ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_THROW( i++, my_exception ) ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + if( i/10 > 10 ) + {} + else + BOOST_CHECK_THROW( throw my_exception(), my_exception ); // unreachable code warning is expected +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK_EXCEPTION ) +{ + BOOST_CHECK_EXCEPTION( throw my_exception( 1 ), my_exception, is_critical ); // unreachable code warning is expected + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + BOOST_CHECK_EXCEPTION( throw my_exception( -1 ), my_exception, is_critical ); // unreachable code warning is expected +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK_NO_THROW ) +{ + int i=0; + if( i*10 == 0 ) + BOOST_CHECK_NO_THROW( i++ ); + else {} + + BOOST_CHECK_NO_THROW( throw my_exception() ); // unreachable code warning is expected +} + +//____________________________________________________________________________// + +struct B { + B( int i ) : m_i( i ) {} + + int m_i; +}; + +bool operator==( B const& b1, B const& b2 ) { return b1.m_i == b2.m_i; } +std::ostream& operator<<( std::ostream& str, B const& b ) { return str << "B(" << b.m_i << ")"; } + +//____________________________________________________________________________// + +struct C { + C( int i, int id ) : m_i( i ), m_id( id ) {} + + int m_i; + int m_id; +}; + +boost::test_tools::predicate_result +operator==( C const& c1, C const& c2 ) +{ + boost::test_tools::predicate_result res( c1.m_i == c2.m_i && c1.m_id == c2.m_id ); + + if( !res ) { + if( c1.m_i != c2.m_i ) + res.message() << "Index mismatch"; + else + res.message() << "Id mismatch"; + } + + return res; +} + +std::ostream& operator<<( std::ostream& str, C const& c ) { return str << "C(" << c.m_i << ',' << c.m_id << ")"; } + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK_EQUAL ) +{ + int i=1; + int j=2; + BOOST_CHECK_EQUAL( i, j ); + BOOST_CHECK_EQUAL( ++i, j ); + BOOST_CHECK_EQUAL( i++, j ); + + char const* str1 = "test1"; + char const* str2 = "test12"; + BOOST_CHECK_EQUAL( str1, str2 ); + + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + BOOST_CHECK_EQUAL( i+1, j ); + + char const* str3 = "1test1"; + BOOST_CHECK_EQUAL( str1, str3+1 ); + + ut::unit_test_log.set_threshold_level( ut::log_all_errors ); + str1 = NULL; + str2 = NULL; + BOOST_CHECK_EQUAL( str1, str2 ); + + str1 = "test"; + str2 = NULL; + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_EQUAL( str1, str2 ) ); + + B b1(1); + B b2(2); + + ut::unit_test_log.set_threshold_level( ut::log_warnings ); + BOOST_WARN_EQUAL( b1, b2 ); + + ut::unit_test_log.set_threshold_level( ( ut::log_all_errors ) ); + C c1( 0, 100 ); + C c2( 0, 101 ); + C c3( 1, 102 ); + BOOST_CHECK_EQUAL( c1, c3 ); + BOOST_CHECK_EQUAL( c1, c2 ); + + signed char ch1 = -2; // char is unsigned on some archs GH-179 + signed char ch2 = -3; + BOOST_CHECK_EQUAL(ch1, ch2); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK_LOGICAL_EXPR ) +{ + int i=1; + int j=2; + BOOST_CHECK_NE( i, j ); + + BOOST_CHECK_NE( ++i, j ); + + BOOST_CHECK_LT( i, j ); + BOOST_CHECK_GT( i, j ); + + BOOST_CHECK_LE( i, j ); + BOOST_CHECK_GE( i, j ); + + ++i; + + BOOST_CHECK_LE( i, j ); + BOOST_CHECK_GE( j, i ); + + char const* str1 = "test1"; + char const* str2 = "test1"; + + BOOST_CHECK_NE( str1, str2 ); +} + +//____________________________________________________________________________// + +bool is_even( int i ) { return i%2 == 0; } +int foo( int arg, int mod ) { return arg % mod; } +bool moo( int arg1, int arg2, int mod ) { return ((arg1+arg2) % mod) == 0; } + +BOOST_TEST_DONT_PRINT_LOG_VALUE( std::list<int> ) + +boost::test_tools::assertion_result +compare_lists( std::list<int> const& l1, std::list<int> const& l2 ) +{ + if( l1.size() != l2.size() ) { + boost::test_tools::predicate_result res( false ); + + res.message() << "Different sizes [" << l1.size() << "!=" << l2.size() << "]"; + + return res; + } + + return true; +} + +TEST_CASE( test_BOOST_CHECK_PREDICATE ) +{ + BOOST_CHECK_PREDICATE( is_even, (14) ); + + int i = 17; + BOOST_CHECK_PREDICATE( is_even, (i) ); + + using std::not_equal_to; + BOOST_CHECK_PREDICATE( not_equal_to<int>(), (i)(17) ); + + using namespace boost::placeholders; + int j=15; + BOOST_CHECK_PREDICATE( boost::bind( is_even, boost::bind( &foo, _1, _2 ) ), (i)(j) ); + + ut::unit_test_log.set_threshold_level( ut::log_warnings ); + BOOST_WARN_PREDICATE( moo, (12)(i)(j) ); + + ut::unit_test_log.set_threshold_level( ( ut::log_all_errors ) ); + std::list<int> l1, l2, l3; + l1.push_back( 1 ); + l3.push_back( 1 ); + l1.push_back( 2 ); + l3.push_back( 3 ); + BOOST_CHECK_PREDICATE( compare_lists, (l1)(l2) ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_REQUIRE_PREDICATE ) +{ + int arg1 = 1; + int arg2 = 2; + + using std::less_equal; + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_PREDICATE( less_equal<int>(), (arg1)(arg2) ) ); + + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_PREDICATE( less_equal<int>(), (arg2)(arg1) ) ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK_EQUAL_COLLECTIONS ) +{ + ut::unit_test_log.set_threshold_level( ( ut::log_all_errors ) ); + + int pattern [] = { 1, 2, 3, 4, 5, 6, 7 }; + + std::list<int> testlist; + + testlist.push_back( 1 ); + testlist.push_back( 2 ); + testlist.push_back( 4 ); // 3 + testlist.push_back( 4 ); + testlist.push_back( 5 ); + testlist.push_back( 7 ); // 6 + testlist.push_back( 7 ); + + BOOST_CHECK_EQUAL_COLLECTIONS( testlist.begin(), testlist.end(), pattern, pattern+7 ); + BOOST_CHECK_EQUAL_COLLECTIONS( testlist.begin(), testlist.end(), pattern, pattern+2 ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK_BITWISE_EQUAL ) +{ + BOOST_CHECK_BITWISE_EQUAL( 0x16, 0x16 ); + + BOOST_CHECK_BITWISE_EQUAL( (char)0x06, (char)0x16 ); + + ut::unit_test_log.set_threshold_level( ut::log_warnings ); + BOOST_WARN_BITWISE_EQUAL( (char)0x26, (char)0x04 ); + + ut::unit_test_log.set_threshold_level( ( ut::log_all_errors ) ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_BITWISE_EQUAL( (char)0x26, (int)0x26 ) ); +} + +//____________________________________________________________________________// + +struct A { + friend std::ostream& operator<<( std::ostream& str, A const& ) { str << "struct A"; return str;} +}; + +TEST_CASE( test_BOOST_TEST_MESSAGE ) +{ + ut::unit_test_log.set_threshold_level( ut::log_messages ); + + BOOST_TEST_MESSAGE( "still testing" ); + BOOST_TEST_MESSAGE( "1+1=" << 2 ); + + int i = 2; + BOOST_TEST_MESSAGE( i << "+" << i << "=" << (i+i) ); + + A a = A(); + BOOST_TEST_MESSAGE( a ); + +#if BOOST_TEST_USE_STD_LOCALE + BOOST_TEST_MESSAGE( std::hex << std::showbase << 20 ); +#else + BOOST_TEST_MESSAGE( "0x14" ); +#endif + + BOOST_TEST_MESSAGE( std::setw( 4 ) << 20 ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_TEST_CHECKPOINT ) +{ + BOOST_TEST_CHECKPOINT( "Going to do a silly things" ); + + throw "some error"; +} + +//____________________________________________________________________________// + +bool foo() { throw 1; return true; } + +TEST_CASE( test_BOOST_TEST_PASSPOINT ) +{ + BOOST_CHECK( foo() ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_BOOST_IS_DEFINED ) +{ +#define SYMBOL1 +#define SYMBOL2 std::cout +#define ONE_ARG( arg ) arg +#define TWO_ARG( arg1, arg2 ) BOOST_JOIN( arg1, arg2 ) + + BOOST_CHECK( BOOST_IS_DEFINED(SYMBOL1) ); + BOOST_CHECK( BOOST_IS_DEFINED(SYMBOL2) ); + BOOST_CHECK( !BOOST_IS_DEFINED( SYMBOL3 ) ); + BOOST_CHECK( BOOST_IS_DEFINED( ONE_ARG(arg1) ) ); + BOOST_CHECK( !BOOST_IS_DEFINED( ONE_ARG1(arg1) ) ); + BOOST_CHECK( BOOST_IS_DEFINED( TWO_ARG(arg1,arg2) ) ); + BOOST_CHECK( !BOOST_IS_DEFINED( TWO_ARG1(arg1,arg2) ) ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_context_logging ) +{ + BOOST_TEST_INFO( "some context" ); + BOOST_CHECK( false ); + + int i = 12; + BOOST_TEST_INFO( "some more context: " << i ); + BOOST_CHECK( false ); + + BOOST_TEST_INFO( "info 1" ); + BOOST_TEST_INFO( "info 2" ); + BOOST_TEST_INFO( "info 3" ); + BOOST_CHECK( false ); + + BOOST_TEST_CONTEXT( "some sticky context" ) { + BOOST_CHECK( false ); + + BOOST_TEST_INFO( "more context" ); + BOOST_CHECK( false ); + + BOOST_TEST_INFO( "different subcontext" ); + BOOST_CHECK( false ); + } + + BOOST_TEST_CONTEXT( "outer context" ) { + BOOST_CHECK( false ); + + BOOST_TEST_CONTEXT( "inner context" ) { + BOOST_CHECK( false ); + } + + BOOST_CHECK( false ); + } +} + +//____________________________________________________________________________// + +class FooType { +public: + FooType& operator*() { return *this; } + operator bool() const { return false; } + int operator&() { return 10; } +}; + +TEST_CASE( test_BOOST_TEST_basic_arithmetic_op ) +{ + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); + + BOOST_TEST( true ); + BOOST_TEST( false ); + + bool_convertible bc; + BOOST_TEST( bc ); + + int i = 1; + + BOOST_TEST( i == 2 ); + BOOST_TEST( i != 1 ); + BOOST_TEST( i > 2 ); + BOOST_TEST( i < 1 ); + BOOST_TEST( i <= 0 ); + BOOST_TEST( i >= 5 ); + + int j = 2; + BOOST_TEST( i+j >= 5 ); + BOOST_TEST( j-i == 2 ); + + int* p = &i; + BOOST_TEST( *p == 2 ); + + BOOST_TEST( j-*p == 0 ); + + FooType F; + + BOOST_TEST( FooType() ); + BOOST_TEST( *F ); + BOOST_TEST( **F ); + BOOST_TEST( ***F ); + BOOST_TEST( &F > 100 ); + BOOST_TEST( &*F > 100 ); + + BOOST_TEST( (i == 1) & (j == 1) ); + BOOST_TEST( (i == 2) | (j == 1) ); + + BOOST_TEST(( i == 1 && j == 1 )); + BOOST_TEST(( i == 2 || j == 1 )); + + // check correct behavior in if clause + if( true ) + BOOST_TEST( true ); + + // check correct behavior in else clause + if( false ) + {} + else + BOOST_TEST( true ); + + BOOST_TEST( i+j==15, "This message reported instead including " << i << " and " << j ); + + // Does not work + // BOOST_TEST( i == 1 && j == 1 ); + // BOOST_TEST( i == 2 || j == 1 ); + // BOOST_TEST( i > 5 ? false : true ); +} + +BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(std::vector<int>) + +TEST_CASE( test_BOOST_TEST_collection_comp ) +{ + std::vector<int> v; + v.push_back( 1 ); + v.push_back( 2 ); + v.push_back( 3 ); + + std::vector<int> v2 = v; + + std::vector<int> l; + l.push_back( 1 ); + l.push_back( 3 ); + l.push_back( 2 ); + + BOOST_TEST( v == l ); + BOOST_TEST( v != v2 ); + BOOST_TEST( v < l ); + BOOST_TEST( v > l ); + + BOOST_TEST( v <= l ); + BOOST_TEST( v >= l ); +} + +//____________________________________________________________________________// + +namespace boost{ namespace test_tools{ namespace tt_detail{ +template<> +struct print_log_value<double> { + void operator()( std::ostream& os, double d ) + { + std::streamsize curr_prec = os.precision(); + os << std::setprecision(3) << d << std::setprecision( curr_prec ); + } +}; +}}} + +TEST_CASE( test_BOOST_TEST_fpv_comp ) +{ + ScientificNotationExponentOutputNormalizer norm; + boost::ignore_unused( norm ); + + double d1 = 1.1e-5; + double d2 = 1.101e-5; + float f1 = 1.1e-5f; + + BOOST_TEST( tt::fpc_tolerance<double>() == 0 ); + BOOST_TEST( d1 == d2 ); + BOOST_TEST( tt::fpc_tolerance<double>() == 0 ); + BOOST_TEST( d1 == d2, tt::tolerance( 1e-7 ) ); + BOOST_TEST( tt::fpc_tolerance<double>() == 0 ); + BOOST_TEST( d1 != f1, tt::tolerance( 1e-7 ) ); + BOOST_TEST( tt::fpc_tolerance<double>() == 0 ); + BOOST_TEST( tt::fpc_tolerance<float>() == 0 ); + + BOOST_TEST( d1 > d2 ); + BOOST_TEST( d1+1./1e20 > d2, 1e-5% tt::tolerance() ); + BOOST_TEST( tt::fpc_tolerance<double>() == 0 ); + BOOST_TEST( d2 <= d1, tt::tolerance( tt::fpc::percent_tolerance( 1e-5 ) ) ); + BOOST_TEST( tt::fpc_tolerance<double>() == 0 ); + + BOOST_TEST( d1-1e-5 == 0., tt::tolerance( 1e-7 ) ); + BOOST_TEST( d1-1e-5 != 0., tt::tolerance( 1e-4 ) ); + BOOST_TEST( 0. != 1e-5-d1, tt::tolerance( 1e-4 ) ); + BOOST_TEST( d2-1e-5 < 0., tt::tolerance( 1e-6 ) ); + + const double cd = 1.0; + BOOST_TEST( cd == 1.0); + BOOST_TEST( 1.0 == cd ); + BOOST_TEST( cd == 1.01, 10.% tt::tolerance()); + BOOST_TEST( 1.01 == cd, 0.1% tt::tolerance() ); + + BOOST_TEST( 0.0 == 0.0); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_TEST_cstring_comp ) +{ + char const* str1 = "test1"; + char const* str2 = "test12"; + std::string str3 = "test2"; + char str4[] = "test3"; + char const* str5 = NULL; + char const* str6 = "1test1"; + + BOOST_TEST( str1 == str2 ); + BOOST_TEST( str1 == str3 ); + BOOST_TEST( str3 == str2 ); + BOOST_TEST( str1 == str4 ); + BOOST_TEST( str3 == str4 ); + BOOST_TEST( str1 == str5 ); + + BOOST_TEST( str1 != (str6+1) ); + BOOST_TEST( str5 != str5 ); + + BOOST_TEST( str3 < str1 ); + BOOST_TEST( str1 >= str2 ); +} + +//____________________________________________________________________________// + +TEST_CASE( string_comparison_per_element ) +{ + using namespace boost::test_tools; + + std::string s1 = "asdfhjk"; + std::string s2 = "asdfgjk"; + + BOOST_TEST( s1 == s2, tt::per_element() ); + + std::string s3 = "hello world"; + std::string s4 = "helko worlt"; + + BOOST_TEST( s3 == s4, tt::per_element() ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_TEST_bitwise ) +{ + int a = 0xAB; + int b = 0x88; + short c = 0x8A; + // decltype is needed for this to work. Not the case for eg. MSVC 2008. + BOOST_TEST( a == b, tt::bitwise() ); + BOOST_TEST( c == b, tt::bitwise() ); +} + +//____________________________________________________________________________// + +int goo() +{ + static int i = 0; + return i++; +} + +struct copy_counter : boost::noncopyable { + static int s_value; + + copy_counter() {} + copy_counter( copy_counter const& ) { s_value++; } + copy_counter( copy_counter&& ) {} +}; + +int copy_counter::s_value = 0; + +bool operator==( copy_counter const&, copy_counter const& ) { return true; } +std::ostream& operator<<( std::ostream& os, copy_counter const& ) { return os << "copy_counter"; } + +BOOST_AUTO_TEST_CASE( test_argument_handling ) +{ + BOOST_TEST( goo() == 0 ); + BOOST_TEST( goo() == 1 ); + BOOST_TEST( 2 == goo() ); + BOOST_TEST( 3 == goo() ); + BOOST_TEST( goo() != 5 ); + BOOST_TEST( copy_counter() == copy_counter() ); + BOOST_TEST( copy_counter::s_value == 0 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test_precision_mutation, * ut::expected_failures( 1 ) ) +{ + std::streamsize initial_precition = std::cout.precision(); + std::cout.precision(initial_precition); + + BOOST_TEST( 1.2 == 2.3, 10.% tt::tolerance() ); + + BOOST_TEST( initial_precition == std::cout.precision() ); +} + +//____________________________________________________________________________// + +// addresses issue #11887 +#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && \ + !defined(BOOST_NO_CXX11_LAMBDAS) && \ + !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ + !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && \ + !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) + +struct rv_erasure_test { + rv_erasure_test() : value( 1 ) {} + ~rv_erasure_test() { value = 0; } + + int value; +}; + +BOOST_AUTO_TEST_CASE( test_rvalue_erasure ) +{ + auto erase_rv = []( rv_erasure_test const& arg ) -> rv_erasure_test const& { return arg; }; + + BOOST_TEST( 1 == erase_rv( rv_erasure_test{} ).value ); +} + +#endif + + +TEST_CASE( test_BOOST_TEST_fpv_comp_on_collections ) +{ + ScientificNotationExponentOutputNormalizer norm; + boost::ignore_unused( norm ); + + using namespace boost::test_tools; + ut::unit_test_log.set_threshold_level( ut::log_successful_tests ); // we log everything + + double d1 = 1.1e-5; + double d2 = 1.11e-5; + float f1 = 1.1e-5f; + + std::vector<double> v1(3, d1), v2(3, d2), v3(3, d2); + std::vector<float> v1f(3, static_cast<float>(d1)), v2f(3, static_cast<float>(d2)); + + BOOST_TEST( d1 == d2, tt::tolerance( 1e-3 ) ); + BOOST_TEST( d1 == d2, tt::tolerance( 1e-2 ) ); + BOOST_TEST( v1 == v2, tt::tolerance( 1e-3 ) ); + + // tolerance and per element + BOOST_TEST( v1 == v2, tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1f == v2f, tt::tolerance( 1e-3 ) << tt::per_element() ); // tolerance is on double, does not apply to vectors. + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1 < v2, tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-2 ) << tt::per_element() ); // high tolerance + BOOST_TEST( v1 < v2, tt::tolerance( 1e-2 ) << tt::per_element() ); + BOOST_TEST( v1f < v2f, tt::tolerance( 1e-2 ) << tt::per_element() ); // not float tolerance + + // tolerance and custom message + BOOST_TEST( v1 == v2, tt::tolerance( 1e-3 ) << "'custom error message v1 == v2 tolerance<double> ' " << v1[0] << " != " << v2[0] ); + BOOST_TEST( v1f == v2f, tt::tolerance( 1e-3 ) << "'custom error message v1f == v2f tolerance<double> ' " << v1f[0] << " != " << v2f[0]); + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-3 ) << "'custom error message v1 <= v2 tolerance<double> ' " << v1[0] << " > " << v2[0] ); + BOOST_TEST( v1 < v2, tt::tolerance( 1e-3 ) << "'custom error message v1 < v2 tolerance<double> ' " << v1[0] << " >= " << v2[0] ); + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-3 ) << "'custom error message v1 <= v2 high_tolerance<double> ' " << v1[0] << " > " << v2[0] ); + BOOST_TEST( v1 < v2, tt::tolerance( 1e-2 ) << "'custom error message v1 < v2 high_tolerance<double> ' " << v1[0] << " >= " << v2[0] ); + BOOST_TEST( v1f < v2f, tt::tolerance( 1e-2 ) << "'custom error message v1f < v2f high_tolerance<double> ' " << v1f[0] << " >= " << v2f[0]); // not float tolerance + + // tolerance, custom message and per element + BOOST_TEST( v1 == v2, tt::tolerance( 1e-3 ) << "'custom error message v1 == v2 tolerance<double> ' " << v1[0] << " != " << v2[0] << tt::per_element() ); + BOOST_TEST( v1f == v2f, tt::tolerance( 1e-3 ) << "'custom error message v1f == v2f tolerance<double> ' " << v1f[0] << " != " << v2f[0] << tt::per_element() ); + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-3 ) << "'custom error message v1 <= v2 tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::per_element() ); + BOOST_TEST( v1 < v2, tt::tolerance( 1e-3 ) << "'custom error message v1 < v2 tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::per_element() ); + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-3 ) << "'custom error message v1 <= v2 high_tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::per_element() ); + BOOST_TEST( v1 < v2, tt::tolerance( 1e-2 ) << "'custom error message v1 < v2 high_tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::per_element() ); + BOOST_TEST( v1f < v2f, tt::tolerance( 1e-2 ) << "'custom error message v1f < v2f high_tolerance<double> ' " << v1f[0] << " >= " << v2f[0] << tt::per_element() ); // not float tolerance + + // swapping tolerance and custom message + BOOST_TEST( v1 == v2, "'custom error message v1 == v2 tolerance<double> ' " << v1[0] << " != " << v2[0] << tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1f == v2f, "'custom error message v1f == v2f tolerance<double> ' " << v1f[0] << " != " << v2f[0] << tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1 <= v2, "'custom error message v1 <= v2 tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1 < v2, "'custom error message v1 < v2 tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1 <= v2, "'custom error message v1 <= v2 high_tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::tolerance( 1e-3 ) << tt::per_element() ); + BOOST_TEST( v1 < v2, "'custom error message v1 < v2 high_tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::tolerance( 1e-2 ) << tt::per_element() ); + BOOST_TEST( v1f < v2f, "'custom error message v1f < v2f high_tolerance<double> ' " << v1f[0] << " >= " << v2f[0] << tt::tolerance( 1e-2 ) << tt::per_element() ); // not float tolerance + + // custom message and per_element + BOOST_TEST( v1 == v2, "'custom error message v1 == v2 ' " << v1[0] << " != " << v2[0] << tt::per_element() ); + BOOST_TEST( v1f == v2f, "'custom error message v1f == v2f ' " << v1f[0] << " != " << v2f[0] << tt::per_element() ); + BOOST_TEST( v1 <= v2, "'custom error message v1 <= v2 ' " << v1[0] << " > " << v2[0] << tt::per_element() ); + BOOST_TEST( v1 < v2, "'custom error message v1 < v2 ' " << v1[0] << " >= " << v2[0] << tt::per_element() ); + BOOST_TEST( v1f < v2f, "'custom error message v1f < v2f ' " << v1f[0] << " >= " << v2f[0] << tt::per_element() ); // not float tolerance + + // tolerance and lexicographic + // BOOST_TEST( v1 == v2, tt::tolerance( 1e-3 ) << tt::lexicographic()); + // BOOST_TEST( v1f == v2f, tt::tolerance( 1e-3 ) << tt::lexicographic()); // tolerance is on double, does not apply to vectors. + v3[1] = d1; + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v1 < v2, tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v2 <= v3, tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v2 < v3, tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v3 <= v2, tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v3 < v2, tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-2 ) << tt::lexicographic() ); // high tolerance + BOOST_TEST( v1 < v2, tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v2 <= v3, tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v2 < v3, tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v3 <= v2, tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v3 < v2, tt::tolerance( 1e-2 ) << tt::lexicographic() ); + + // custom and lexico + BOOST_TEST( v1 <= v2, "'custom error message v1 <= v2 ' " << v1[0] << " != " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v1 < v2, "'custom error message v1 < v2 ' " << v1f[0] << " != " << v2f[0] << tt::lexicographic() ); + BOOST_TEST( v2 <= v3, "'custom error message v2 <= v3 ' " << v1[0] << " > " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v2 < v3, "'custom error message v2 < v3 ' " << v1[0] << " >= " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v3 <= v2, "'custom error message v3 <= v2 ' " << v1[0] << " > " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v3 < v2, "'custom error message v3 < v2 ' " << v1[0] << " >= " << v2[0] << tt::lexicographic() ); + + // custom, tolerance and lexico + BOOST_TEST( v1 <= v2, "'custom error message v1 <= v2 tolerance<double> ' " << v1[0] << " != " << v2[0] << tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v1 < v2, "'custom error message v1 < v2 tolerance<double> ' " << v1f[0] << " != " << v2f[0] << tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v2 <= v3, "'custom error message v2 <= v3 tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v2 < v3, "'custom error message v2 < v3 tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v3 <= v2, "'custom error message v3 <= v2 tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v3 < v2, "'custom error message v3 < v2 tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::tolerance( 1e-3 ) << tt::lexicographic() ); + BOOST_TEST( v1 <= v2, "'custom error message v1 <= v2 high_tolerance<double> ' " << v1[0] << " != " << v2[0] << tt::tolerance( 1e-2 ) << tt::lexicographic() ); // high tolerance + BOOST_TEST( v1 < v2, "'custom error message v1 < v2 high_tolerance<double> ' " << v1f[0] << " != " << v2f[0] << tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v2 <= v3, "'custom error message v2 <= v3 high_tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v2 < v3, "'custom error message v2 < v3 high_tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v3 <= v2, "'custom error message v3 <= v2 high_tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::tolerance( 1e-2 ) << tt::lexicographic() ); + BOOST_TEST( v3 < v2, "'custom error message v3 < v2 high_tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::tolerance( 1e-2 ) << tt::lexicographic() ); + + // swapping custom and tolerance + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-3 ) << "'custom error message v1 <= v2 tolerance<double> ' " << v1[0] << " != " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v1 < v2, tt::tolerance( 1e-3 ) << "'custom error message v1 < v2 tolerance<double> ' " << v1f[0] << " != " << v2f[0] << tt::lexicographic() ); + BOOST_TEST( v2 <= v3, tt::tolerance( 1e-3 ) << "'custom error message v2 <= v3 tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v2 < v3, tt::tolerance( 1e-3 ) << "'custom error message v2 < v3 tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v3 <= v2, tt::tolerance( 1e-3 ) << "'custom error message v3 <= v2 tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v3 < v2, tt::tolerance( 1e-3 ) << "'custom error message v3 < v2 tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v1 <= v2, tt::tolerance( 1e-2 ) << "'custom error message v1 <= v2 high_tolerance<double> ' " << v1[0] << " != " << v2[0] << tt::lexicographic() ); // high tolerance + BOOST_TEST( v1 < v2, tt::tolerance( 1e-2 ) << "'custom error message v1 < v2 high_tolerance<double> ' " << v1f[0] << " != " << v2f[0] << tt::lexicographic() ); + BOOST_TEST( v2 <= v3, tt::tolerance( 1e-2 ) << "'custom error message v2 <= v3 high_tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v2 < v3, tt::tolerance( 1e-2 ) << "'custom error message v2 < v3 high_tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v3 <= v2, tt::tolerance( 1e-2 ) << "'custom error message v3 <= v2 high_tolerance<double> ' " << v1[0] << " > " << v2[0] << tt::lexicographic() ); + BOOST_TEST( v3 < v2, tt::tolerance( 1e-2 ) << "'custom error message v3 < v2 high_tolerance<double> ' " << v1[0] << " >= " << v2[0] << tt::lexicographic() ); +} + + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/tools-debuggable-test.cpp b/src/boost/libs/test/test/writing-test-ts/tools-debuggable-test.cpp new file mode 100644 index 000000000..43185ec5d --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/tools-debuggable-test.cpp @@ -0,0 +1,43 @@ +// (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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : testing BOOST_TEST_UNDER_DEBUGGER compilation and operation +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_TOOLS_DEBUGGABLE +#define BOOST_TEST_MODULE tools under debugger test +#include <boost/test/unit_test.hpp> + +//____________________________________________________________________________// + +static int +foo( int arg ) +{ + if( arg == 0 ) + throw std::runtime_error("Oops"); + + return arg * arg; +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 2; + BOOST_TEST( foo(i)+1 == 5 ); + + BOOST_TEST( foo(i)+1 == 5, "My message" ); + + BOOST_CHECK_THROW( foo(0), std::runtime_error ); +} + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/tools-under-debugger-test.cpp b/src/boost/libs/test/test/writing-test-ts/tools-under-debugger-test.cpp new file mode 100644 index 000000000..e41f5a69a --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/tools-under-debugger-test.cpp @@ -0,0 +1,58 @@ +// (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. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : testing BOOST_TEST_UNDER_DEBUGGER compilation and operation +// *************************************************************************** + +// Boost.Test +#define BOOST_TEST_TOOLS_UNDER_DEBUGGER +#define BOOST_TEST_MODULE tools under debugger test +#include <boost/test/unit_test.hpp> + +// STL +#include <exception> + +//____________________________________________________________________________// + +static int +foo( int arg ) +{ + if( arg == 0 ) + throw std::runtime_error("Oops"); + + return arg * arg; +} + +//____________________________________________________________________________// + +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT +BOOST_AUTO_TEST_CASE( test ) +{ + int i = 2; + BOOST_TEST( foo(i)+1 == 5 ); + + BOOST_TEST( foo(i)+1 == 5, "My message" ); + + BOOST_CHECK_THROW( foo(0), std::runtime_error ); +} +#endif + +BOOST_AUTO_TEST_CASE( test2 ) +{ + int i = 2; + BOOST_CHECK( foo(i)+1 == 5 ); + + BOOST_CHECK_MESSAGE( foo(i)+1 == 5, "My message" ); + + BOOST_CHECK_THROW( foo(0), std::runtime_error ); +} + +// EOF diff --git a/src/boost/libs/test/test/writing-test-ts/user-defined-types-logging-customization-points.cpp b/src/boost/libs/test/test/writing-test-ts/user-defined-types-logging-customization-points.cpp new file mode 100644 index 000000000..102068438 --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/user-defined-types-logging-customization-points.cpp @@ -0,0 +1,56 @@ +// (C) Copyright Raffi Enficiaud 2017. +// 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 +//! Customization point for printing user defined types +// ***************************************************************************** + +#define BOOST_TEST_MODULE user type logger customization points +#include <boost/test/unit_test.hpp> + +namespace printing_test { +struct user_defined_type { + int value; + + user_defined_type(int value_) : value(value_) + {} + + bool operator==(int right) const { + return right == value; + } +}; + +std::ostream& boost_test_print_type(std::ostream& ostr, user_defined_type const& right) { + ostr << "** value of my type is " << right.value << " **"; + return ostr; +} +} + +//using namespace printing_test; + +BOOST_AUTO_TEST_CASE(test1) +{ + //using printing_test::user_defined_type; + printing_test::user_defined_type t(10); + BOOST_CHECK_EQUAL(t, 10); +#ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT + BOOST_TEST(t == 10); +#endif +} + +// on unary expressions as well +struct s { + operator bool() const { return true; } +}; +std::ostream &boost_test_print_type(std::ostream &o, const s &) { + return o << "printed-s"; +} + +BOOST_AUTO_TEST_CASE( test_logs ) +{ + BOOST_TEST(s()); +} diff --git a/src/boost/libs/test/test/writing-test-ts/windows-headers-test.cpp b/src/boost/libs/test/test/writing-test-ts/windows-headers-test.cpp new file mode 100644 index 000000000..bc893e4ed --- /dev/null +++ b/src/boost/libs/test/test/writing-test-ts/windows-headers-test.cpp @@ -0,0 +1,32 @@ +// (C) Copyright Raffi Enficiaud 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. +// +// Tests some compilation troubleshooting issues with the windows headers (eg min/max macros) +// *************************************************************************** + +#define BOOST_TEST_MODULE test_windows_headers + +#include <boost/config.hpp> +#ifdef BOOST_WINDOWS +#include <windows.h> +#endif + +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/floating_point_comparison.hpp> // Extra test tool for FP comparison. + +BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test, 2 ) + +BOOST_AUTO_TEST_CASE( test ) +{ + // produces an error + BOOST_TEST(1 == 0); + + // this is added in order to compile floating point relative code as well + // which might have trouble compiling if system headers are included (as for + // boost.thread, eg. for std::min). + BOOST_CHECK_CLOSE(1.1, 1.2, 1e-5); +} diff --git a/src/boost/libs/test/tools/console_test_runner/Jamfile.v2 b/src/boost/libs/test/tools/console_test_runner/Jamfile.v2 new file mode 100644 index 000000000..c95e71811 --- /dev/null +++ b/src/boost/libs/test/tools/console_test_runner/Jamfile.v2 @@ -0,0 +1,38 @@ +# (C) Copyright Gennadiy Rozental 2008-2014. +# 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. + +# Project +project libs/test/tools/console_test_runner ; + +alias unit_test_framework + : # sources + /boost//unit_test_framework + ; + +alias test_runner_src + : # sources + src/console_test_runner.cpp + unit_test_framework + ; + +# make aliases explicit so the libraries will only be built when requested +explicit unit_test_framework ; +explicit test_runner_src ; + +lib dl ; + +lib test_runner_test : test/test_runner_test.cpp unit_test_framework ; + +exe console_test_runner + : test_runner_src + dl + ; + +exe console_test_runner + : test_runner_src + : <target-os>windows + ; diff --git a/src/boost/libs/test/tools/console_test_runner/src/console_test_runner.cpp b/src/boost/libs/test/tools/console_test_runner/src/console_test_runner.cpp new file mode 100644 index 000000000..354484e9f --- /dev/null +++ b/src/boost/libs/test/tools/console_test_runner/src/console_test_runner.cpp @@ -0,0 +1,207 @@ +// (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 +#ifndef BOOST_TEST_DYN_LINK +#define BOOST_TEST_DYN_LINK +#endif +#include <boost/test/unit_test.hpp> + +// Boost.Runtime.Param +//#include <boost/test/utils/runtime/cla/named_parameter.hpp> +#include <boost/test/utils/named_params.hpp> +#include <boost/test/utils/runtime/cla/parser.hpp> + +namespace rt = boost::runtime; +namespace cla = boost::runtime::cla; + +// STL +#include <iostream> + +//_________________________________________________________________// + +// System API + +namespace dyn_lib { + +#if defined(BOOST_WINDOWS) && !defined(BOOST_DISABLE_WIN32) // WIN32 API + +#include <windows.h> + +typedef HINSTANCE handle; + +inline handle +open( std::string const& file_name ) +{ + return LoadLibrary( file_name.c_str() ); +} + +//_________________________________________________________________// + +template<typename TargType> +inline TargType +locate_symbol( handle h, std::string const& symbol ) +{ + return reinterpret_cast<TargType>( GetProcAddress( h, symbol.c_str() ) ); +} + +//_________________________________________________________________// + +inline void +close( handle h ) +{ + if( h ) + FreeLibrary( h ); +} + +//_________________________________________________________________// + +inline std::string +error() +{ + LPTSTR msg = NULL; + + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&msg, + 0, NULL ); + + std::string res( msg ); + + if( msg ) + LocalFree( msg ); + + return res; +} + +//_________________________________________________________________// + +#elif defined(BOOST_HAS_UNISTD_H) // POSIX API + +#include <dlfcn.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + + +typedef void* handle; + +inline handle +open( std::string const& file_name ) +{ + return dlopen( file_name.c_str(), RTLD_LOCAL | RTLD_LAZY ); +} + +//_________________________________________________________________// + +template<typename TargType> +inline TargType +locate_symbol( handle h, std::string const& symbol ) +{ + return reinterpret_cast<TargType>( dlsym( h, symbol.c_str() ) ); +} + +//_________________________________________________________________// + +inline void +close( handle h ) +{ + if( h ) + dlclose( h ); +} + +//_________________________________________________________________// + +inline std::string +error() +{ + return dlerror(); +} + +//_________________________________________________________________// + +#else + +#error "Dynamic library API is unknown" + +#endif + +} // namespace dyn_lib + +//____________________________________________________________________________// + +static std::string test_lib_name; +static std::string init_func_name( "init_unit_test" ); + +dyn_lib::handle test_lib_handle; + +bool load_test_lib() +{ + typedef bool (*init_func_ptr)(); + init_func_ptr init_func; + + test_lib_handle = dyn_lib::open( test_lib_name ); + if( !test_lib_handle ) + throw std::logic_error( std::string("Fail to load test library: ") + .append( dyn_lib::error() ) ); + + init_func = dyn_lib::locate_symbol<init_func_ptr>( test_lib_handle, init_func_name ); + + if( !init_func ) + throw std::logic_error( std::string("Can't locate test initilization function ") + .append( init_func_name ) + .append( ": " ) + .append( dyn_lib::error() ) ); + + return (*init_func)(); +} + +//____________________________________________________________________________// + +int main( int argc, char* argv[] ) +{ + try { + + rt::parameters_store store; + + rt::parameter<rt::cstring, rt::REQUIRED_PARAM> p_test( "test" ); + p_test.add_cla_id( "--", "test", " " ); + store.add( p_test ); + + rt::parameter<rt::cstring> p_init( "init" ); + p_init.add_cla_id( "--", "init", " " ); + store.add( p_init ); + + rt::cla::parser P( store ); + + rt::arguments_store args_store; + + P.parse( argc, argv, args_store ); + + test_lib_name = args_store.get<std::string>( "test" ); + if( args_store.has("init") ) + init_func_name = args_store.get<std::string>( "init" ); + + int res = ::boost::unit_test::unit_test_main( &load_test_lib, argc, argv ); + + ::boost::unit_test::framework::clear(); + dyn_lib::close( test_lib_handle ); + + return res; + } + catch( rt::param_error const& ex ) { + std::cout << "Fail to parse command line arguments: " << ex.msg << std::endl; + return -1; + } +} + +//____________________________________________________________________________// + +// EOF diff --git a/src/boost/libs/test/tools/console_test_runner/test/test_runner_test.cpp b/src/boost/libs/test/tools/console_test_runner/test/test_runner_test.cpp new file mode 100644 index 000000000..b3c40e797 --- /dev/null +++ b/src/boost/libs/test/tools/console_test_runner/test/test_runner_test.cpp @@ -0,0 +1,53 @@ +// (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 +#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_CASE( test1 ) +{ + int i = 0; + + BOOST_CHECK_EQUAL( i, 2 ); +} + +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test2 ) +{ + BOOST_TEST_CHECKPOINT("About to force division by zero!"); + int i = 1, j = 0; + + i = i / j; +} + +//____________________________________________________________________________// + +extern "C" { + +#ifdef BOOST_WINDOWS +__declspec(dllexport) +#endif +bool +init_unit_test() +{ + framework::master_test_suite().p_name.value = "Test runner test"; + + return true; +} + +} + +//____________________________________________________________________________// + +// EOF |