]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/test/doc/examples/decorator_08.run-fail.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / doc / examples / decorator_08.run-fail.cpp
CommitLineData
7c673cae
FG
1// (C) Copyright Andrzej Krzemienski 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//[example_code
9#define BOOST_TEST_MODULE decorator_08
10#include <boost/test/included/unit_test.hpp>
11namespace utf = boost::unit_test;
12namespace tt = boost::test_tools;
13
14BOOST_AUTO_TEST_CASE(test1)
15{
16 BOOST_TEST(true);
17}
18
19BOOST_AUTO_TEST_CASE(test2)
20{
21 BOOST_TEST(false);
22}
23
24struct if_either
25{
26 std::string tc1, tc2;
27 if_either(std::string t1, std::string t2)
28 : tc1(t1), tc2(t2) {}
29
30 tt::assertion_result operator()(utf::test_unit_id)
31 {
32 auto& master = utf::framework::master_test_suite();
33 auto& collector = utf::results_collector_t::instance();
34 auto& test1_result = collector.results(master.get(tc1));
35 auto& test2_result = collector.results(master.get(tc2));
36
37 if (test1_result.passed() || test2_result.passed())
38 return true;
39
40 tt::assertion_result ans(false);
41 ans.message() << tc1 << " and " << tc2 << " failed";
42 return ans;
43 }
44};
45
46BOOST_AUTO_TEST_CASE(test3,
47 * utf::precondition(if_either("test1", "test2")))
48{
49 BOOST_TEST(false);
50}
51
52BOOST_AUTO_TEST_CASE(test4,
53 * utf::precondition(if_either("test2", "test3")))
54{
55 BOOST_TEST(false);
56}
57//]