1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //    http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #ifndef TEST_COMMON_AUTOTEST_AUTOTEST_HPP
17 #define TEST_COMMON_AUTOTEST_AUTOTEST_HPP
18 
19 #include "test_suite.hpp"
20 
21 #define STR_JOIN( X, Y ) STR_DO_JOIN( X, Y )
22 #define STR_DO_JOIN( X, Y ) STR_DO_JOIN_2(X,Y)
23 #define STR_DO_JOIN_2( X, Y ) X##Y
24 
25 
26 // How to use AUTO_TEST_CASE macro:
27 //
28 // AUTO_TEST_CASE(<test_case_name>)(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
29 // {
30 //      (test case code...)
31 // }
32 //
33 #define AUTO_TEST_CASE(name) \
34     struct name { static int run_test(cl_device_id, cl_context, cl_command_queue, int); }; \
35     static autotest::detail::test_case_registration STR_JOIN(name, STR_JOIN(_registration, __LINE__)) (#name, name::run_test); \
36     int name::run_test
37 
38 #endif //TEST_COMMON_AUTOTEST_AUTOTEST_HPP