Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/UnitTest/TUTTest.hpp
4 : : \copyright 2012-2015 J. Bakosi,
5 : : 2016-2018 Los Alamos National Security, LLC.,
6 : : 2019-2021 Triad National Security, LLC.,
7 : : 2022-2025 J. Bakosi
8 : : All rights reserved. See the LICENSE file for details.
9 : : \brief Template Unit Test unit test class declaration
10 : : \details Template Unit Test unit test class declaration.
11 : : */
12 : : // *****************************************************************************
13 : : #ifndef TUTTest_h
14 : : #define TUTTest_h
15 : :
16 : : #include <string>
17 : : #include <iosfwd>
18 : :
19 : : #include "NoWarning/tut.hpp"
20 : : #include "NoWarning/tuttest.decl.h"
21 : :
22 : : namespace unittest {
23 : :
24 : : extern tut::test_runner_singleton g_runner;
25 : :
26 : : //! \brief Generic Charm++ chare class for unit tests utilizing the Template
27 : : //! Unit Test library
28 : : template< class Proxy >
29 : : class TUTTest : public CBase_TUTTest< Proxy > {
30 : :
31 : : public:
32 : : //! Constructor: run test then call back to host proxy to evaluate it
33 : : //! \param[in] proxy Host proxy to call back to after test has been run
34 : : //! \param[in] groupname Name of the group the test belongs to
35 : : //! \param[in] t Test number in test group
36 : 2500 : explicit TUTTest( Proxy&& proxy, const std::string& groupname, int t ) {
37 : 2500 : tut::test_result tr;
38 [ + - ]: 2500 : g_runner.get().run_test( groupname, t, tr );
39 [ + - ][ + - ]: 17500 : proxy.evaluateTest( { tr.group, tr.name, std::to_string(tr.result),
[ + + ][ - - ]
40 : : tr.message, tr.exception_typeid } );
41 [ + - ][ + - ]: 5000 : }
[ + - ][ + - ]
[ - - ][ - - ]
42 : : };
43 : :
44 : : } // unittest::
45 : :
46 : : #define CK_TEMPLATES_ONLY
47 : : #include "NoWarning/tuttest.def.h"
48 : : #undef CK_TEMPLATES_ONLY
49 : :
50 : : #endif // TUTTest_h
|