1 // (C) Copyright Raffi Enficiaud 2019. 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 example83 multicontext 10 #include <boost/test/included/unit_test.hpp> 11 #include <cmath> 12 BOOST_AUTO_TEST_CASE(test_multi_context)13BOOST_AUTO_TEST_CASE(test_multi_context) 14 { 15 for (int level = 0; level < 10; ++level) { 16 int rand_value = std::abs(rand()) % 50; 17 BOOST_TEST_CONTEXT("With level " << level, "Random value=" << rand_value){ 18 for( int j = 1; j < rand_value; j++) { 19 BOOST_TEST(level < rand_value); 20 rand_value /= 2; 21 } 22 } 23 } 24 } 25 //] 26