main.h File Reference
#include <cstdlib>
#include <cerrno>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <typeinfo>
#include <type_traits>
#include <functional>
#include <limits>
#include <algorithm>
#include <complex>
#include <deque>
#include <queue>
#include <cassert>
#include <list>
#include "split_test_helper.h"
#include <Eigen/QR>
#include "random_matrix_helper.h"
#include "gpu_test_helper.h"

Go to the source code of this file.

Classes

struct  real
 
struct  imag
 
class  Eigen::EigenTest
 
struct  Eigen::eigen_assert_exception
 
struct  Eigen::eigen_static_assert_exception
 
struct  GetDifferentType< float >
 
struct  GetDifferentType< double >
 
struct  GetDifferentType< std::complex< T > >
 

Namespaces

 Eigen
 Namespace containing all symbols from the Eigen library.
 

Macros

#define _OVERRIDE_COMPLEX_SPECIALIZATION_   1
 
#define min(A, B)   please_protect_your_min_with_parentheses
 
#define max(A, B)   please_protect_your_max_with_parentheses
 
#define isnan(X)   please_protect_your_isnan_with_parentheses
 
#define isinf(X)   please_protect_your_isinf_with_parentheses
 
#define isfinite(X)   please_protect_your_isfinite_with_parentheses
 
#define M_PI   please_use_EIGEN_PI_instead_of_M_PI
 
#define FORBIDDEN_IDENTIFIER    (this_identifier_is_forbidden_to_avoid_clashes) this_identifier_is_forbidden_to_avoid_clashes
 
#define B0   FORBIDDEN_IDENTIFIER
 
#define I   FORBIDDEN_IDENTIFIER
 
#define _res   FORBIDDEN_IDENTIFIER
 
#define EIGEN_DEBUG_SMALL_PRODUCT_BLOCKS
 
#define TEST_SET_BUT_UNUSED_VARIABLE(X)   EIGEN_UNUSED_VARIABLE(X)
 
#define DEBUG
 
#define DEFAULT_REPEAT   10
 
#define EIGEN_DECLARE_TEST(X)
 
#define TRACK   std::cerr << __FILE__ << " " << __LINE__ << std::endl
 
#define EIGEN_DEFAULT_IO_FORMAT   IOFormat(4, 0, " ", "\n", "", "", "", "")
 
#define eigen_assert(a)
 
#define VERIFY_RAISES_ASSERT(a)   std::cout << "Can't VERIFY_RAISES_ASSERT( " #a " ) with exceptions disabled\n";
 
#define EIGEN_USE_CUSTOM_ASSERT
 
#define EIGEN_INTERNAL_DEBUGGING
 
#define VERIFY(a)   ::verify_impl(a, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a))
 
#define VERIFY_GE(a, b)   ::verify_impl(a >= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a >= b))
 
#define VERIFY_LE(a, b)   ::verify_impl(a <= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a <= b))
 
#define VERIFY_IS_EQUAL(a, b)   VERIFY(test_is_equal(a, b, true))
 
#define VERIFY_IS_NOT_EQUAL(a, b)   VERIFY(test_is_equal(a, b, false))
 
#define VERIFY_IS_APPROX(a, b)   VERIFY(verifyIsApprox(a, b))
 
#define VERIFY_IS_NOT_APPROX(a, b)   VERIFY(!test_isApprox(a, b))
 
#define VERIFY_IS_MUCH_SMALLER_THAN(a, b)   VERIFY(test_isMuchSmallerThan(a, b))
 
#define VERIFY_IS_NOT_MUCH_SMALLER_THAN(a, b)   VERIFY(!test_isMuchSmallerThan(a, b))
 
#define VERIFY_IS_APPROX_OR_LESS_THAN(a, b)   VERIFY(test_isApproxOrLessThan(a, b))
 
#define VERIFY_IS_NOT_APPROX_OR_LESS_THAN(a, b)   VERIFY(!test_isApproxOrLessThan(a, b))
 
#define VERIFY_IS_CWISE_EQUAL(a, b)   VERIFY(verifyIsCwiseApprox(a, b, true))
 
#define VERIFY_IS_CWISE_APPROX(a, b)   VERIFY(verifyIsCwiseApprox(a, b, false))
 
