2#ifndef LIBMESH_LIBMESH_CPPUNIT_H
3#define LIBMESH_LIBMESH_CPPUNIT_H
6#include <libmesh/ignore_warnings.h>
7#include <cppunit/extensions/HelperMacros.h>
8#include <cppunit/TestCase.h>
9#include <libmesh/restore_warnings.h>
11#include <libmesh/libmesh_logging.h>
13#if defined(LIBMESH_DEFAULT_QUADRUPLE_PRECISION) || \
14 defined(LIBMESH_DEFAULT_TRIPLE_PRECISION)
15# define LIBMESH_ASSERT_FP_EQUAL(expected,actual,tolerance) \
16 CPPUNIT_ASSERT_DOUBLES_EQUAL(double((expected)-(actual)),0,double(tolerance))
18# define LIBMESH_ASSERT_FP_EQUAL(expected,actual,tolerance) \
19 CPPUNIT_ASSERT_DOUBLES_EQUAL(expected,actual,tolerance)
22# define LIBMESH_ASSERT_COMPLEX_EQUAL(expected,actual,tolerance) \
24 LIBMESH_ASSERT_FP_EQUAL(libMesh::libmesh_real(expected),libMesh::libmesh_real(actual),tolerance); \
25 LIBMESH_ASSERT_FP_EQUAL(libMesh::libmesh_imag(expected),libMesh::libmesh_imag(actual),tolerance); \
28#ifdef LIBMESH_USE_COMPLEX_NUMBERS
29# define LIBMESH_ASSERT_NUMBERS_EQUAL(expected,actual,tolerance) \
30 LIBMESH_ASSERT_COMPLEX_EQUAL(expected,actual,tolerance)
32# define LIBMESH_ASSERT_NUMBERS_EQUAL(expected,actual,tolerance) \
33 LIBMESH_ASSERT_FP_EQUAL(expected,actual,tolerance)
37#define LIBMESH_ASSERT_REALVEC_EQUAL(expected,actual,tolerance) \
39 VectorValue<Real> expected_vec{expected}; \
40 VectorValue<Real> actual_vec{actual}; \
41 for (int realvec_d=0; realvec_d != LIBMESH_DIM; ++realvec_d) \
42 LIBMESH_ASSERT_FP_EQUAL(expected_vec(realvec_d), actual_vec(realvec_d), tolerance); \
53#include <libmesh/ignore_warnings.h>
55#pragma clang diagnostic ignored "-Wdeprecated-declarations"
57#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
58#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
59#pragma GCC diagnostic push
60#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
96#define LIBMESH_CPPUNIT_TEST_SUITE(ATestFixtureType) \
98 std::string libmesh_suite_name = #ATestFixtureType; \
99 CPPUNIT_TEST_SUITE(ATestFixtureType)
102#define LOG_UNIT_TEST UnitPerfItem TOKENPASTE2(perf_item_, __LINE__)(__func__,this->libmesh_suite_name,*unitlog)
UnitPerfItem(std::string label, std::string header, libMesh::PerfLog &my_perflog)
const std::string _header
libMesh::PerfLog & _perflog
The PerfLog class allows monitoring of specific events.
void pop(const char *label, const char *header="")
Pop the event label off the stack, resuming any lower event.
void push(const char *label, const char *header="")
Push the event label onto the stack, pausing any active event.
libMesh::PerfLog * unitlog