LCOV - code coverage report
Current view: top level - opt/homebrew/include/boost/test/tree - test_case_counter.hpp (source / functions) Hit Total Coverage
Test: test_dash_coverage.info Lines: 7 7 100.0 %
Date: 2026-06-25 07:23:51 Functions: 8 9 88.9 %

          Line data    Source code
       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)
       5             : 
       6             : //  See http://www.boost.org/libs/test for the library home page.
       7             : //
       8             : /// @file
       9             : /// Defines @ref test_case_counter
      10             : // ***************************************************************************
      11             : 
      12             : #ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
      13             : #define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
      14             : 
      15             : // Boost.Test
      16             : #include <boost/test/detail/config.hpp>
      17             : #include <boost/test/utils/class_properties.hpp>
      18             : 
      19             : #include <boost/test/tree/test_unit.hpp>
      20             : #include <boost/test/tree/visitor.hpp>
      21             : 
      22             : #include <boost/test/detail/suppress_warnings.hpp>
      23             : 
      24             : //____________________________________________________________________________//
      25             : 
      26             : namespace boost {
      27             : namespace unit_test {
      28             : 
      29             : // ************************************************************************** //
      30             : // **************                test_case_counter             ************** //
      31             : // ************************************************************************** //
      32             : 
      33             : ///! Counts the number of enabled test cases
      34             : class test_case_counter : public test_tree_visitor {
      35             : public:
      36             :     // Constructor
      37             :     // @param ignore_disabled ignore the status when counting
      38       42296 :     test_case_counter(bool ignore_status = false)
      39       21148 :     : p_count( 0 )
      40       21148 :     , m_ignore_status(ignore_status)
      41       42296 :     {}
      42             : 
      43       42296 :     BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count;
      44             : private:
      45             :     // test tree visitor interface
      46      101686 :     void    visit( test_case const& tc ) BOOST_OVERRIDE                { if( m_ignore_status || tc.is_enabled() ) ++p_count.value; }
      47       21294 :     bool    test_suite_start( test_suite const& ts ) BOOST_OVERRIDE    { return m_ignore_status || ts.is_enabled(); }
      48             :   
      49             :     bool m_ignore_status;
      50             : };
      51             : 
      52             : } // namespace unit_test
      53             : } // namespace boost
      54             : 
      55             : #include <boost/test/detail/enable_warnings.hpp>
      56             : 
      57             : #endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
      58             : 

Generated by: LCOV version 1.16