TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
gtest_tools.hpp File Reference
#include "./nda.hpp"
#include <gtest/gtest.h>
#include <cstdlib>
#include <iostream>
#include <sstream>

Detailed Description

Provides convenient tools for checking nda::basic_array and nda::basic_array_view objects with googletest.

Definition in file gtest_tools.hpp.

Go to the source code of this file.

Macros

#define EXPECT_ARRAY_EQ(X, Y)
 Macro that expects array_are_equal to return true.
 
#define EXPECT_ARRAY_NEAR(X, ...)
 Macro that expects array_are_close to return true.
 
#define EXPECT_ARRAY_ZERO(X)
 Macro that expects array_almost_zero to return true.
 
#define EXPECT_CLOSE(X, Y)
 Macro that expects generic_are_near to return true.
 
#define EXPECT_COMPLEX_NEAR(X, ...)
 Macro that expects complex_are_close to return true.
 
#define EXPECT_EQ_ARRAY(X, Y)
 Macro that expects array_are_equal to return true.
 

Functions

template<typename X >
::testing::AssertionResult array_almost_zero (X const &x)
 Check that an array/view is close to zero, i.e. that its largest absolute element is less than 1e-10.
 
template<typename X , typename Y >
::testing::AssertionResult array_are_close (X const &x, Y const &y, double precision=1.e-10)
 Check that two arrays/views are close, i.e. that they have the same shape and that the largest element of their absolute difference is less than a given precision.
 
template<typename X , typename Y >
::testing::AssertionResult array_are_equal (X const &x, Y const &y)
 Check that two arrays/views are equal, i.e. that they have the same shape and the same elements.
 
template<typename X , typename Y >
::testing::AssertionResult complex_are_close (X const &x, Y const &y, double precision=1.e-10)
 Check the absolute difference of two (complex) numbers.
 
template<typename X , typename Y >
::testing::AssertionResult generic_are_near (X const &x, Y const &y)
 Check that that two generic objects are close, i.e. that their absolute difference is less than 1e-12.