Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UT for createSubBuffer #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/test_openclhpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4517,4 +4517,37 @@ void testgetObjectInfo() {
TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER);
TEST_ASSERT_EQUAL(bufobj, 0);
}
#if CL_HPP_TARGET_OPENCL_VERSION >= 110
static cl_mem clCreateSubBuffer_testCreateSubBuffer(
cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type,
const void *buffer_create_info, cl_int *errcode_ret, int num_calls) {
(void)errcode_ret;
TEST_ASSERT_EQUAL(make_mem(0), buffer);
TEST_ASSERT_EQUAL(0, flags);
TEST_ASSERT_EQUAL(0, buffer_create_type);
TEST_ASSERT_EQUAL_PTR(nullptr, buffer_create_info);
TEST_ASSERT_EQUAL(0, num_calls);

return make_mem(1);
}

void testCreateSubBuffer() {
#ifndef CL_HPP_ENABLE_EXCEPTIONS
cl_mem_flags flags = 0;
cl_buffer_create_type buffer_create_type = 0;
const void *buffer_create_info = nullptr;
cl_int *err = nullptr;
static cl::Buffer ret;

clCreateSubBuffer_StubWithCallback(clCreateSubBuffer_testCreateSubBuffer);
ret = bufferPool[0].createSubBuffer(flags, buffer_create_type,
buffer_create_info, err);

TEST_ASSERT_EQUAL_PTR(make_mem(1), ret());
ret() = nullptr;
#endif
}
#else
void testCreateSubBuffer() {}
#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
} // extern "C"