-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathdevice_selector_api.cpp
60 lines (51 loc) · 1.61 KB
/
device_selector_api.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*******************************************************************************
//
// SYCL 2020 Conformance Test Suite
//
// Copyright: (c) 2017 by Codeplay Software LTD. All Rights Reserved.
//
*******************************************************************************/
#include "../common/common.h"
#define TEST_NAME device_selector_api
namespace device_selector_api__ {
using namespace sycl_cts;
/** tests the api for cl::sycl::device_selector
*/
class TEST_NAME : public util::test_base {
public:
/** return information about this test
*/
void get_info(test_base::info &out) const override {
set_test_info(out, TOSTRING(TEST_NAME), TEST_FILE);
}
/** execute the test
*/
void run(util::logger &log) override {
try {
/** check select_device() method
*/
{
cts_selector selector;
auto selected_device = selector.select_device();
check_return_type<cl::sycl::device>(log, selected_device,
"select_device()");
}
/** check ()(device) operator
*/
{
cl::sycl::device device;
cts_selector selector;
auto score = selector(device);
check_return_type<int>(log, score, "selector(cl::sycl::device)");
}
} catch (const cl::sycl::exception &e) {
log_exception(log, e);
cl::sycl::string_class errorMsg =
"a SYCL exception was caught: " + cl::sycl::string_class(e.what());
FAIL(log, errorMsg.c_str());
}
}
};
// register this test with the test_collection
util::test_proxy<TEST_NAME> proxy;
} /* namespace device_selector_api__ */