1 // (C) Copyright Gennadiy Rozental 2001.
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 /// Defines @ref test_case_counter
10 // ***************************************************************************
12 #ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
13 #define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
16 #include <boost/test/detail/config.hpp>
17 #include <boost/test/utils/class_properties.hpp>
19 #include <boost/test/tree/test_unit.hpp>
20 #include <boost/test/tree/visitor.hpp>
22 #include <boost/test/detail/suppress_warnings.hpp>
24 //____________________________________________________________________________//
29 // ************************************************************************** //
30 // ************** test_case_counter ************** //
31 // ************************************************************************** //
33 ///! Counts the number of enabled test cases
34 class test_case_counter : public test_tree_visitor {
37 // @param ignore_disabled ignore the status when counting
38 test_case_counter(bool ignore_status = false)
40 , m_ignore_status(ignore_status)
43 BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count;
45 // test tree visitor interface
46 void visit( test_case const& tc ) BOOST_OVERRIDE { if( m_ignore_status || tc.is_enabled() ) ++p_count.value; }
47 bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE { return m_ignore_status || ts.is_enabled(); }
52 } // namespace unit_test
55 #include <boost/test/detail/enable_warnings.hpp>
57 #endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER