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

Function TEST

test/sort_index.cpp:127–150  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

125//////////////////////////////////// CPP /////////////////////////////////
126//
127TEST(SortIndex, CPPDim0) {
128 const bool dir = true;
129 const unsigned resultIdx0 = 0;
130 const unsigned resultIdx1 = 1;
131
132 vector<dim4> numDims;
133 vector<vector<float>> in;
134 vector<vector<float>> tests;
135 readTests<float, float, int>(string(TEST_DIR "/sort/sort_10x10.test"),
136 numDims, in, tests);
137
138 dim4 idims = numDims[0];
139 array input(idims, &(in[0].front()));
140 array outValues, outIndices;
141 sort(outValues, outIndices, input, 0, dir);
142
143 ASSERT_VEC_ARRAY_EQ(tests[resultIdx0], idims, outValues);
144
145 vector<unsigned> ixTest(tests[resultIdx1].size());
146 transform(tests[resultIdx1].begin(), tests[resultIdx1].end(),
147 ixTest.begin(), convert_to<unsigned, float>);
148
149 ASSERT_VEC_ARRAY_EQ(ixTest, idims, outIndices);
150}
151
152TEST(SortIndex, CPPDim1) {
153 const bool dir = true;

Callers

nothing calls this directly

Calls 3

sortFunction · 0.50
transformFunction · 0.50
reorderFunction · 0.50

Tested by

no test coverage detected