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

Function ConstantCCheck

test/constant.cpp:55–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54template<typename T>
55void ConstantCCheck(T value) {
56 SUPPORTED_TYPE_CHECK(T);
57
58 const int num = 1000;
59 typedef typename dtype_traits<T>::base_type BT;
60 BT val(::real(value));
61 dtype dty = (dtype)dtype_traits<T>::af_type;
62 af_array out;
63 dim_t dim[] = {(dim_t)num};
64 ASSERT_SUCCESS(af_constant(&out, val, 1, dim, dty));
65
66 vector<T> h_in(num);
67 af_get_data_ptr(&h_in.front(), out);
68
69 for (int i = 0; i < num; i++) { ASSERT_EQ(::real(h_in[i]), val); }
70 ASSERT_SUCCESS(af_release_array(out));
71}
72
73template<typename T>
74void IdentityCPPCheck() {

Callers

nothing calls this directly

Calls 4

realFunction · 0.70
af_constantFunction · 0.50
af_get_data_ptrFunction · 0.50
af_release_arrayFunction · 0.50

Tested by

no test coverage detected