Skip to content

Commit

Permalink
UT for EnqueueMapBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-wozniak-mobica committed Sep 22, 2023
1 parent 550bec5 commit d6dd6d3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/test_openclhpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4516,5 +4516,41 @@ void testgetObjectInfo() {
TEST_ASSERT_EQUAL(buffer.getObjectInfo(&type, &bufobj), CL_SUCCESS);
TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER);
TEST_ASSERT_EQUAL(bufobj, 0);
static void *clEnqueueMapBuffer_testenqueueMapBuffer(
cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map,
cl_map_flags map_flags, size_t offset, size_t size,
cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
cl_event *event, cl_int *errcode_ret, int num_calls) {
(void)command_queue;
TEST_ASSERT_EQUAL_PTR(make_mem(0), buffer);
TEST_ASSERT_EQUAL(CL_TRUE, blocking_map);
TEST_ASSERT_EQUAL(CL_MAP_WRITE, map_flags);
TEST_ASSERT_EQUAL(0, offset);
TEST_ASSERT_EQUAL(sizeof(int) * 1024, size);
TEST_ASSERT_EQUAL(0, num_events_in_wait_list);
TEST_ASSERT_EQUAL_PTR(nullptr, event_wait_list);
TEST_ASSERT_NOT_NULL(event);
TEST_ASSERT_NOT_EQUAL(nullptr, errcode_ret);
TEST_ASSERT_EQUAL(0, num_calls);
return make_mem(0);
}
void testenqueueMapBuffer() {
cl_bool blocking = CL_TRUE;
cl_map_flags flags = CL_MAP_WRITE;
cl::size_type offset = 0;
cl::size_type size = sizeof(int) * 1024;
cl::Event event_data(make_event(0), false);
cl::Event *event = &event_data;
const cl::vector<cl::Event> *events = nullptr;
cl_int *err = nullptr;
void *ret = nullptr;

clEnqueueMapBuffer_StubWithCallback(
clEnqueueMapBuffer_testenqueueMapBuffer);
ret = enqueueMapBuffer(bufferPool[0], blocking, flags, offset, size, events,
event, err);

TEST_ASSERT_EQUAL_PTR(make_mem(0), ret);
event_data() = nullptr;
}
} // extern "C"

0 comments on commit d6dd6d3

Please sign in to comment.