os/ossrv/ossrv_pub/boost_apis/boost/test/logged_expectations.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
//  (C) Copyright Gennadiy Rozental 2005.
sl@0
     2
//  Distributed under the Boost Software License, Version 1.0.
sl@0
     3
//  (See accompanying file LICENSE_1_0.txt or copy at 
sl@0
     4
//  http://www.boost.org/LICENSE_1_0.txt)
sl@0
     5
sl@0
     6
//  See http://www.boost.org/libs/test for the library home page.
sl@0
     7
//
sl@0
     8
//  File        : $RCSfile: logged_expectations.hpp,v $
sl@0
     9
//
sl@0
    10
//  Version     : $Revision: 1.2 $
sl@0
    11
//
sl@0
    12
//  Description : Facilities to perform interaction based testng of logged expectations
sl@0
    13
// ***************************************************************************
sl@0
    14
sl@0
    15
#ifndef BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER
sl@0
    16
#define BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER
sl@0
    17
sl@0
    18
// Boost.Test
sl@0
    19
#include <boost/test/detail/config.hpp>
sl@0
    20
#include <boost/test/detail/unit_test_parameters.hpp>
sl@0
    21
#include <boost/test/utils/callback.hpp>
sl@0
    22
sl@0
    23
#include <boost/test/detail/suppress_warnings.hpp>
sl@0
    24
sl@0
    25
//____________________________________________________________________________//
sl@0
    26
sl@0
    27
// ************************************************************************** //
sl@0
    28
// **************        BOOST_TEST_LOGGED_EXPECTATIONS        ************** //
sl@0
    29
// ************************************************************************** //
sl@0
    30
sl@0
    31
#define BOOST_TEST_LOGGED_EXPECTATIONS( test_name )                     \
sl@0
    32
struct test_name : public BOOST_AUTO_TEST_CASE_FIXTURE                  \
sl@0
    33
{ void test_method(); };                                                \
sl@0
    34
                                                                        \
sl@0
    35
static void BOOST_AUTO_TC_INVOKER( test_name )()                        \
sl@0
    36
{                                                                       \
sl@0
    37
    test_name t;                                                        \
sl@0
    38
    ::boost::itest::logged_expectations(                                \
sl@0
    39
        boost::bind( &test_name::test_method, t ),                      \
sl@0
    40
        BOOST_STRINGIZE(test_name) ".elog",                             \
sl@0
    41
        !::boost::unit_test::runtime_config::save_pattern() );          \
sl@0
    42
}                                                                       \
sl@0
    43
                                                                        \
sl@0
    44
struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {};                         \
sl@0
    45
                                                                        \
sl@0
    46
BOOST_AUTO_TC_REGISTRAR( test_name )(                                   \
sl@0
    47
    boost::unit_test::make_test_case(                                   \
sl@0
    48
        &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ),              \
sl@0
    49
    boost::unit_test::ut_detail::auto_tc_exp_fail<                      \
sl@0
    50
        BOOST_AUTO_TC_UNIQUE_ID( test_name )>::value );                 \
sl@0
    51
                                                                        \
sl@0
    52
void test_name::test_method()                                           \
sl@0
    53
/**/
sl@0
    54
sl@0
    55
namespace boost {
sl@0
    56
sl@0
    57
namespace itest {
sl@0
    58
sl@0
    59
// ************************************************************************** //
sl@0
    60
// **************           logged expectations test           ************** //
sl@0
    61
// ************************************************************************** //
sl@0
    62
sl@0
    63
void    BOOST_TEST_DECL
sl@0
    64
logged_expectations( unit_test::callback0<> const&  F, 
sl@0
    65
                     unit_test::const_string        log_file_name, 
sl@0
    66
                     bool                           test_or_log = true );
sl@0
    67
sl@0
    68
} // namespace itest
sl@0
    69
sl@0
    70
} // namespace boost
sl@0
    71
sl@0
    72
#include <boost/test/detail/enable_warnings.hpp>
sl@0
    73
sl@0
    74
// ***************************************************************************
sl@0
    75
//  Revision History :
sl@0
    76
//  
sl@0
    77
//  $Log: logged_expectations.hpp,v $
sl@0
    78
//  Revision 1.2  2005/12/20 23:50:13  rogeeff
sl@0
    79
//  unit_test.hpp removed
sl@0
    80
//
sl@0
    81
//  Revision 1.1  2005/12/14 05:09:21  rogeeff
sl@0
    82
//  interraction based testing is introdused
sl@0
    83
//
sl@0
    84
// ***************************************************************************
sl@0
    85
sl@0
    86
#endif // BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER