Quinoa all test code coverage report
Current view: top level - UnitTest - TUTSuite.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 4 4 100.0 %
Date: 2024-11-08 10:37:44 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           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                 :            :         { "Base/Factory", 2 }
      71                 :            :       , { "Base/PUPUtil", 14 }
      72                 :            :       , { "Base/Timer", 1 }
      73                 :            :       , { "Inciter/Scheme", 4 }
      74                 :            :       , { "LinearSolver/ConjugateGradients", 2+4+2+4 }
      75                 :            :     };
      76                 :            : 
      77                 :            :     // Tests that must be run on PE 0
      78                 :            :     // \details Some Charm++ tests must be run on PE 0 because they create
      79                 :            :     // Charm++ chare arrays whose ckNew() must be called on PE 0.
      80                 :            :     const std::unordered_set< std::string > m_fromPE0 {
      81                 :            :         { "LoadBalance/LinearMap"}
      82                 :            :       , { "LoadBalance/UnsMeshMap" }
      83                 :            :       , { "LinearSolver/ConjugateGradients" }
      84                 :            :       , { "Inciter/Scheme" }
      85                 :            :     };
      86                 :            : 
      87                 :            :     //! Fire up all tests in a test group
      88                 :            :     void spawngrp( const std::string& g );
      89                 :            : 
      90                 :            :     //! Create pretty printer specialized to UnitTest
      91                 :            :     //! \return Pretty printer
      92                 :       2595 :     UnitTestPrint printer() const {
      93                 :            :       return UnitTestPrint(
      94                 :       2595 :         m_cmdline.logname( m_cmdline.get< tag::io, tag::screen >(),
      95                 :            :                            m_cmdline.get< tag::io, tag::nrestart >() ),
      96                 :       2595 :         m_cmdline.get< tag::verbose >() ? std::cout : std::clog,
      97         [ -  + ]:       5190 :         std::ios_base::app );
      98                 :            :     }
      99                 :            : };
     100                 :            : 
     101                 :            : } // unittest::
     102                 :            : 
     103                 :            : #endif // TUTSuite_h

Generated by: LCOV version 1.14