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

Function approx2ArgsTestPrecision

test/approx2.cpp:207–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205
206template<typename T>
207void approx2ArgsTestPrecision(string pTestFile, const unsigned resultIdx,
208 const af_interp_type method) {
209 UNUSED(resultIdx);
210 SUPPORTED_TYPE_CHECK(T);
211 vector<dim4> numDims;
212 vector<vector<T>> in;
213 vector<vector<T>> tests;
214 readTests<T, T, float>(pTestFile, numDims, in, tests);
215
216 dim4 idims = numDims[0];
217 dim4 pdims = numDims[1];
218 dim4 qdims = numDims[2];
219
220 af_array inArray = 0;
221 af_array pos0Array = 0;
222 af_array pos1Array = 0;
223 af_array outArray = 0;
224
225 vector<T> input(in[0].begin(), in[0].end());
226
227 ASSERT_SUCCESS(af_create_array(&inArray, &(input.front()), idims.ndims(),
228 idims.get(),
229 (af_dtype)dtype_traits<T>::af_type));
230
231 ASSERT_SUCCESS(af_create_array(&pos0Array, &(in[1].front()), pdims.ndims(),
232 pdims.get(),
233 (af_dtype)dtype_traits<T>::af_type));
234 ASSERT_SUCCESS(af_create_array(&pos1Array, &(in[2].front()), qdims.ndims(),
235 qdims.get(),
236 (af_dtype)dtype_traits<T>::af_type));
237
238 if ((af_dtype)dtype_traits<T>::af_type == c32 ||
239 (af_dtype)dtype_traits<T>::af_type == c64) {
240 ASSERT_EQ(AF_ERR_ARG, af_approx2(&outArray, inArray, pos0Array,
241 pos1Array, method, 0));
242 } else {
243 ASSERT_SUCCESS(
244 af_approx2(&outArray, inArray, pos0Array, pos1Array, method, 0));
245 }
246
247 if (inArray != 0) af_release_array(inArray);
248 if (pos0Array != 0) af_release_array(pos0Array);
249 if (pos1Array != 0) af_release_array(pos1Array);
250 if (outArray != 0) af_release_array(outArray);
251}
252
253#define APPROX2_ARGSP(desc, file, resultIdx, method) \
254 TYPED_TEST(Approx2, desc) { \

Callers

nothing calls this directly

Calls 5

af_create_arrayFunction · 0.50
af_approx2Function · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected