Namespaces | Defines | Functions
gtest_eigen.hpp File Reference
#include <gtest/gtest.h>
#include <Eigen/Core>
#include <iostream>
#include <cmath>
Include dependency graph for gtest_eigen.hpp:

Go to the source code of this file.

Namespaces

namespace  grid_map

Defines

#define ASSERT_DOUBLE_MX_EQ(A, B, PERCENT_TOLERANCE, MSG)
#define ASSERT_DOUBLE_SPARSE_MX_EQ(A, B, PERCENT_TOLERANCE, MSG)

Functions

template<typename M1 , typename M2 >
void grid_map::assertEqual (const M1 &A, const M2 &B, std::string const &message="")
template<typename M1 >
void grid_map::assertFinite (const M1 &A, std::string const &message="")
template<typename M1 , typename M2 , typename T >
void grid_map::assertNear (const M1 &A, const M2 &B, T tolerance, std::string const &message="")
bool grid_map::compareRelative (double a, double b, double percentTolerance, double *percentError=NULL)
template<typename M1 , typename M2 , typename T >
void grid_map::expectNear (const M1 &A, const M2 &B, T tolerance, std::string const &message="")
template<int N>
Eigen::Matrix< double, N, N > grid_map::randomCovariance ()
Eigen::MatrixXd grid_map::randomCovarianceXd (int N)

Define Documentation

#define ASSERT_DOUBLE_MX_EQ (   A,
  B,
  PERCENT_TOLERANCE,
  MSG 
)
Value:
ASSERT_EQ((size_t)(A).rows(), (size_t)(B).rows())  << MSG << "\nMatrix " << #A << ":\n" << A << "\nand matrix " << #B << "\n" << B << "\nare not the same size"; \
    ASSERT_EQ((size_t)(A).cols(), (size_t)(B).cols())  << MSG << "\nMatrix " << #A << ":\n" << A << "\nand matrix " << #B << "\n" << B << "\nare not the same size"; \
    for(int r = 0; r < (A).rows(); r++)                                                                 \
      {                                                                                                                                 \
                for(int c = 0; c < (A).cols(); c++)                                                             \
                  {                                                                                                                             \
                        double percentError = 0.0;                                                                      \
                        ASSERT_TRUE(grid_map::compareRelative( (A)(r,c), (B)(r,c), PERCENT_TOLERANCE, &percentError)) \
                          << MSG << "\nComparing:\n"                                                            \
                          << #A << "(" << r << "," << c << ") = " << (A)(r,c) << std::endl \
                          << #B << "(" << r << "," << c << ") = " << (B)(r,c) << std::endl \
                          << "Error was " << percentError << "% > " << PERCENT_TOLERANCE << "%\n" \
                          << "\nMatrix " << #A << ":\n" << A << "\nand matrix " << #B << "\n" << B; \
                  }                                                                                                                             \
      }

Definition at line 127 of file gtest_eigen.hpp.

#define ASSERT_DOUBLE_SPARSE_MX_EQ (   A,
  B,
  PERCENT_TOLERANCE,
  MSG 
)
Value:
ASSERT_EQ((size_t)(A).rows(), (size_t)(B).rows())  << MSG << "\nMatrix " << #A << ":\n" << A << "\nand matrix " << #B << "\n" << B << "\nare not the same size"; \
    ASSERT_EQ((size_t)(A).cols(), (size_t)(B).cols())  << MSG << "\nMatrix " << #A << ":\n" << A << "\nand matrix " << #B << "\n" << B << "\nare not the same size"; \
    for(int r = 0; r < (A).rows(); r++)                 \
      {                                 \
    for(int c = 0; c < (A).cols(); c++)               \
      {                               \
      double percentError = 0.0;                  \
      ASSERT_TRUE(grid_map::compareRelative( (A).coeff(r,c), (B).coeff(r,c), PERCENT_TOLERANCE, &percentError)) \
        << MSG << "\nComparing:\n"                \
        << #A << "(" << r << "," << c << ") = " << (A).coeff(r,c) << std::endl \
        << #B << "(" << r << "," << c << ") = " << (B).coeff(r,c) << std::endl \
        << "Error was " << percentError << "% > " << PERCENT_TOLERANCE << "%\n" \
        << "\nMatrix " << #A << ":\n" << A << "\nand matrix " << #B << "\n" << B; \
      }                               \
      }

Definition at line 144 of file gtest_eigen.hpp.



grid_map_core
Author(s): Péter Fankhauser
autogenerated on Tue Jul 9 2019 05:06:13