#define VERIFY_IS_UNITARY(a)   VERIFY(test_isUnitary(a))
 
#define STATIC_CHECK(COND)   EIGEN_STATIC_ASSERT((COND), EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT)
 
#define CALL_SUBTEST(FUNC)
 
#define EIGEN_TEST_SCALAR_TEST_OVERLOAD(TYPE)
 

Functions

void verify_impl (bool condition, const char *testname, const char *file, int line, const char *condition_as_string)
 
template<typename T1 , typename T2 >
std::enable_if_t< internal::is_same< T1, T2 >::value, boolEigen::is_same_type (const T1 &, const T2 &)
 
template<typename T >
NumTraits< T >::Real Eigen::test_precision ()
 
template<>
float Eigen::test_precision< float > ()
 
template<>
double Eigen::test_precision< double > ()
 
template<>
long double Eigen::test_precision< long double > ()
 
template<>
float Eigen::test_precision< std::complex< float > > ()
 
template<>
double Eigen::test_precision< std::complex< double > > ()
 
template<>
long double Eigen::test_precision< std::complex< long double > > ()
 
bool Eigen::test_isApprox (const std::complex< float > &a, const std::complex< float > &b)
 
bool Eigen::test_isMuchSmallerThan (const std::complex< float > &a, const std::complex< float > &b)
 
bool Eigen::test_isApprox (const std::complex< double > &a, const std::complex< double > &b)
 
bool Eigen::test_isMuchSmallerThan (const std::complex< double > &a, const std::complex< double > &b)
 
bool Eigen::test_isApprox (const std::complex< long double > &a, const std::complex< long double > &b)
 
bool Eigen::test_isMuchSmallerThan (const std::complex< long double > &a, const std::complex< long double > &b)
 
bool Eigen::test_isApprox (const long double &a, const long double &b)
 
bool Eigen::test_isMuchSmallerThan (const long double &a, const long double &b)
 
bool Eigen::test_isApproxOrLessThan (const long double &a, const long double &b)
 
template<typename T1 , typename T2 >
NumTraits< typename T1::RealScalar >::NonInteger Eigen::test_relative_error (const EigenBase< T1 > &a, const EigenBase< T2 > &b)
 
template<typename T1 , typename T2 >
T1::RealScalar Eigen::test_relative_error (const T1 &a, const T2 &b, const typename T1::Coefficients *=0)
 
template<typename T1 , typename T2 >
T1::Scalar Eigen::test_relative_error (const T1 &a, const T2 &b, const typename T1::MatrixType *=0)
 
template<typename S , int D>
Eigen::test_relative_error (const Translation< S, D > &a, const Translation< S, D > &b)
 
template<typename S , int D, int O>
Eigen::test_relative_error (const ParametrizedLine< S, D, O > &a, const ParametrizedLine< S, D, O > &b)
 
template<typename S , int D>
Eigen::test_relative_error (const AlignedBox< S, D > &a, const AlignedBox< S, D > &b)
 
template<typename T1 , typename T2 >
T1::RealScalar Eigen::test_relative_error (const MatrixBase< T1 > &a, const SparseMatrixBase< T2 > &b)
 
template<typename T1 , typename T2 >
T1::RealScalar Eigen::test_relative_error (const SparseMatrixBase< T1 > &a, const MatrixBase< T2 > &b)
 
template<typename T1 , typename T2 >
T1::RealScalar Eigen::test_relative_error (const SparseMatrixBase< T1 > &a, const SparseMatrixBase< T2 > &b)
 
template<typename T1 , typename T2 >
NumTraits< typename NumTraits< T1 >::Real >::NonInteger Eigen::test_relative_error (const T1 &a, const T2 &b, std::enable_if_t< internal::is_arithmetic< typename NumTraits< T1 >::Real >::value, T1 > *=0)
 
template<typename T >
T Eigen::test_relative_error (const Rotation2D< T > &a, const Rotation2D< T > &b)
 
template<typename T >
T Eigen::test_relative_error (const AngleAxis< T > &a, const AngleAxis< T > &b)
 
template<typename Type1 , typename Type2 >
bool Eigen::test_isApprox (const Type1 &a, const Type2 &b, typename Type1::Scalar *=0)
 
