Class UnitTest is simple utility for running unit tests. It provides basic routines for tracing success or failure of tests, and reporting the results. More...
#include <UnitTest.h>
Public Member Functions | |
| void | expected_failure (const char *format,...) |
| void | expected_failure (std::string in) |
| Indicate an expected failed test (thread-safe) | |
| void | failure (const char *format,...) |
| void | failure (std::string in) |
| Indicate a failed test (thread-safe) | |
| const auto & | getExpected () const |
| Return the number of expected failed tests locally. | |
| const auto & | getFail () const |
| Return the number of failed tests locally. | |
| const auto & | getPass () const |
| Return the tests passed locally. | |
| size_t | NumExpectedFailGlobal () const |
| Return the number of expected failed tests locally. | |
| size_t | NumExpectedFailLocal () const |
| Return the number of expected failed tests locally. | |
| size_t | NumFailGlobal () const |
| Return the number of failed tests locally. | |
| size_t | NumFailLocal () const |
| Return the number of failed tests locally. | |
| size_t | NumPassGlobal () const |
| Return the number of passed tests locally. | |
| size_t | NumPassLocal () const |
| Return the number of passed tests locally. | |
| UnitTest & | operator= (const UnitTest &)=delete |
| void | pass_fail (bool pass, const char *format,...) |
| void | pass_fail (bool pass, std::string in) |
| Indicate a pass/fail test. | |
| void | passes (const char *format,...) |
| void | passes (std::string in) |
| Indicate a passed test (thread-safe) | |
| void | report (const int level=1, bool removeDuplicates=true) const |
| void | reset () |
| Clear the messages. | |
| UnitTest ()=default | |
| Default constructor. | |
| UnitTest (const UnitTest &)=delete | |
| ~UnitTest () | |
| Destructor. | |
Private Attributes | |
| std::vector< std::string > | d_expected |
| std::vector< std::string > | d_fail |
| std::vector< std::string > | d_pass |
Class UnitTest is simple utility for running unit tests. It provides basic routines for tracing success or failure of tests, and reporting the results.
Definition at line 48 of file UnitTest.h.
|
default |
Default constructor.
| AMP::UnitTest::~UnitTest | ( | ) |
Destructor.
|
delete |
|
inline |
Definition at line 151 of file UnitTest.h.
References AMP_INSIST, and expected_failure().
| void AMP::UnitTest::expected_failure | ( | std::string | in | ) |
Indicate an expected failed test (thread-safe)
Referenced by expected_failure().
|
inline |
Definition at line 139 of file UnitTest.h.
References AMP_INSIST, and failure().
| void AMP::UnitTest::failure | ( | std::string | in | ) |
Indicate a failed test (thread-safe)
Referenced by failure().
|
inline |
Return the number of expected failed tests locally.
Definition at line 100 of file UnitTest.h.
References d_expected.
|
inline |
Return the number of failed tests locally.
Definition at line 97 of file UnitTest.h.
References d_fail.
|
inline |
| size_t AMP::UnitTest::NumExpectedFailGlobal | ( | ) | const |
Return the number of expected failed tests locally.
|
inline |
Return the number of expected failed tests locally.
Definition at line 82 of file UnitTest.h.
References d_expected.
| size_t AMP::UnitTest::NumFailGlobal | ( | ) | const |
Return the number of failed tests locally.
|
inline |
Return the number of failed tests locally.
Definition at line 79 of file UnitTest.h.
References d_fail.
| size_t AMP::UnitTest::NumPassGlobal | ( | ) | const |
Return the number of passed tests locally.
|
inline |
Return the number of passed tests locally.
Definition at line 76 of file UnitTest.h.
References d_pass.
|
inline |
Definition at line 163 of file UnitTest.h.
References AMP_INSIST, and pass_fail().
| void AMP::UnitTest::pass_fail | ( | bool | pass, |
| std::string | in | ||
| ) |
Indicate a pass/fail test.
Referenced by pass_fail().
|
inline |
Definition at line 127 of file UnitTest.h.
References AMP_INSIST, and passes().
| void AMP::UnitTest::passes | ( | std::string | in | ) |
Indicate a passed test (thread-safe)
Referenced by passes().
| void AMP::UnitTest::report | ( | const int | level = 1, |
| bool | removeDuplicates = true |
||
| ) | const |
Print a report of the passed and failed tests. Note: This is a blocking call that all processors must execute together. Note: Only rank 0 will print the messages (this is necessary as other ranks may not be able to print correctly).
| level | Optional integer specifying the level of reporting (default: 1) 0: Report the number of tests passed, failed, and expected failures. 1: Report the passed tests (if <=20) or number passed, Report all failures, Report the expected failed tests (if <=50) or the number passed. 2: Report the passed tests (if <=50) Report all failures, Report all expected 3: Report all passed, failed, and expected failed tests. |
| removeDuplicates | Remove duplicate messages. If set, the total number of message will be unchanged but if printed duplicate messages will be removed |
| void AMP::UnitTest::reset | ( | ) |
Clear the messages.
|
private |
Definition at line 179 of file UnitTest.h.
Referenced by getExpected(), and NumExpectedFailLocal().
|
private |
Definition at line 178 of file UnitTest.h.
Referenced by getFail(), and NumFailLocal().
|
private |
Definition at line 177 of file UnitTest.h.
Referenced by getPass(), and NumPassLocal().
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:42. Comments on this page |