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

Function approx1ArgsTestPrecision

test/approx1.cpp:278–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276
277template<typename T>
278void approx1ArgsTestPrecision(string pTestFile, const unsigned,
279 const af_interp_type method) {
280 SUPPORTED_TYPE_CHECK(T);
281 vector<dim4> numDims;
282 vector<vector<T>> in;
283 vector<vector<T>> tests;
284 readTests<T, T, float>(pTestFile, numDims, in, tests);
285
286 dim4 idims = numDims[0];
287 dim4 pdims = numDims[1];
288
289 af_array inArray = 0;
290 af_array posArray = 0;
291 af_array outArray = 0;
292
293 vector<T> input(in[0].begin(), in[0].end());
294
295 ASSERT_SUCCESS(af_create_array(&inArray, &(input.front()), idims.ndims(),
296 idims.get(),
297 (af_dtype)dtype_traits<T>::af_type));
298
299 ASSERT_SUCCESS(af_create_array(&posArray, &(in[1].front()), pdims.ndims(),
300 pdims.get(),
301 (af_dtype)dtype_traits<T>::af_type));
302
303 if ((af_dtype)dtype_traits<T>::af_type == c32 ||
304 (af_dtype)dtype_traits<T>::af_type == c64) {
305 ASSERT_EQ(AF_ERR_ARG,
306 af_approx1(&outArray, inArray, posArray, method, 0));
307 } else {
308 ASSERT_SUCCESS(af_approx1(&outArray, inArray, posArray, method, 0));
309 }
310
311 if (inArray != 0) af_release_array(inArray);
312 if (posArray != 0) af_release_array(posArray);
313 if (outArray != 0) af_release_array(outArray);
314}
315
316TYPED_TEST(Approx1, Approx1NearestArgsPrecision) {
317 approx1ArgsTestPrecision<TypeParam>(string(TEST_DIR "/approx/approx1.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