TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
Convenient tools for checking nda::basic_array and nda::basic_array_view objects with googletest.
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. | |
::testing::AssertionResult array_almost_zero | ( | X const & | x | ) |
#include <nda/gtest_tools.hpp>
Check that an array/view is close to zero, i.e. that its largest absolute element is less than 1e-10.
X | Type of the array/view. |
x | Array/View. |
::testing::AssertionSuccess()
if the absolute value of every element is less than 1e-10. ::testing::AssertionFailure()
otherwise. Definition at line 136 of file gtest_tools.hpp.
::testing::AssertionResult array_are_close | ( | X const & | x, |
Y const & | y, | ||
double | precision = 1.e-10 ) |
#include <nda/gtest_tools.hpp>
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.
X | Type of the first array/view. |
Y | Type of the second array/view. |
x | First array/view. |
y | Second array/view. |
precision | Required precision for the comparison to be considered successful. |
::testing::AssertionSuccess()
if the arrays/view have the same shape and largest element of their absolute difference is less than a given precision. ::testing::AssertionFailure()
otherwise. Definition at line 104 of file gtest_tools.hpp.
::testing::AssertionResult array_are_equal | ( | X const & | x, |
Y const & | y ) |
#include <nda/gtest_tools.hpp>
Check that two arrays/views are equal, i.e. that they have the same shape and the same elements.
X | Type of the first array/view. |
Y | Type of the second array/view. |
x | First array/view. |
y | Second array/view. |
::testing::AssertionSuccess()
if the arrays/view have the same shape and the same elements, ::testing::AssertionFailure()
otherwise. Definition at line 75 of file gtest_tools.hpp.
::testing::AssertionResult complex_are_close | ( | X const & | x, |
Y const & | y, | ||
double | precision = 1.e-10 ) |
#include <nda/gtest_tools.hpp>
Check the absolute difference of two (complex) numbers.
X | Type of the first number. |
Y | Type of the second number. |
x | First number. |
y | Second number. |
precision | Required precision for the comparison to be considered successful. |
::testing::AssertionSuccess()
if the absolute difference is less than the given precision, ::testing::AssertionFailure()
otherwise. Definition at line 53 of file gtest_tools.hpp.
::testing::AssertionResult generic_are_near | ( | X const & | x, |
Y const & | y ) |
#include <nda/gtest_tools.hpp>
Check that that two generic objects are close, i.e. that their absolute difference is less than 1e-12.
X | Type of the first object. |
Y | Type of the second object. |
x | First object. |
y | Second object. |
::testing::AssertionSuccess()
if the absolute value of their difference is less than 1e-12. ::testing::AssertionFailure()
otherwise. Definition at line 161 of file gtest_tools.hpp.