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

Function TEST

test/approx2.cpp:264–299  ·  view source on GitHub ↗

/////////////////////////////// CPP ////////////////////////////////////

Source from the content-addressed store, hash-verified

262//////////////////////////////////// CPP ////////////////////////////////////
263//
264TEST(Approx2, CPP) {
265 const unsigned resultIdx = 1;
266#define BT dtype_traits<float>::base_type
267 vector<dim4> numDims;
268 vector<vector<BT>> in;
269 vector<vector<float>> tests;
270 readTests<BT, float, float>(string(TEST_DIR "/approx/approx2.test"),
271 numDims, in, tests);
272
273 dim4 idims = numDims[0];
274 dim4 pdims = numDims[1];
275 dim4 qdims = numDims[2];
276
277 array input(idims, &(in[0].front()));
278 array pos0(pdims, &(in[1].front()));
279 array pos1(qdims, &(in[2].front()));
280 array output = approx2(input, pos0, pos1, AF_INTERP_LINEAR, 0);
281
282 // Get result
283 float* outData = new float[tests[resultIdx].size()];
284 output.host((void*)outData);
285
286 // Compare result
287 size_t nElems = tests[resultIdx].size();
288 bool ret = true;
289 for (size_t elIter = 0; elIter < nElems; ++elIter) {
290 ret = (std::abs(tests[resultIdx][elIter] - outData[elIter]) < 0.001);
291 ASSERT_EQ(true, ret) << tests[resultIdx][elIter] << "\t"
292 << outData[elIter] << "at: " << elIter << endl;
293 }
294
295 // Delete
296 delete[] outData;
297
298#undef BT
299}
300
301TEST(Approx2Cubic, CPP) {
302 const unsigned resultIdx = 0;

Callers

nothing calls this directly

Calls 14

randuFunction · 0.85
seqClass · 0.85
roundFunction · 0.85
sinFunction · 0.85
cosFunction · 0.85
hostMethod · 0.80
TMethod · 0.80
absFunction · 0.70
realFunction · 0.70
approx2Function · 0.50
tileFunction · 0.50
reorderFunction · 0.50

Tested by

no test coverage detected