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