JayBeams  0.1
Another project to have fun coding.
ut_config.cpp
Go to the documentation of this file.
1 #include <jb/opencl/config.hpp>
2 
3 #include <boost/test/unit_test.hpp>
4 
5 /**
6  * @test Verify that the cl_config works as expected.
7  */
8 BOOST_AUTO_TEST_CASE(opencl_config_basic) {
9  jb::opencl::config config;
10 
11  BOOST_CHECK_EQUAL(config.device_name(), "");
12 
13  config.device_name("foo").device_name("bar");
14 
15  BOOST_CHECK_EQUAL(config.device_name(), "bar");
16 }
17 
18 BOOST_AUTO_TEST_CASE(cl_config_cmdline) {
19  char argv0[] = "a/b/c";
20  char argv1[] = "--device-name=Tahiti";
21  char* argv[] = {argv0, argv1};
22  int argc = sizeof(argv) / sizeof(argv[0]);
23 
24  jb::opencl::config config;
25  config.process_cmdline(argc, argv);
26 
27  BOOST_CHECK_EQUAL(config.device_name(), "Tahiti");
28 }
Configure the OpenCL device / context options.
Definition: config.hpp:12
BOOST_AUTO_TEST_CASE(opencl_config_basic)
Definition: ut_config.cpp:8
jb::config_attribute< config, std::string > device_name
Definition: config.hpp:17
void process_cmdline(int &argc, char *argv[])
Process the command line.