]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/doc/examples/example82_contexts.run-fail.cpp
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)
6 // See http://www.boost.org/libs/test for the library home page.
9 #define BOOST_TEST_MODULE example82
10 #include <boost/test/included/unit_test.hpp>
15 void optimization_level(int l
) { level
= l
; }
16 bool op1(int) { return level
< 2; }
17 bool op2(int, int) { return level
< 1; }
20 void test_operations(Processor
& processor
, int limit
)
22 for (int i
= 0; i
< limit
; ++i
) {
23 BOOST_TEST_CONTEXT("With parameter i = " << i
) {
24 BOOST_TEST(processor
.op1(i
));
25 for (int j
= 0; j
< i
; ++j
) {
26 BOOST_TEST_INFO("With parameter j = " << j
);
27 BOOST_TEST(processor
.op2(i
, j
));
33 BOOST_AUTO_TEST_CASE(test1
)
37 for (int level
= 0; level
< 3; ++level
) {
38 BOOST_TEST_CONTEXT("With optimization level " << level
) {
39 processor
.optimization_level(level
);
40 test_operations(processor
, 2);