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 : : 2022-2024 J. Bakosi 8 : : All rights reserved. See the LICENSE file for details. 9 : : \brief Template Unit Test suite class declaration 10 : : \details Template Unit Test suite class declaration. In principle there can 11 : : be unit test suites other than this one which uses the Template Unit Test 12 : : library. 13 : : */ 14 : : // ***************************************************************************** 15 : : #ifndef TUTSuite_h 16 : : #define TUTSuite_h 17 : : 18 : : #include <vector> 19 : : #include <map> 20 : : #include <string> 21 : : #include <iosfwd> 22 : : #include <cstddef> 23 : : #include <cstring> 24 : : 25 : : #include "NoWarning/tutsuite.decl.h" 26 : : 27 : : namespace unittest { 28 : : 29 : : //! Template Unit Test unit test suite 30 : : class TUTSuite : public CBase_TUTSuite { 31 : : 32 : : public: 33 : : //! Constructor 34 : : explicit TUTSuite( const std::string& grp ); 35 : : 36 : : //! Run all tests 37 : : void run(); 38 : : 39 : : //! Evaluate a unit test 40 : : void evaluateTest( std::vector< std::string >&& status ); 41 : : 42 : : private: 43 : : std::string m_group2run; //!< Test group to run 44 : : std::size_t m_nrun; //!< Number of tests ran (including dummies) 45 : : std::size_t m_ngroup; //!< Number of test groups 46 : : std::size_t m_ncomplete; //!< Number of completed tests 47 : : std::size_t m_nfail; //!< Number of failed tests 48 : : std::size_t m_nskip; //!< Number of skipped tests 49 : : std::size_t m_nwarn; //!< Number of tests with a warning 50 : : std::size_t m_nexcp; //!< Number of tests with an exception 51 : : std::size_t m_nspaw; //!< Number of additionallly spawned tests ran 52 : : 53 : : //! \brief Charm++ test group names that spawn additional tests and number 54 : : //! of tests they spawn 55 : : //! \details This map stores the names of test groups that define Charm++ 56 : : //! tests, such as migration tests, that spawn multiple tests and their 57 : : //! associated number tests they additionally spawn. Every such test 58 : : //! consists of multiple unit tests: one for the host test and one or more 59 : : //! for receive(s). All such tests trigger/spawn additional TUT test(s). 60 : : //! The receive side of the spawed tests are created manually, i.e., 61 : : //! without the awareness of the TUT library. Unfortunately, there is no 62 : : //! good way to count up these additionally spawned tests, so they need to 63 : : //! be explicitly maintained here. To find out what tests spawn a new 64 : : //! Charm++ chare, grep the src directory for 'This test spawns a new 65 : : //! Charm++ chare', which appears in the comment before each such 66 : : //! host test name. 67 : : const std::map< std::string, std::size_t > m_nspawned { 68 [ + - ][ - - ]: 2 : { "Base/PUPUtil", 14 } 69 : : , { "Base/Timer", 1 } 70 [ + - ][ - - ]: 2 : , { "LinearSolver/ConjugateGradients", 2 + 4 + 2 + 4 } 71 : : }; 72 : : 73 : : // Tests that must be run on PE 0 74 : : // \details Some Charm++ tests must be run on PE 0 because they create 75 : : // Charm++ chare arrays whose ckNew() must be called on PE 0. 76 : : const std::unordered_set< std::string > m_fromPE0 { 77 : : { "LinearSolver/ConjugateGradients" } 78 : : }; 79 : : 80 : : //! Fire up all tests in a test group 81 : : void spawngrp( const std::string& g ); 82 : : 83 : : //! Echo final assessment after the full unit test suite has finished 84 : : bool assess(); 85 : : }; 86 : : 87 : : } // unittest:: 88 : : 89 : : #endif // TUTSuite_h