]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/test/writing-test-ts/tools-under-debugger-test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / test / test / writing-test-ts / tools-under-debugger-test.cpp
1 // (C) Copyright Gennadiy Rozental 2015.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 // See http://www.boost.org/libs/test for the library home page.
7 //
8 // File : $RCSfile$
9 //
10 // Version : $Revision$
11 //
12 // Description : testing BOOST_TEST_UNDER_DEBUGGER compilation and operation
13 // ***************************************************************************
14
15 // Boost.Test
16 #define BOOST_TEST_TOOLS_UNDER_DEBUGGER
17 #define BOOST_TEST_MODULE tools under debugger test
18 #include <boost/test/unit_test.hpp>
19
20 // STL
21 #include <exception>
22
23 //____________________________________________________________________________//
24
25 static int
26 foo( int arg )
27 {
28 if( arg == 0 )
29 throw std::runtime_error("Oops");
30
31 return arg * arg;
32 }
33
34 //____________________________________________________________________________//
35
36 #ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT
37 BOOST_AUTO_TEST_CASE( test )
38 {
39 int i = 2;
40 BOOST_TEST( foo(i)+1 == 5 );
41
42 BOOST_TEST( foo(i)+1 == 5, "My message" );
43
44 BOOST_CHECK_THROW( foo(0), std::runtime_error );
45 }
46 #endif
47
48 BOOST_AUTO_TEST_CASE( test2 )
49 {
50 int i = 2;
51 BOOST_CHECK( foo(i)+1 == 5 );
52
53 BOOST_CHECK_MESSAGE( foo(i)+1 == 5, "My message" );
54
55 BOOST_CHECK_THROW( foo(0), std::runtime_error );
56 }
57
58 // EOF