Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
Teuchos_TestingHelpers.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_TestingHelpers.hpp
"
11
#include "Teuchos_toString.hpp"
12
13
14
namespace
{
15
16
17
// Make sure this is initialized whenever needed before main starts!
18
bool
& showTestFailureLocationImpl()
19
{
20
static
bool
showTFL =
false
;
21
return
showTFL;
22
}
23
24
25
}
// namespace
26
27
28
const
std::string
29
Teuchos::passfail_with_location
(
const
bool
result,
30
const
std::string &file,
const
int
lineNumber)
31
{
32
std::string rtn =
passfail
(result);
33
if
(!result &&
showTestFailureLocation
()) {
34
rtn +=
" ==> "
+file+
":"
+toString(lineNumber);
35
}
36
return
rtn;
37
}
38
39
40
void
Teuchos::showTestFailureLocation
(
bool
showTFL)
41
{
42
showTestFailureLocationImpl() = showTFL;
43
}
44
45
46
bool
Teuchos::showTestFailureLocation
()
47
{
48
return
showTestFailureLocationImpl();
49
}
Teuchos_TestingHelpers.hpp
Utilities to make writing tests easier.
Teuchos::passfail_with_location
TEUCHOSCORE_LIB_DLL_EXPORT const std::string passfail_with_location(const bool result, const std::string &file, const int lineNumber)
Helper function for TEUCHOS_PASS_FAIL(...).
Definition
Teuchos_TestingHelpers.cpp:29
Teuchos::showTestFailureLocation
bool showTestFailureLocation()
Return if TEUCHOS_PASS_FAIL(...) should print test failure location.
Definition
Teuchos_TestingHelpers.cpp:46
Teuchos::passfail
const std::string passfail(const bool result)
Return "passed" or "failed".
Definition
Teuchos_TestingHelpers.hpp:621
Teuchos::showTestFailureLocation
void showTestFailureLocation(bool)
Set if TEUCHOS_PASS_FAIL(...) should print test failure location.
Definition
Teuchos_TestingHelpers.cpp:40
Generated by
1.17.0