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

Function trsCPPTest

test/transpose.cpp:157–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155//
156template<typename T>
157void trsCPPTest(string pFileName) {
158 vector<dim4> numDims;
159
160 vector<vector<T>> in;
161 vector<vector<T>> tests;
162 readTests<T, T, int>(pFileName, numDims, in, tests);
163 dim4 dims = numDims[0];
164
165 SUPPORTED_TYPE_CHECK(T);
166
167 array input(dims, &(in[0].front()));
168 array output = transpose(input);
169
170 T *outData = new T[dims.elements()];
171 output.host((void *)outData);
172
173 for (size_t testIter = 0; testIter < tests.size(); ++testIter) {
174 vector<T> currGoldBar = tests[testIter];
175 size_t nElems = currGoldBar.size();
176 for (size_t elIter = 0; elIter < nElems; ++elIter) {
177 ASSERT_EQ(currGoldBar[elIter], outData[elIter])
178 << "at: " << elIter << endl;
179 }
180 }
181
182 // cleanup
183 delete[] outData;
184}
185
186TEST(Transpose, CPP_f64) {
187 trsCPPTest<double>(string(TEST_DIR "/transpose/rectangle_batch2.test"));

Callers

nothing calls this directly

Calls 3

hostMethod · 0.80
transposeFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected