| 52 | |
| 53 | template<typename T> |
| 54 | void reorderTest(string pTestFile, const unsigned resultIdx, const uint x, |
| 55 | const uint y, const uint z, const uint w, |
| 56 | bool isSubRef = false, const vector<af_seq> *seqv = NULL) { |
| 57 | SUPPORTED_TYPE_CHECK(T); |
| 58 | |
| 59 | vector<dim4> numDims; |
| 60 | vector<vector<T>> in; |
| 61 | vector<vector<T>> tests; |
| 62 | readTests<T, T, int>(pTestFile, numDims, in, tests); |
| 63 | |
| 64 | dim4 idims = numDims[0]; |
| 65 | |
| 66 | af_array inArray = 0; |
| 67 | af_array outArray = 0; |
| 68 | af_array tempArray = 0; |
| 69 | |
| 70 | if (isSubRef) { |
| 71 | ASSERT_SUCCESS(af_create_array(&tempArray, &(in[0].front()), |
| 72 | idims.ndims(), idims.get(), |
| 73 | (af_dtype)dtype_traits<T>::af_type)); |
| 74 | |
| 75 | ASSERT_SUCCESS( |
| 76 | af_index(&inArray, tempArray, seqv->size(), &seqv->front())); |
| 77 | } else { |
| 78 | ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), |
| 79 | idims.ndims(), idims.get(), |
| 80 | (af_dtype)dtype_traits<T>::af_type)); |
| 81 | } |
| 82 | |
| 83 | ASSERT_SUCCESS(af_reorder(&outArray, inArray, x, y, z, w)); |
| 84 | |
| 85 | dim4 goldDims(idims[x], idims[y], idims[z], idims[w]); |
| 86 | ASSERT_VEC_ARRAY_EQ(tests[resultIdx], goldDims, outArray); |
| 87 | |
| 88 | if (inArray != 0) af_release_array(inArray); |
| 89 | if (outArray != 0) af_release_array(outArray); |
| 90 | if (tempArray != 0) af_release_array(tempArray); |
| 91 | } |
| 92 | |
| 93 | #define REORDER_INIT(desc, file, resultIdx, x, y, z, w) \ |
| 94 | TYPED_TEST(Reorder, desc) { \ |
nothing calls this directly
no test coverage detected