template<typename T >
NumTraits< typename T::Scalar >::Real Eigen::get_test_precision (const T &, const typename T::Scalar *=0)
 
template<typename T >
NumTraits< T >::Real Eigen::get_test_precision (const T &, std::enable_if_t< internal::is_arithmetic< typename NumTraits< T >::Real >::value, T > *=0)
 
template<typename Type1 , typename Type2 >
bool Eigen::verifyIsApprox (const Type1 &a, const Type2 &b)
 
template<typename Type1 , typename Type2 >
bool Eigen::verifyIsCwiseApprox (const Type1 &a, const Type2 &b, bool exact)
 
template<typename Scalar , typename ScalarRef >
bool Eigen::test_isApproxWithRef (const Scalar &a, const Scalar &b, const ScalarRef &ref)
 
template<typename Derived1 , typename Derived2 >
bool Eigen::test_isMuchSmallerThan (const MatrixBase< Derived1 > &m1, const MatrixBase< Derived2 > &m2)
 
template<typename Derived >
bool Eigen::test_isMuchSmallerThan (const MatrixBase< Derived > &m, const typename NumTraits< typename internal::traits< Derived >::Scalar >::Real &s)
 
template<typename Derived >
bool Eigen::test_isUnitary (const MatrixBase< Derived > &m)
 
template<typename Derived1 , typename Derived2 >
bool Eigen::test_isCwiseApprox (const DenseBase< Derived1 > &m1, const DenseBase< Derived2 > &m2, bool exact)
 
template<typename Derived1 , typename Derived2 >
bool Eigen::test_isCwiseApprox (const SparseMatrixBase< Derived1 > &m1, const SparseMatrixBase< Derived2 > &m2, bool exact)
 
template<typename T , typename U >
bool Eigen::test_is_equal (const T &actual, const U &expected, bool expect_equal)
 
template<typename T >
bool Eigen::isNotNaN (const T &x)
 
template<typename T >
bool Eigen::isPlusInf (const T &x)
 
template<typename T >
bool Eigen::isMinusInf (const T &x)
 
template<typename T >
std::string type_name (T)
 
template<>
std::string type_name< float > (float)
 
template<>
std::string type_name< double > (double)
 
template<>
std::string type_name< long double > (long double)
 
template<>
std::string type_name< Eigen::half > (Eigen::half)
 
template<>
std::string type_name< Eigen::bfloat16 > (Eigen::bfloat16)
 
template<>
std::string type_name< int8_t > (int8_t)
 
template<>
std::string type_name< int16_t > (int16_t)
 
template<>
std::string type_name< int32_t > (int32_t)
 
template<>
std::string type_name< int64_t > (int64_t)
 
template<>
std::string type_name< uint8_t > (uint8_t)
 
template<>
std::string type_name< uint16_t > (uint16_t)
 
template<>
std::string type_name< uint32_t > (uint32_t)
 
template<>
std::string type_name< uint64_t > (uint64_t)
 
template<>
std::string type_name< std::complex< float > > (std::complex< float >)
 
template<>
std::string type_name< std::complex< double > > (std::complex< double >)
 
template<>
std::string type_name< std::complex< long double > > (std::complex< long double >)
 
template<>
std::string type_name< std::complex< int > > (std::complex< int >)
 
template<typename T >
std::string type_name ()
 
void set_repeat_from_string (const char *str)
 
void set_seed_from_string (const char *str)
 
int main (int argc, char *argv[])
 

Variables

static std::vector< std::string > Eigen::g_test_stack
 
static int Eigen::g_test_level = 0
 
static int Eigen::g_repeat = 1
 
static unsigned int Eigen::g_seed = 0
 
static bool Eigen::g_has_set_repeat = false
 
static bool Eigen::g_has_set_seed = false
 
static const bool Eigen::should_raise_an_assert = false
 
static bool Eigen::no_more_assert = false
 
static bool Eigen::report_on_cerr_on_assert_failure = true
 

Macro Definition Documentation

◆ _OVERRIDE_COMPLEX_SPECIALIZATION_

#define _OVERRIDE_COMPLEX_SPECIALIZATION_   1

◆ _res

#define _res   FORBIDDEN_IDENTIFIER

