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

Function TEST

test/histogram.cpp:116–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114using af::span;
115
116TEST(Histogram, CPP) {
117 const unsigned nbins = 100;
118 const double minval = 0.0;
119 const double maxval = 99.0;
120
121 vector<dim4> numDims;
122
123 vector<vector<float>> in;
124 vector<vector<uint>> tests;
125 readTests<float, uint, int>(
126 string(TEST_DIR "/histogram/100bin0min99max.test"), numDims, in, tests);
127
128 //! [hist_nominmax]
129 array input(numDims[0], &(in[0].front()));
130 array output = histogram(input, nbins, minval, maxval);
131 //! [hist_nominmax]
132
133 vector<uint> outData(output.elements());
134 output.host((void*)outData.data());
135
136 for (size_t testIter = 0; testIter < tests.size(); ++testIter) {
137 vector<uint> currGoldBar = tests[testIter];
138
139 dim4 goldDims = numDims[0];
140 goldDims[0] = nbins;
141 goldDims[1] = 1;
142 ASSERT_VEC_ARRAY_EQ(currGoldBar, goldDims, output);
143 }
144}
145
146/////////////////////////////////// Documentation Snippets
147/////////////////////////////////////

Callers

nothing calls this directly

Calls 15

histEqualFunction · 0.85
roundFunction · 0.85
randuFunction · 0.85
constantFunction · 0.85
seqClass · 0.85
hostMethod · 0.80
asMethod · 0.80
absFunction · 0.70
minFunction · 0.70
histogramFunction · 0.50
copyFunction · 0.50
dim4Class · 0.50

Tested by

no test coverage detected