From d3e7a7293dcaaaa48ea7aace2be17f2830566f32 Mon Sep 17 00:00:00 2001 From: Norihiro Watanabe <norihiro.watanabe@ufz.de> Date: Wed, 12 Jun 2013 16:13:40 +0200 Subject: [PATCH] add Tests/TestTools.h to store utility functions --- Tests/TestTools.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Tests/TestTools.h diff --git a/Tests/TestTools.h b/Tests/TestTools.h new file mode 100644 index 00000000000..767e58ecac6 --- /dev/null +++ b/Tests/TestTools.h @@ -0,0 +1,31 @@ +/** + * \file + * \author Norihiro Watanabe + * \date 2013-04-16 + * \brief + * + * \copyright + * Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include <gtest/gtest.h> + +#ifndef TESTTOOLS_H_ +#define TESTTOOLS_H_ + +inline void ASSERT_DOUBLE_ARRAY_EQ(const double* Expected, const double* Actual, std::size_t N, double epsilon=1.0e-8) { + for (size_t i=0; i<N; i++) \ + ASSERT_NEAR(Expected[i], Actual[i], epsilon); +} + +template <typename T1, typename T2> +inline void ASSERT_DOUBLE_ARRAY_EQ(const T1 &Expected, const T2 &Actual, std::size_t N, double epsilon=1.0e-8) { + for (size_t i=0; i<N; i++) \ + ASSERT_NEAR(Expected[i], Actual[i], epsilon); +} + +#endif // TESTTOOLS_H_ -- GitLab