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

Function loadImageNativeCPPTest

test/imageio.cpp:314–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312
313template<typename T>
314void loadImageNativeCPPTest(string pTestFile, string pImageFile) {
315 IMAGEIO_ENABLED_CHECK();
316
317 vector<dim4> numDims;
318
319 vector<vector<float>> in;
320 vector<vector<float>> tests;
321 readTests<float, float, float>(pTestFile, numDims, in, tests);
322
323 dim4 dims = numDims[0];
324 array img = loadImageNative(pImageFile.c_str());
325 ASSERT_EQ(img.type(), (af_dtype)dtype_traits<T>::af_type);
326
327 // Get result
328 T* imgData = new T[dims.elements()];
329 img.host((void*)imgData);
330
331 // Compare result
332 size_t nElems = in[0].size();
333 for (size_t elIter = 0; elIter < nElems; ++elIter) {
334 ASSERT_EQ(in[0][elIter], imgData[elIter]) << "at: " << elIter << endl;
335 }
336
337 // Delete
338 delete[] imgData;
339}
340
341TEST(ImageIONative, LoadImageNative8CPP) {
342 loadImageNativeCPPTest<uchar>(string(TEST_DIR "/imageio/color_small.test"),

Callers

nothing calls this directly

Calls 4

loadImageNativeFunction · 0.85
typeMethod · 0.80
hostMethod · 0.80
elementsMethod · 0.45

Tested by

no test coverage detected