1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #define BOOST_TEST_MODULE TestPlatform
12 #include <boost/test/unit_test.hpp>
16 #include <boost/compute/platform.hpp>
17 #include <boost/compute/system.hpp>
19 BOOST_AUTO_TEST_CASE(platform_id
)
21 boost::compute::platform platform
=
22 boost::compute::system::platforms().front();
24 boost::compute::platform
platform_copy(platform
.id());
26 BOOST_CHECK(platform
== platform_copy
);
27 BOOST_CHECK(platform
.id() == platform_copy
.id());
30 BOOST_AUTO_TEST_CASE(platform_supports_extension
)
32 boost::compute::platform platform
=
33 boost::compute::system::platforms().front();
35 std::string extensions
= platform
.get_info
<CL_PLATFORM_EXTENSIONS
>();
36 if(extensions
.empty()){
37 std::cerr
<< "platform doesn't support any extensions" << std::endl
;
41 size_t space
= extensions
.find(' ');
42 std::string first_extension
= extensions
.substr(0, space
);
43 BOOST_CHECK(platform
.supports_extension(first_extension
) == true);
44 BOOST_CHECK(platform
.supports_extension("invalid_extension_name") == false);