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

Function moddimsArgsTest

test/moddims.cpp:129–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127
128template<typename T>
129void moddimsArgsTest(string pTestFile) {
130 SUPPORTED_TYPE_CHECK(T);
131
132 vector<dim4> numDims;
133
134 vector<vector<T>> in;
135 vector<vector<T>> tests;
136 readTests<T, T, int>(pTestFile, numDims, in, tests);
137 dim4 dims = numDims[0];
138
139 af_array inArray = 0;
140 af_array outArray = 0;
141 af_array outArray2 = 0;
142 ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), dims.ndims(),
143 dims.get(),
144 (af_dtype)dtype_traits<T>::af_type));
145
146 dim4 newDims(1);
147 newDims[0] = dims[1];
148 newDims[1] = dims[0] * dims[2];
149 ASSERT_SUCCESS(af_moddims(&outArray, inArray, 0, newDims.get()));
150 ASSERT_EQ(AF_ERR_ARG,
151 af_moddims(&outArray2, inArray, newDims.ndims(), NULL));
152
153 ASSERT_SUCCESS(af_release_array(inArray));
154 ASSERT_SUCCESS(af_release_array(outArray));
155}
156
157TYPED_TEST(Moddims, InvalidArgs) {
158 moddimsArgsTest<TypeParam>(string(TEST_DIR "/moddims/basic.test"));

Callers

nothing calls this directly

Calls 5

af_create_arrayFunction · 0.50
af_moddimsFunction · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected