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

Method SetUp

test/gen_index.cpp:47–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46class IndexGeneralizedLegacy : public ::testing::TestWithParam<index_params> {
47 void SetUp() {
48 index_params params = GetParam();
49 vector<dim4> numDims;
50 vector<vector<float>> in;
51 vector<vector<float>> tests;
52
53 if (noDoubleTests(get<1>(params))) return;
54 if (noHalfTests(get<1>(params))) return;
55
56 if (noDoubleTests(get<2>(params))) return;
57 if (noHalfTests(get<2>(params))) return;
58 readTestsFromFile<float, float>(get<0>(params).filename_, numDims, in,
59 tests);
60
61 dim4 dims0 = numDims[0];
62 dim4 dims1 = numDims[1];
63
64 af_array inTmp = 0;
65 ASSERT_SUCCESS(af_create_array(&inTmp, &(in[0].front()), dims0.ndims(),
66 dims0.get(), f32));
67
68 ASSERT_SUCCESS(af_cast(&inArray_, inTmp, get<1>(params)));
69 af_release_array(inTmp);
70
71 af_array idxTmp = 0;
72 ASSERT_SUCCESS(af_create_array(&idxTmp, &(in[1].front()), dims1.ndims(),
73 dims1.get(), f32));
74 ASSERT_SUCCESS(af_cast(&idxArray_, idxTmp, get<2>(params)));
75 af_release_array(idxTmp);
76
77 vector<float> hgold = tests[0];
78 af_array goldTmp;
79 af_create_array(&goldTmp, &hgold.front(), get<0>(params).dims_.ndims(),
80 get<0>(params).dims_.get(), f32);
81 ASSERT_SUCCESS(af_cast(&gold_, goldTmp, get<1>(params)));
82 af_release_array(goldTmp);
83 }
84
85 void TearDown() {
86 if (inArray_) { ASSERT_SUCCESS(af_release_array(inArray_)); }

Callers

nothing calls this directly

Calls 7

noDoubleTestsFunction · 0.85
noHalfTestsFunction · 0.85
af_create_arrayFunction · 0.50
af_castFunction · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected