Celeritas  0.5.0-86+4a8eea4
Classes | Functions
TestMacrosImpl.hh File Reference
#include <string_view>
#include <type_traits>
#include <vector>
#include <gtest/gtest.h>
#include "corecel/Config.hh"
#include "corecel/Macros.hh"
#include "corecel/io/Repr.hh"
#include "corecel/math/SoftEqual.hh"
This graph shows which files directly or indirectly include this file:

Classes

struct  celeritas::testdetail::SoftPrecisionType< T, T >
 
struct  celeritas::testdetail::SoftPrecisionType< double, float >
 
struct  celeritas::testdetail::SoftPrecisionType< float, double >
 
struct  celeritas::testdetail::SoftPrecisionType< int, T >
 
struct  celeritas::testdetail::FailedValue< T1, T2 >
 A single index/expected/actual value. More...
 
struct  celeritas::testdetail::TCT< C1, C2 >
 
struct  celeritas::testdetail::FVIT< Iter1, Iter2 >
 

Functions

int celeritas::testdetail::num_digits (unsigned long val)
 Number of base-10 digits in an unsigned integer. More...
 
char const * celeritas::testdetail::trunc_string (unsigned int digits, char const *str, char const *trunc)
 Return a replacement string if the given string is too long. More...
 
template<class T1 , class T2 >
constexpr bool celeritas::testdetail::can_soft_equiv ()
 Whether soft equivalence can be performed on the given types.
 
template<class BinaryOp >
::testing::AssertionResult celeritas::testdetail::IsSoftEquivImpl (typename BinaryOp::value_type expected, char const *expected_expr, typename BinaryOp::value_type actual, char const *actual_expr, BinaryOp comp)
 Compare a range of values.
 
template<class Value_E , class Value_A >
::testing::AssertionResult celeritas::testdetail::IsSoftEquiv (char const *expected_expr, char const *actual_expr, Value_E &&expected, Value_A &&actual)
 Predicate for relative error soft equivalence.
 
template<class Value_E , class Value_A , class Value_R >
::testing::AssertionResult celeritas::testdetail::IsSoftEquiv (char const *expected_expr, char const *actual_expr, char const *, Value_E &&expected, Value_A &&actual, Value_R rel)
 Predicate for relative error soft equivalence.
 
template<class Iter1 , class Iter2 , class BinaryOp >
::testing::AssertionResult celeritas::testdetail::IsRangeEqImpl (Iter1 e_iter, Iter1 e_end, char const *expected_expr, Iter2 a_iter, Iter2 a_end, char const *actual_expr, typename FVIT< Iter1, Iter2 >::Vec_t &failures, BinaryOp comp)
 Compare a range of values.
 
template<class ContainerE , class ContainerA , class BinaryOp >
::testing::AssertionResult celeritas::testdetail::IsVecSoftEquivImpl (ContainerE const &expected, char const *expected_expr, ContainerA const &actual, char const *actual_expr, BinaryOp comp)
 Compare vectors with soft equivalence. More...
 
template<class T1 , class T2 >
std::string celeritas::testdetail::failure_msg (char const *expected_expr, char const *actual_expr, std::vector< FailedValue< T1, T2 >> const &failures)
 Print failure results.
 
template<class T1 , class T2 >
std::string celeritas::testdetail::float_failure_msg (char const *expected_expr, char const *actual_expr, std::vector< FailedValue< T1, T2 >> const &failures, double abs_thresh)
 Print failure results for floating point comparisons.
 
template<class Container >
void celeritas::testdetail::print_expected (Container const &data, std::string label)
 Print expected values.
 
template<class ContainerE , class ContainerA >
::testing::AssertionResult celeritas::testdetail::IsVecEq (char const *expected_expr, char const *actual_expr, ContainerE const &expected, ContainerA const &actual)
 Compare two containers.
 
template<class ContainerE , class ContainerA >
::testing::AssertionResult celeritas::testdetail::IsVecSoftEquiv (char const *expected_expr, char const *actual_expr, ContainerE const &expected, ContainerA const &actual)
 Compare two containers using soft equivalence.
 
template<class ContainerE , class ContainerA , class T >
::testing::AssertionResult celeritas::testdetail::IsVecSoftEquiv (char const *expected_expr, char const *actual_expr, char const *, ContainerE const &expected, ContainerA const &actual, T rel)
 Compare two containers using soft equivalence. More...
 
template<class ContainerE , class ContainerA , class T >
::testing::AssertionResult celeritas::testdetail::IsVecSoftEquiv (char const *expected_expr, char const *actual_expr, char const *, char const *, ContainerE const &expected, ContainerA const &actual, T rel, T abs)
 Compare two containers using soft equivalence. More...
 
::testing::AssertionResult celeritas::testdetail::IsJsonEq (char const *, char const *, std::string_view expected, std::string_view actual)
 Compare two JSON objects.
 

Function Documentation

◆ IsVecSoftEquiv() [1/2]

template<class ContainerE , class ContainerA , class T >
::testing::AssertionResult celeritas::testdetail::IsVecSoftEquiv ( char const *  expected_expr,
char const *  actual_expr,
char const *  ,
char const *  ,
ContainerE const &  expected,
ContainerA const &  actual,
rel,
abs 
)

Compare two containers using soft equivalence.

Used by EXPECT_VEC_CLOSE.

◆ IsVecSoftEquiv() [2/2]

template<class ContainerE , class ContainerA , class T >
::testing::AssertionResult celeritas::testdetail::IsVecSoftEquiv ( char const *  expected_expr,
char const *  actual_expr,
char const *  ,
ContainerE const &  expected,
ContainerA const &  actual,
rel 
)

Compare two containers using soft equivalence.

This signature uses the default tolerance for the appropriate floating point operations.

◆ IsVecSoftEquivImpl()

template<class ContainerE , class ContainerA , class BinaryOp >
::testing::AssertionResult celeritas::testdetail::IsVecSoftEquivImpl ( ContainerE const &  expected,
char const *  expected_expr,
ContainerA const &  actual,
char const *  actual_expr,
BinaryOp  comp 
)

Compare vectors with soft equivalence.

This signature uses the default tolerance for the appropriate floating point operations.

◆ num_digits()

int celeritas::testdetail::num_digits ( unsigned long  val)

Number of base-10 digits in an unsigned integer.

This function is useful for pre-calculating field widths for printing.

◆ trunc_string()

char const * celeritas::testdetail::trunc_string ( unsigned int  digits,
char const *  str,
char const *  trunc 
)

Return a replacement string if the given string is too long.

where too long means > digits digits.