◆ B0

#define B0   FORBIDDEN_IDENTIFIER

◆ CALL_SUBTEST

#define CALL_SUBTEST (   FUNC)
Value:
do { \
g_test_stack.push_back(EIGEN_MAKESTRING(FUNC)); \
FUNC; \
g_test_stack.pop_back(); \
} while (0)
#define EIGEN_MAKESTRING(a)
Definition: Macros.h:825

◆ DEBUG

#define DEBUG

◆ DEFAULT_REPEAT

#define DEFAULT_REPEAT   10

◆ eigen_assert

#define eigen_assert (   a)
Value:
if ((!(a)) && (!no_more_assert)) { \
eigen_plain_assert(a); \
} else { \
EIGEN_THROW_X(Eigen::eigen_assert_exception()); \
} \
}
const Scalar * a
Definition: level2_cplx_impl.h:32
static bool no_more_assert
Definition: main.h:243
static bool report_on_cerr_on_assert_failure
Definition: main.h:244
Definition: main.h:246

◆ EIGEN_DEBUG_SMALL_PRODUCT_BLOCKS

#define EIGEN_DEBUG_SMALL_PRODUCT_BLOCKS

◆ EIGEN_DECLARE_TEST

#define EIGEN_DECLARE_TEST (   X)
Value:
void EIGEN_CAT(test_, X)(); \
static EigenTest EIGEN_CAT(test_handler_, X)(EIGEN_MAKESTRING(X), &EIGEN_CAT(test_, X)); \
void EIGEN_CAT(test_, X)()
#define EIGEN_CAT(a, b)
Definition: Macros.h:819
Definition: main.h:195
#define X
Definition: icosphere.cpp:20

◆ EIGEN_DEFAULT_IO_FORMAT

#define EIGEN_DEFAULT_IO_FORMAT   IOFormat(4, 0, " ", "\n", "", "", "", "")

◆ EIGEN_INTERNAL_DEBUGGING

#define EIGEN_INTERNAL_DEBUGGING

◆ EIGEN_TEST_SCALAR_TEST_OVERLOAD

#define EIGEN_TEST_SCALAR_TEST_OVERLOAD (   TYPE)
Value:
inline bool test_isApprox(TYPE a, TYPE b) { \
return numext::equal_strict(a, b) || ((numext::isnan)(a) && (numext::isnan)(b)) || \
(internal::isApprox(a, b, test_precision<TYPE>())); \
} \
inline bool test_isCwiseApprox(TYPE a, TYPE b, bool exact) { \
return numext::equal_strict(a, b) || ((numext::isnan)(a) && (numext::isnan)(b)) || \
(!exact && internal::isApprox(a, b, test_precision<TYPE>())); \
} \
inline bool test_isMuchSmallerThan(TYPE a, TYPE b) { \
return internal::isMuchSmallerThan(a, b, test_precision<TYPE>()); \
} \
inline bool test_isApproxOrLessThan(TYPE a, TYPE b) { \
return internal::isApproxOrLessThan(a, b, test_precision<TYPE>()); \
}
bool test_isApprox(const AnnoyingScalar &a, const AnnoyingScalar &b)
Definition: AnnoyingScalar.h:196
bool test_isMuchSmallerThan(const AnnoyingScalar &a, const AnnoyingScalar &b)
Definition: AnnoyingScalar.h:200
#define TYPE
Definition: benchFFT.cpp:39
Scalar * b
Definition: benchVecAdd.cpp:17
#define isnan(X)
Definition: main.h:109
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1923
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1916
EIGEN_DEVICE_FUNC bool isApproxOrLessThan(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1930
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool equal_strict(const X &x, const Y &y)
Definition: Meta.h:571
bool test_isCwiseApprox(const SparseMatrixBase< Derived1 > &m1, const SparseMatrixBase< Derived2 > &m2, bool exact)
Definition: main.h:683
bool test_isApproxOrLessThan(const long double &a, const long double &b)
Definition: main.h:507

◆ EIGEN_USE_CUSTOM_ASSERT

#define EIGEN_USE_CUSTOM_ASSERT

◆ FORBIDDEN_IDENTIFIER

#define FORBIDDEN_IDENTIFIER    (this_identifier_is_forbidden_to_avoid_clashes) this_identifier_is_forbidden_to_avoid_clashes

◆ I

#define I   FORBIDDEN_IDENTIFIER

◆ isfinite

#define isfinite (   X)    please_protect_your_isfinite_with_parentheses

◆ isinf

#define isinf (   X)    please_protect_your_isinf_with_parentheses

◆ isnan

#define isnan (   X)    please_protect_your_isnan_with_parentheses

◆ M_PI

#define M_PI   please_use_EIGEN_PI_instead_of_M_PI

◆ max

#define max (   A,
  B 
)    please_protect_your_max_with_parentheses

