MCPcopy Create free account
hub / github.com/ROCm/rocPRIM / TEST

Function TEST

test/rocprim/test_predicate_iterator.cpp:203–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203TEST(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
234TEST(RocprimPredicateIteratorTests, HostWrite)

Callers

nothing calls this directly

Calls 6

make_mask_iteratorFunction · 0.85
make_predicate_iteratorFunction · 0.85
iotaFunction · 0.85
transformClass · 0.70
getMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected