| 45 | |
| 46 | template<typename Ti, typename To> |
| 47 | void testSobelDerivatives(string pTestFile) { |
| 48 | SUPPORTED_TYPE_CHECK(Ti); |
| 49 | |
| 50 | vector<dim4> numDims; |
| 51 | vector<vector<Ti>> in; |
| 52 | vector<vector<To>> tests; |
| 53 | |
| 54 | readTests<Ti, To, int>(pTestFile, numDims, in, tests); |
| 55 | |
| 56 | dim4 dims = numDims[0]; |
| 57 | af_array dxArray = 0; |
| 58 | af_array dyArray = 0; |
| 59 | af_array inArray = 0; |
| 60 | |
| 61 | ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), dims.ndims(), |
| 62 | dims.get(), |
| 63 | (af_dtype)dtype_traits<Ti>::af_type)); |
| 64 | |
| 65 | ASSERT_SUCCESS(af_sobel_operator(&dxArray, &dyArray, inArray, 3)); |
| 66 | |
| 67 | vector<To> currDXGoldBar = tests[0]; |
| 68 | vector<To> currDYGoldBar = tests[1]; |
| 69 | |
| 70 | ASSERT_VEC_ARRAY_EQ(currDXGoldBar, dims, dxArray); |
| 71 | ASSERT_VEC_ARRAY_EQ(currDYGoldBar, dims, dyArray); |
| 72 | |
| 73 | // cleanup |
| 74 | ASSERT_SUCCESS(af_release_array(inArray)); |
| 75 | ASSERT_SUCCESS(af_release_array(dxArray)); |
| 76 | ASSERT_SUCCESS(af_release_array(dyArray)); |
| 77 | } |
| 78 | |
| 79 | // rectangle test data is generated using opencv |
| 80 | // border type is set to cv.BORDER_REFLECT_101 in opencv |
nothing calls this directly
no test coverage detected