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

Function TEST

test/regions.cpp:112–140  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

110///////////////////////////////////// CPP ////////////////////////////////
111//
112TEST(Regions, CPP) {
113 UNSUPPORTED_BACKEND(AF_BACKEND_ONEAPI);
114 vector<dim4> numDims;
115 vector<vector<float>> in;
116 vector<vector<float>> tests;
117 readTests<float, float, int>(string(TEST_DIR "/regions/regions_8x8_4.test"),
118 numDims, in, tests);
119
120 dim4 idims = numDims[0];
121 array input(idims, (float*)&(in[0].front()));
122 array output = regions(input.as(b8));
123
124 // Get result
125 float* outData = new float[idims.elements()];
126 output.host((void*)outData);
127
128 // Compare result
129 for (size_t testIter = 0; testIter < tests.size(); ++testIter) {
130 vector<float> currGoldBar = tests[testIter];
131 size_t nElems = currGoldBar.size();
132 for (size_t elIter = 0; elIter < nElems; ++elIter) {
133 ASSERT_EQ(currGoldBar[elIter], outData[elIter])
134 << "at: " << elIter << endl;
135 }
136 }
137
138 // Delete
139 delete[] outData;
140}
141
142///////////////////////////////// Documentation Examples ///////////////////
143TEST(Regions, Docs_8) {

Callers

nothing calls this directly

Calls 5

asMethod · 0.80
hostMethod · 0.80
regionsFunction · 0.50
arrayClass · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected