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

Function medfiltTest

test/medfilt.cpp:47–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template<typename T>
47void medfiltTest(string pTestFile, dim_t w_len, dim_t w_wid,
48 af_border_type pad) {
49 SUPPORTED_TYPE_CHECK(T);
50
51 vector<dim4> numDims;
52 vector<vector<T>> in;
53 vector<vector<T>> tests;
54
55 readTests<T, T, int>(pTestFile, numDims, in, tests);
56
57 dim4 dims = numDims[0];
58 af_array outArray = 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<T>::af_type));
64
65 ASSERT_SUCCESS(af_medfilt2(&outArray, inArray, w_len, w_wid, pad));
66
67 vector<T> outData(dims.elements());
68
69 ASSERT_SUCCESS(af_get_data_ptr((void*)outData.data(), outArray));
70
71 vector<T> currGoldBar = tests[0];
72 size_t nElems = currGoldBar.size();
73 for (size_t elIter = 0; elIter < nElems; ++elIter) {
74 ASSERT_EQ(currGoldBar[elIter], outData[elIter])
75 << "at: " << elIter << endl;
76 }
77
78 // cleanup
79 ASSERT_SUCCESS(af_release_array(inArray));
80 ASSERT_SUCCESS(af_release_array(outArray));
81}
82
83TYPED_TEST(MedianFilter, ZERO_PAD_3x3) {
84 UNSUPPORTED_BACKEND(AF_BACKEND_ONEAPI);

Callers

nothing calls this directly

Calls 7

af_create_arrayFunction · 0.50
af_medfilt2Function · 0.50
af_get_data_ptrFunction · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45
elementsMethod · 0.45

Tested by

no test coverage detected