diff --git a/tests/test_openclhpp.cpp b/tests/test_openclhpp.cpp index cb112b5c..a459c8f0 100644 --- a/tests/test_openclhpp.cpp +++ b/tests/test_openclhpp.cpp @@ -4472,4 +4472,27 @@ void testTemplateGetImageRequirementsInfo() void testTemplateGetImageRequirementsInfo() {} #endif // cl_ext_image_requirements_info +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 +static cl_int clSetContextDestructor_testsetDestructorCallback( + cl_context context, cmock_cl_func_ptr3 pfn_notify, void *user_data, + int num_calls) { + TEST_ASSERT_EQUAL_PTR(context, make_context(0)); + TEST_ASSERT_EQUAL_PTR(pfn_notify, nullptr); + TEST_ASSERT_EQUAL_PTR(user_data, nullptr); + TEST_ASSERT_EQUAL(0, num_calls); + return CL_INVALID_CONTEXT; +} + +void testsetDestructorCallback() { + cl_int ret = 0; + void(CL_CALLBACK * pfn_notify)(cl_context, void *) = nullptr; + + clSetContextDestructorCallback_StubWithCallback( + clSetContextDestructor_testsetDestructorCallback); + ret = contextPool[0].setDestructorCallback(pfn_notify); + TEST_ASSERT_EQUAL(CL_INVALID_CONTEXT, ret); +} +#else +void testsetDestructorCallback() {} +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 300 } // extern "C"