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

Function approx2ArgsTest

test/approx2.cpp:151–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149// Test Argument Failure Cases
150template<typename T>
151void approx2ArgsTest(string pTestFile, const af_interp_type method,
152 const af_err err) {
153 SUPPORTED_TYPE_CHECK(T);
154 typedef typename dtype_traits<T>::base_type BT;
155 vector<dim4> numDims;
156 vector<vector<BT>> in;
157 vector<vector<T>> tests;
158 readTests<BT, T, float>(pTestFile, numDims, in, tests);
159
160 dim4 idims = numDims[0];
161 dim4 pdims = numDims[1];
162 dim4 qdims = numDims[2];
163
164 af_array inArray = 0;
165 af_array pos0Array = 0;
166 af_array pos1Array = 0;
167 af_array outArray = 0;
168
169 vector<T> input(in[0].begin(), in[0].end());
170
171 ASSERT_SUCCESS(af_create_array(&inArray, &(input.front()), idims.ndims(),
172 idims.get(),
173 (af_dtype)dtype_traits<T>::af_type));
174
175 ASSERT_SUCCESS(af_create_array(&pos0Array, &(in[1].front()), pdims.ndims(),
176 pdims.get(),
177 (af_dtype)dtype_traits<BT>::af_type));
178 ASSERT_SUCCESS(af_create_array(&pos1Array, &(in[2].front()), qdims.ndims(),
179 qdims.get(),
180 (af_dtype)dtype_traits<BT>::af_type));
181
182 ASSERT_EQ(err,
183 af_approx2(&outArray, inArray, pos0Array, pos1Array, method, 0));
184
185 if (inArray != 0) af_release_array(inArray);
186 if (pos0Array != 0) af_release_array(pos0Array);
187 if (pos1Array != 0) af_release_array(pos1Array);
188 if (outArray != 0) af_release_array(outArray);
189}
190
191TYPED_TEST(Approx2, Approx2NearestArgsPos3D) {
192 approx2ArgsTest<TypeParam>(string(TEST_DIR "/approx/approx2_pos3d.test"),

Callers

nothing calls this directly

Calls 5

af_create_arrayFunction · 0.50
af_approx2Function · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected