MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / test_fill

Function test_fill

compute/test/test_fill.cpp:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 11

CHECK_RANGE_EQUALFunction · 0.70
fillFunction · 0.50
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