| 159 | |
| 160 | // Documentation examples for setUnique |
| 161 | TEST(Set, SNIPPET_setUniqueSorted) { |
| 162 | //! [ex_set_unique_sorted] |
| 163 | |
| 164 | // input data |
| 165 | int h_set[6] = {1, 2, 2, 3, 3, 3}; |
| 166 | af::array set(6, h_set); |
| 167 | |
| 168 | // is_sorted flag specifies if input is sorted, |
| 169 | // allows algorithm to skip internal sorting step |
| 170 | const bool is_sorted = true; |
| 171 | af::array unique = setUnique(set, is_sorted); |
| 172 | // unique == { 1, 2, 3 }; |
| 173 | |
| 174 | //! [ex_set_unique_sorted] |
| 175 | |
| 176 | vector<int> unique_gold = {1, 2, 3}; |
| 177 | dim4 gold_dim(3, 1, 1, 1); |
| 178 | ASSERT_VEC_ARRAY_EQ(unique_gold, gold_dim, unique); |
| 179 | } |
| 180 | |
| 181 | TEST(Set, SNIPPET_setUniqueSortedDesc) { |
| 182 | //! [ex_set_unique_desc] |
nothing calls this directly
no test coverage detected