1 //  (C) Copyright Gennadiy Rozental 2001-2014.
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 //  File        : $RCSfile$
9 //
10 //  Version     : $Revision: 74640 $
11 //
12 //  Description : defines test_case_counter
13 // ***************************************************************************
14 
15 #ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
16 #define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
17 
18 // Boost.Test
19 #include <boost/test/detail/config.hpp>
20 #include <boost/test/utils/class_properties.hpp>
21 
22 #include <boost/test/tree/test_unit.hpp>
23 #include <boost/test/tree/visitor.hpp>
24 
25 #include <boost/test/detail/suppress_warnings.hpp>
26 
27 //____________________________________________________________________________//
28 
29 namespace boost {
30 namespace unit_test {
31 
32 // ************************************************************************** //
33 // **************                test_case_counter             ************** //
34 // ************************************************************************** //
35 
36 class test_case_counter : public test_tree_visitor {
37 public:
38     // Constructor
test_case_counter()39     test_case_counter() : p_count( 0 ) {}
40 
41     BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count;
42 private:
43     // test tree visitor interface
visit(test_case const & tc)44     virtual void    visit( test_case const& tc )                { if( tc.is_enabled() ) ++p_count.value; }
test_suite_start(test_suite const & ts)45     virtual bool    test_suite_start( test_suite const& ts )    { return ts.is_enabled(); }
46 };
47 
48 } // namespace unit_test
49 } // namespace boost
50 
51 #include <boost/test/detail/enable_warnings.hpp>
52 
53 #endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
54 
55