Skip to content

Commit

Permalink
UT for setDestructorCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-wozniak-mobica committed Aug 4, 2023
1 parent b8b3056 commit 2986780
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_openclhpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 2986780

Please sign in to comment.