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

Method setTestData

test/approx1.cpp:876–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

874 void TearDown() { releaseArrays(); }
875
876 void setTestData(float* h_gold, dim4 gold_dims, float* h_in, dim4 in_dims,
877 float* h_pos, dim4 pos_dims) {
878 releaseArrays();
879
880 gold = 0;
881 in = 0;
882 pos = 0;
883
884 this->gold_dims = gold_dims;
885 this->in_dims = in_dims;
886 this->pos_dims = pos_dims;
887
888 for (int i = 0; i < gold_dims.elements(); ++i) {
889 h_gold_cast.push_back(static_cast<T>(h_gold[i]));
890 }
891 for (int i = 0; i < in_dims.elements(); ++i) {
892 h_in_cast.push_back(static_cast<T>(h_in[i]));
893 }
894 for (int i = 0; i < pos_dims.elements(); ++i) {
895 h_pos_cast.push_back(static_cast<BT>(h_pos[i]));
896 }
897
898 ASSERT_SUCCESS(af_create_array(&gold, &h_gold_cast.front(),
899 gold_dims.ndims(), gold_dims.get(),
900 (af_dtype)dtype_traits<T>::af_type));
901 ASSERT_SUCCESS(af_create_array(&in, &h_in_cast.front(), in_dims.ndims(),
902 in_dims.get(),
903 (af_dtype)dtype_traits<T>::af_type));
904 ASSERT_SUCCESS(af_create_array(&pos, &h_pos_cast.front(),
905 pos_dims.ndims(), pos_dims.get(),
906 (af_dtype)dtype_traits<BT>::af_type));
907 }
908
909 void testSpclOutArray(TestOutputArrayType out_array_type) {
910 SUPPORTED_TYPE_CHECK(T);

Callers 1

SetUpMethod · 0.45

Calls 4

af_create_arrayFunction · 0.50
elementsMethod · 0.45
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected