| 58 | |
| 59 | template<typename T> |
| 60 | void dotTest(string pTestFile, const int resultIdx, |
| 61 | const af_mat_prop optLhs = AF_MAT_NONE, |
| 62 | const af_mat_prop optRhs = AF_MAT_NONE) { |
| 63 | SUPPORTED_TYPE_CHECK(T); |
| 64 | |
| 65 | vector<dim4> numDims; |
| 66 | vector<vector<T>> in; |
| 67 | vector<vector<T>> tests; |
| 68 | |
| 69 | readTests<T, T, T>(pTestFile, numDims, in, tests); |
| 70 | |
| 71 | dim4 aDims = numDims[0]; |
| 72 | dim4 bDims = numDims[1]; |
| 73 | |
| 74 | af_array a = 0; |
| 75 | af_array b = 0; |
| 76 | af_array out = 0; |
| 77 | |
| 78 | ASSERT_SUCCESS(af_create_array(&a, &(in[0].front()), aDims.ndims(), |
| 79 | aDims.get(), |
| 80 | (af_dtype)dtype_traits<T>::af_type)); |
| 81 | ASSERT_SUCCESS(af_create_array(&b, &(in[1].front()), bDims.ndims(), |
| 82 | bDims.get(), |
| 83 | (af_dtype)dtype_traits<T>::af_type)); |
| 84 | |
| 85 | ASSERT_SUCCESS(af_dot(&out, a, b, optLhs, optRhs)); |
| 86 | |
| 87 | vector<T> goldData = tests[resultIdx]; |
| 88 | size_t nElems = goldData.size(); |
| 89 | |
| 90 | ASSERT_VEC_ARRAY_NEAR(goldData, dim4(nElems), out, 0.03); |
| 91 | |
| 92 | ASSERT_SUCCESS(af_release_array(a)); |
| 93 | ASSERT_SUCCESS(af_release_array(b)); |
| 94 | ASSERT_SUCCESS(af_release_array(out)); |
| 95 | } |
| 96 | |
| 97 | template<typename T> |
| 98 | void compare(double rval, double /*ival*/, T gold) { |
nothing calls this directly
no test coverage detected