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

Function medfilt1_Test

test/medfilt.cpp:112–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111template<typename T>
112void medfilt1_Test(string pTestFile, dim_t w_wid, af_border_type pad) {
113 SUPPORTED_TYPE_CHECK(T);
114
115 vector<dim4> numDims;
116 vector<vector<T>> in;
117 vector<vector<T>> tests;
118
119 readTests<T, T, int>(pTestFile, numDims, in, tests);
120
121 dim4 dims = numDims[0];
122 af_array outArray = 0;
123 af_array inArray = 0;
124
125 ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), dims.ndims(),
126 dims.get(),
127 (af_dtype)dtype_traits<T>::af_type));
128
129 ASSERT_SUCCESS(af_medfilt1(&outArray, inArray, w_wid, pad));
130
131 vector<T> outData(dims.elements());
132
133 ASSERT_SUCCESS(af_get_data_ptr((void*)outData.data(), outArray));
134
135 vector<T> currGoldBar = tests[0];
136 size_t nElems = currGoldBar.size();
137 for (size_t elIter = 0; elIter < nElems; ++elIter) {
138 ASSERT_EQ(currGoldBar[elIter], outData[elIter])
139 << "at: " << elIter << endl;
140 }
141
142 // cleanup
143 ASSERT_SUCCESS(af_release_array(inArray));
144 ASSERT_SUCCESS(af_release_array(outArray));
145}
146
147TYPED_TEST(MedianFilter1d, ZERO_PAD_3) {
148 UNSUPPORTED_BACKEND(AF_BACKEND_ONEAPI);

Callers

nothing calls this directly

Calls 7

af_create_arrayFunction · 0.50
af_medfilt1Function · 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