| 201 | } |
| 202 | |
| 203 | TEST(RocprimPredicateIteratorTests, TypeTraits) |
| 204 | { |
| 205 | using value_type = int; |
| 206 | |
| 207 | value_type* data{}; |
| 208 | bool* mask{}; |
| 209 | |
| 210 | auto m_it = rocprim::make_mask_iterator(data, mask); |
| 211 | |
| 212 | using m_it_t = decltype(m_it); |
| 213 | using proxy_t = m_it_t::proxy; |
| 214 | |
| 215 | static_assert(std::is_assignable<proxy_t, value_type>::value, |
| 216 | "discard type is not assignable with underlying type, even though it should be!"); |
| 217 | static_assert(std::is_assignable<decltype(*m_it), value_type>::value, |
| 218 | "iterator is not assignable with underlying type via dereference, even though it " |
| 219 | "should be!"); |
| 220 | static_assert(std::is_assignable<decltype(m_it[0]), value_type>::value, |
| 221 | "iterator is not assignablle with underlying type via array index, even though " |
| 222 | "is should be!"); |
| 223 | |
| 224 | // Check if we can apply predicate iterator on a constant iterator |
| 225 | auto c_it = rocprim::make_constant_iterator(0); |
| 226 | auto p_it = rocprim::make_predicate_iterator(c_it, is_odd{}); |
| 227 | |
| 228 | static_assert( |
| 229 | std::is_convertible<decltype(*p_it), value_type>::value, |
| 230 | "predicate iterator is not convertible to underlying type, even though it should be!"); |
| 231 | } |
| 232 | |
| 233 | // Test that we are only writing if predicate holds |
| 234 | TEST(RocprimPredicateIteratorTests, HostWrite) |
nothing calls this directly
no test coverage detected