diff --git a/Tests/TestTools.h b/Tests/TestTools.h new file mode 100644 index 0000000000000000000000000000000000000000..767e58ecac6852e27b054750771b4c4b714780d9 --- /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_