]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/test/test-organization-ts/test_unit-nested-suite-dependency.cpp
34d731e829534e5855e1a7640da7393a88501f82
1 // (C) Copyright Raffi Enficiaud 2017.
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 //! checking the nested suites activation, ticket trac #13149
10 // *****************************************************************************
12 #define BOOST_TEST_MODULE test_nested_dependency
13 #include <boost/test/unit_test.hpp>
14 #include <boost/test/unit_test_parameters.hpp>
15 #include <boost/test/tree/test_case_counter.hpp>
16 #include <boost/test/tree/traverse.hpp>
18 // initial reproducing snippet on the corresponding ticket
20 BOOST_AUTO_TEST_SUITE(suite1
, *boost::unit_test::depends_on("suite2"))
21 BOOST_AUTO_TEST_SUITE(suite1_nested
)
22 BOOST_AUTO_TEST_CASE(suite1_test1
)
26 BOOST_AUTO_TEST_SUITE_END()
27 BOOST_AUTO_TEST_SUITE_END()
29 BOOST_AUTO_TEST_SUITE(suite2
)
30 BOOST_AUTO_TEST_CASE(suite2_test2
)
34 BOOST_AUTO_TEST_SUITE_END()
47 BOOST_AUTO_TEST_CASE( some_test
)
49 using namespace boost::unit_test
;
52 test_suite
* master_ts
= BOOST_TEST_SUITE("local master");
53 test_suite
* t_suite1
= BOOST_TEST_SUITE( "suite1" );
54 test_suite
* t_suite1_nested
= BOOST_TEST_SUITE( "suite1_nested" );
55 t_suite1_nested
->add( BOOST_TEST_CASE( suite1_test1
) );
56 t_suite1
->add(t_suite1_nested
);
58 test_suite
* t_suite2
= BOOST_TEST_SUITE( "suite2" );
59 t_suite2
->add( BOOST_TEST_CASE( suite2_test2
) );
61 master_ts
->add(t_suite1
);
62 master_ts
->add(t_suite2
);
65 t_suite1
->depends_on( t_suite2
);
68 char const* argv
[] = { "dummy-test-module.exe", "--log_level=all", "--run_test=suite1/suite1_nested"};
69 int argc
= sizeof(argv
)/sizeof(argv
[0]);
71 master_ts
->p_default_status
.value
= test_unit::RS_ENABLED
;
72 framework::finalize_setup_phase( master_ts
->p_id
);
74 runtime_config::init( argc
, (char**)argv
);
75 framework::impl::setup_for_execution( *master_ts
);
78 //framework::run( master_ts );
80 // we should have 2 test cases enabled with this run parameters
81 test_case_counter tcc
;
82 traverse_test_tree( master_ts
->p_id
, tcc
);
83 BOOST_TEST( tcc
.p_count
== 2 );