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

Function testData

test/confidence_connected.cpp:115–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114template<typename T>
115void testData(CCCTestParams params) {
116 SUPPORTED_TYPE_CHECK(T);
117
118 vector<dim4> numDims;
119 vector<vector<T>> in;
120 vector<vector<T>> tests;
121
122 string file = string(TEST_DIR) + "/confidence_cc/" + string(params.prefix) +
123 "_" + to_string(params.radius) + "_" +
124 to_string(params.multiplier) + ".test";
125 readTests<T, T, int>(file, numDims, in, tests);
126
127 dim4 dims = numDims[0];
128 af_array inArray = 0;
129 af_array seedxArr = 0, seedyArr = 0;
130
131 vector<uint> seedCoords(in[1].begin(), in[1].end());
132 const unsigned *seedxy = seedCoords.data();
133
134 dim4 seedDims(1);
135 ASSERT_SUCCESS(af_create_array(&seedxArr, seedxy + 0, seedDims.ndims(),
136 seedDims.get(), u32));
137 ASSERT_SUCCESS(af_create_array(&seedyArr, seedxy + 1, seedDims.ndims(),
138 seedDims.get(), u32));
139 ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), dims.ndims(),
140 dims.get(),
141 (af_dtype)af::dtype_traits<T>::af_type));
142
143 af_array outArray = 0;
144 ASSERT_SUCCESS(af_confidence_cc(&outArray, inArray, seedxArr, seedyArr,
145 params.radius, params.multiplier,
146 params.iterations, params.replace));
147 int device = 0;
148 ASSERT_SUCCESS(af_get_device(&device));
149 ASSERT_SUCCESS(af_sync(device));
150
151 ASSERT_VEC_ARRAY_EQ(tests[0], dims, outArray);
152
153 ASSERT_SUCCESS(af_release_array(inArray));
154 ASSERT_SUCCESS(af_release_array(outArray));
155 ASSERT_SUCCESS(af_release_array(seedxArr));
156 ASSERT_SUCCESS(af_release_array(seedyArr));
157}
158
159class ConfidenceConnectedDataTest
160 : public testing::TestWithParam<CCCTestParams> {};

Callers

nothing calls this directly

Calls 8

to_stringFunction · 0.85
af_create_arrayFunction · 0.50
af_confidence_ccFunction · 0.50
af_get_deviceFunction · 0.50
af_syncFunction · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected