MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / approx1ArgsTest

Function approx1ArgsTest

test/approx1.cpp:231–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229///////////////////////////////////////////////////////////////////////////////
230template<typename T>
231void approx1ArgsTest(string pTestFile, const af_interp_type method,
232 const af_err err) {
233 SUPPORTED_TYPE_CHECK(T);
234 typedef typename dtype_traits<T>::base_type BT;
235 vector<dim4> numDims;
236 vector<vector<BT>> in;
237 vector<vector<T>> tests;
238 readTests<BT, T, float>(pTestFile, numDims, in, tests);
239
240 dim4 idims = numDims[0];
241 dim4 pdims = numDims[1];
242
243 af_array inArray = 0;
244 af_array posArray = 0;
245 af_array outArray = 0;
246
247 vector<T> input(in[0].begin(), in[0].end());
248
249 ASSERT_SUCCESS(af_create_array(&inArray, &(input.front()), idims.ndims(),
250 idims.get(),
251 (af_dtype)dtype_traits<T>::af_type));
252
253 ASSERT_SUCCESS(af_create_array(&posArray, &(in[1].front()), pdims.ndims(),
254 pdims.get(),
255 (af_dtype)dtype_traits<BT>::af_type));
256
257 ASSERT_EQ(err, af_approx1(&outArray, inArray, posArray, method, 0));
258
259 if (inArray != 0) af_release_array(inArray);
260 if (posArray != 0) af_release_array(posArray);
261 if (outArray != 0) af_release_array(outArray);
262}
263
264TYPED_TEST(Approx1, Approx1NearestArgsPos2D) {
265 approx1ArgsTest<TypeParam>(string(TEST_DIR "/approx/approx1_pos2d.test"),

Callers

nothing calls this directly

Calls 5

af_create_arrayFunction · 0.50
af_approx1Function · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected