MCPcopy Create free account
hub / github.com/boostorg/compute / test_fill

Function test_fill

test/test_fill.cpp:35–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34template<class T>
35inline void test_fill(T v1, T v2, T v3, bc::command_queue queue) {
36 if(boost::is_same<typename bc::scalar_type<T>::type, bc::double_>::value &&
37 !queue.get_device().supports_extension("cl_khr_fp64")) {
38 std::cerr << "Skipping test_fill<" << bc::type_name<T>() << ">() "
39 "on device which doesn't support cl_khr_fp64" << std::endl;
40 return;
41 }
42
43 bc::vector<T> vector(4, queue.get_context());
44 bc::fill(vector.begin(), vector.end(), v1, queue);
45 queue.finish();
46 CHECK_RANGE_EQUAL(T, 4, vector, (v1, v1, v1, v1));
47
48 vector.resize(1000, queue);
49 bc::fill(vector.begin(), vector.end(), v2, queue);
50 queue.finish();
51 BOOST_CHECK_EQUAL(vector.front(), v2);
52 BOOST_CHECK_EQUAL(vector.back(), v2);
53
54 bc::fill(vector.begin() + 500, vector.end(), v3, queue);
55 queue.finish();
56 BOOST_CHECK_EQUAL(vector.front(), v2);
57 BOOST_CHECK_EQUAL(vector[499], v2);
58 BOOST_CHECK_EQUAL(vector[500], v3);
59 BOOST_CHECK_EQUAL(vector.back(), v3);
60}
61
62BOOST_AUTO_TEST_CASE_TEMPLATE( fill_scalar, S, scalar_types )
63{

Callers 1

Calls 11

fillFunction · 0.85
CHECK_RANGE_EQUALFunction · 0.70
supports_extensionMethod · 0.45
get_deviceMethod · 0.45
get_contextMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
finishMethod · 0.45
resizeMethod · 0.45
frontMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected