Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:41

0001 //  (C) Copyright Gennadiy Rozental 2001.
0002 //  Distributed under the Boost Software License, Version 1.0.
0003 //  (See accompanying file LICENSE_1_0.txt or copy at
0004 //  http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See http://www.boost.org/libs/test for the library home page.
0007 //
0008 /// @file
0009 /// Defines @ref test_case_counter
0010 // ***************************************************************************
0011 
0012 #ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
0013 #define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
0014 
0015 // Boost.Test
0016 #include <boost/test/detail/config.hpp>
0017 #include <boost/test/utils/class_properties.hpp>
0018 
0019 #include <boost/test/tree/test_unit.hpp>
0020 #include <boost/test/tree/visitor.hpp>
0021 
0022 #include <boost/test/detail/suppress_warnings.hpp>
0023 
0024 //____________________________________________________________________________//
0025 
0026 namespace boost {
0027 namespace unit_test {
0028 
0029 // ************************************************************************** //
0030 // **************                test_case_counter             ************** //
0031 // ************************************************************************** //
0032 
0033 ///! Counts the number of enabled test cases
0034 class test_case_counter : public test_tree_visitor {
0035 public:
0036     // Constructor
0037     // @param ignore_disabled ignore the status when counting
0038     test_case_counter(bool ignore_status = false)
0039     : p_count( 0 )
0040     , m_ignore_status(ignore_status)
0041     {}
0042 
0043     BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count;
0044 private:
0045     // test tree visitor interface
0046     void    visit( test_case const& tc ) BOOST_OVERRIDE                { if( m_ignore_status || tc.is_enabled() ) ++p_count.value; }
0047     bool    test_suite_start( test_suite const& ts ) BOOST_OVERRIDE    { return m_ignore_status || ts.is_enabled(); }
0048   
0049     bool m_ignore_status;
0050 };
0051 
0052 } // namespace unit_test
0053 } // namespace boost
0054 
0055 #include <boost/test/detail/enable_warnings.hpp>
0056 
0057 #endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
0058