/////////////////////////////// CPP /////////////////////////////////
| 125 | //////////////////////////////////// CPP ///////////////////////////////// |
| 126 | // |
| 127 | TEST(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 | |
| 152 | TEST(SortIndex, CPPDim1) { |
| 153 | const bool dir = true; |