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

Function TEST

test/sort.cpp:127–156  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

125////////////////////////////////////// CPP ////////////////////////////////
126//
127TEST(Sort, CPPDim0) {
128 const bool dir = true;
129 const unsigned resultIdx0 = 0;
130
131 vector<dim4> numDims;
132 vector<vector<float>> in;
133 vector<vector<float>> tests;
134 readTests<float, float, int>(string(TEST_DIR "/sort/sort_10x10.test"),
135 numDims, in, tests);
136
137 dim4 idims = numDims[0];
138 array input(idims, &(in[0].front()));
139
140 array output = sort(input, 0, dir);
141
142 size_t nElems = tests[resultIdx0].size();
143
144 // Get result
145 float* sxData = new float[tests[resultIdx0].size()];
146 output.host((void*)sxData);
147
148 // Compare result
149 for (size_t elIter = 0; elIter < nElems; ++elIter) {
150 ASSERT_EQ(tests[resultIdx0][elIter], sxData[elIter])
151 << "at: " << elIter << endl;
152 }
153
154 // Delete
155 delete[] sxData;
156}
157
158TEST(Sort, CPPDim1) {
159 const bool dir = true;

Callers

nothing calls this directly

Calls 3

hostMethod · 0.80
sortFunction · 0.50
reorderFunction · 0.50

Tested by

no test coverage detected