]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/test/writing-test-ts/test-timeout-suite.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / test / test / writing-test-ts / test-timeout-suite.cpp
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 #define BOOST_TEST_MODULE timeout-error-suite
9 #include <boost/test/unit_test.hpp>
10 #include <boost/test/data/test_case.hpp>
11 #include <chrono>
12 #include <thread>
13
14 namespace utf = boost::unit_test;
15
16 // each of the test case of the data set has a timeout of 1 sec
17 BOOST_TEST_DECORATOR(* utf::timeout(1))
18 BOOST_DATA_TEST_CASE(test_success, utf::data::make({0,1,2,3}))
19 {
20 std::this_thread::sleep_for(std::chrono::milliseconds(100));
21 BOOST_TEST(sample >= 0);
22 }
23
24 // the full test suite has a timeout of 1s
25 BOOST_TEST_DECORATOR(* utf::timeout(1))
26
27 BOOST_AUTO_TEST_SUITE(test_suite_success)
28 BOOST_DATA_TEST_CASE(test_success, utf::data::make({0,1,2,3,4,5,6,7,8}))
29 {
30 std::this_thread::sleep_for(std::chrono::milliseconds(100));
31 BOOST_TEST(sample >= 0);
32 }
33 BOOST_AUTO_TEST_SUITE_END()