◆ min

#define min (   A,
  B 
)    please_protect_your_min_with_parentheses

◆ STATIC_CHECK

#define STATIC_CHECK (   COND)    EIGEN_STATIC_ASSERT((COND), EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT)

◆ TEST_SET_BUT_UNUSED_VARIABLE

#define TEST_SET_BUT_UNUSED_VARIABLE (   X)    EIGEN_UNUSED_VARIABLE(X)

◆ TRACK

#define TRACK   std::cerr << __FILE__ << " " << __LINE__ << std::endl

◆ VERIFY

#define VERIFY (   a)    ::verify_impl(a, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a))

◆ VERIFY_GE

#define VERIFY_GE (   a,
  b 
)    ::verify_impl(a >= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a >= b))

◆ VERIFY_IS_APPROX

#define VERIFY_IS_APPROX (   a,
  b 
)    VERIFY(verifyIsApprox(a, b))

◆ VERIFY_IS_APPROX_OR_LESS_THAN

#define VERIFY_IS_APPROX_OR_LESS_THAN (   a,
  b 
)    VERIFY(test_isApproxOrLessThan(a, b))

◆ VERIFY_IS_CWISE_APPROX

#define VERIFY_IS_CWISE_APPROX (   a,
  b 
)    VERIFY(verifyIsCwiseApprox(a, b, false))

◆ VERIFY_IS_CWISE_EQUAL

#define VERIFY_IS_CWISE_EQUAL (   a,
  b 
)    VERIFY(verifyIsCwiseApprox(a, b, true))

◆ VERIFY_IS_EQUAL

#define VERIFY_IS_EQUAL (   a,
  b 
)    VERIFY(test_is_equal(a, b, true))

◆ VERIFY_IS_MUCH_SMALLER_THAN

#define VERIFY_IS_MUCH_SMALLER_THAN (   a,
  b 
)    VERIFY(test_isMuchSmallerThan(a, b))

◆ VERIFY_IS_NOT_APPROX

#define VERIFY_IS_NOT_APPROX (   a,
  b 
)    VERIFY(!test_isApprox(a, b))

◆ VERIFY_IS_NOT_APPROX_OR_LESS_THAN

#define VERIFY_IS_NOT_APPROX_OR_LESS_THAN (   a,
  b 
)    VERIFY(!test_isApproxOrLessThan(a, b))

◆ VERIFY_IS_NOT_EQUAL

#define VERIFY_IS_NOT_EQUAL (   a,
  b 
)    VERIFY(test_is_equal(a, b, false))

◆ VERIFY_IS_NOT_MUCH_SMALLER_THAN

#define VERIFY_IS_NOT_MUCH_SMALLER_THAN (   a,
  b 
)    VERIFY(!test_isMuchSmallerThan(a, b))

◆ VERIFY_IS_UNITARY

#define VERIFY_IS_UNITARY (   a)    VERIFY(test_isUnitary(a))

◆ VERIFY_LE

#define VERIFY_LE (   a,
  b 
)    ::verify_impl(a <= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a <= b))

◆ VERIFY_RAISES_ASSERT

