Celeritas 0.7-develop+ddcb429
Loading...
Searching...
No Matches
Macros
TestMacros.hh File Reference
#include <gtest/gtest.h>
#include "corecel/Config.hh"
#include "corecel/SourceFile.hh"
#include "testdetail/TestMacrosImpl.hh"

Macros

#define PRINT_EXPECTED(data)
 Print the given object for unit/regression tests.
 
#define EXPECT_REF_EQ(expected, actual)    EXPECT_PRED_FORMAT2(::celeritas::testdetail::IsRefEq, expected, actual)
 Custom comparison for Celeritas test result types, using ADL.
 
#define EXPECT_REF_NEAR(expected, actual, tol)
 
#define EXPECT_VEC_EQ(expected, actual)    EXPECT_PRED_FORMAT2(::celeritas::testdetail::IsVecEq, expected, actual)
 Container equality macro.
 
#define EXPECT_REAL_EQ(expected, actual)   EXPECT_DOUBLE_EQ(expected, actual)
 Single-ULP floating point equality macro.
 
#define EXPECT_SOFT_EQ(expected, actual)    EXPECT_PRED_FORMAT2(::celeritas::testdetail::IsSoftEquiv, expected, actual)
 Soft equivalence macro.
 
#define EXPECT_SOFT_NEAR(expected, actual, tol)
 Soft equivalence macro with relative error or comparator.
 
#define EXPECT_VEC_SOFT_EQ(expected, actual)
 Container soft equivalence macro.
 
#define EXPECT_VEC_NEAR(expected, actual, tol)
 Container soft equivalence macro with relative error or comparator.
 
#define CELER_REPR_ATTR(ref, attr)
 Helper for printing expected values in reference structs.
 
#define CELER_INVOKE_TYPE_ATTR(func, type, attr)   func(#attr, &type::attr)
 Invoke an attribute comparison with an optional tolerance.
 
#define CELER_INVOKE_TYPE_ATTR_TOL(func, type, attr, tol)    func(#attr, &type::attr, tol)
 
#define EXPECT_JSON_EQ(expected, actual)    EXPECT_PRED_FORMAT2(::celeritas::testdetail::IsJsonEq, expected, actual)
 JSON string equality (soft equal for floats)
 
#define TEST_IF_CELERITAS_DEBUG(name)   DISABLED_##name
 Construct a test name that is disabled when assertions are enabled.
 
#define TEST_IF_CELER_DEVICE(name)   DISABLED_##name
 Construct a test name that is disabled when CUDA/HIP are disabled.
 
#define TEST_IF_CELERITAS_DOUBLE(name)   name
 Construct a test name that is disabled unless using double-precision real.
 
#define TEST_IF_CELERITAS_GEANT(name)   DISABLED_##name
 Construct a test name that is disabled when Geant4 is disabled.
 
#define TEST_IF_CELERITAS_USE_ROOT(name)   DISABLED_##name
 Construct a test name that is disabled when ROOT is disabled.
 

Macro Definition Documentation

◆ CELER_REPR_ATTR

#define CELER_REPR_ATTR (   ref,
  attr 
)
Value:
{ \
#attr, ref.attr \
}
Print an attribute with CELER_REPR_ATTR.
Definition TestMacrosImpl.hh:119

Helper for printing expected values in reference structs.

◆ EXPECT_REF_NEAR

#define EXPECT_REF_NEAR (   expected,
  actual,
  tol 
)
Value:
EXPECT_PRED_FORMAT3( \
::celeritas::testdetail::IsRefEq, expected, actual, tol)

◆ EXPECT_SOFT_NEAR

#define EXPECT_SOFT_NEAR (   expected,
  actual,
  tol 
)
Value:
EXPECT_PRED_FORMAT3( \
::celeritas::testdetail::IsSoftEquiv, expected, actual, tol)

Soft equivalence macro with relative error or comparator.

◆ EXPECT_VEC_NEAR

#define EXPECT_VEC_NEAR (   expected,
  actual,
  tol 
)
Value:
EXPECT_PRED_FORMAT3( \
::celeritas::testdetail::IsVecSoftEquiv, expected, actual, tol)

Container soft equivalence macro with relative error or comparator.

◆ EXPECT_VEC_SOFT_EQ

#define EXPECT_VEC_SOFT_EQ (   expected,
  actual 
)
Value:
EXPECT_PRED_FORMAT2( \
::celeritas::testdetail::IsVecSoftEquiv, expected, actual)

Container soft equivalence macro.

◆ PRINT_EXPECTED

#define PRINT_EXPECTED (   data)
Value:
::celeritas::testdetail::print_expected( \
data, #data, CELER_SOURCE_FILE, __LINE__)
#define CELER_SOURCE_FILE
Expand to the current source file path relative to the Celeritas source tree, as a null-terminated st...
Definition SourceFile.hh:172

Print the given object for unit/regression tests.