Walker test code coverage report
Current view: top level - UnitTest - TUTSuite.hpp (source / functions) Hit Total Coverage
Commit: test_coverage.info Lines: 9 9 100.0 %
Date: 2022-09-21 18:57:21 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 16 31.2 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/UnitTest/TUTSuite.hpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.
       7                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     Template Unit Test suite class declaration
       9                 :            :   \details   Template Unit Test suite class declaration. In principle there can
      10                 :            :     be unit test suites other than this one which uses the Template Unit Test
      11                 :            :     library.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : #ifndef TUTSuite_h
      15                 :            : #define TUTSuite_h
      16                 :            : 
      17                 :            : #include <vector>
      18                 :            : #include <map>
      19                 :            : #include <string>
      20                 :            : #include <iosfwd>
      21                 :            : #include <cstddef>
      22                 :            : #include <cstring>
      23                 :            : 
      24                 :            : #include "UnitTestPrint.hpp"
      25                 :            : #include "UnitTest/CmdLine/CmdLine.hpp"
      26                 :            : 
      27                 :            : #include "NoWarning/tutsuite.decl.h"
      28                 :            : #include "NoWarning/mpirunner.decl.h"
      29                 :            : 
      30                 :            : namespace unittest {
      31                 :            : 
      32                 :            : //! Template Unit Test unit test suite
      33                 :            : class TUTSuite : public CBase_TUTSuite {
      34                 :            : 
      35                 :            :   public:
      36                 :            :     //! Constructor
      37                 :            :     explicit TUTSuite( const ctr::CmdLine& cmdline );
      38                 :            : 
      39                 :            :     //! Evaluate a unit test
      40                 :            :     void evaluate( std::vector< std::string > status );
      41                 :            : 
      42                 :            :   private:
      43                 :            :     ctr::CmdLine m_cmdline;        //!< Command line user input
      44                 :            :     //! MPI unit test runner nodegroup proxy
      45                 :            :     CProxy_MPIRunner< CProxy_TUTSuite > m_mpirunner;
      46                 :            :     std::size_t m_nrun;      //!< Number of tests ran (including dummies)
      47                 :            :     std::size_t m_ngroup;    //!< Number of test groups
      48                 :            :     std::size_t m_ncomplete; //!< Number of completed tests
      49                 :            :     std::size_t m_nfail;     //!< Number of failed tests
      50                 :            :     std::size_t m_nskip;     //!< Number of skipped tests
      51                 :            :     std::size_t m_nwarn;     //!< Number of tests with a warning
      52                 :            :     std::size_t m_nexcp;     //!< Number of tests with an exception
      53                 :            :     std::size_t m_nspaw;     //!< Number of additionallly spawned tests ran
      54                 :            : 
      55                 :            :     //! \brief Charm++ test group names that spawn additional tests and number
      56                 :            :     //!   of tests they spawn
      57                 :            :     //! \details This map stores the names of test groups that define Charm++
      58                 :            :     //!   tests, such as migration tests, that spawn multiple tests and their
      59                 :            :     //!   associated number tests they additionally spawn. Every such test
      60                 :            :     //!   consists of multiple unit tests: one for the host test and one or more
      61                 :            :     //!   for receive(s). All such tests trigger/spawn additional TUT test(s).
      62                 :            :     //!   The receive side of the spawed tests are created manually, i.e.,
      63                 :            :     //!   without the awareness of the TUT library. Unfortunately, there is no
      64                 :            :     //!   good way to count up these additionally spawned tests, so they need to
      65                 :            :     //!   be explicitly maintained here. To find out what tests spawn a new
      66                 :            :     //!   Charm++ chare, grep the src directory for 'This test spawns a new
      67                 :            :     //!   Charm++ chare', which appears in the comment before each such
      68                 :            :     //!   host test name.
      69                 :            :     const std::map< std::string, std::size_t > m_nspawned {
      70 [ +  - ][ -  - ]:          1 :         { "Base/Factory", 2 }
      71 [ +  - ][ -  - ]:          1 :       , { "Base/PUPUtil", 14 }
      72 [ +  - ][ -  - ]:          1 :       , { "Base/Timer", 1 }
      73                 :          1 :     };
      74                 :            : 
      75                 :            :     //! Fire up all tests in a test group
      76                 :            :     void spawngrp( const std::string& g );
      77                 :            : 
      78                 :            :     //! Create pretty printer specialized to UnitTest
      79                 :            :     //! \return Pretty printer
      80                 :       2499 :     UnitTestPrint printer() const {
      81                 :            :       return UnitTestPrint(
      82                 :       2499 :         m_cmdline.logname( m_cmdline.get< tag::io, tag::screen >(),
      83                 :       2499 :                            m_cmdline.get< tag::io, tag::nrestart >() ),
      84                 :       2499 :         m_cmdline.get< tag::verbose >() ? std::cout : std::clog,
      85 [ +  - ][ +  - ]:       7497 :         std::ios_base::app );
      86                 :            :     }
      87                 :            : };
      88                 :            : 
      89                 :            : } // unittest::
      90                 :            : 
      91                 :            : #endif // TUTSuite_h

Generated by: LCOV version 1.14