#define VERIFY_RAISES_ASSERT (   a)    std::cout << "Can't VERIFY_RAISES_ASSERT( " #a " ) with exceptions disabled\n";

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
860  {
861  g_has_set_repeat = false;
862  g_has_set_seed = false;
863  bool need_help = false;
864 
865  for (int i = 1; i < argc; i++) {
866  if (argv[i][0] == 'r') {
867  if (g_has_set_repeat) {
868  std::cout << "Argument " << argv[i] << " conflicting with a former argument" << std::endl;
869  return 1;
870  }
871  set_repeat_from_string(argv[i] + 1);
872  } else if (argv[i][0] == 's') {
873  if (g_has_set_seed) {
874  std::cout << "Argument " << argv[i] << " conflicting with a former argument" << std::endl;
875  return 1;
876  }
877  set_seed_from_string(argv[i] + 1);
878  } else {
879  need_help = true;
880  }
881  }
882 
883  if (need_help) {
884  std::cout << "This test application takes the following optional arguments:" << std::endl;
885  std::cout << " rN Repeat each test N times (default: " << DEFAULT_REPEAT << ")" << std::endl;
886  std::cout << " sN Use N as seed for random numbers (default: based on current time)" << std::endl;
887  std::cout << std::endl;
888  std::cout << "If defined, the environment variables EIGEN_REPEAT and EIGEN_SEED" << std::endl;
889  std::cout << "will be used as default values for these parameters." << std::endl;
890  return 1;
891  }
892 
893  char* env_EIGEN_REPEAT = getenv("EIGEN_REPEAT");
894  if (!g_has_set_repeat && env_EIGEN_REPEAT) set_repeat_from_string(env_EIGEN_REPEAT);
895  char* env_EIGEN_SEED = getenv("EIGEN_SEED");
896  if (!g_has_set_seed && env_EIGEN_SEED) set_seed_from_string(env_EIGEN_SEED);
897 
898  if (!g_has_set_seed) g_seed = (unsigned int)time(NULL);
900 
901  std::cout << "Initializing random number generator with seed " << g_seed << std::endl;
902  std::stringstream ss;
903  ss << "Seed: " << g_seed;
904  g_test_stack.push_back(ss.str());
905  srand(g_seed);
906  std::cout << "Repeating each test " << g_repeat << " times" << std::endl;
907 
908  VERIFY(EigenTest::all().size() > 0);
909 
910  for (std::size_t i = 0; i < EigenTest::all().size(); ++i) {
911  const EigenTest& current_test = *EigenTest::all()[i];
912  Eigen::g_test_stack.push_back(current_test.name());
913  current_test();
914  Eigen::g_test_stack.pop_back();
915  }
916 
917  return 0;
918 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
const std::string & name() const
Definition: main.h:201
static constexpr Eigen::internal::all_t all
Definition: IndexedViewHelper.h:86
return int(ret)+1
#define DEFAULT_REPEAT
Definition: main.h:184
#define VERIFY(a)
Definition: main.h:362
void set_repeat_from_string(const char *str)
Definition: main.h:835
void set_seed_from_string(const char *str)
Definition: main.h:850
static int g_repeat
Definition: main.h:191
static unsigned int g_seed
Definition: main.h:192
static bool g_has_set_seed
Definition: main.h:193
static std::vector< std::string > g_test_stack
Definition: main.h:187
static bool g_has_set_repeat
Definition: main.h:193

References Eigen::EigenTest::all(), DEFAULT_REPEAT, Eigen::g_has_set_repeat, Eigen::g_has_set_seed, Eigen::g_repeat, Eigen::g_seed, Eigen::g_test_stack, i, int(), Eigen::EigenTest::name(), set_repeat_from_string(), set_seed_from_string(), size, and VERIFY.

◆ set_repeat_from_string()

void set_repeat_from_string ( const char str)
inline

Set number of repetitions for unit test from input string.

Parameters
strinput string
835  {
836  errno = 0;
837  g_repeat = int(strtoul(str, 0, 10));
838  if (errno || g_repeat <= 0) {
839  std::cout << "Invalid repeat value " << str << std::endl;
840  exit(EXIT_FAILURE);
841  }
842  g_has_set_repeat = true;
843 }
str
Definition: compute_granudrum_aor.py:141

References Eigen::g_has_set_repeat, Eigen::g_repeat, int(), and compute_granudrum_aor::str.

Referenced by main().

◆ set_seed_from_string()

void set_seed_from_string ( const char str)
inline

Set seed for randomized unit tests from input string.

Parameters
strinput string
850  {
851  errno = 0;
852  g_seed = int(strtoul(str, 0, 10));
853  if (errno || g_seed == 0) {
854  std::cout << "Invalid seed value " << str << std::endl;
855  exit(EXIT_FAILURE);
856  }
857  g_has_set_seed = true;
858 }

References Eigen::g_has_set_seed, Eigen::g_seed, int(), and compute_granudrum_aor::str.

Referenced by main().

◆ type_name() [1/2]

template<typename T >
std::string type_name ( )
824  {
825  return type_name(T());
826 }
Eigen::Triplet< double > T
Definition: EigenUnitTest.cpp:11
std::string type_name(T)
Definition: main.h:752

References type_name().

◆ type_name() [2/2]

template<typename T >
std::string type_name ( T  )
752  {
753  return typeid(T).name();
754 }
string name
Definition: plotDoE.py:33

References plotDoE::name.

Referenced by type_name().

◆ type_name< double >()

template<>
std::string type_name< double > ( double  )
760  {
761  return "double";
762 }

◆ type_name< Eigen::bfloat16 >()

template<>
std::string type_name< Eigen::bfloat16 > ( Eigen::bfloat16  )
772  {
773  return "bfloat16";
774 }

◆ type_name< Eigen::half >()

template<>
std::string type_name< Eigen::half > ( Eigen::half  )
768  {
769  return "half";
770 }

◆ type_name< float >()

template<>
std::string type_name< float > ( float  )
756  {
757  return "float";
758 }

◆ type_name< int16_t >()

template<>
std::string type_name< int16_t > ( int16_t  )
780  {
781  return "int16_t";
782 }

◆ type_name< int32_t >()

template<>
std::string type_name< int32_t > ( int32_t  )
784  {
785  return "int32_t";
786 }

◆ type_name< int64_t >()

template<>
std::string type_name< int64_t > ( int64_t  )
788  {
789  return "int64_t";
790 }

◆ type_name< int8_t >()

template<>
std::string type_name< int8_t > ( int8_t  )
776  {
777  return "int8_t";
778 }

◆ type_name< long double >()

template<>
std::string type_name< long double > ( long double  )
764  {
765  return "long double";
766 }

◆ type_name< std::complex< double > >()

template<>
std::string type_name< std::complex< double > > ( std::complex< double )
812  {
813  return "complex<double>";
814 }

◆ type_name< std::complex< float > >()

template<>
std::string type_name< std::complex< float > > ( std::complex< float >  )
808  {
809  return "complex<float>";
810 }

◆ type_name< std::complex< int > >()

template<>
std::string type_name< std::complex< int > > ( std::complex< int )
820  {
821  return "complex<int>";
822 }

◆ type_name< std::complex< long double > >()

template<>
std::string type_name< std::complex< long double > > ( std::complex< long double )
816  {
817  return "complex<long double>";
818 }

◆ type_name< uint16_t >()

template<>
std::string type_name< uint16_t > ( uint16_t  )
796  {
797  return "uint16_t";
798 }

◆ type_name< uint32_t >()

template<>
std::string type_name< uint32_t > ( uint32_t  )
800  {
801  return "uint32_t";
802 }

◆ type_name< uint64_t >()

template<>
std::string type_name< uint64_t > ( uint64_t  )
804  {
805  return "uint64_t";
806 }

◆ type_name< uint8_t >()

template<>
std::string type_name< uint8_t > ( uint8_t  )
792  {
793  return "uint8_t";
794 }

◆ verify_impl()

void verify_impl ( bool  condition,
const char testname,
const char file,
int  line,
const char condition_as_string 
)
inline
349  {
350  if (!condition) {
351  if (Eigen::g_test_level > 0) std::cerr << "WARNING: ";
352  std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")" << std::endl
353  << " " << condition_as_string << std::endl;
354  std::cerr << "Stack:\n";
355  const int test_stack_size = static_cast<int>(Eigen::g_test_stack.size());
356  for (int i = test_stack_size - 1; i >= 0; --i) std::cerr << " - " << Eigen::g_test_stack[i] << "\n";
357  std::cerr << "\n";
358  if (Eigen::g_test_level == 0) abort();
359  }
360 }
static int g_test_level
Definition: main.h:190
line
Definition: calibrate.py:103

References Eigen::g_test_level, Eigen::g_test_stack, i, and calibrate::line.