8 inline bool arrays_equal(
size_t n,
const T* test,
const T* right);
16 static bool equals(
size_t n,
const T* test,
const T* right) {
17 return arrays_equal<T>(n, test, right);
20 static bool equals(
const T& test,
const T& right) {
34 static bool equals(
float test,
float right) {
36 return (
fabs(test - right) /
fabs(right)) < cutoff;
39 static bool equals(
size_t n,
const float* test,
const float* right) {
40 return arrays_equal<float>(n, test, right);
53 static bool equals(
double test,
double right) {
55 return (
fabs(test - right) /
fabs(right)) < cutoff;
64 static bool equals(
const std::vector<T>& test,
const std::vector<T>& asserted) {
65 if (test.size() != asserted.size()) {
69 typename std::vector<T>::const_iterator it, end = test.end();
70 typename std::vector<T>::const_iterator ia = asserted.begin();
71 for (it=test.begin(); it != end; ++ia, ++it) {
83 for (
size_t i=0; i < n; ++i) {
static bool equals(size_t n, const float *test, const float *right)
static bool equals(size_t n, const T *test, const T *right)
bool arrays_equal(size_t n, const T *test, const T *right)
Variable< T > fabs(const Variable< T > &t)
static bool equals(float test, float right)
static bool equals(double test, double right)
static bool equals(const T &test, const T &right)
static bool equals(const std::vector< T > &test, const std::vector< T > &asserted)