/*******************************************************
* Copyright (c) 2015, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include
#include
#include
#include
#include
#include
#include
using af::dim4;
using std::endl;
using std::string;
using std::vector;
template
class GaussianKernel : public ::testing::Test {
public:
virtual void SetUp() {}
};
// create a list of types to be tested
typedef ::testing::Types TestTypes;
// register the type list
TYPED_TEST_SUITE(GaussianKernel, TestTypes);
template
void gaussianKernelTest(string pFileName, double sigma) {
SUPPORTED_TYPE_CHECK(T);
vector numDims;
vector in;
vector tests;
readTestsFromFile(pFileName, numDims, in, tests);
af_array outArray = 0;
vector input(in[0].begin(), in[0].end());
ASSERT_SUCCESS(
af_gaussian_kernel(&outArray, input[0], input[1], sigma, sigma));
dim_t outElems = 0;
ASSERT_SUCCESS(af_get_elements(&outElems, outArray));
T *outData = new T[outElems];
ASSERT_SUCCESS(af_get_data_ptr((void *)outData, outArray));
vector currGoldBar(tests[0].begin(), tests[0].end());
size_t nElems = currGoldBar.size();
ASSERT_EQ(outElems, (dim_t)nElems);
for (size_t elIter = 0; elIter < nElems; ++elIter) {
ASSERT_NEAR(currGoldBar[elIter], outData[elIter], 1.0e-3)