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

Function TEST

test/imageio.cpp:124–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122using af::span;
123
124TEST(ImageIO, CPP) {
125 IMAGEIO_ENABLED_CHECK();
126
127 vector<dim4> numDims;
128
129 vector<vector<float>> in;
130 vector<vector<float>> tests;
131 readTests<float, float, float>(string(TEST_DIR "/imageio/color_small.test"),
132 numDims, in, tests);
133
134 dim4 dims = numDims[0];
135 array img =
136 loadImage(string(TEST_DIR "/imageio/color_small.png").c_str(), true);
137
138 // Get result
139 float* imgData = new float[dims.elements()];
140 img.host((void*)imgData);
141
142 // Compare result
143 size_t nElems = in[0].size();
144 for (size_t elIter = 0; elIter < nElems; ++elIter) {
145 ASSERT_EQ(in[0][elIter], imgData[elIter]) << "at: " << elIter << endl;
146 }
147
148 // Delete
149 delete[] imgData;
150}
151
152TEST(ImageIO, SavePNGCPP) {
153 IMAGEIO_ENABLED_CHECK();

Callers

nothing calls this directly

Calls 14

loadImageFunction · 0.85
getTestNameFunction · 0.85
getBackendNameFunction · 0.85
saveImageFunction · 0.85
saveImageMemFunction · 0.85
loadImageMemFunction · 0.85
deleteImageMemFunction · 0.85
randuFunction · 0.85
floorFunction · 0.85
hostMethod · 0.80
typeMethod · 0.80
asMethod · 0.80

Tested by

no test coverage detected