| 114 | using af::span; |
| 115 | |
| 116 | TEST(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 | ///////////////////////////////////// |
nothing calls this directly
no test coverage detected