Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_UnitTestBase.cpp
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #include "Teuchos_UnitTestBase.hpp"
12 #include "Teuchos_Assert.hpp"
13 #include "Teuchos_StandardCatchMacros.hpp"
14 
15 
16 namespace Teuchos {
17 
18 
19 UnitTestBase::UnitTestBase(const std::string groupName, std::string testName)
20 {
21  Teuchos::UnitTestRepository::addUnitTest(this, groupName, testName);
22 }
23 
24 
26 {
27  bool success = true;
28  try {
29  runUnitTestImpl(out, success);
30  }
31  TEUCHOS_STANDARD_CATCH_STATEMENTS(true, out, success)
32  return success;
33 }
34 
35 
36 } // namespace Teuchos
Unit testing support.
static void addUnitTest(UnitTestBase *unitTest, const std::string groupName, const std::string testName)
Add an unit test (called indirectly through macros.
Unit testing support.
std::ostream subclass that performs the magic of indenting data sent to an std::ostream object among ...
bool runUnitTest(FancyOStream &out) const
virtual void runUnitTestImpl(FancyOStream &out, bool &success) const =0
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
Simple macro that catches and reports standard exceptions and other exceptions.
UnitTestBase(const std::string groupName, std::string testName)